-
Notifications
You must be signed in to change notification settings - Fork 415
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Use MediaSessionImpl.onMediaButtonEvent() to dispatch key events
This change moves the handling of any media button event into `MediaSessionImpl.onMediaButtonEvent(intent)`. This includes the double click handling from `MediaSessionLegacyStub`. The advantage is that everything is in one place which allows to offer `MediaSession.Callback.onMediaButtonEvent` with which an app can override the default implementation and handle media buttons in a custom way. Media button events can originate from various places: - Delivered to `MediaSessionService.onStartCommand(Intent)` - A `PendingIntent` from the notification below API 33 - An `Intent` sent to the `MediaButtonReceiver` by the system dispatched to the service - Delivered to `MediaSessionCompat.Callback.onMediaButtonEvent(Intent)` implemented by `MediaSessionLegacyStub` during the session is active - Bluetooth (headset/remote control) - Apps/system using `AudioManager.dispatchKeyEvent(KeyEvent)` - Apps/system using `MediaControllerCompat.dispatchKeyEvent(keyEvent)` Issue: #12 Issue: #159 Issue: #216 Issue: #249 #minor-release PiperOrigin-RevId: 575231251 (cherry picked from commit a79d44e)
- Loading branch information
1 parent
47a451a
commit f2cf43c
Showing
8 changed files
with
746 additions
and
177 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
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
Oops, something went wrong.