From d8f6e839b3810fc7ab548f89d6ec6b6061f81743 Mon Sep 17 00:00:00 2001 From: Alex Chau Date: Tue, 1 Apr 2025 16:25:28 +0100 Subject: [PATCH] Avoid removing ClearAllButton in split select animation - When ClearAllButton is removed, lastTaskScroll calculation (which is baserd on clearAllScroll) no longer works, and causes TaskView to snap to wrong position when there are < 5 tasks - Also avoid showing empty Recents when rotating in split select without any TaskViews Fix: 407462546 Test: manaul Flag: EXEMPT bug fix Change-Id: I4ffd3c43046ab3e11adc2e58b21b4256c4445757 --- .../android/quickstep/views/RecentsView.java | 20 +++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-) diff --git a/quickstep/src/com/android/quickstep/views/RecentsView.java b/quickstep/src/com/android/quickstep/views/RecentsView.java index 1e0762d169..9057bc9ded 100644 --- a/quickstep/src/com/android/quickstep/views/RecentsView.java +++ b/quickstep/src/com/android/quickstep/views/RecentsView.java @@ -757,6 +757,7 @@ public abstract class RecentsView< /** * Placeholder view indicating where the first split screen selected app will be placed */ + @Nullable protected SplitSelectStateController mSplitSelectStateController; /** @@ -1220,7 +1221,8 @@ public abstract class RecentsView< } public boolean isSplitSelectionActive() { - return mSplitSelectStateController.isSplitSelectActive(); + return mSplitSelectStateController != null + && mSplitSelectStateController.isSplitSelectActive(); } /** @@ -4302,12 +4304,14 @@ public abstract class RecentsView< mTopRowIdSet.remove(dismissedTaskViewId); if (taskCount == 1) { - removeViewInLayout(mClearAllButton); - removeViewInLayout(mAddDesktopButton); - if (isHomeTaskDismissed) { - updateEmptyMessage(); - } else if (!mSplitSelectStateController.isSplitSelectActive()) { - startHome(); + if (!isSplitSelectionActive()) { + removeViewInLayout(mClearAllButton); + removeViewInLayout(mAddDesktopButton); + if (isHomeTaskDismissed) { + updateEmptyMessage(); + } else { + startHome(); + } } } else { // Update focus task and its size. @@ -4957,7 +4961,7 @@ public abstract class RecentsView< } public void updateEmptyMessage() { - boolean isEmpty = !hasTaskViews(); + boolean isEmpty = !hasTaskViews() && !isSplitSelectionActive(); boolean hasSizeChanged = mLastMeasureSize.x != getWidth() || mLastMeasureSize.y != getHeight(); if (isEmpty == mShowEmptyMessage && !hasSizeChanged) {