summaryrefslogtreecommitdiff
path: root/quickstep/src
diff options
context:
space:
mode:
author Suhua Lei <lsuhua@google.com> 2025-03-21 17:33:31 +0000
committer Suhua Lei <lsuhua@google.com> 2025-03-24 17:19:17 +0000
commit77481d611b45a9c433dc5d923646f6928d60754f (patch)
tree48afb51d64d9e269761664c98121de27ebf19c04 /quickstep/src
parent376885f8ba0b3ca4dcffdea6c1b67eae22f1889d (diff)
Stay in the current task when a new desk is created
Bug: 401002178 Flag: com.android.window.flags.enable_multiple_desktops_frontend Flag: com.android.window.flags.enable_multiple_desktops_backend Test: manual create new desks Change-Id: Iaa29c557a421d5c51b90aa808188d3cabec89143
Diffstat (limited to 'quickstep/src')
-rw-r--r--quickstep/src/com/android/quickstep/views/RecentsView.java9
1 files changed, 7 insertions, 2 deletions
diff --git a/quickstep/src/com/android/quickstep/views/RecentsView.java b/quickstep/src/com/android/quickstep/views/RecentsView.java
index 4feeb95f04..2c7a5af804 100644
--- a/quickstep/src/com/android/quickstep/views/RecentsView.java
+++ b/quickstep/src/com/android/quickstep/views/RecentsView.java
@@ -7038,6 +7038,8 @@ public abstract class RecentsView<
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 =
@@ -7051,9 +7053,12 @@ public abstract class RecentsView<
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