diff options
| -rw-r--r-- | packages/SystemUI/src/com/android/systemui/recents/model/RecentsTaskLoadPlan.java | 13 | ||||
| -rw-r--r-- | packages/SystemUI/src/com/android/systemui/recents/views/grid/TaskGridLayoutAlgorithm.java | 12 |
2 files changed, 22 insertions, 3 deletions
diff --git a/packages/SystemUI/src/com/android/systemui/recents/model/RecentsTaskLoadPlan.java b/packages/SystemUI/src/com/android/systemui/recents/model/RecentsTaskLoadPlan.java index 9b48e4d02623..1f082cce54c1 100644 --- a/packages/SystemUI/src/com/android/systemui/recents/model/RecentsTaskLoadPlan.java +++ b/packages/SystemUI/src/com/android/systemui/recents/model/RecentsTaskLoadPlan.java @@ -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 diff --git a/packages/SystemUI/src/com/android/systemui/recents/views/grid/TaskGridLayoutAlgorithm.java b/packages/SystemUI/src/com/android/systemui/recents/views/grid/TaskGridLayoutAlgorithm.java index be3af040c748..046ced4aa57f 100644 --- a/packages/SystemUI/src/com/android/systemui/recents/views/grid/TaskGridLayoutAlgorithm.java +++ b/packages/SystemUI/src/com/android/systemui/recents/views/grid/TaskGridLayoutAlgorithm.java @@ -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) { |