From 95ee35826974336f8ccf1dfc89b71adb419e17d2 Mon Sep 17 00:00:00 2001 From: Vinit Nayak Date: Mon, 4 Oct 2021 12:41:34 -0700 Subject: [PATCH] Show split options when overview actions hidden for grid * We hide split option in task menu for focused task if the user hasn't scrolled at all in overview * We show option when user has scrolled because then the split option from overview actions will be hidden * Mostly uses the same logic as RecentsView#updateActionsViewFocusedScroll() Bug: 201380373 Test: Manual Change-Id: Ia8769a67cfbb2e4414cd4d8e816e62245fc4bd2c --- .../TaskViewTouchController.java | 2 +- .../android/quickstep/TaskOverlayFactory.java | 19 +++++++++++++++---- .../android/quickstep/views/RecentsView.java | 7 +++---- 3 files changed, 19 insertions(+), 9 deletions(-) diff --git a/quickstep/src/com/android/launcher3/uioverrides/touchcontrollers/TaskViewTouchController.java b/quickstep/src/com/android/launcher3/uioverrides/touchcontrollers/TaskViewTouchController.java index 37a1674635..308bca62e4 100644 --- a/quickstep/src/com/android/launcher3/uioverrides/touchcontrollers/TaskViewTouchController.java +++ b/quickstep/src/com/android/launcher3/uioverrides/touchcontrollers/TaskViewTouchController.java @@ -179,7 +179,7 @@ public abstract class TaskViewTouchController mAllowGoingDown = i == mRecentsView.getCurrentPage() && SysUINavigationMode.getMode(mActivity).hasGestures && (!mRecentsView.showAsGrid() || mTaskBeingDragged.isFocusedTask()) - && mRecentsView.isTaskSnapped(i); + && mRecentsView.isTaskInExpectedScrollPosition(i); directionsToDetectScroll = mAllowGoingDown ? DIRECTION_BOTH : upDirection; break; diff --git a/quickstep/src/com/android/quickstep/TaskOverlayFactory.java b/quickstep/src/com/android/quickstep/TaskOverlayFactory.java index 9ac00e845a..c45159e48e 100644 --- a/quickstep/src/com/android/quickstep/TaskOverlayFactory.java +++ b/quickstep/src/com/android/quickstep/TaskOverlayFactory.java @@ -111,19 +111,30 @@ public class TaskOverlayFactory implements ResourceBasedOverride { } + /** + * Does NOT add split options in the following scenarios: + * * The taskView to add split options is already showing split screen tasks + * * There aren't at least 2 tasks in overview to show split options for + * * The taskView to show split options for is the focused task AND we haven't started + * scrolling in overview (if we haven't scrolled, there's a split overview action so + * we don't need this menu option) + */ private static void addSplitOptions(List outShortcuts, BaseDraggingActivity activity, TaskView taskView, DeviceProfile deviceProfile) { + RecentsView recentsView = taskView.getRecentsView(); + PagedOrientationHandler orientationHandler = recentsView.getPagedOrientationHandler(); int[] taskViewTaskIds = taskView.getTaskIds(); boolean taskViewHasMultipleTasks = taskViewTaskIds[0] != -1 && taskViewTaskIds[1] != -1; - boolean notEnoughTasksToSplit = taskView.getRecentsView().getTaskViewCount() < 2; + boolean notEnoughTasksToSplit = recentsView.getTaskViewCount() < 2; + boolean isFocusedTask = deviceProfile.overviewShowAsGrid && taskView.isFocusedTask(); + boolean isTaskInExpectedScrollPosition = + recentsView.isTaskInExpectedScrollPosition(recentsView.indexOfChild(taskView)); if (taskViewHasMultipleTasks || notEnoughTasksToSplit || - (deviceProfile.overviewShowAsGrid && taskView.isFocusedTask())) { + (isFocusedTask && isTaskInExpectedScrollPosition)) { return; } - PagedOrientationHandler orientationHandler = - taskView.getRecentsView().getPagedOrientationHandler(); List positions = orientationHandler.getSplitPositionOptions(deviceProfile); for (SplitPositionOption option : positions) { diff --git a/quickstep/src/com/android/quickstep/views/RecentsView.java b/quickstep/src/com/android/quickstep/views/RecentsView.java index e1a389582f..c0e7fc25f3 100644 --- a/quickstep/src/com/android/quickstep/views/RecentsView.java +++ b/quickstep/src/com/android/quickstep/views/RecentsView.java @@ -1055,11 +1055,11 @@ public abstract class RecentsView