Merge "Accessibility shortcut on Android TV." into oc-dev
This commit is contained in:
committed by
Android (Google) Code Review
commit
4fca7821fb
@@ -780,6 +780,10 @@ public class PhoneWindowManager implements WindowManagerPolicy {
|
|||||||
private boolean mBugreportTvKey2Pressed;
|
private boolean mBugreportTvKey2Pressed;
|
||||||
private boolean mBugreportTvScheduled;
|
private boolean mBugreportTvScheduled;
|
||||||
|
|
||||||
|
private boolean mAccessibilityTvKey1Pressed;
|
||||||
|
private boolean mAccessibilityTvKey2Pressed;
|
||||||
|
private boolean mAccessibilityTvScheduled;
|
||||||
|
|
||||||
/* The number of steps between min and max brightness */
|
/* The number of steps between min and max brightness */
|
||||||
private static final int BRIGHTNESS_STEPS = 10;
|
private static final int BRIGHTNESS_STEPS = 10;
|
||||||
|
|
||||||
@@ -824,6 +828,7 @@ public class PhoneWindowManager implements WindowManagerPolicy {
|
|||||||
private static final int MSG_BACK_DELAYED_PRESS = 20;
|
private static final int MSG_BACK_DELAYED_PRESS = 20;
|
||||||
private static final int MSG_ACCESSIBILITY_SHORTCUT = 21;
|
private static final int MSG_ACCESSIBILITY_SHORTCUT = 21;
|
||||||
private static final int MSG_BUGREPORT_TV = 22;
|
private static final int MSG_BUGREPORT_TV = 22;
|
||||||
|
private static final int MSG_ACCESSIBILITY_TV = 23;
|
||||||
|
|
||||||
private static final int MSG_REQUEST_TRANSIENT_BARS_ARG_STATUS = 0;
|
private static final int MSG_REQUEST_TRANSIENT_BARS_ARG_STATUS = 0;
|
||||||
private static final int MSG_REQUEST_TRANSIENT_BARS_ARG_NAVIGATION = 1;
|
private static final int MSG_REQUEST_TRANSIENT_BARS_ARG_NAVIGATION = 1;
|
||||||
@@ -905,6 +910,11 @@ public class PhoneWindowManager implements WindowManagerPolicy {
|
|||||||
case MSG_BUGREPORT_TV:
|
case MSG_BUGREPORT_TV:
|
||||||
takeBugreport();
|
takeBugreport();
|
||||||
break;
|
break;
|
||||||
|
case MSG_ACCESSIBILITY_TV:
|
||||||
|
if (mAccessibilityShortcutController.isAccessibilityShortcutAvailable(false)) {
|
||||||
|
accessibilityShortcutActivated();
|
||||||
|
}
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -3319,6 +3329,11 @@ public class PhoneWindowManager implements WindowManagerPolicy {
|
|||||||
if (!down) {
|
if (!down) {
|
||||||
cancelPreloadRecentApps();
|
cancelPreloadRecentApps();
|
||||||
|
|
||||||
|
if (mHasFeatureLeanback) {
|
||||||
|
// Clear flags
|
||||||
|
mAccessibilityTvKey2Pressed = down;
|
||||||
|
}
|
||||||
|
|
||||||
mHomePressed = false;
|
mHomePressed = false;
|
||||||
if (mHomeConsumed) {
|
if (mHomeConsumed) {
|
||||||
mHomeConsumed = false;
|
mHomeConsumed = false;
|
||||||
@@ -3373,6 +3388,13 @@ public class PhoneWindowManager implements WindowManagerPolicy {
|
|||||||
preloadRecentApps();
|
preloadRecentApps();
|
||||||
}
|
}
|
||||||
} else if ((event.getFlags() & KeyEvent.FLAG_LONG_PRESS) != 0) {
|
} else if ((event.getFlags() & KeyEvent.FLAG_LONG_PRESS) != 0) {
|
||||||
|
if (mHasFeatureLeanback) {
|
||||||
|
mAccessibilityTvKey2Pressed = down;
|
||||||
|
if (interceptAccessibilityGestureTv()) {
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (!keyguardOn) {
|
if (!keyguardOn) {
|
||||||
handleLongPressOnHome(event.getDeviceId());
|
handleLongPressOnHome(event.getDeviceId());
|
||||||
}
|
}
|
||||||
@@ -3532,6 +3554,11 @@ public class PhoneWindowManager implements WindowManagerPolicy {
|
|||||||
return 0;
|
return 0;
|
||||||
} else if (mHasFeatureLeanback && interceptBugreportGestureTv(keyCode, down)) {
|
} else if (mHasFeatureLeanback && interceptBugreportGestureTv(keyCode, down)) {
|
||||||
return -1;
|
return -1;
|
||||||
|
} else if (mHasFeatureLeanback && keyCode == KeyEvent.KEYCODE_DPAD_CENTER) {
|
||||||
|
mAccessibilityTvKey1Pressed = down;
|
||||||
|
if (interceptAccessibilityGestureTv()) {
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Toggle Caps Lock on META-ALT.
|
// Toggle Caps Lock on META-ALT.
|
||||||
@@ -3750,6 +3777,25 @@ public class PhoneWindowManager implements WindowManagerPolicy {
|
|||||||
return mBugreportTvScheduled;
|
return mBugreportTvScheduled;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* TV only: recognizes a remote control gesture as Accessibility shortcut.
|
||||||
|
* Shortcut: Long press (HOME + DPAD_CENTER)
|
||||||
|
*/
|
||||||
|
private boolean interceptAccessibilityGestureTv() {
|
||||||
|
if (mAccessibilityTvKey1Pressed && mAccessibilityTvKey2Pressed) {
|
||||||
|
if (!mAccessibilityTvScheduled) {
|
||||||
|
mAccessibilityTvScheduled = true;
|
||||||
|
Message msg = Message.obtain(mHandler, MSG_ACCESSIBILITY_TV);
|
||||||
|
msg.setAsynchronous(true);
|
||||||
|
mHandler.sendMessage(msg);
|
||||||
|
}
|
||||||
|
} else if (mAccessibilityTvScheduled) {
|
||||||
|
mHandler.removeMessages(MSG_ACCESSIBILITY_TV);
|
||||||
|
mAccessibilityTvScheduled = false;
|
||||||
|
}
|
||||||
|
return mAccessibilityTvScheduled;
|
||||||
|
}
|
||||||
|
|
||||||
private void takeBugreport() {
|
private void takeBugreport() {
|
||||||
if ("1".equals(SystemProperties.get("ro.debuggable"))
|
if ("1".equals(SystemProperties.get("ro.debuggable"))
|
||||||
|| Settings.Global.getInt(mContext.getContentResolver(),
|
|| Settings.Global.getInt(mContext.getContentResolver(),
|
||||||
@@ -8235,6 +8281,14 @@ public class PhoneWindowManager implements WindowManagerPolicy {
|
|||||||
pw.print(prefix); pw.print("mDemoHdmiRotation="); pw.print(mDemoHdmiRotation);
|
pw.print(prefix); pw.print("mDemoHdmiRotation="); pw.print(mDemoHdmiRotation);
|
||||||
pw.print(" mDemoHdmiRotationLock="); pw.println(mDemoHdmiRotationLock);
|
pw.print(" mDemoHdmiRotationLock="); pw.println(mDemoHdmiRotationLock);
|
||||||
pw.print(prefix); pw.print("mUndockedHdmiRotation="); pw.println(mUndockedHdmiRotation);
|
pw.print(prefix); pw.print("mUndockedHdmiRotation="); pw.println(mUndockedHdmiRotation);
|
||||||
|
if (mHasFeatureLeanback) {
|
||||||
|
pw.print(prefix);
|
||||||
|
pw.print("mAccessibilityTvKey1Pressed="); pw.println(mAccessibilityTvKey1Pressed);
|
||||||
|
pw.print(prefix);
|
||||||
|
pw.print("mAccessibilityTvKey2Pressed="); pw.println(mAccessibilityTvKey2Pressed);
|
||||||
|
pw.print(prefix);
|
||||||
|
pw.print("mAccessibilityTvScheduled="); pw.println(mAccessibilityTvScheduled);
|
||||||
|
}
|
||||||
|
|
||||||
mGlobalKeyManager.dump(prefix, pw);
|
mGlobalKeyManager.dump(prefix, pw);
|
||||||
mStatusBarController.dump(pw, prefix);
|
mStatusBarController.dump(pw, prefix);
|
||||||
|
|||||||
Reference in New Issue
Block a user