From e8a805c3f68a50b1b0db662484b23f3933703144 Mon Sep 17 00:00:00 2001 From: Vinit Nayak Date: Mon, 27 Jun 2022 11:49:08 -0700 Subject: [PATCH] Hide split option if task is not dockable * Also hide if activity is currently in multi-window to keep logic parity Fixes: 236689017 Test: Unable to initiate split with Camera app Change-Id: Ib7e3043cbc7d4e2ef5da51779de36969ae7e6fef --- .../quickstep/TaskShortcutFactory.java | 20 ++++++++++++++----- 1 file changed, 15 insertions(+), 5 deletions(-) diff --git a/quickstep/src/com/android/quickstep/TaskShortcutFactory.java b/quickstep/src/com/android/quickstep/TaskShortcutFactory.java index 749c07bd05..092854f98c 100644 --- a/quickstep/src/com/android/quickstep/TaskShortcutFactory.java +++ b/quickstep/src/com/android/quickstep/TaskShortcutFactory.java @@ -261,6 +261,8 @@ public interface TaskShortcutFactory { * 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 + * * Split isn't supported by the task itself (non resizable activity) + * * We aren't currently in multi-window * * 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 button so * we don't need this menu option) @@ -270,9 +272,12 @@ public interface TaskShortcutFactory { public List getShortcuts(BaseDraggingActivity activity, TaskIdAttributeContainer taskContainer) { DeviceProfile deviceProfile = activity.getDeviceProfile(); - TaskView taskView = taskContainer.getTaskView(); - RecentsView recentsView = taskView.getRecentsView(); - PagedOrientationHandler orientationHandler = recentsView.getPagedOrientationHandler(); + final Task task = taskContainer.getTask(); + final TaskView taskView = taskContainer.getTaskView(); + final RecentsView recentsView = taskView.getRecentsView(); + final PagedOrientationHandler orientationHandler = + recentsView.getPagedOrientationHandler(); + int[] taskViewTaskIds = taskView.getTaskIds(); boolean taskViewHasMultipleTasks = taskViewTaskIds[0] != -1 && taskViewTaskIds[1] != -1; @@ -280,9 +285,14 @@ public interface TaskShortcutFactory { boolean isFocusedTask = deviceProfile.isTablet && taskView.isFocusedTask(); boolean isTaskInExpectedScrollPosition = recentsView.isTaskInExpectedScrollPosition(recentsView.indexOfChild(taskView)); + boolean isTaskSplitNotSupported = !task.isDockable; + boolean hideForExistingMultiWindow = activity.getDeviceProfile().isMultiWindowMode; - if (taskViewHasMultipleTasks || notEnoughTasksToSplit - || (isFocusedTask && isTaskInExpectedScrollPosition)) { + if (taskViewHasMultipleTasks || + notEnoughTasksToSplit || + isTaskSplitNotSupported || + hideForExistingMultiWindow || + (isFocusedTask && isTaskInExpectedScrollPosition)) { return null; }