commit | ba18d8ed0ebdeae2b6903527900ade6b4d7364c0 | [log] [tgz] |
---|---|---|
author | Jaewan Kim <jaewan@google.com> | Fri May 12 17:37:57 2017 +0900 |
committer | Jaewan Kim <jaewan@google.com> | Fri May 12 18:05:10 2017 +0900 |
tree | 0b50cbeb51d9e6eb5e849b3448663943dc9ee28b | |
parent | 972b2c236ef005eb24cc01719ec4469dba517f74 [diff] [blame] |
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
diff --git a/services/core/java/com/android/server/media/MediaSessionService.java b/services/core/java/com/android/server/media/MediaSessionService.java index 0db1b5d..2cb9cdd4 100644 --- a/services/core/java/com/android/server/media/MediaSessionService.java +++ b/services/core/java/com/android/server/media/MediaSessionService.java
@@ -1505,7 +1505,8 @@ } private boolean isVoiceKey(int keyCode) { - return keyCode == KeyEvent.KEYCODE_HEADSETHOOK; + return keyCode == KeyEvent.KEYCODE_HEADSETHOOK + || keyCode == KeyEvent.KEYCODE_MEDIA_PLAY_PAUSE; } private boolean isUserSetupComplete() {