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

Commit 2daf6aaa authored by Tracy Zhou's avatar Tracy Zhou
Browse files

Check pointer count for trackpad gesture features

Bug: 255697805
Test: 4-finger back swipe no longer works
Change-Id: Iac5e5f6987004fa43f11b5109abd431a361a5d9c
parent 03f1bb50
Loading
Loading
Loading
Loading
+4 −4
Original line number Diff line number Diff line
@@ -18,7 +18,7 @@ package com.android.systemui.navigationbar.gestural;
import static android.view.WindowManager.LayoutParams.PRIVATE_FLAG_EXCLUDE_FROM_SCREEN_MAGNIFICATION;

import static com.android.systemui.classifier.Classifier.BACK_GESTURE;
import static com.android.systemui.navigationbar.gestural.Utilities.isTrackpadMotionEvent;
import static com.android.systemui.navigationbar.gestural.Utilities.isTrackpadThreeFingerSwipe;

import android.annotation.NonNull;
import android.app.ActivityManager;
@@ -244,7 +244,7 @@ public class EdgeBackGestureHandler implements PluginListener<NavigationEdgeBack
    private boolean mIsBackGestureAllowed;
    private boolean mGestureBlockingActivityRunning;
    private boolean mIsNewBackAffordanceEnabled;
    private boolean mIsTrackpadGestureBackEnabled;
    private boolean mIsTrackpadGestureFeaturesEnabled;
    private boolean mIsButtonForceVisible;

    private InputMonitor mInputMonitor;
@@ -590,7 +590,7 @@ public class EdgeBackGestureHandler implements PluginListener<NavigationEdgeBack

            // Add a nav bar panel window
            mIsNewBackAffordanceEnabled = mFeatureFlags.isEnabled(Flags.NEW_BACK_AFFORDANCE);
            mIsTrackpadGestureBackEnabled = mFeatureFlags.isEnabled(
            mIsTrackpadGestureFeaturesEnabled = mFeatureFlags.isEnabled(
                    Flags.TRACKPAD_GESTURE_FEATURES);
            resetEdgeBackPlugin();
            mPluginManager.addPluginListener(
@@ -883,7 +883,7 @@ public class EdgeBackGestureHandler implements PluginListener<NavigationEdgeBack
    }

    private void onMotionEvent(MotionEvent ev) {
        boolean isTrackpadEvent = isTrackpadMotionEvent(mIsTrackpadGestureBackEnabled, ev);
        boolean isTrackpadEvent = isTrackpadThreeFingerSwipe(mIsTrackpadGestureFeaturesEnabled, ev);
        int action = ev.getActionMasked();
        if (action == MotionEvent.ACTION_DOWN) {
            if (DEBUG_MISSING_GESTURE) {
+4 −3
Original line number Diff line number Diff line
@@ -22,9 +22,10 @@ import android.view.MotionEvent;

public final class Utilities {

    public static boolean isTrackpadMotionEvent(boolean isTrackpadGestureBackEnabled,
    public static boolean isTrackpadThreeFingerSwipe(boolean isTrackpadGestureFeaturesEnabled,
            MotionEvent event) {
        return isTrackpadGestureBackEnabled
                && event.getClassification() == CLASSIFICATION_MULTI_FINGER_SWIPE;
        return isTrackpadGestureFeaturesEnabled
                && event.getClassification() == CLASSIFICATION_MULTI_FINGER_SWIPE
                && event.getPointerCount() == 3;
    }
}