Fix RecentsView crash when DesktopTask has only 1 task and it is in split mode

This CL fixes a crash happening when no other task is available in Desktop Windowing (DW), and the only task in DW is selected to be part of the pair (split mode). The crash is happening because of the following logic:

- applyLoadPlan skips the staged tasks (for split) from the groupTask when adding the TaskViews to RecentsView.
- If a groupTask has multiple tasks, and one of the tasks is staged, groupTask will be treated as a single task and applyLoadPlan uses the other task (not staged) to create a single TaskView in Overview.
- DesktopTasks returns true for hasMultipleTasks, even when only 1 task is in DW mode. This causes a crash when the only task available in DW is staged for split.

This fix will skip DesktopTaskView creation when split selection is active. In addition, it updates DesktopTask to report multiple tasks only when more than 1 task is its task list.

Fix: 372357270
Fix: 372375086
Fix: 372864249
Flag: EXEMPT bugfix
Test: Manual. Instructions on bug report.
Change-Id: I95e32252a5cac4f6b99296422703d69d129a5a47
This commit is contained in:
Jordan Silva committed 2024-10-16 17:34:08 +01:00
1 parent 9777937d41
commit f4a21b7e5c
5 files changed
+24 -9

No files matched your search

@@ -65,8 +65,8 @@ import com.android.launcher3.util.LauncherBindableItemsContainer;
import com.android.launcher3.util.Themes;
import com.android.launcher3.views.ActivityContext;
import com.android.launcher3.views.IconButtonView;
import com.android.quickstep.util.DesktopTask;
import com.android.quickstep.util.GroupTask;
import com.android.quickstep.views.TaskViewType;
import com.android.systemui.shared.recents.model.Task;
import com.android.wm.shell.shared.bubbles.BubbleBarLocation;
@@ -453,8 +453,8 @@ public class TaskbarView extends FrameLayout implements FolderIcon.FolderIconPar
// Replace any Recent views with the appropriate type if it's not already that type.
final int expectedLayoutResId;
boolean isCollection = false;
if (task.hasMultipleTasks()) {
if (task instanceof DesktopTask) {
if (task.supportsMultipleTasks()) {
if (task.taskViewType == TaskViewType.DESKTOP) {
// TODO(b/316004172): use Desktop tile layout.
expectedLayoutResId = -1;
} else {