summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrew Chant <achant@google.com>2017-05-08 10:28:13 -0700
committerAndrew Chant <achant@google.com>2017-05-10 13:30:16 -0700
commit0415220ec79cf8f01880257d8b32d975dda6801a (patch)
treea91af7c4a762d3d107304b2f788741b215bad6ce
parentb5181910fa553e19fcf2d21ce2a079bb6dc51745 (diff)
downloadTelecomm-0415220ec79cf8f01880257d8b32d975dda6801a.tar.gz
let KEYCODE_MEDIA_PLAY_PAUSE answer/hangup calls
By the Android USB headset spec: https://source.android.com/devices/accessories/headset/usb-headset-spec The Android key KECODE_MEDIA_PLAY_PAUSE should accept, reject, and end calls when pressed appropriately. This behavior is the same as the HEADSETHOOK behavior. This updates the button handling code to match the spec. Test: answered, muted, and hung-up call with USB headset adhering to spec. Bug: 36070414 Change-Id: Id575d8b6178b76985a883e987908cf8c445c7bdf Signed-off-by: Andrew Chant <achant@google.com>
-rw-r--r--src/com/android/server/telecom/HeadsetMediaButton.java13
1 files changed, 7 insertions, 6 deletions
diff --git a/src/com/android/server/telecom/HeadsetMediaButton.java b/src/com/android/server/telecom/HeadsetMediaButton.java
index 7d6a798f4..64de8745e 100644
--- a/src/com/android/server/telecom/HeadsetMediaButton.java
+++ b/src/com/android/server/telecom/HeadsetMediaButton.java
@@ -47,11 +47,12 @@ public class HeadsetMediaButton extends CallsManagerListenerBase {
public boolean onMediaButtonEvent(Intent intent) {
KeyEvent event = (KeyEvent) intent.getParcelableExtra(Intent.EXTRA_KEY_EVENT);
Log.v(this, "SessionCallback.onMediaButton()... event = %s.", event);
- if ((event != null) && (event.getKeyCode() == KeyEvent.KEYCODE_HEADSETHOOK)) {
+ if ((event != null) && ((event.getKeyCode() == KeyEvent.KEYCODE_HEADSETHOOK) ||
+ (event.getKeyCode() == KeyEvent.KEYCODE_MEDIA_PLAY_PAUSE))) {
synchronized (mLock) {
- Log.v(this, "SessionCallback: HEADSETHOOK");
- boolean consumed = handleHeadsetHook(event);
- Log.v(this, "==> handleHeadsetHook(): consumed = %b.", consumed);
+ Log.v(this, "SessionCallback: HEADSETHOOK/MEDIA_PLAY_PAUSE");
+ boolean consumed = handleCallMediaButton(event);
+ Log.v(this, "==> handleCallMediaButton(): consumed = %b.", consumed);
return consumed;
}
}
@@ -113,8 +114,8 @@ public class HeadsetMediaButton extends CallsManagerListenerBase {
*
* @return true if we consumed the event.
*/
- private boolean handleHeadsetHook(KeyEvent event) {
- Log.d(this, "handleHeadsetHook()...%s %s", event.getAction(), event.getRepeatCount());
+ private boolean handleCallMediaButton(KeyEvent event) {
+ Log.d(this, "handleCallMediaButton()...%s %s", event.getAction(), event.getRepeatCount());
// Save ACTION_DOWN Event temporarily.
if (event.getAction() == KeyEvent.ACTION_DOWN) {