From 95cad640c74b3c205879ddb445fd458d877c8c2d Mon Sep 17 00:00:00 2001 From: Brian Isganitis Date: Tue, 19 Apr 2022 23:11:12 +0000 Subject: [PATCH] Decrease overview degree threshold from 45 to 15 degrees. Met with arifhuda@ to confirm the benefit of lowering to 15 degrees. This change also updates AbsSwipeHandler to differentiate between X and Y flings in calculateEndTarget. Test: Manual Fix: 222117127 Change-Id: I416986145a4306d1babe23735e0563e87660c417 --- .../com/android/quickstep/AbsSwipeUpHandler.java | 14 ++++++++++---- .../inputconsumers/OtherActivityInputConsumer.java | 6 +++++- 2 files changed, 15 insertions(+), 5 deletions(-) diff --git a/quickstep/src/com/android/quickstep/AbsSwipeUpHandler.java b/quickstep/src/com/android/quickstep/AbsSwipeUpHandler.java index 2ae0646ed0..7ca76399a6 100644 --- a/quickstep/src/com/android/quickstep/AbsSwipeUpHandler.java +++ b/quickstep/src/com/android/quickstep/AbsSwipeUpHandler.java @@ -1006,8 +1006,8 @@ public abstract class AbsSwipeUpHandler, return false; } - private GestureEndTarget calculateEndTarget(PointF velocity, float endVelocity, boolean isFling, - boolean isCancel) { + private GestureEndTarget calculateEndTarget(PointF velocity, float endVelocity, + boolean isFlingY, boolean isCancel) { if (mGestureState.isHandlingAtomicEvent()) { // Button mode, this is only used to go to recents return RECENTS; @@ -1028,11 +1028,17 @@ public abstract class AbsSwipeUpHandler, goingToNewTask = false; } final boolean reachedOverviewThreshold = mCurrentShift.value >= MIN_PROGRESS_FOR_OVERVIEW; - if (!isFling) { + final boolean isFlingX = Math.abs(velocity.x) > mContext.getResources() + .getDimension(R.dimen.quickstep_fling_threshold_speed); + if (!isFlingY) { if (isCancel) { endTarget = LAST_TASK; } else if (mDeviceState.isFullyGesturalNavMode()) { - if (mIsMotionPaused) { + if (goingToNewTask && isFlingX) { + // Flinging towards new task takes precedence over mIsMotionPaused (which only + // checks y-velocity). + endTarget = NEW_TASK; + } else if (mIsMotionPaused) { endTarget = RECENTS; } else if (goingToNewTask) { endTarget = NEW_TASK; diff --git a/quickstep/src/com/android/quickstep/inputconsumers/OtherActivityInputConsumer.java b/quickstep/src/com/android/quickstep/inputconsumers/OtherActivityInputConsumer.java index dd459f5258..11f0ff3259 100644 --- a/quickstep/src/com/android/quickstep/inputconsumers/OtherActivityInputConsumer.java +++ b/quickstep/src/com/android/quickstep/inputconsumers/OtherActivityInputConsumer.java @@ -84,6 +84,9 @@ public class OtherActivityInputConsumer extends ContextWrapper implements InputC public static final float QUICKSTEP_TOUCH_SLOP_RATIO_TWO_BUTTON = 9; public static final float QUICKSTEP_TOUCH_SLOP_RATIO_GESTURAL = 2; + // Minimum angle of a gesture's coordinate where a release goes to overview. + public static final int OVERVIEW_MIN_DEGREES = 15; + private final RecentsAnimationDeviceState mDeviceState; private final NavBarPosition mNavBarPosition; private final TaskAnimationManager mTaskAnimationManager; @@ -291,8 +294,9 @@ public class OtherActivityInputConsumer extends ContextWrapper implements InputC // the gesture (in which case mPassedPilferInputSlop starts as true). boolean haveNotPassedSlopOnContinuedGesture = !mPassedSlopOnThisGesture && mPassedPilferInputSlop; + double degrees = Math.toDegrees(Math.atan(upDist / horizontalDist)); boolean isLikelyToStartNewTask = haveNotPassedSlopOnContinuedGesture - || horizontalDist > upDist; + || degrees <= OVERVIEW_MIN_DEGREES; if (!mPassedPilferInputSlop) { if (passedSlop) {