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

Commit f705e782 authored by Tracy Zhou's avatar Tracy Zhou Committed by Automerger Merge Worker
Browse files

Merge "Edge click and drag using the trackpad shouldn't trigger back" into...

Merge "Edge click and drag using the trackpad shouldn't trigger back" into udc-dev am: d9f0c546 am: c1dff416

Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/22879585



Change-Id: I528c2a58515b306c2f1ce1a68e35d579088a186f
Signed-off-by: default avatarAutomerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
parents b97138f3 c1dff416
Loading
Loading
Loading
Loading
+11 −2
Original line number Diff line number Diff line
@@ -15,6 +15,8 @@
 */
package com.android.systemui.navigationbar.gestural;

import static android.view.InputDevice.SOURCE_MOUSE;
import static android.view.InputDevice.SOURCE_TOUCHPAD;
import static android.view.WindowManager.LayoutParams.PRIVATE_FLAG_EXCLUDE_FROM_SCREEN_MAGNIFICATION;

import static com.android.systemui.classifier.Classifier.BACK_GESTURE;
@@ -937,10 +939,12 @@ public class EdgeBackGestureHandler implements PluginListener<NavigationEdgeBack
            mMLResults = 0;
            mLogGesture = false;
            mInRejectedExclusion = false;
            boolean isWithinInsets = isWithinInsets((int) ev.getX(), (int) ev.getY());
            // Trackpad back gestures don't have zones, so we don't need to check if the down event
            // is within insets.
            // is within insets. Also we don't allow back for button press from the trackpad, and
            // yet we do with a mouse.
            boolean isWithinInsets = isWithinInsets((int) ev.getX(), (int) ev.getY());
            mAllowGesture = !mDisabledForQuickstep && mIsBackGestureAllowed
                    && !isButtonPressFromTrackpad(ev)
                    && (isTrackpadMultiFingerSwipe || isWithinInsets)
                    && !mGestureBlockingActivityRunning
                    && !QuickStepContract.isBackGestureDisabled(mSysUiFlags)
@@ -1047,6 +1051,11 @@ public class EdgeBackGestureHandler implements PluginListener<NavigationEdgeBack
        mProtoTracer.scheduleFrameUpdate();
    }

    private boolean isButtonPressFromTrackpad(MotionEvent ev) {
        int sources = InputManager.getInstance().getInputDevice(ev.getDeviceId()).getSources();
        return (sources & (SOURCE_MOUSE | SOURCE_TOUCHPAD)) == sources && ev.getButtonState() != 0;
    }

    private void dispatchToBackAnimation(MotionEvent event) {
        if (mBackAnimation != null) {
            mVelocityTracker.addMovement(event);