Merge "Stay in the current task when a new desk is created" into main
diff --git a/quickstep/src/com/android/quickstep/views/RecentsView.java b/quickstep/src/com/android/quickstep/views/RecentsView.java
index ea95206..3e4b953 100644
--- a/quickstep/src/com/android/quickstep/views/RecentsView.java
+++ b/quickstep/src/com/android/quickstep/views/RecentsView.java
@@ -7016,6 +7016,8 @@
return;
}
+ TaskView currentTaskView = getTaskViewAt(mCurrentPage);
+
// We assume that a newly added desk is always empty and gets added to the left of the
// `AddNewDesktopButton`.
DesktopTaskView desktopTaskView =
@@ -7029,9 +7031,12 @@
updateTaskSize();
mUtils.updateChildTaskOrientations();
+ updateScrollSynchronously();
- // TODO: b/401002178 - Recalculate the new current page such that the addition of the new
- // desk does not result in a change in the current scroll page.
+ // Set Current Page based on the stored TaskView.
+ if (currentTaskView != null) {
+ setCurrentPage(indexOfChild(currentTaskView));
+ }
}
@Override