Skip to content

MediaSession.setSessionActivity prevents unsetting Activity #2109

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

Open
1 task
bubenheimer opened this issue Feb 5, 2025 · 2 comments
Open
1 task

MediaSession.setSessionActivity prevents unsetting Activity #2109

bubenheimer opened this issue Feb 5, 2025 · 2 comments
Assignees
Labels

Comments

@bubenheimer
Copy link

Version

Media3 1.5.1

More version details

No response

Devices that reproduce the issue

N/A

Devices that do not reproduce the issue

No response

Reproducible in the demo app?

Yes

Reproduction steps

MediaSession.setSessionActivity(PendingIntent) does not accept null. This prevents unsetting the session Activity when it is no longer valid. The best I can do is cancel the PendingIntent.

MediaSession.Builder does not require setting a session Activity. Why does setSessionActivity attempt to prevent this?

In my use case I have a long-lived media session transcending major changes in app state.

Expected result

N/A

Actual result

N/A

Media

N/A

Bug Report

  • You will email the zip file produced by adb bugreport to [email protected] after filing this issue.
@marcbaechinger
Copy link
Contributor

Thanks for your report!

MediaSessionCompat.setSessionActivity(PendingIntent pi) is @ NonNull which is probably where this is coming from.

However, I agree we should allow to reset the PendingIntent to null for convenience and because the platform version of the method allows to set null.

@bubenheimer
Copy link
Author

I also have the impression that media3's setSessionActivity does not sufficiently account for concurrent access.

copybara-service bot pushed a commit that referenced this issue Feb 18, 2025
Issue: #2109
PiperOrigin-RevId: 728160580
tonihei pushed a commit that referenced this issue Feb 18, 2025
Issue: #2109
PiperOrigin-RevId: 728160580
(cherry picked from commit 2b8700b)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants