From 94fb4cd3fd561aa08ab1d0970687981387d7512a Mon Sep 17 00:00:00 2001 From: Tony Wickham Date: Wed, 20 Nov 2019 13:08:44 -0800 Subject: [PATCH] Fix quick switch from home biased towards returning home When flinging up and to the right, we previously always returned home. Now, if the right velocity is stronger, we quick switch. Bug: 126596417 Change-Id: I14fa0584399bb90f2e07e0b296fc5932d8224fbf --- .../NoButtonQuickSwitchTouchController.java | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) diff --git a/quickstep/recents_ui_overrides/src/com/android/launcher3/uioverrides/touchcontrollers/NoButtonQuickSwitchTouchController.java b/quickstep/recents_ui_overrides/src/com/android/launcher3/uioverrides/touchcontrollers/NoButtonQuickSwitchTouchController.java index 7ffffeda10..7dec014f91 100644 --- a/quickstep/recents_ui_overrides/src/com/android/launcher3/uioverrides/touchcontrollers/NoButtonQuickSwitchTouchController.java +++ b/quickstep/recents_ui_overrides/src/com/android/launcher3/uioverrides/touchcontrollers/NoButtonQuickSwitchTouchController.java @@ -342,9 +342,20 @@ public class NoButtonQuickSwitchTouchController implements TouchController, final LauncherState targetState; if (horizontalFling && verticalFling) { - // Flinging left and up, left and down, or right and up all go back home. - // Only flinging right and down goes to quick switch. - targetState = velocity.x < 0 || velocity.y < 0 ? NORMAL : QUICK_SWITCH; + if (velocity.x < 0) { + // Flinging left and up or down both go back home. + targetState = NORMAL; + } else { + if (velocity.y > 0) { + // Flinging right and down goes to quick switch. + targetState = QUICK_SWITCH; + } else { + // Flinging up and right could go either home or to quick switch. + // Determine the target based on the higher velocity. + targetState = Math.abs(velocity.x) > Math.abs(velocity.y) + ? QUICK_SWITCH : NORMAL; + } + } } else if (horizontalFling) { targetState = velocity.x > 0 ? QUICK_SWITCH : NORMAL; } else if (verticalFling) {