Merge "Revert "Recycle tasks that are split when split select anim complete for reuse"" into main

This commit is contained in:
Treehugger Robot authored and Android (Google) Code Review committed 2024-12-06 14:37:28 +00:00
commit 2173882ec6
1 file changed
+12 -22
@@ -1244,24 +1244,21 @@ public abstract class RecentsView<
// - It's the focused task to be moved to the front, we immediately re-add the task
if (child instanceof TaskView && child != mSplitHiddenTaskView
&& child != mMovingTaskView) {
clearAndRecycleTaskView((TaskView) child);
TaskView taskView = (TaskView) child;
for (int i : taskView.getTaskIds()) {
mHasVisibleTaskData.delete(i);
}
if (child instanceof GroupedTaskView) {
mGroupedTaskViewPool.recycle((GroupedTaskView) taskView);
} else if (child instanceof DesktopTaskView) {
mDesktopTaskViewPool.recycle((DesktopTaskView) taskView);
} else {
mTaskViewPool.recycle(taskView);
}
mActionsView.updateHiddenFlags(HIDDEN_NO_TASKS, getTaskViewCount() == 0);
}
}
private void clearAndRecycleTaskView(TaskView taskView) {
for (int taskId : taskView.getTaskIds()) {
mHasVisibleTaskData.delete(taskId);
}
if (taskView instanceof GroupedTaskView) {
mGroupedTaskViewPool.recycle((GroupedTaskView) taskView);
} else if (taskView instanceof DesktopTaskView) {
mDesktopTaskViewPool.recycle((DesktopTaskView) taskView);
} else {
mTaskViewPool.recycle(taskView);
}
mActionsView.updateHiddenFlags(HIDDEN_NO_TASKS, getTaskViewCount() == 0);
}
@Override
public void onViewAdded(View child) {
super.onViewAdded(child);
@@ -5407,13 +5404,6 @@ public abstract class RecentsView<
mSplitHiddenTaskViewIndex = -1;
if (mSplitHiddenTaskView != null) {
mSplitHiddenTaskView.setThumbnailVisibility(VISIBLE, INVALID_TASK_ID);
// mSplitHiddenTaskView is set when split select animation starts. The TaskView is only
// removed when when the animation finishes. So in the case of overview being dismissed
// during the animation, we should not call clearAndRecycleTaskView() because it has
// not been removed yet.
if (mSplitHiddenTaskView.getParent() == null) {
clearAndRecycleTaskView(mSplitHiddenTaskView);
}
mSplitHiddenTaskView = null;
}
}