Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit ef8df12f authored by Andreas Agvard's avatar Andreas Agvard Committed by Android (Google) Code Review
Browse files

Merge "Makes deep press for LPNH toggelable" into main

parents 8a7b54ad 0fc7d528
Loading
Loading
Loading
Loading
+3 −1
Original line number Diff line number Diff line
@@ -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);
+4 −0
Original line number Diff line number Diff line
@@ -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,