From 4a08ce60dc0873cbdf71149536528444953b0bb0 Mon Sep 17 00:00:00 2001 From: Thales Lima Date: Tue, 3 Aug 2021 11:56:51 +0100 Subject: [PATCH] overview: rebalance hidden tasks in grid The tasks that are not showing in the screen will be rearranged. This doesn't change anything for tasks before the dismissed task because the grid is already balanced there. Fixes: 194189955 Test: manual with 10 tasks, normal and RTL mode Change-Id: I07ddbb752110339751bd1ed6056fe9f645b5497f --- .../android/quickstep/views/RecentsView.java | 124 +++++++++++++++++- 1 file changed, 117 insertions(+), 7 deletions(-) diff --git a/quickstep/src/com/android/quickstep/views/RecentsView.java b/quickstep/src/com/android/quickstep/views/RecentsView.java index b077ca6741..224220693f 100644 --- a/quickstep/src/com/android/quickstep/views/RecentsView.java +++ b/quickstep/src/com/android/quickstep/views/RecentsView.java @@ -123,6 +123,7 @@ import com.android.launcher3.statemanager.StatefulActivity; import com.android.launcher3.touch.OverScroll; import com.android.launcher3.touch.PagedOrientationHandler; import com.android.launcher3.util.DynamicResource; +import com.android.launcher3.util.IntArray; import com.android.launcher3.util.IntSet; import com.android.launcher3.util.MultiValueAlpha; import com.android.launcher3.util.ResourceBasedOverride.Overrides; @@ -2054,23 +2055,39 @@ public abstract class RecentsView startRebalanceAfter) { + mTopRowIdSet.remove(taskViewId); + isTopRow = topRowWidth <= bottomRowWidth; + } else { + isTopRow = mTopRowIdSet.contains(taskViewId); + } + } else { + isTopRow = topRowWidth <= bottomRowWidth; + } + if (isTopRow) { if (homeTaskView != null && nextFocusedTaskView == null) { // TaskView will be focused when swipe up, don't count towards row width. @@ -2644,9 +2673,44 @@ public abstract class RecentsView= screenEnd - mPageSpacing; + } + + if (shouldRebalance) { + updateGridProperties(/*isTaskDismissal=*/ true, + highestVisibleTaskIndex); + updateScrollSynchronously(); + } + } + setCurrentPage(pageToSnapTo); dispatchScrollChanged(); } @@ -2658,6 +2722,52 @@ public abstract class RecentsView ActivityManagerWrapper.getInstance().removeTask(dismissedTaskId),