Stop ignoring media key events in PhoneFallbackEventHandler while in call

Without the extra check, keys  will be routed to the telecom service via
MediaSessionService. The telecom service can decide the media key handling.

Bug: 187527519
Test: Manually press media play/pause key on 3.5mm headset while in call with Pixel 3a
Change-Id: I01002a83e0b752f8355dca307b42400a9489097a
This commit is contained in:
Jaewan Kim
2021-05-11 21:21:40 +09:00
parent c90d1c3034
commit 0de9a836b7

View File

@@ -97,11 +97,6 @@ public class PhoneFallbackEventHandler implements FallbackEventHandler {
case KeyEvent.KEYCODE_MEDIA_PLAY:
case KeyEvent.KEYCODE_MEDIA_PAUSE:
case KeyEvent.KEYCODE_MEDIA_PLAY_PAUSE:
/* Suppress PLAY/PAUSE toggle when phone is ringing or in-call
* to avoid music playback */
if (getTelephonyManager().getCallState() != TelephonyManager.CALL_STATE_IDLE) {
return true; // suppress key event
}
case KeyEvent.KEYCODE_MUTE:
case KeyEvent.KEYCODE_HEADSETHOOK:
case KeyEvent.KEYCODE_MEDIA_STOP: