diff options
| author | 2018-08-03 11:28:05 -0700 | |
|---|---|---|
| committer | 2018-09-17 11:01:25 -0700 | |
| commit | 1e12d4678cbc8ca3e6186f225511e89b2e9fab16 (patch) | |
| tree | ce05e89b3188347cc83b4c4c86db78240dccad9a | |
| parent | f0ed77694f333be8581d7a00cdfd0a5129b536de (diff) | |
Allow ATV Keychord to turn on/off talkback
Bug: 74307653
Test: manual - tested on elfin
1) Pair emote app to Android TV
2) use keychord (Dpad_down + back) to trigger on/off talkback
(currently, emote app is the only remote that can pair with ATV and
send/trigger 2 keyevents simultaneously to actually trigger the keychord)
---
Talkback was consuming keyevents between interceptKeyEventBeforeQueueing
and interceptKeyEventBeforeDispatching, so if we move the logic that
schedules the toggling of the accessibility feature to the
"...BeforeQueueing" method we can turn off talkback appropriately.
The original CL was located here: ag/4466951. This CL will be CPed back
to pi-tv-dev.
Change-Id: I2c4e532c09d57a1a3cf093cfb7e3d5557f6b9929
| -rw-r--r-- | services/core/java/com/android/server/policy/PhoneWindowManager.java | 18 |
1 files changed, 16 insertions, 2 deletions
diff --git a/services/core/java/com/android/server/policy/PhoneWindowManager.java b/services/core/java/com/android/server/policy/PhoneWindowManager.java index 3e0429fd443e..05a5dd7dc3ba 100644 --- a/services/core/java/com/android/server/policy/PhoneWindowManager.java +++ b/services/core/java/com/android/server/policy/PhoneWindowManager.java @@ -3543,8 +3543,6 @@ public class PhoneWindowManager implements WindowManagerPolicy { return 0; } else if (mHasFeatureLeanback && interceptBugreportGestureTv(keyCode, down)) { return -1; - } else if (mHasFeatureLeanback && interceptAccessibilityGestureTv(keyCode, down)) { - return -1; } else if (keyCode == KeyEvent.KEYCODE_ALL_APPS) { if (!down) { mHandler.removeMessages(MSG_HANDLE_ALL_APPS); @@ -6037,6 +6035,22 @@ public class PhoneWindowManager implements WindowManagerPolicy { } } + // Intercept the Accessibility keychord for TV (DPAD_DOWN + Back) before the keyevent is + // processed through interceptKeyEventBeforeDispatch since Talkback may consume this event + // before it has a chance to reach that method. + if (mHasFeatureLeanback) { + switch (keyCode) { + case KeyEvent.KEYCODE_DPAD_DOWN: + case KeyEvent.KEYCODE_BACK: { + boolean handled = interceptAccessibilityGestureTv(keyCode, down); + if (handled) { + result &= ~ACTION_PASS_TO_USER; + } + break; + } + } + } + if (useHapticFeedback) { performHapticFeedbackLw(null, HapticFeedbackConstants.VIRTUAL_KEY, false, "Virtual Key - Press"); |