Clean-up unnecessary desktop windowing flag usage

- mDesktopVisibilityController will now be null if desktop windowing flag is disabled
- As a result, all code that uses mDesktopVisibilityController no longer need to check desktop windowing flag
- DesktopTaskView/DesktopTask only populates when flag is enabled, so we don't need to check flag if we already check DesktopTaskView/DesktopTask
- Removed the flag check in SplitToWorkspaceController, as we shouldn't enable split from workspace base on desktop windowing, contextual split already have its own flag
- Also avoid creating GroupTask or DesktopTask for freeform tasks when flag is off, to avoid a crash in RecentsView

Bug: 332655617
Test: manual with desktop windowing flag on/off
Flag: ACONFIG com.android.window.flags.enable_desktop_windowing_mode DEVELOPMENT
Change-Id: I0e45f73ad2b0d99dfb4ec3215f973679ca93957c
This commit is contained in:
Alex Chau
2024-04-02 17:07:03 +01:00
parent 75e48fc0ec
commit 13b7ceeff0
15 changed files with 67 additions and 120 deletions
@@ -15,8 +15,6 @@
*/
package com.android.launcher3.taskbar;
import static com.android.window.flags.Flags.enableDesktopWindowingMode;
import android.content.ComponentName;
import android.content.pm.ActivityInfo;
@@ -117,9 +115,7 @@ public final class KeyboardQuickSwitchController implements
DesktopVisibilityController desktopController =
LauncherActivityInterface.INSTANCE.getDesktopVisibilityController();
final boolean onDesktop =
enableDesktopWindowingMode()
&& desktopController != null
&& desktopController.areFreeformTasksVisible();
desktopController != null && desktopController.areFreeformTasksVisible();
if (mModel.isTaskListValid(mTaskListChangeId)) {
// When we are opening the KQS with no focus override, check if the first task is
@@ -158,14 +154,12 @@ public final class KeyboardQuickSwitchController implements
// Hide all desktop tasks and show them on the hidden tile
int hiddenDesktopTasks = 0;
if (enableDesktopWindowingMode()) {
DesktopTask desktopTask = findDesktopTask(tasks);
if (desktopTask != null) {
hiddenDesktopTasks = desktopTask.tasks.size();
tasks = tasks.stream()
.filter(t -> !(t instanceof DesktopTask))
.collect(Collectors.toCollection(ArrayList<GroupTask>::new));
}
DesktopTask desktopTask = findDesktopTask(tasks);
if (desktopTask != null) {
hiddenDesktopTasks = desktopTask.tasks.size();
tasks = tasks.stream()
.filter(t -> !(t instanceof DesktopTask))
.collect(Collectors.toCollection(ArrayList<GroupTask>::new));
}
mTasks = tasks.stream()
.limit(MAX_TASKS)