diff options
| author | 2023-11-28 20:04:07 +0000 | |
|---|---|---|
| committer | 2023-11-28 20:04:07 +0000 | |
| commit | fdfd74fde94908155d02504d8a232e5af0e42be0 (patch) | |
| tree | 696a537bfe5de1af4832e5f8f5bb24d550a1382a | |
| parent | 617fd0acc6bd175870f8a3078292a4b462e50532 (diff) | |
| parent | f18f5bf7f42b9224e1ef7b824b5a0fd85f66d7bc (diff) | |
Merge "Fix Desktop Windowing focus if clicked in Taskbar" into main
4 files changed, 31 insertions, 0 deletions
diff --git a/services/core/java/com/android/server/wm/ActivityStarter.java b/services/core/java/com/android/server/wm/ActivityStarter.java index d6302e08fedb..bbaa6912417c 100644 --- a/services/core/java/com/android/server/wm/ActivityStarter.java +++ b/services/core/java/com/android/server/wm/ActivityStarter.java @@ -1582,6 +1582,7 @@ class ActivityStarter { // An activity has changed order/visibility or the task is occluded by a transient // activity, so this isn't just deliver-to-top && mMovedToTopActivity == null + && !transitionController.hasOrderChanges() && !transitionController.isTransientHide(startedActivityRootTask)) { // We just delivered to top, so there isn't an actual transition here. if (!forceTransientTransition) { diff --git a/services/core/java/com/android/server/wm/Transition.java b/services/core/java/com/android/server/wm/Transition.java index 642d22f0bb9a..e5604eca3df0 100644 --- a/services/core/java/com/android/server/wm/Transition.java +++ b/services/core/java/com/android/server/wm/Transition.java @@ -1756,6 +1756,27 @@ class Transition implements BLASTSyncEngine.TransactionReadyListener { } /** + * Checks if the transition contains order changes. + * + * This is a shallow check that doesn't account for collection in parallel, unlike + * {@code collectOrderChanges} + */ + boolean hasOrderChanges() { + ArrayList<Task> onTopTasks = new ArrayList<>(); + // Iterate over target displays to get up to date on top tasks. + // Cannot use `mOnTopTasksAtReady` as it's not populated before the `applyReady` is called. + for (DisplayContent dc : mTargetDisplays) { + addOnTopTasks(dc, onTopTasks); + } + for (Task task : onTopTasks) { + if (!mOnTopTasksStart.contains(task)) { + return true; + } + } + return false; + } + + /** * Collect tasks which moved-to-top as part of this transition. This also updates the * controller's latest-reported when relevant. * diff --git a/services/core/java/com/android/server/wm/TransitionController.java b/services/core/java/com/android/server/wm/TransitionController.java index bacfda5fc528..e648d6417e88 100644 --- a/services/core/java/com/android/server/wm/TransitionController.java +++ b/services/core/java/com/android/server/wm/TransitionController.java @@ -792,6 +792,12 @@ class TransitionController { mCollectingTransition.recordTaskOrder(wc); } + /** @see Transition#hasOrderChanges */ + boolean hasOrderChanges() { + if (mCollectingTransition == null) return false; + return mCollectingTransition.hasOrderChanges(); + } + /** * Collects the window containers which need to be synced with the changing display area into * the current collecting transition. diff --git a/services/tests/wmtests/src/com/android/server/wm/TransitionTests.java b/services/tests/wmtests/src/com/android/server/wm/TransitionTests.java index dade3b91e0eb..71447e72de8c 100644 --- a/services/tests/wmtests/src/com/android/server/wm/TransitionTests.java +++ b/services/tests/wmtests/src/com/android/server/wm/TransitionTests.java @@ -2015,6 +2015,9 @@ public class TransitionTests extends WindowTestsBase { transition.collect(leafTaskA); rootTaskA.moveToFront("test", leafTaskA); + // Test has order changes, a shallow check of order changes + assertTrue(transition.hasOrderChanges()); + // All the tasks were already visible, so there shouldn't be any changes ArrayList<Transition.ChangeInfo> targets = Transition.calculateTargets( participants, changes); |