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

Commit dae18892 authored by Tracy Zhou's avatar Tracy Zhou
Browse files

Disallow two finger edge swipe back

Back gesture is a 3-finger gesture. Currently because a two-finger swipe is recognized as if it's a motion event from on the screen, it triggers edge swipe when the cursor is in the zone. We don't want to allow this behavior

Bug: 283112069
Test: manual
Change-Id: I6b6955fe1f290a7c117986f7b72e31ecc23d04e9
parent 1d0fcb0f
Loading
Loading
Loading
Loading
+3 −1
Original line number Diff line number Diff line
@@ -22,6 +22,7 @@ import static android.view.WindowManager.LayoutParams.PRIVATE_FLAG_EXCLUDE_FROM_
import static com.android.systemui.classifier.Classifier.BACK_GESTURE;
import static com.android.systemui.navigationbar.gestural.Utilities.isTrackpadFourFingerSwipe;
import static com.android.systemui.navigationbar.gestural.Utilities.isTrackpadMultiFingerSwipe;
import static com.android.systemui.navigationbar.gestural.Utilities.isTrackpadScroll;

import android.annotation.NonNull;
import android.app.ActivityManager;
@@ -1011,7 +1012,8 @@ public class EdgeBackGestureHandler implements PluginListener<NavigationEdgeBack
            boolean isWithinInsets = isWithinInsets((int) ev.getX(), (int) ev.getY());
            boolean isBackAllowedCommon = !mDisabledForQuickstep && mIsBackGestureAllowed
                    && !mGestureBlockingActivityRunning
                    && !QuickStepContract.isBackGestureDisabled(mSysUiFlags);
                    && !QuickStepContract.isBackGestureDisabled(mSysUiFlags)
                    && !isTrackpadScroll(mIsTrackpadGestureFeaturesEnabled, ev);
            if (isTrackpadMultiFingerSwipe) {
                // Trackpad back gestures don't have zones, so we don't need to check if the down
                // event is within insets.
+7 −0
Original line number Diff line number Diff line
@@ -17,11 +17,18 @@
package com.android.systemui.navigationbar.gestural;

import static android.view.MotionEvent.CLASSIFICATION_MULTI_FINGER_SWIPE;
import static android.view.MotionEvent.CLASSIFICATION_TWO_FINGER_SWIPE;

import android.view.MotionEvent;

public final class Utilities {

    public static boolean isTrackpadScroll(boolean isTrackpadGestureFeaturesEnabled,
            MotionEvent event) {
        return isTrackpadGestureFeaturesEnabled
                && event.getClassification() == CLASSIFICATION_TWO_FINGER_SWIPE;
    }

    public static boolean isTrackpadMultiFingerSwipe(boolean isTrackpadGestureFeaturesEnabled,
            MotionEvent event) {
        return isTrackpadGestureFeaturesEnabled