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
This commit is contained in:
Tracy Zhou
2023-05-17 18:01:53 -07:00
parent 1d0fcb0f8d
commit dae18892a2
2 changed files with 10 additions and 1 deletions

View File

@@ -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.

View File

@@ -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