diff options
| author | 2024-07-29 09:32:49 +0100 | |
|---|---|---|
| committer | 2024-07-29 09:49:29 +0100 | |
| commit | 4a811f0274262e86ce43f6fb536414bc5bb7f0dc (patch) | |
| tree | 587ec4aab82ecccdb4cae25e159ab8bac07c37dd | |
| parent | cf7ea37140d913bd003d25645b880ab5423d3130 (diff) | |
Add task limit flags to the Dev Options.
Update the call sites for enableDesktopWindowingTaskLimit and add the
new-style flag in dev options.
Also correct a few comments in the DesktopTasksLimiter class.
Fix: 356069386
Test: Build and check that enabled dev option enable task limit
Flag: EXEMPT (updating how the flags are called)
Change-Id: Id7633120b5da16b9d5be26c99fbd3c54599d0928
3 files changed, 13 insertions, 13 deletions
diff --git a/libs/WindowManager/Shell/shared/src/com/android/wm/shell/shared/desktopmode/DesktopModeFlags.kt b/libs/WindowManager/Shell/shared/src/com/android/wm/shell/shared/desktopmode/DesktopModeFlags.kt index 2b01eac3c210..13049694d3fb 100644 --- a/libs/WindowManager/Shell/shared/src/com/android/wm/shell/shared/desktopmode/DesktopModeFlags.kt +++ b/libs/WindowManager/Shell/shared/src/com/android/wm/shell/shared/desktopmode/DesktopModeFlags.kt @@ -43,7 +43,8 @@ enum class DesktopModeFlags( APP_HEADER_WITH_TASK_DENSITY(Flags::enableAppHeaderWithTaskDensity, true), TASK_STACK_OBSERVER_IN_SHELL(Flags::enableTaskStackObserverInShell, true), SIZE_CONSTRAINTS(Flags::enableDesktopWindowingSizeConstraints, true), - DYNAMIC_INITIAL_BOUNDS(Flags::enableWindowingDynamicInitialBounds, true); + DYNAMIC_INITIAL_BOUNDS(Flags::enableWindowingDynamicInitialBounds, true), + ENABLE_DESKTOP_WINDOWING_TASK_LIMIT(Flags::enableDesktopWindowingTaskLimit, true); /** * Determines state of flag based on the actual flag and desktop mode developer option overrides. diff --git a/libs/WindowManager/Shell/src/com/android/wm/shell/dagger/WMShellModule.java b/libs/WindowManager/Shell/src/com/android/wm/shell/dagger/WMShellModule.java index 35d387632f03..02625076a7c8 100644 --- a/libs/WindowManager/Shell/src/com/android/wm/shell/dagger/WMShellModule.java +++ b/libs/WindowManager/Shell/src/com/android/wm/shell/dagger/WMShellModule.java @@ -16,7 +16,7 @@ package com.android.wm.shell.dagger; -import static com.android.wm.shell.shared.desktopmode.DesktopModeFlags.DESKTOP_WINDOWING_MODE; +import static com.android.wm.shell.shared.desktopmode.DesktopModeFlags.ENABLE_DESKTOP_WINDOWING_TASK_LIMIT; import android.annotation.Nullable; import android.app.KeyguardManager; @@ -569,7 +569,7 @@ public abstract class WMShellModule { ShellTaskOrganizer shellTaskOrganizer) { int maxTaskLimit = DesktopModeStatus.getMaxTaskLimit(context); if (!DesktopModeStatus.canEnterDesktopMode(context) - || !DESKTOP_WINDOWING_MODE.isEnabled(context) + || !ENABLE_DESKTOP_WINDOWING_TASK_LIMIT.isEnabled(context) || maxTaskLimit <= 0) { return Optional.empty(); } diff --git a/libs/WindowManager/Shell/src/com/android/wm/shell/desktopmode/DesktopTasksLimiter.kt b/libs/WindowManager/Shell/src/com/android/wm/shell/desktopmode/DesktopTasksLimiter.kt index a011ff5636d2..87d1800265f1 100644 --- a/libs/WindowManager/Shell/src/com/android/wm/shell/desktopmode/DesktopTasksLimiter.kt +++ b/libs/WindowManager/Shell/src/com/android/wm/shell/desktopmode/DesktopTasksLimiter.kt @@ -33,7 +33,8 @@ import com.android.wm.shell.transition.Transitions.TransitionObserver * Limits the number of tasks shown in Desktop Mode. * * This class should only be used if - * [com.android.window.flags.Flags.enableDesktopWindowingTaskLimit()] is true. + * [com.android.wm.shell.shared.desktopmode.DesktopModeFlags.ENABLE_DESKTOP_WINDOWING_TASK_LIMIT] + * is enabled and [maxTasksLimit] is strictly greater than 0. */ class DesktopTasksLimiter ( transitions: Transitions, @@ -86,10 +87,10 @@ class DesktopTasksLimiter ( } /** - * Returns whether the given Task is being reordered to the back in the given transition, or - * is already invisible. + * Returns whether the Task [taskDetails] is being reordered to the back in the transition + * [info], or is already invisible. * - * <p> This check can be used to double-check that a task was indeed minimized before + * This check can be used to double-check that a task was indeed minimized before * marking it as such. */ private fun isTaskReorderedToBackOrInvisible( @@ -149,8 +150,8 @@ class DesktopTasksLimiter ( } /** - * Mark a task as minimized, this should only be done after the corresponding transition has - * finished so we don't minimize the task if the transition fails. + * Mark [taskId], which must be on [displayId], as minimized, this should only be done after the + * corresponding transition has finished so we don't minimize the task if the transition fails. */ private fun markTaskMinimized(displayId: Int, taskId: Int) { ProtoLog.v( @@ -161,11 +162,9 @@ class DesktopTasksLimiter ( /** * Add a minimize-transition to [wct] if adding [newFrontTaskInfo] brings us over the task - * limit. + * limit, returning the task to minimize. * - * @param transition the transition that the minimize-transition will be appended to, or null if - * the transition will be started later. - * @return the ID of the minimized task, or null if no task is being minimized. + * The task must be on [displayId]. */ fun addAndGetMinimizeTaskChangesIfNeeded( displayId: Int, |