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/ActivityTaskManagerService.java b/services/core/java/com/android/server/wm/ActivityTaskManagerService.java
index 142c3b3..e2421d6 100644
--- a/services/core/java/com/android/server/wm/ActivityTaskManagerService.java
+++ b/services/core/java/com/android/server/wm/ActivityTaskManagerService.java
@@ -4781,18 +4781,12 @@
private void applyUpdateVrModeLocked(ActivityRecord r) {
// VR apps are expected to run in a main display. If an app is turning on VR for
- // itself, but lives in a dynamic stack, then make sure that it is moved to the main
- // fullscreen stack before enabling VR Mode.
- // TODO: The goal of this code is to keep the VR app on the main display. When the
- // stack implementation changes in the future, keep in mind that the use of the fullscreen
- // stack is a means to move the activity to the main display and a moveActivityToDisplay()
- // option would be a better choice here.
+ // itself, but isn't on the main display, then move it there before enabling VR Mode.
if (r.requestedVrComponent != null && r.getDisplayId() != DEFAULT_DISPLAY) {
- Slog.i(TAG, "Moving " + r.shortComponentName + " from stack " + r.getStackId()
- + " to main stack for VR");
- final ActivityStack stack = mRootActivityContainer.getDefaultDisplay().getOrCreateStack(
- WINDOWING_MODE_FULLSCREEN, r.getActivityType(), true /* toTop */);
- moveTaskToStack(r.getTaskRecord().taskId, stack.mStackId, true /* toTop */);
+ Slog.i(TAG, "Moving " + r.shortComponentName + " from display " + r.getDisplayId()
+ + " to main display for VR");
+ mRootActivityContainer.moveStackToDisplay(
+ r.getStackId(), DEFAULT_DISPLAY, true /* toTop */);
}
mH.post(() -> {
if (!mVrController.onVrModeChanged(r)) {