Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Skip to content
Commit f32bf371 authored by Tyler Gunn's avatar Tyler Gunn Committed by Android (Google) Code Review
Browse files

Ensure MediaSession is ONLY made active when routed to wired headset.

This CL re-lands the functionality. 

In the past we always made a global MediaSession active in Telecom when
there was a call present on the device.  This was to ensure that when the
device used a wired headset that we'd be able to handle the button presses.

Due to our more recent change to not inform HFP devices of DND calls, we
saw a regression in car head unit operation during calls in DND.  Because
the HFP device is no longer made aware of DND calls and we were still
opening a media session, HFP car kits were not properly routing control
to an ongoing music playback session.

Modified Telecom's HeadsetMediaButton class to ONLY open a media session if
there is a call present and the audio is routed to a wired headset.
Control of calls via bluetooth headsets are always routed via the
BluetoothInCallService and never rely on keycode events.  Further, when
routed to speaker or earpiece, there are never going to be "pause/resume"
media keycode events that Telecom needs to handle.

Test: Manual test with wired headset to ensure basic operation of media
buttons on wired headset operate as expected.
Test: Added new unit test cases to ensure media session is not started until
we are routed to a wired headset.
Test: Fix existing unit tests to account for the new behavior.
Fixes: 266171157

Change-Id: I7355f6b0f1d5f07b5c3779831dea0adf29932a58
parent 8f25e34f
Loading
Loading
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment