Reland: Clear transitions for app windows display change.
This prevents unwanted animations from running for windows on the new
display that are no longer relevant.
Also,
- Transfer the opening app token transition to the new display so that
it can be eventually made visible on that display
- Clean-up TODO relating to moving VR activity to main display, so that
the right states are set.
Bug: 128449959
Test: VrDisplayTests
Test: manual - launch activity with options moving between virtual and
default display, atest WmTests
Change-Id: I285c6742839d38e76322621b9c2a1d7f313cd6f8
diff --git a/services/core/java/com/android/server/wm/AppWindowToken.java b/services/core/java/com/android/server/wm/AppWindowToken.java
index 4a9a3f7..03cae42 100644
--- a/services/core/java/com/android/server/wm/AppWindowToken.java
+++ b/services/core/java/com/android/server/wm/AppWindowToken.java
@@ -1322,7 +1322,15 @@
if (prevDc == null || prevDc == mDisplayContent) {
return;
}
- if (prevDc.mChangingApps.contains(this)) {
+
+ if (prevDc.mOpeningApps.remove(this)) {
+ // Transfer opening transition to new display.
+ mDisplayContent.mOpeningApps.add(this);
+ mDisplayContent.prepareAppTransition(prevDc.mAppTransition.getAppTransition(), true);
+ mDisplayContent.executeAppTransition();
+ }
+
+ if (prevDc.mChangingApps.remove(this)) {
// This gets called *after* the AppWindowToken has been reparented to the new display.
// That reparenting resulted in this window changing modes (eg. FREEFORM -> FULLSCREEN),
// so this token is now "frozen" while waiting for the animation to start on prevDc
@@ -1331,6 +1339,8 @@
// so we need to cancel the change transition here.
clearChangeLeash(getPendingTransaction(), true /* cancel */);
}
+ prevDc.mClosingApps.remove(this);
+
if (prevDc.mFocusedApp == this) {
prevDc.setFocusedApp(null);
final TaskStack stack = dc.getTopStack();
@@ -3216,16 +3226,6 @@
true /* topToBottom */);
}
- void removeFromPendingTransition() {
- if (isWaitingForTransitionStart() && mDisplayContent != null) {
- mDisplayContent.mOpeningApps.remove(this);
- if (mDisplayContent.mChangingApps.remove(this)) {
- clearChangeLeash(getPendingTransaction(), true /* cancel */);
- }
- mDisplayContent.mClosingApps.remove(this);
- }
- }
-
private void updateColorTransform() {
if (mSurfaceControl != null && mLastAppSaturationInfo != null) {
getPendingTransaction().setColorTransform(mSurfaceControl,