From 1f60acd68d1f3b9db79545381ac3ac07c2ce8500 Mon Sep 17 00:00:00 2001 From: Brian Isganitis Date: Tue, 17 May 2022 00:16:56 +0000 Subject: [PATCH] Revert "Snap to last task if swiping down at a greater Y than X velocity." This reverts commit e10ab8cdcde65f32cdf0d5e96e8721a62cbd7725. Reason for revert: Possibly introduced regressions. There was a followup to this CL that was also reverted. Would prefer to revert this one too and then roll forward with a CL that addresses all problems. Change-Id: Ic32ad10945e4ace2f985475d24adb6a80b19067f --- .../android/quickstep/AbsSwipeUpHandler.java | 32 ++++++++++--------- 1 file changed, 17 insertions(+), 15 deletions(-) diff --git a/quickstep/src/com/android/quickstep/AbsSwipeUpHandler.java b/quickstep/src/com/android/quickstep/AbsSwipeUpHandler.java index b90e8206f7..b073b90baf 100644 --- a/quickstep/src/com/android/quickstep/AbsSwipeUpHandler.java +++ b/quickstep/src/com/android/quickstep/AbsSwipeUpHandler.java @@ -1013,19 +1013,19 @@ public abstract class AbsSwipeUpHandler, return RECENTS; } final GestureEndTarget endTarget; - final boolean canGoToNewTask; + final boolean goingToNewTask; if (mRecentsView != null) { if (!hasTargets()) { // If there are no running tasks, then we can assume that this is a continuation of // the last gesture, but after the recents animation has finished - canGoToNewTask = true; + goingToNewTask = true; } else { final int runningTaskIndex = mRecentsView.getRunningTaskIndex(); final int taskToLaunch = mRecentsView.getNextPage(); - canGoToNewTask = runningTaskIndex >= 0 && taskToLaunch != runningTaskIndex; + goingToNewTask = runningTaskIndex >= 0 && taskToLaunch != runningTaskIndex; } } else { - canGoToNewTask = false; + goingToNewTask = false; } final boolean reachedOverviewThreshold = mCurrentShift.value >= MIN_PROGRESS_FOR_OVERVIEW; final boolean isFlingX = Math.abs(velocity.x) > mContext.getResources() @@ -1034,13 +1034,13 @@ public abstract class AbsSwipeUpHandler, if (isCancel) { endTarget = LAST_TASK; } else if (mDeviceState.isFullyGesturalNavMode()) { - if (canGoToNewTask && isFlingX) { + 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 (canGoToNewTask) { + } else if (goingToNewTask) { endTarget = NEW_TASK; } else { endTarget = !reachedOverviewThreshold ? LAST_TASK : HOME; @@ -1048,22 +1048,26 @@ public abstract class AbsSwipeUpHandler, } else { endTarget = reachedOverviewThreshold && mGestureStarted ? RECENTS - : canGoToNewTask + : goingToNewTask ? NEW_TASK : LAST_TASK; } } else { // If swiping at a diagonal, base end target on the faster velocity. boolean isSwipeUp = endVelocity < 0; - boolean willGoToNewTask = - canGoToNewTask && Math.abs(velocity.x) > Math.abs(endVelocity); + boolean willGoToNewTaskOnSwipeUp = + goingToNewTask && Math.abs(velocity.x) > Math.abs(endVelocity); - if (mDeviceState.isFullyGesturalNavMode() && isSwipeUp) { - endTarget = willGoToNewTask ? NEW_TASK : HOME; + if (mDeviceState.isFullyGesturalNavMode() && isSwipeUp && !willGoToNewTaskOnSwipeUp) { + endTarget = HOME; + } else if (mDeviceState.isFullyGesturalNavMode() && isSwipeUp) { + // If swiping at a diagonal, base end target on the faster velocity. + endTarget = NEW_TASK; } else if (isSwipeUp) { - endTarget = (!reachedOverviewThreshold && willGoToNewTask) ? NEW_TASK : RECENTS; + endTarget = !reachedOverviewThreshold && willGoToNewTaskOnSwipeUp + ? NEW_TASK : RECENTS; } else { - endTarget = willGoToNewTask ? NEW_TASK : LAST_TASK; // Swipe is downward. + endTarget = goingToNewTask ? NEW_TASK : LAST_TASK; } } @@ -1141,8 +1145,6 @@ public abstract class AbsSwipeUpHandler, duration = Math.max(duration, mRecentsView.getScroller().getDuration()); } } - } else if (endTarget == LAST_TASK && mRecentsView != null) { - mRecentsView.snapToPage(mRecentsView.getCurrentPage(), Math.toIntExact(duration)); } // Let RecentsView handle the scrolling to the task, which we launch in startNewTask()