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

Commit ba18d8ed authored by Jaewan Kim's avatar Jaewan Kim
Browse files

Launch voice assistant by the KEYCODE_MEDIA_PLAY_PAUSE

Android's headset spec is update to deprecate the KEYCODE_HEADSETHOOK,
and the KEYCODE_MEDIA_PLAY_PAUSE will be used instead. So we need to
launch voice assistant by both the KEYCODE_MEDIA_PLAY_PAUSE and
the KEYCODE_HEADSETHOOK.

See following docucument for the details
https://source.android.com/devices/accessories/headset/usb-headset-spec#software-mapping

Bug: 36575213
Test: Manual test (injects long press of the KEYCODE_MEDIA_PLAY_PAUSE
    and confirmed that it launches voice activity)
Change-Id: I3dc2500ca5bb3d9d0ba3104246a19b84e731b46f
parent 972b2c23
Loading
Loading
Loading
Loading
+2 −1
Original line number Diff line number Diff line
@@ -1505,7 +1505,8 @@ public class MediaSessionService extends SystemService implements Monitor {
        }

        private boolean isVoiceKey(int keyCode) {
            return keyCode == KeyEvent.KEYCODE_HEADSETHOOK;
            return keyCode == KeyEvent.KEYCODE_HEADSETHOOK
                    || keyCode == KeyEvent.KEYCODE_MEDIA_PLAY_PAUSE;
        }

        private boolean isUserSetupComplete() {