From 244bac6c8bb8c7ef621786b42cf26dafaa417829 Mon Sep 17 00:00:00 2001 From: Jiaquan He Date: Tue, 17 Jan 2017 13:25:33 -0800 Subject: [PATCH] 2D Recents: Fix issue with undocking only one task While there's only one task and we undock it, it's not in the Recents task list. In this change, we just reset the transform and return it. Test: Checked that Recents works properly while docking and undocking a task and it's the only task running. Bug: 32101881 Change-Id: I1207b546ff2864018c8d9bf2520f4690762b2d27 --- .../systemui/recents/views/grid/TaskGridLayoutAlgorithm.java | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) 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 5d969f9e1b48..ffcd09d93204 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 @@ -147,6 +147,10 @@ public class TaskGridLayoutAlgorithm { */ public TaskViewTransform getTransform(int taskIndex, int taskCount, TaskViewTransform transformOut, TaskStackLayoutAlgorithm stackLayout) { + if (taskCount == 0) { + transformOut.reset(); + return transformOut; + } TaskGridRectInfo gridInfo = mTaskGridRectInfoList[taskCount - 1]; mTaskGridRect.set(gridInfo.size); @@ -162,7 +166,7 @@ public class TaskGridLayoutAlgorithm { // We also need to invert the index in order to display the most recent tasks first. int taskLayoutIndex = taskCount - taskIndex - 1; - boolean isTaskViewVisible = (taskLayoutIndex < MAX_LAYOUT_TASK_COUNT); + boolean isTaskViewVisible = taskLayoutIndex < MAX_LAYOUT_TASK_COUNT; // Fill out the transform transformOut.scale = 1f; -- 2.11.0