From a2227658dbf3183f8bc09d7dd205574f24e4a082 Mon Sep 17 00:00:00 2001 From: Tracy Zhou Date: Thu, 24 Aug 2023 13:34:35 -0700 Subject: [PATCH] Ignore touch slop threshold for trackpad gestures using gesture nav Gesture library has a threshold for 3-finger swipes, and if it's recoginized as one, it only reports movement in one axis. There is no point waiting for it to pass the initial threshold, unlike gestures on the screen. Bug: 291771975 Test: swipe up slowly, observe the smoothness of the gesture nav animation. Change-Id: I0904efb1d5cd26f6566da46279d0153e19a9618c --- .../inputconsumers/OtherActivityInputConsumer.java | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/quickstep/src/com/android/quickstep/inputconsumers/OtherActivityInputConsumer.java b/quickstep/src/com/android/quickstep/inputconsumers/OtherActivityInputConsumer.java index 281622882a..4c66504b89 100644 --- a/quickstep/src/com/android/quickstep/inputconsumers/OtherActivityInputConsumer.java +++ b/quickstep/src/com/android/quickstep/inputconsumers/OtherActivityInputConsumer.java @@ -278,7 +278,8 @@ public class OtherActivityInputConsumer extends ContextWrapper implements InputC if (!mIsDeferredDownTarget) { // Normal gesture, ensure we pass the drag slop before we start tracking // the gesture - if (Math.abs(displacement) > mTouchSlop) { + if (mGestureState.isTrackpadGesture() || Math.abs(displacement) + > mTouchSlop) { mPassedWindowMoveSlop = true; mStartDisplacement = Math.min(displacement, -mTouchSlop); } @@ -287,8 +288,8 @@ public class OtherActivityInputConsumer extends ContextWrapper implements InputC float horizontalDist = Math.abs(displacementX); float upDist = -displacement; - boolean passedSlop = squaredHypot(displacementX, displacementY) - >= mSquaredTouchSlop; + boolean passedSlop = mGestureState.isTrackpadGesture() || squaredHypot( + displacementX, displacementY) >= mSquaredTouchSlop; if (!mPassedSlopOnThisGesture && passedSlop) { mPassedSlopOnThisGesture = true;