Merge "Force Grid-based Recents to show at most 8 tasks." into nyc-mr2-dev
This commit is contained in:
committed by
Android (Google) Code Review
commit
b100a9ac58
@@ -37,6 +37,7 @@ import com.android.systemui.recents.RecentsConfiguration;
|
|||||||
import com.android.systemui.recents.RecentsDebugFlags;
|
import com.android.systemui.recents.RecentsDebugFlags;
|
||||||
import com.android.systemui.recents.misc.SystemServicesProxy;
|
import com.android.systemui.recents.misc.SystemServicesProxy;
|
||||||
|
|
||||||
|
import com.android.systemui.recents.views.grid.TaskGridLayoutAlgorithm;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Collections;
|
import java.util.Collections;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
@@ -148,11 +149,19 @@ public class RecentsTaskLoadPlan {
|
|||||||
Task.TaskKey taskKey = new Task.TaskKey(t.persistentId, t.stackId, t.baseIntent,
|
Task.TaskKey taskKey = new Task.TaskKey(t.persistentId, t.stackId, t.baseIntent,
|
||||||
t.userId, t.firstActiveTime, t.lastActiveTime);
|
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.
|
// number of tasks constraints. Freeform tasks are also always shown.
|
||||||
boolean isFreeformTask = SystemServicesProxy.isFreeformStack(t.stackId);
|
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));
|
(t.lastActiveTime >= lastStackActiveTime && i >= (taskCount - MIN_NUM_TASKS));
|
||||||
|
}
|
||||||
boolean isLaunchTarget = taskKey.id == runningTaskId;
|
boolean isLaunchTarget = taskKey.id == runningTaskId;
|
||||||
|
|
||||||
// The last stack active time is the baseline for which we show visible tasks. Since
|
// The last stack active time is the baseline for which we show visible tasks. Since
|
||||||
|
|||||||
@@ -30,7 +30,7 @@ import com.android.systemui.recents.views.TaskViewTransform;
|
|||||||
public class TaskGridLayoutAlgorithm {
|
public class TaskGridLayoutAlgorithm {
|
||||||
|
|
||||||
private final String TAG = "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. */
|
/** The horizontal padding around the whole recents view. */
|
||||||
private int mPaddingLeftRight;
|
private int mPaddingLeftRight;
|
||||||
@@ -135,6 +135,16 @@ public class TaskGridLayoutAlgorithm {
|
|||||||
updateAppAspectRatio();
|
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,
|
public TaskViewTransform getTransform(int taskIndex, int taskCount,
|
||||||
TaskViewTransform transformOut, TaskStackLayoutAlgorithm stackLayout) {
|
TaskViewTransform transformOut, TaskStackLayoutAlgorithm stackLayout) {
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user