-
Notifications
You must be signed in to change notification settings - Fork 409
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Precedence for app provided media button receiver
This change selects the best suited media button receiver component and pending intent when creating the legacy session. This is important to ensure that a service can be started with a media button event from BT headsets after the app has been terminated. The `MediaSessionLegacyStub` selects the best suited receiver to be passed to the `MediaSessionCompat` constructor. 1. When the app has declared a broadcast receiver for `ACTION_MEDIA_BUTTON` in the manifest, this broadcast receiver is used. 2. When the session is housed in a service, the service component is used as a fallback. 3. As a last resort a receiver is created at runtime. When the `MediaSessionLegacyStub` is released, the media button receiver is removed unless the app has provided a media button receiver in the manifest. In this case we assume the app supports resuming when the BT play intent arrives at `MediaSessionService.onStartCommand`. Issue: #167 Issue: #27 Issue: #314 PiperOrigin-RevId: 523638051 (cherry picked from commit e54a934)
- Loading branch information
1 parent
9360530
commit eb322b7
Showing
2 changed files
with
107 additions
and
70 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters