From b39a166018f1e4495ba5071bcd5cdb9eba951b47 Mon Sep 17 00:00:00 2001 From: Sunny Goyal Date: Fri, 9 Aug 2019 16:17:37 -0700 Subject: Always go to home in case of fling-up Bug: 138881088 Change-Id: I86bf4c7a495805d5912b102470e72a51e843a222 (cherry picked from commit a2cfc2d95e1ae5d8b44e3f63a620d7a819bc826c) (cherry picked from commit 64155533b694ef3b4f45e3365270ca99ec369200) --- .../quickstep/WindowTransformSwipeHandler.java | 23 +++++++++++----------- 1 file changed, 12 insertions(+), 11 deletions(-) diff --git a/quickstep/recents_ui_overrides/src/com/android/quickstep/WindowTransformSwipeHandler.java b/quickstep/recents_ui_overrides/src/com/android/quickstep/WindowTransformSwipeHandler.java index 476bb8f93..f790c4027 100644 --- a/quickstep/recents_ui_overrides/src/com/android/quickstep/WindowTransformSwipeHandler.java +++ b/quickstep/recents_ui_overrides/src/com/android/quickstep/WindowTransformSwipeHandler.java @@ -926,18 +926,19 @@ public class WindowTransformSwipeHandler : LAST_TASK; } } else { - if (mMode == Mode.NO_BUTTON && endVelocity < 0 && !mIsShelfPeeking) { + // If swiping at a diagonal, base end target on the faster velocity. + boolean isSwipeUp = endVelocity < 0; + boolean willGoToNewTaskOnSwipeUp = + goingToNewTask && Math.abs(velocity.x) > Math.abs(endVelocity); + + if (mMode == Mode.NO_BUTTON && isSwipeUp && !willGoToNewTaskOnSwipeUp) { + endTarget = HOME; + } else if (mMode == Mode.NO_BUTTON && isSwipeUp && !mIsShelfPeeking) { // If swiping at a diagonal, base end target on the faster velocity. - endTarget = goingToNewTask && Math.abs(velocity.x) > Math.abs(endVelocity) - ? NEW_TASK : HOME; - } else if (endVelocity < 0) { - if (reachedOverviewThreshold) { - endTarget = RECENTS; - } else { - // If swiping at a diagonal, base end target on the faster velocity. - endTarget = goingToNewTask && Math.abs(velocity.x) > Math.abs(endVelocity) - ? NEW_TASK : RECENTS; - } + endTarget = NEW_TASK; + } else if (isSwipeUp) { + endTarget = !reachedOverviewThreshold && willGoToNewTaskOnSwipeUp + ? NEW_TASK : RECENTS; } else { endTarget = goingToNewTask ? NEW_TASK : LAST_TASK; } -- cgit v1.2.3