Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit f8477b02 authored by Treehugger Robot's avatar Treehugger Robot Committed by Android (Google) Code Review
Browse files

Merge "Add task limit flags to the Dev Options." into main

parents 937b6dc7 4a811f02
Loading
Loading
Loading
Loading
+2 −1
Original line number Diff line number Diff line
@@ -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.
+2 −2
Original line number Diff line number Diff line
@@ -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();
        }
+9 −10
Original line number Diff line number Diff line
@@ -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,