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

Commit 31f04fc1 authored by Andre Eisenbach's avatar Andre Eisenbach
Browse files

Always send KEYCODE_MEDIA_PLAY_PAUSE

Instead of sending _PLAY or _PAUSE as requested by an AVRCP controller,
forward only KEYCODE_MEDIA_PLAY_PAUSE. That way, if the remote device is
not correctly tracking the playback state, the media player will pause
or resume playback in a manner consistent with a users expectations.

Change-Id: Ibc2e542c799fa500f07dbc62408015e74cd6799e
Fixes: 64006398
Test: Manual; play audio; issue PLAY/PAUSE commands from headphones
parent d8bcaa2c
Loading
Loading
Loading
Loading
+6 −4
Original line number Diff line number Diff line
@@ -2650,12 +2650,8 @@ public final class Avrcp {
                return KeyEvent.KEYCODE_VOLUME_DOWN;
            case BluetoothAvrcp.PASSTHROUGH_ID_MUTE:
                return KeyEvent.KEYCODE_MUTE;
            case BluetoothAvrcp.PASSTHROUGH_ID_PLAY:
                return KeyEvent.KEYCODE_MEDIA_PLAY;
            case BluetoothAvrcp.PASSTHROUGH_ID_STOP:
                return KeyEvent.KEYCODE_MEDIA_STOP;
            case BluetoothAvrcp.PASSTHROUGH_ID_PAUSE:
                return KeyEvent.KEYCODE_MEDIA_PAUSE;
            case BluetoothAvrcp.PASSTHROUGH_ID_RECORD:
                return KeyEvent.KEYCODE_MEDIA_RECORD;
            case BluetoothAvrcp.PASSTHROUGH_ID_REWIND:
@@ -2678,6 +2674,12 @@ public final class Avrcp {
                return KeyEvent.KEYCODE_F4;
            case BluetoothAvrcp.PASSTHROUGH_ID_F5:
                return KeyEvent.KEYCODE_F5;
            // Interop workaround for headphones/car kits
            // which do not properly key track of playback
            // state...
            case BluetoothAvrcp.PASSTHROUGH_ID_PLAY:
            case BluetoothAvrcp.PASSTHROUGH_ID_PAUSE:
                return KeyEvent.KEYCODE_MEDIA_PLAY_PAUSE;
            // Fallthrough for all unknown key mappings
            case BluetoothAvrcp.PASSTHROUGH_ID_SELECT:
            case BluetoothAvrcp.PASSTHROUGH_ID_ROOT_MENU: