diff --git a/services/core/java/com/android/server/wm/DisplayContent.java b/services/core/java/com/android/server/wm/DisplayContent.java index b6672d3c73c09..fcd642f9a9c94 100644 --- a/services/core/java/com/android/server/wm/DisplayContent.java +++ b/services/core/java/com/android/server/wm/DisplayContent.java @@ -1527,6 +1527,11 @@ class DisplayContent extends WindowContainer { final Configuration mRotatedOverrideConfiguration; final SeamlessRotator mRotator; /** - * The tokens that share the same transform. Their end time of transform are the same as - * {@link #mOwner}. + * The tokens that share the same transform. Their end time of transform are the same. The + * list should at least contain the token who creates this state. */ - final ArrayList mAssociatedTokens = new ArrayList<>(1); + final ArrayList mAssociatedTokens = new ArrayList<>(3); final ArrayList> mRotatedContainers = new ArrayList<>(3); boolean mIsTransforming = true; @@ -531,6 +531,7 @@ class WindowToken extends WindowContainer { mDisplayContent.getConfiguration().uiMode); mFixedRotationTransformState = new FixedRotationTransformState(info, displayFrames, insetsState, new Configuration(config), mDisplayContent.getRotation()); + mFixedRotationTransformState.mAssociatedTokens.add(this); onConfigurationChanged(getParent().getConfiguration()); notifyFixedRotationTransform(true /* enabled */); } @@ -578,14 +579,12 @@ class WindowToken extends WindowContainer { for (int i = state.mAssociatedTokens.size() - 1; i >= 0; i--) { state.mAssociatedTokens.get(i).cancelFixedRotationTransform(); } - cancelFixedRotationTransform(); } // The state is cleared at the end, because it is used to indicate that other windows can // use seamless rotation when applying rotation to display. for (int i = state.mAssociatedTokens.size() - 1; i >= 0; i--) { state.mAssociatedTokens.get(i).cleanUpFixedRotationTransformState(); } - cleanUpFixedRotationTransformState(); } private void cleanUpFixedRotationTransformState() { diff --git a/services/tests/wmtests/src/com/android/server/wm/DisplayContentTests.java b/services/tests/wmtests/src/com/android/server/wm/DisplayContentTests.java index 7be2b732ac620..7197ce9c22aa1 100644 --- a/services/tests/wmtests/src/com/android/server/wm/DisplayContentTests.java +++ b/services/tests/wmtests/src/com/android/server/wm/DisplayContentTests.java @@ -1134,8 +1134,10 @@ public class DisplayContentTests extends WindowTestsBase { mDisplayContent.mOpeningApps.add(app2); app2.setRequestedOrientation(newOrientation); - // The activity should share the same transform state as the existing one. + // The activity should share the same transform state as the existing one. The activity + // should also be the fixed rotation launching app because it is the latest top. assertTrue(app.hasFixedRotationTransform(app2)); + assertTrue(mDisplayContent.isFixedRotationLaunchingApp(app2)); // The display should be rotated after the launch is finished. mDisplayContent.mAppTransition.notifyAppTransitionFinishedLocked(app.token);