Stop app switches only when home is the focused app
The home activity was transient launched to top when transition started.
A translucent activity was started before the transition finished.
In that case, the app switch was stopped when finishing the transition
because the transition contains visible transient launches, while
the top activity was not home. Therefore, the top translucent activity
was unable to start activity and had to wait until timed out.
Bug: 368512259
Test: wm presubmit
Flag: EXEMPT bugfix
Change-Id: Ib46d76923f3bbacd06d6d9dea3f0bfc148b8c129
diff --git a/services/core/java/com/android/server/wm/Transition.java b/services/core/java/com/android/server/wm/Transition.java
index 0a47522..ee00426 100644
--- a/services/core/java/com/android/server/wm/Transition.java
+++ b/services/core/java/com/android/server/wm/Transition.java
@@ -1356,6 +1356,11 @@
mController.mAtm.setLastResumedActivityUncheckLocked(ar,
"transitionFinished");
}
+
+ // Prevent spurious background app switches.
+ if (ar.mDisplayContent.mFocusedApp == ar) {
+ mController.mAtm.stopAppSwitches();
+ }
}
continue;
}
@@ -1410,8 +1415,6 @@
if (enterAutoPip) {
mController.mAtm.getTaskChangeNotificationController().notifyTaskStackChanged();
}
- // Prevent spurious background app switches.
- mController.mAtm.stopAppSwitches();
// The end of transient launch may not reorder task, so make sure to compute the latest
// task rank according to the current visibility.
mController.mAtm.mRootWindowContainer.rankTaskLayers();