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 796caa0961..7f085b7d24 100644 --- a/quickstep/src/com/android/quickstep/views/RecentsView.java +++ b/quickstep/src/com/android/quickstep/views/RecentsView.java @@ -1056,11 +1056,11 @@ public abstract class RecentsView