summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTony Wickham <twickham@google.com>2019-05-30 15:54:07 -0700
committerTony Wickham <twickham@google.com>2019-05-30 17:38:46 -0700
commit1689d65ac3286fa7830b7689eb93c3b8a801d252 (patch)
tree40a698948c985962e26d19fd1cf4379229f5cd98
parent1d7b2a0672edb497b2fd2784cebd04393428713c (diff)
downloadandroid_packages_apps_Trebuchet-1689d65ac3286fa7830b7689eb93c3b8a801d252.tar.gz
android_packages_apps_Trebuchet-1689d65ac3286fa7830b7689eb93c3b8a801d252.tar.bz2
android_packages_apps_Trebuchet-1689d65ac3286fa7830b7689eb93c3b8a801d252.zip
If y velocity > x velocity in 2-button mode, go to recents
Also, when landing in recents, snap to the nearest page so that swipe up consitently goes to task 0 instead of sometimes scrolling to task 1. Bug: 133518678 Change-Id: I63a161a9f1f87266d3c3fc71c98cd5fc5e2f8874
-rw-r--r--quickstep/recents_ui_overrides/src/com/android/quickstep/WindowTransformSwipeHandler.java19
1 files changed, 14 insertions, 5 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 0d0478ae0..51e5e22a3 100644
--- a/quickstep/recents_ui_overrides/src/com/android/quickstep/WindowTransformSwipeHandler.java
+++ b/quickstep/recents_ui_overrides/src/com/android/quickstep/WindowTransformSwipeHandler.java
@@ -106,7 +106,6 @@ import com.android.quickstep.views.TaskView;
import com.android.systemui.shared.recents.model.ThumbnailData;
import com.android.systemui.shared.system.InputConsumerController;
import com.android.systemui.shared.system.LatencyTrackerCompat;
-import com.android.systemui.shared.system.QuickStepContract;
import com.android.systemui.shared.system.RemoteAnimationTargetCompat;
import com.android.systemui.shared.system.SyncRtSurfaceTransactionApplierCompat;
import com.android.systemui.shared.system.WindowCallbacksCompat;
@@ -902,10 +901,14 @@ public class WindowTransformSwipeHandler<T extends BaseDraggingActivity>
// 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 && (!goingToNewTask || reachedOverviewThreshold)) {
- // If user scrolled to a new task, only go to recents if they already passed
- // the overview threshold. Otherwise, we'll snap to the new task and launch it.
- endTarget = RECENTS;
+ } 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;
+ }
} else {
endTarget = goingToNewTask ? NEW_TASK : LAST_TASK;
}
@@ -976,6 +979,12 @@ public class WindowTransformSwipeHandler<T extends BaseDraggingActivity>
} else if (endTarget == RECENTS) {
mLiveTileOverlay.startIconAnimation();
if (mRecentsView != null) {
+ int nearestPage = mRecentsView.getPageNearestToCenterOfScreen();
+ if (mRecentsView.getNextPage() != nearestPage) {
+ // We shouldn't really scroll to the next page when swiping up to recents.
+ // Only allow settling on the next page if it's nearest to the center.
+ mRecentsView.snapToPage(nearestPage, Math.toIntExact(duration));
+ }
if (mRecentsView.getScroller().getDuration() > MAX_SWIPE_DURATION) {
mRecentsView.snapToPage(mRecentsView.getNextPage(), (int) MAX_SWIPE_DURATION);
}