Ignore minimized Desktop apps in Overview.

For each desktop session, Overview shows a single tile with multiple
desktop tasks. With this CL avoid showing minimized tasks in that tile.

Bug: 333013317
Flag: com.android.window.flags.enable_desktop_windowing_mode
Test: manual: ensured minimized desktop tasks are not shown in Overview

Change-Id: I48cb6826849abf225c0fe4448ca7b0b13afea44e
This commit is contained in:
Gustav Sennton
2024-06-26 08:53:15 +00:00
parent c1391754ff
commit d06e8dc8a3
3 changed files with 72 additions and 4 deletions
@@ -44,6 +44,7 @@ import com.android.wm.shell.util.GroupedRecentTaskInfo;
import java.io.PrintWriter;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.List;
import java.util.function.Consumer;
@@ -324,7 +325,9 @@ public class RecentTasksList {
// leftover TYPE_FREEFORM tasks created when flag was on should be ignored.
if (enableDesktopWindowingMode()) {
GroupTask desktopTask = createDesktopTask(rawTask);
allTasks.add(desktopTask);
if (desktopTask != null) {
allTasks.add(desktopTask);
}
}
continue;
}
@@ -368,8 +371,13 @@ public class RecentTasksList {
return allTasks;
}
private DesktopTask createDesktopTask(GroupedRecentTaskInfo recentTaskInfo) {
private @Nullable DesktopTask createDesktopTask(GroupedRecentTaskInfo recentTaskInfo) {
ArrayList<Task> tasks = new ArrayList<>(recentTaskInfo.getTaskInfoList().size());
int[] minimizedTaskIds = recentTaskInfo.getMinimizedTaskIds();
if (minimizedTaskIds.length == recentTaskInfo.getTaskInfoList().size()) {
// All Tasks are minimized -> don't create a DesktopTask
return null;
}
for (ActivityManager.RecentTaskInfo taskInfo : recentTaskInfo.getTaskInfoList()) {
Task.TaskKey key = new Task.TaskKey(taskInfo);
Task task = Task.from(key, taskInfo, false);
@@ -377,6 +385,8 @@ public class RecentTasksList {
task.positionInParent = taskInfo.positionInParent;
task.appBounds = taskInfo.configuration.windowConfiguration.getAppBounds();
task.isVisible = taskInfo.isVisible;
task.isMinimized =
Arrays.stream(minimizedTaskIds).anyMatch(taskId -> taskId == taskInfo.taskId);
tasks.add(task);
}
return new DesktopTask(tasks);
@@ -1826,8 +1826,13 @@ public abstract class RecentsView<CONTAINER_TYPE extends Context & RecentsViewCo
((GroupedTaskView) taskView).bind(leftTopTask, rightBottomTask, mOrientationState,
mTaskOverlayFactory, groupTask.mSplitBounds);
} else if (taskView instanceof DesktopTaskView) {
((DesktopTaskView) taskView).bind(((DesktopTask) groupTask).tasks,
mOrientationState, mTaskOverlayFactory);
// Minimized tasks should not be shown in Overview
List<Task> nonMinimizedTasks =
((DesktopTask) groupTask).tasks.stream()
.filter(task -> !task.isMinimized)
.toList();
((DesktopTaskView) taskView).bind(nonMinimizedTasks, mOrientationState,
mTaskOverlayFactory);
mDesktopTaskView = (DesktopTaskView) taskView;
} else {
Task task = groupTask.task1.key.id == stagedTaskIdToBeRemoved ? groupTask.task2