Force Grid-based Recents to show at most 8 tasks.

am: 883887eac9

Change-Id: I3960939f61acd8834101767481e5cafa7d9aac23
This commit is contained in:
Jiaquan He
2017-01-09 18:03:34 +00:00
committed by android-build-merger
2 changed files with 22 additions and 3 deletions

View File

@@ -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

View File

@@ -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) {