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

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

Disallow two finger gesture nav behaviors when the cursor is in the zones

- This change addresses swipe up and quick switch from the nav bar area using two fingers
- Separate changes will be implemented in SysUI to disable two finger swipe down from the status bar area and two finger swipe edge swipe for back

Bug: 283112069
Test: manual
Change-Id: I67c7ba31e759d5693d89112fd8f37f3d2a9eaa41
parent 60136287
Loading
Loading
Loading
Loading
+7 −4
Original line number Original line Diff line number Diff line
@@ -19,6 +19,7 @@ import static android.view.Display.DEFAULT_DISPLAY;
import static android.view.Surface.ROTATION_0;
import static android.view.Surface.ROTATION_0;


import static com.android.launcher3.MotionEventsUtils.isTrackpadMultiFingerSwipe;
import static com.android.launcher3.MotionEventsUtils.isTrackpadMultiFingerSwipe;
import static com.android.launcher3.MotionEventsUtils.isTrackpadScroll;
import static com.android.launcher3.util.DisplayController.CHANGE_ACTIVE_SCREEN;
import static com.android.launcher3.util.DisplayController.CHANGE_ACTIVE_SCREEN;
import static com.android.launcher3.util.DisplayController.CHANGE_ALL;
import static com.android.launcher3.util.DisplayController.CHANGE_ALL;
import static com.android.launcher3.util.DisplayController.CHANGE_NAVIGATION_MODE;
import static com.android.launcher3.util.DisplayController.CHANGE_NAVIGATION_MODE;
@@ -232,16 +233,18 @@ public class RotationTouchHelper implements DisplayInfoChangeListener {
    /**
    /**
     * @return whether the coordinates of the {@param event} is in the swipe up gesture region.
     * @return whether the coordinates of the {@param event} is in the swipe up gesture region.
     */
     */
    public boolean isInSwipeUpTouchRegion(MotionEvent event, BaseActivityInterface activity) {
    public boolean isInSwipeUpTouchRegion(MotionEvent event) {
        return isInSwipeUpTouchRegion(event, 0, activity);
        return isInSwipeUpTouchRegion(event, 0);
    }
    }


    /**
    /**
     * @return whether the coordinates of the {@param event} with the given {@param pointerIndex}
     * @return whether the coordinates of the {@param event} with the given {@param pointerIndex}
     *         is in the swipe up gesture region.
     *         is in the swipe up gesture region.
     */
     */
    public boolean isInSwipeUpTouchRegion(MotionEvent event, int pointerIndex,
    public boolean isInSwipeUpTouchRegion(MotionEvent event, int pointerIndex) {
            BaseActivityInterface activity) {
        if (isTrackpadScroll(event)) {
            return false;
        }
        if (isTrackpadMultiFingerSwipe(event)) {
        if (isTrackpadMultiFingerSwipe(event)) {
            return true;
            return true;
        }
        }
+1 −2
Original line number Original line Diff line number Diff line
@@ -661,8 +661,7 @@ public class TouchInteractionService extends Service
            mRotationTouchHelper.setOrientationTransformIfNeeded(event);
            mRotationTouchHelper.setOrientationTransformIfNeeded(event);


            if ((!mDeviceState.isOneHandedModeActive()
            if ((!mDeviceState.isOneHandedModeActive()
                    && mRotationTouchHelper.isInSwipeUpTouchRegion(event,
                    && mRotationTouchHelper.isInSwipeUpTouchRegion(event))
                    mOverviewComponentObserver.getActivityInterface()))
                    || isHoverActionWithoutConsumer) {
                    || isHoverActionWithoutConsumer) {
                // Clone the previous gesture state since onConsumerAboutToBeSwitched might trigger
                // Clone the previous gesture state since onConsumerAboutToBeSwitched might trigger
                // onConsumerInactive and wipe the previous gesture state
                // onConsumerInactive and wipe the previous gesture state
+1 −2
Original line number Original line Diff line number Diff line
@@ -103,8 +103,7 @@ public class AccessibilityInputConsumer extends DelegateInputConsumer {
                if (mState == STATE_INACTIVE) {
                if (mState == STATE_INACTIVE) {
                    int pointerIndex = ev.getActionIndex();
                    int pointerIndex = ev.getActionIndex();
                    if (mDeviceState.getRotationTouchHelper().isInSwipeUpTouchRegion(ev,
                    if (mDeviceState.getRotationTouchHelper().isInSwipeUpTouchRegion(ev,
                            pointerIndex, mGestureState.getActivityInterface())
                            pointerIndex) && mDelegate.allowInterceptByParent()) {
                            && mDelegate.allowInterceptByParent()) {
                        setActive(ev);
                        setActive(ev);


                        mActivePointerId = ev.getPointerId(pointerIndex);
                        mActivePointerId = ev.getPointerId(pointerIndex);
+1 −2
Original line number Original line Diff line number Diff line
@@ -153,8 +153,7 @@ public class DeviceLockedInputConsumer implements InputConsumer,
                if (!mThresholdCrossed) {
                if (!mThresholdCrossed) {
                    // Cancel interaction in case of multi-touch interaction
                    // Cancel interaction in case of multi-touch interaction
                    int ptrIdx = ev.getActionIndex();
                    int ptrIdx = ev.getActionIndex();
                    if (!mDeviceState.getRotationTouchHelper().isInSwipeUpTouchRegion(ev, ptrIdx,
                    if (!mDeviceState.getRotationTouchHelper().isInSwipeUpTouchRegion(ev, ptrIdx)) {
                            mGestureState.getActivityInterface())) {
                        int action = ev.getAction();
                        int action = ev.getAction();
                        ev.setAction(ACTION_CANCEL);
                        ev.setAction(ACTION_CANCEL);
                        finishTouchTracking(ev);
                        finishTouchTracking(ev);
+1 −2
Original line number Original line Diff line number Diff line
@@ -248,8 +248,7 @@ public class OtherActivityInputConsumer extends ContextWrapper implements InputC
                if (!mPassedPilferInputSlop) {
                if (!mPassedPilferInputSlop) {
                    // Cancel interaction in case of multi-touch interaction
                    // Cancel interaction in case of multi-touch interaction
                    int ptrIdx = ev.getActionIndex();
                    int ptrIdx = ev.getActionIndex();
                    if (!mRotationTouchHelper.isInSwipeUpTouchRegion(ev, ptrIdx,
                    if (!mRotationTouchHelper.isInSwipeUpTouchRegion(ev, ptrIdx)) {
                            mActivityInterface)) {
                        forceCancelGesture(ev);
                        forceCancelGesture(ev);
                    }
                    }
                }
                }