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

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

Merge "Force Grid-based Recents to show at most 8 tasks." into nyc-mr2-dev

parents b0181b63 883887ea
Loading
Loading
Loading
Loading
+11 −2
Original line number Diff line number Diff line
@@ -37,6 +37,7 @@ import com.android.systemui.recents.RecentsConfiguration;
import com.android.systemui.recents.RecentsDebugFlags;
import com.android.systemui.recents.misc.SystemServicesProxy;

import com.android.systemui.recents.views.grid.TaskGridLayoutAlgorithm;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
@@ -148,11 +149,19 @@ public class RecentsTaskLoadPlan {
            Task.TaskKey taskKey = new Task.TaskKey(t.persistentId, t.stackId, t.baseIntent,
                    t.userId, t.firstActiveTime, t.lastActiveTime);

            // This task is only shown in the stack if it statisfies the historical time or min
            // This task is only shown in the stack if it satisfies the historical time or min
            // number of tasks constraints. Freeform tasks are also always shown.
            boolean isFreeformTask = SystemServicesProxy.isFreeformStack(t.stackId);
            boolean isStackTask = isFreeformTask || !isHistoricalTask(t) ||
            boolean isStackTask;
            if (Recents.getConfiguration().isGridEnabled) {
                // When grid layout is enabled, we only show the first
                // TaskGridLayoutAlgorithm.MAX_LAYOUT_TASK_COUNT} tasks.
                isStackTask = t.lastActiveTime >= lastStackActiveTime &&
                    i >= taskCount - TaskGridLayoutAlgorithm.MAX_LAYOUT_TASK_COUNT;
            } else {
                isStackTask = isFreeformTask || !isHistoricalTask(t) ||
                    (t.lastActiveTime >= lastStackActiveTime && i >= (taskCount - MIN_NUM_TASKS));
            }
            boolean isLaunchTarget = taskKey.id == runningTaskId;

            // The last stack active time is the baseline for which we show visible tasks.  Since
+11 −1
Original line number Diff line number Diff line
@@ -30,7 +30,7 @@ import com.android.systemui.recents.views.TaskViewTransform;
public class TaskGridLayoutAlgorithm  {

    private final String TAG = "TaskGridLayoutAlgorithm";
    private final int MAX_LAYOUT_TASK_COUNT = 8;
    public static final int MAX_LAYOUT_TASK_COUNT = 8;

    /** The horizontal padding around the whole recents view. */
    private int mPaddingLeftRight;
@@ -135,6 +135,16 @@ public class TaskGridLayoutAlgorithm {
        updateAppAspectRatio();
    }

    /**
     * Returns the proper task view transform of a certain task view, according to its index and the
     * amount of task views.
     * @param taskIndex     The index of the task view whose transform we want. It's never greater
     *                      than {@link MAX_LAYOUT_TASK_COUNT}.
     * @param taskCount     The current amount of task views.
     * @param transformOut  The result transform that this method returns.
     * @param stackLayout   The base stack layout algorithm.
     * @return  The expected transform of the (taskIndex)th task view.
     */
    public TaskViewTransform getTransform(int taskIndex, int taskCount,
        TaskViewTransform transformOut, TaskStackLayoutAlgorithm stackLayout) {