Move silent player to A2DPSink, get button routing only if focus is granted
Originally AVRCP had the silent media player. The media player would
play each time we thought we wanted to play, regardless of whether or
not A2DPSink was actually granted audio focus. This meant stealing the
media button session when we didnt want to. Additionaly, A2DPSink never
notified AVRCP controller of lost focus, so we couldn't destroy the
player and signal to MSS that we no longer wanted to be considered. This
allows us to destroy the player when focus is lost as well.
Media button routing requires a MediaSession and a MediaPlayer in the
same process. This only continues to work because all the BT profiles do
in fact run from the same process. This will need to live in AVRCP
again if that is ever not the case.
Bug: b/128922658
Test: Pair a device with automotive hardware, initiate playback from
media center. Verify that adb shell dumpsys media_session shows BT as
the media button session. Use adb shell input keyevent MEDIA_* commands
to verify that button events get routed to BT.
Change-Id: I8f8d11b29cbc5243b43434143148960b5a806b99
2 files changed