summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--core/java/android/hardware/input/InputSettings.java10
-rw-r--r--services/core/java/com/android/server/input/KeyGestureController.java27
-rw-r--r--services/core/java/com/android/server/policy/PhoneWindowManager.java8
3 files changed, 28 insertions, 17 deletions
diff --git a/core/java/android/hardware/input/InputSettings.java b/core/java/android/hardware/input/InputSettings.java
index 96f6ad117035..71b60cff9367 100644
--- a/core/java/android/hardware/input/InputSettings.java
+++ b/core/java/android/hardware/input/InputSettings.java
@@ -31,6 +31,7 @@ import static com.android.hardware.input.Flags.touchpadTapDragging;
import static com.android.hardware.input.Flags.touchpadThreeFingerTapShortcut;
import static com.android.hardware.input.Flags.touchpadVisualizer;
import static com.android.hardware.input.Flags.useKeyGestureEventHandler;
+import static com.android.hardware.input.Flags.useKeyGestureEventHandlerMultiPressGestures;
import static com.android.input.flags.Flags.FLAG_KEYBOARD_REPEAT_KEYS;
import static com.android.input.flags.Flags.enableInputFilterRustImpl;
import static com.android.input.flags.Flags.keyboardRepeatKeys;
@@ -1147,4 +1148,13 @@ public class InputSettings {
public static boolean isCustomizableInputGesturesFeatureFlagEnabled() {
return enableCustomizableInputGestures() && useKeyGestureEventHandler();
}
+
+ /**
+ * Whether multi-key gestures are supported using {@code KeyGestureEventHandler}
+ *
+ * @hide
+ */
+ public static boolean doesKeyGestureEventHandlerSupportMultiKeyGestures() {
+ return useKeyGestureEventHandler() && useKeyGestureEventHandlerMultiPressGestures();
+ }
}
diff --git a/services/core/java/com/android/server/input/KeyGestureController.java b/services/core/java/com/android/server/input/KeyGestureController.java
index 0124e25f0655..bb0b19009962 100644
--- a/services/core/java/com/android/server/input/KeyGestureController.java
+++ b/services/core/java/com/android/server/input/KeyGestureController.java
@@ -21,8 +21,6 @@ import static android.content.pm.PackageManager.FEATURE_WATCH;
import static android.view.WindowManagerPolicyConstants.FLAG_INTERACTIVE;
import static com.android.hardware.input.Flags.enableNew25q2Keycodes;
-import static com.android.hardware.input.Flags.useKeyGestureEventHandler;
-import static com.android.hardware.input.Flags.useKeyGestureEventHandlerMultiPressGestures;
import android.annotation.BinderThread;
import android.annotation.MainThread;
@@ -51,7 +49,6 @@ import android.os.Message;
import android.os.Process;
import android.os.RemoteException;
import android.os.SystemClock;
-import android.os.SystemProperties;
import android.os.UserHandle;
import android.provider.Settings;
import android.util.IndentingPrintWriter;
@@ -215,7 +212,7 @@ final class KeyGestureController {
}
private void initKeyCombinationRules() {
- if (!useKeyGestureEventHandler() || !useKeyGestureEventHandlerMultiPressGestures()) {
+ if (!InputSettings.doesKeyGestureEventHandlerSupportMultiKeyGestures()) {
return;
}
// TODO(b/358569822): Handle Power, Back key properly since key combination gesture is
@@ -441,7 +438,8 @@ final class KeyGestureController {
public boolean interceptKeyBeforeQueueing(KeyEvent event, int policyFlags) {
final boolean interactive = (policyFlags & FLAG_INTERACTIVE) != 0;
- if ((event.getFlags() & KeyEvent.FLAG_FALLBACK) == 0) {
+ if (InputSettings.doesKeyGestureEventHandlerSupportMultiKeyGestures()
+ && (event.getFlags() & KeyEvent.FLAG_FALLBACK) == 0) {
return mKeyCombinationManager.interceptKey(event, interactive);
}
return false;
@@ -457,15 +455,18 @@ final class KeyGestureController {
final long keyConsumed = -1;
final long keyNotConsumed = 0;
- if (mKeyCombinationManager.isKeyConsumed(event)) {
- return keyConsumed;
- }
+ if (InputSettings.doesKeyGestureEventHandlerSupportMultiKeyGestures()) {
+ if (mKeyCombinationManager.isKeyConsumed(event)) {
+ return keyConsumed;
+ }
- if ((flags & KeyEvent.FLAG_FALLBACK) == 0) {
- final long now = SystemClock.uptimeMillis();
- final long interceptTimeout = mKeyCombinationManager.getKeyInterceptTimeout(keyCode);
- if (now < interceptTimeout) {
- return interceptTimeout - now;
+ if ((flags & KeyEvent.FLAG_FALLBACK) == 0) {
+ final long now = SystemClock.uptimeMillis();
+ final long interceptTimeout = mKeyCombinationManager.getKeyInterceptTimeout(
+ keyCode);
+ if (now < interceptTimeout) {
+ return interceptTimeout - now;
+ }
}
}
diff --git a/services/core/java/com/android/server/policy/PhoneWindowManager.java b/services/core/java/com/android/server/policy/PhoneWindowManager.java
index 8d039f19db8c..dda5bcf24d07 100644
--- a/services/core/java/com/android/server/policy/PhoneWindowManager.java
+++ b/services/core/java/com/android/server/policy/PhoneWindowManager.java
@@ -88,7 +88,6 @@ import static com.android.hardware.input.Flags.enableTalkbackAndMagnifierKeyGest
import static com.android.hardware.input.Flags.keyboardA11yShortcutControl;
import static com.android.hardware.input.Flags.modifierShortcutDump;
import static com.android.hardware.input.Flags.useKeyGestureEventHandler;
-import static com.android.hardware.input.Flags.useKeyGestureEventHandlerMultiPressGestures;
import static com.android.server.flags.Flags.modifierShortcutManagerMultiuser;
import static com.android.server.flags.Flags.newBugreportKeyboardShortcut;
import static com.android.internal.config.sysui.SystemUiDeviceConfigFlags.SCREENSHOT_KEYCHORD_DELAY;
@@ -2496,7 +2495,7 @@ public class PhoneWindowManager implements WindowManagerPolicy {
private void initKeyCombinationRules() {
mKeyCombinationManager = new KeyCombinationManager(mHandler);
- if (useKeyGestureEventHandler() && useKeyGestureEventHandlerMultiPressGestures()) {
+ if (InputSettings.doesKeyGestureEventHandlerSupportMultiKeyGestures()) {
return;
}
final boolean screenshotChordEnabled = mContext.getResources().getBoolean(
@@ -3442,7 +3441,7 @@ public class PhoneWindowManager implements WindowManagerPolicy {
+ keyguardOn() + " canceled=" + event.isCanceled());
}
- if (!useKeyGestureEventHandler()) {
+ if (!InputSettings.doesKeyGestureEventHandlerSupportMultiKeyGestures()) {
if (mKeyCombinationManager.isKeyConsumed(event)) {
return keyConsumed;
}
@@ -5720,7 +5719,8 @@ public class PhoneWindowManager implements WindowManagerPolicy {
}
private void handleKeyGesture(KeyEvent event, boolean interactive, boolean defaultDisplayOn) {
- if (mKeyCombinationManager.interceptKey(event, interactive)) {
+ if (!InputSettings.doesKeyGestureEventHandlerSupportMultiKeyGestures()
+ && mKeyCombinationManager.interceptKey(event, interactive)) {
// handled by combo keys manager.
mSingleKeyGestureDetector.reset();
return;