diff --git a/quickstep/src/com/android/quickstep/inputconsumers/NavHandleLongPressInputConsumer.java b/quickstep/src/com/android/quickstep/inputconsumers/NavHandleLongPressInputConsumer.java index d38376cace..8051e68f2f 100644 --- a/quickstep/src/com/android/quickstep/inputconsumers/NavHandleLongPressInputConsumer.java +++ b/quickstep/src/com/android/quickstep/inputconsumers/NavHandleLongPressInputConsumer.java @@ -42,6 +42,7 @@ public class NavHandleLongPressInputConsumer extends DelegateInputConsumer { private final Runnable mTriggerLongPress = this::triggerLongPress; private final float mTouchSlopSquared; private final int mLongPressTimeout; + private final boolean mDeepPressEnabled; private MotionEvent mCurrentDownEvent; @@ -51,6 +52,7 @@ public class NavHandleLongPressInputConsumer extends DelegateInputConsumer { mNavHandleWidth = context.getResources().getDimensionPixelSize( R.dimen.navigation_home_handle_width); mScreenWidth = DisplayController.INSTANCE.get(context).getInfo().currentSize.x; + mDeepPressEnabled = FeatureFlags.ENABLE_LPNH_DEEP_PRESS.get(); if (FeatureFlags.CUSTOM_LPNH_THRESHOLDS.get()) { mLongPressTimeout = LauncherPrefs.get(context).get(LONG_PRESS_NAV_HANDLE_TIMEOUT_MS); } else { @@ -108,7 +110,7 @@ public class NavHandleLongPressInputConsumer extends DelegateInputConsumer { } // If the gesture is deep press then trigger long press asap - if (MAIN_EXECUTOR.getHandler().hasCallbacks(mTriggerLongPress) + if (mDeepPressEnabled && MAIN_EXECUTOR.getHandler().hasCallbacks(mTriggerLongPress) && ev.getClassification() == MotionEvent.CLASSIFICATION_DEEP_PRESS) { MAIN_EXECUTOR.getHandler().removeCallbacks(mTriggerLongPress); MAIN_EXECUTOR.getHandler().post(mTriggerLongPress); diff --git a/src/com/android/launcher3/config/FeatureFlags.java b/src/com/android/launcher3/config/FeatureFlags.java index 7d9f70980b..26751eedc1 100644 --- a/src/com/android/launcher3/config/FeatureFlags.java +++ b/src/com/android/launcher3/config/FeatureFlags.java @@ -302,6 +302,10 @@ public final class FeatureFlags { getIntFlag(309972570, "FLAG_LPNH_HAPTIC_HINT_ITERATIONS", 50, "Haptic hint number of iterations."); + public static final BooleanFlag ENABLE_LPNH_DEEP_PRESS = + getReleaseFlag(310952290, "ENABLE_LPNH_DEEP_PRESS", ENABLED, + "Long press of nav handle is instantly triggered if deep press is detected."); + // TODO(Block 17): Clean up flags // Aconfig migration complete for ENABLE_TASKBAR_PINNING. private static final BooleanFlag ENABLE_TASKBAR_PINNING = getDebugFlag(270396583,