Loading services/core/java/com/android/server/policy/PhoneWindowManager.java +54 −0 Original line number Diff line number Diff line Loading @@ -780,6 +780,10 @@ public class PhoneWindowManager implements WindowManagerPolicy { private boolean mBugreportTvKey2Pressed; private boolean mBugreportTvScheduled; private boolean mAccessibilityTvKey1Pressed; private boolean mAccessibilityTvKey2Pressed; private boolean mAccessibilityTvScheduled; /* The number of steps between min and max brightness */ private static final int BRIGHTNESS_STEPS = 10; Loading Loading @@ -824,6 +828,7 @@ public class PhoneWindowManager implements WindowManagerPolicy { private static final int MSG_BACK_DELAYED_PRESS = 20; private static final int MSG_ACCESSIBILITY_SHORTCUT = 21; 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_NAVIGATION = 1; Loading Loading @@ -905,6 +910,11 @@ public class PhoneWindowManager implements WindowManagerPolicy { case MSG_BUGREPORT_TV: takeBugreport(); break; case MSG_ACCESSIBILITY_TV: if (mAccessibilityShortcutController.isAccessibilityShortcutAvailable(false)) { accessibilityShortcutActivated(); } break; } } } Loading Loading @@ -3319,6 +3329,11 @@ public class PhoneWindowManager implements WindowManagerPolicy { if (!down) { cancelPreloadRecentApps(); if (mHasFeatureLeanback) { // Clear flags mAccessibilityTvKey2Pressed = down; } mHomePressed = false; if (mHomeConsumed) { mHomeConsumed = false; Loading Loading @@ -3373,6 +3388,13 @@ public class PhoneWindowManager implements WindowManagerPolicy { preloadRecentApps(); } } else if ((event.getFlags() & KeyEvent.FLAG_LONG_PRESS) != 0) { if (mHasFeatureLeanback) { mAccessibilityTvKey2Pressed = down; if (interceptAccessibilityGestureTv()) { return -1; } } if (!keyguardOn) { handleLongPressOnHome(event.getDeviceId()); } Loading Loading @@ -3532,6 +3554,11 @@ public class PhoneWindowManager implements WindowManagerPolicy { return 0; } else if (mHasFeatureLeanback && interceptBugreportGestureTv(keyCode, down)) { return -1; } else if (mHasFeatureLeanback && keyCode == KeyEvent.KEYCODE_DPAD_CENTER) { mAccessibilityTvKey1Pressed = down; if (interceptAccessibilityGestureTv()) { return -1; } } // Toggle Caps Lock on META-ALT. Loading Loading @@ -3750,6 +3777,25 @@ public class PhoneWindowManager implements WindowManagerPolicy { 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() { if ("1".equals(SystemProperties.get("ro.debuggable")) || Settings.Global.getInt(mContext.getContentResolver(), Loading Loading @@ -8235,6 +8281,14 @@ public class PhoneWindowManager implements WindowManagerPolicy { pw.print(prefix); pw.print("mDemoHdmiRotation="); pw.print(mDemoHdmiRotation); pw.print(" mDemoHdmiRotationLock="); pw.println(mDemoHdmiRotationLock); 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); mStatusBarController.dump(pw, prefix); Loading Loading
services/core/java/com/android/server/policy/PhoneWindowManager.java +54 −0 Original line number Diff line number Diff line Loading @@ -780,6 +780,10 @@ public class PhoneWindowManager implements WindowManagerPolicy { private boolean mBugreportTvKey2Pressed; private boolean mBugreportTvScheduled; private boolean mAccessibilityTvKey1Pressed; private boolean mAccessibilityTvKey2Pressed; private boolean mAccessibilityTvScheduled; /* The number of steps between min and max brightness */ private static final int BRIGHTNESS_STEPS = 10; Loading Loading @@ -824,6 +828,7 @@ public class PhoneWindowManager implements WindowManagerPolicy { private static final int MSG_BACK_DELAYED_PRESS = 20; private static final int MSG_ACCESSIBILITY_SHORTCUT = 21; 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_NAVIGATION = 1; Loading Loading @@ -905,6 +910,11 @@ public class PhoneWindowManager implements WindowManagerPolicy { case MSG_BUGREPORT_TV: takeBugreport(); break; case MSG_ACCESSIBILITY_TV: if (mAccessibilityShortcutController.isAccessibilityShortcutAvailable(false)) { accessibilityShortcutActivated(); } break; } } } Loading Loading @@ -3319,6 +3329,11 @@ public class PhoneWindowManager implements WindowManagerPolicy { if (!down) { cancelPreloadRecentApps(); if (mHasFeatureLeanback) { // Clear flags mAccessibilityTvKey2Pressed = down; } mHomePressed = false; if (mHomeConsumed) { mHomeConsumed = false; Loading Loading @@ -3373,6 +3388,13 @@ public class PhoneWindowManager implements WindowManagerPolicy { preloadRecentApps(); } } else if ((event.getFlags() & KeyEvent.FLAG_LONG_PRESS) != 0) { if (mHasFeatureLeanback) { mAccessibilityTvKey2Pressed = down; if (interceptAccessibilityGestureTv()) { return -1; } } if (!keyguardOn) { handleLongPressOnHome(event.getDeviceId()); } Loading Loading @@ -3532,6 +3554,11 @@ public class PhoneWindowManager implements WindowManagerPolicy { return 0; } else if (mHasFeatureLeanback && interceptBugreportGestureTv(keyCode, down)) { return -1; } else if (mHasFeatureLeanback && keyCode == KeyEvent.KEYCODE_DPAD_CENTER) { mAccessibilityTvKey1Pressed = down; if (interceptAccessibilityGestureTv()) { return -1; } } // Toggle Caps Lock on META-ALT. Loading Loading @@ -3750,6 +3777,25 @@ public class PhoneWindowManager implements WindowManagerPolicy { 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() { if ("1".equals(SystemProperties.get("ro.debuggable")) || Settings.Global.getInt(mContext.getContentResolver(), Loading Loading @@ -8235,6 +8281,14 @@ public class PhoneWindowManager implements WindowManagerPolicy { pw.print(prefix); pw.print("mDemoHdmiRotation="); pw.print(mDemoHdmiRotation); pw.print(" mDemoHdmiRotationLock="); pw.println(mDemoHdmiRotationLock); 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); mStatusBarController.dump(pw, prefix); Loading