Skip to content

[1.6.0-beta01+] clearMediaItems() is no longer clearing the notification #2211

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
Enjot opened this issue Mar 5, 2025 · 1 comment
Closed
Assignees

Comments

@Enjot
Copy link

Enjot commented Mar 5, 2025

Version

Media3 pre-release (alpha, beta or RC not in this list)

More version details

Hi,

I am using MediaSessionService and MediaControllers.
While on 1.6.0-alpha03 and previous versions, clearMediaItems() also cleared the notification.
While on 1.6.0-beta01 and later versions, clearMediaItems() doesn't clear it.

I did a little investigation and I found that this commit is causing the issue.

Devices that reproduce the issue

Any Android device

Reproducible in the demo app?

Yes

Reproduction steps

In demo-session app change this line in MainActivity.kt:78

        browser?.sessionActivity?.send()

To

        browser?.clearMediaItems()

Now, CURRENT PLAYLIST button on the first screen will clear the playlist.
Play some playlist, navigate back, and click this button.

Expected result

The notification will disappear.

Actual result

The notification stays up, but it's not responsive at all.

@tonihei
Copy link
Collaborator

tonihei commented Mar 6, 2025

Thanks for reporting, we'll provide a fix for that.

copybara-service bot pushed a commit that referenced this issue Mar 9, 2025
We currently combine stopping the FGS and optionally removing the
notification in one method, which unnecessarily gates its logic on
checking the desired foreground state again. This causes a bug where
the notification should be removed (because shouldShowNotification
returns false), but stays visible because the service is allowed
to stay in the foreground and the notification removal code is not
triggered.

#cherrypick

Issue: #2211
PiperOrigin-RevId: 735126704
tonihei added a commit that referenced this issue Mar 19, 2025
We currently combine stopping the FGS and optionally removing the
notification in one method, which unnecessarily gates its logic on
checking the desired foreground state again. This causes a bug where
the notification should be removed (because shouldShowNotification
returns false), but stays visible because the service is allowed
to stay in the foreground and the notification removal code is not
triggered.

Issue: #2211
PiperOrigin-RevId: 735126704
(cherry picked from commit 91ecc16)
@Enjot Enjot closed this as completed Mar 26, 2025
@androidx androidx locked and limited conversation to collaborators May 26, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

2 participants