Loading services/core/java/com/android/server/wm/DisplayContent.java +6 −0 Original line number Original line Diff line number Diff line Loading @@ -1527,6 +1527,11 @@ class DisplayContent extends WindowContainer<DisplayContent.DisplayChildWindowCo */ */ void setFixedRotationLaunchingApp(@NonNull ActivityRecord r, @Surface.Rotation int rotation) { void setFixedRotationLaunchingApp(@NonNull ActivityRecord r, @Surface.Rotation int rotation) { final WindowToken prevRotatedLaunchingApp = mFixedRotationLaunchingApp; final WindowToken prevRotatedLaunchingApp = mFixedRotationLaunchingApp; if (prevRotatedLaunchingApp != null && prevRotatedLaunchingApp == r && r.getWindowConfiguration().getRotation() == rotation) { // The given launching app and target rotation are the same as the existing ones. return; } if (prevRotatedLaunchingApp != null if (prevRotatedLaunchingApp != null && prevRotatedLaunchingApp.getWindowConfiguration().getRotation() == rotation && prevRotatedLaunchingApp.getWindowConfiguration().getRotation() == rotation // It is animating so we can expect there will have a transition callback. // It is animating so we can expect there will have a transition callback. Loading @@ -1536,6 +1541,7 @@ class DisplayContent extends WindowContainer<DisplayContent.DisplayChildWindowCo // the heavy operations. This also benefits that the states of multiple activities // the heavy operations. This also benefits that the states of multiple activities // are handled together. // are handled together. r.linkFixedRotationTransform(prevRotatedLaunchingApp); r.linkFixedRotationTransform(prevRotatedLaunchingApp); setFixedRotationLaunchingAppUnchecked(r, rotation); return; return; } } Loading services/core/java/com/android/server/wm/WindowToken.java +4 −5 Original line number Original line Diff line number Diff line Loading @@ -128,10 +128,10 @@ class WindowToken extends WindowContainer<WindowState> { final Configuration mRotatedOverrideConfiguration; final Configuration mRotatedOverrideConfiguration; final SeamlessRotator mRotator; final SeamlessRotator mRotator; /** /** * The tokens that share the same transform. Their end time of transform are the same as * The tokens that share the same transform. Their end time of transform are the same. The * {@link #mOwner}. * list should at least contain the token who creates this state. */ */ final ArrayList<WindowToken> mAssociatedTokens = new ArrayList<>(1); final ArrayList<WindowToken> mAssociatedTokens = new ArrayList<>(3); final ArrayList<WindowContainer<?>> mRotatedContainers = new ArrayList<>(3); final ArrayList<WindowContainer<?>> mRotatedContainers = new ArrayList<>(3); boolean mIsTransforming = true; boolean mIsTransforming = true; Loading Loading @@ -531,6 +531,7 @@ class WindowToken extends WindowContainer<WindowState> { mDisplayContent.getConfiguration().uiMode); mDisplayContent.getConfiguration().uiMode); mFixedRotationTransformState = new FixedRotationTransformState(info, displayFrames, mFixedRotationTransformState = new FixedRotationTransformState(info, displayFrames, insetsState, new Configuration(config), mDisplayContent.getRotation()); insetsState, new Configuration(config), mDisplayContent.getRotation()); mFixedRotationTransformState.mAssociatedTokens.add(this); onConfigurationChanged(getParent().getConfiguration()); onConfigurationChanged(getParent().getConfiguration()); notifyFixedRotationTransform(true /* enabled */); notifyFixedRotationTransform(true /* enabled */); } } Loading Loading @@ -578,14 +579,12 @@ class WindowToken extends WindowContainer<WindowState> { for (int i = state.mAssociatedTokens.size() - 1; i >= 0; i--) { for (int i = state.mAssociatedTokens.size() - 1; i >= 0; i--) { state.mAssociatedTokens.get(i).cancelFixedRotationTransform(); state.mAssociatedTokens.get(i).cancelFixedRotationTransform(); } } cancelFixedRotationTransform(); } } // The state is cleared at the end, because it is used to indicate that other windows can // 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. // use seamless rotation when applying rotation to display. for (int i = state.mAssociatedTokens.size() - 1; i >= 0; i--) { for (int i = state.mAssociatedTokens.size() - 1; i >= 0; i--) { state.mAssociatedTokens.get(i).cleanUpFixedRotationTransformState(); state.mAssociatedTokens.get(i).cleanUpFixedRotationTransformState(); } } cleanUpFixedRotationTransformState(); } } private void cleanUpFixedRotationTransformState() { private void cleanUpFixedRotationTransformState() { Loading services/tests/wmtests/src/com/android/server/wm/DisplayContentTests.java +3 −1 Original line number Original line Diff line number Diff line Loading @@ -1134,8 +1134,10 @@ public class DisplayContentTests extends WindowTestsBase { mDisplayContent.mOpeningApps.add(app2); mDisplayContent.mOpeningApps.add(app2); app2.setRequestedOrientation(newOrientation); 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(app.hasFixedRotationTransform(app2)); assertTrue(mDisplayContent.isFixedRotationLaunchingApp(app2)); // The display should be rotated after the launch is finished. // The display should be rotated after the launch is finished. mDisplayContent.mAppTransition.notifyAppTransitionFinishedLocked(app.token); mDisplayContent.mAppTransition.notifyAppTransitionFinishedLocked(app.token); Loading Loading
services/core/java/com/android/server/wm/DisplayContent.java +6 −0 Original line number Original line Diff line number Diff line Loading @@ -1527,6 +1527,11 @@ class DisplayContent extends WindowContainer<DisplayContent.DisplayChildWindowCo */ */ void setFixedRotationLaunchingApp(@NonNull ActivityRecord r, @Surface.Rotation int rotation) { void setFixedRotationLaunchingApp(@NonNull ActivityRecord r, @Surface.Rotation int rotation) { final WindowToken prevRotatedLaunchingApp = mFixedRotationLaunchingApp; final WindowToken prevRotatedLaunchingApp = mFixedRotationLaunchingApp; if (prevRotatedLaunchingApp != null && prevRotatedLaunchingApp == r && r.getWindowConfiguration().getRotation() == rotation) { // The given launching app and target rotation are the same as the existing ones. return; } if (prevRotatedLaunchingApp != null if (prevRotatedLaunchingApp != null && prevRotatedLaunchingApp.getWindowConfiguration().getRotation() == rotation && prevRotatedLaunchingApp.getWindowConfiguration().getRotation() == rotation // It is animating so we can expect there will have a transition callback. // It is animating so we can expect there will have a transition callback. Loading @@ -1536,6 +1541,7 @@ class DisplayContent extends WindowContainer<DisplayContent.DisplayChildWindowCo // the heavy operations. This also benefits that the states of multiple activities // the heavy operations. This also benefits that the states of multiple activities // are handled together. // are handled together. r.linkFixedRotationTransform(prevRotatedLaunchingApp); r.linkFixedRotationTransform(prevRotatedLaunchingApp); setFixedRotationLaunchingAppUnchecked(r, rotation); return; return; } } Loading
services/core/java/com/android/server/wm/WindowToken.java +4 −5 Original line number Original line Diff line number Diff line Loading @@ -128,10 +128,10 @@ class WindowToken extends WindowContainer<WindowState> { final Configuration mRotatedOverrideConfiguration; final Configuration mRotatedOverrideConfiguration; final SeamlessRotator mRotator; final SeamlessRotator mRotator; /** /** * The tokens that share the same transform. Their end time of transform are the same as * The tokens that share the same transform. Their end time of transform are the same. The * {@link #mOwner}. * list should at least contain the token who creates this state. */ */ final ArrayList<WindowToken> mAssociatedTokens = new ArrayList<>(1); final ArrayList<WindowToken> mAssociatedTokens = new ArrayList<>(3); final ArrayList<WindowContainer<?>> mRotatedContainers = new ArrayList<>(3); final ArrayList<WindowContainer<?>> mRotatedContainers = new ArrayList<>(3); boolean mIsTransforming = true; boolean mIsTransforming = true; Loading Loading @@ -531,6 +531,7 @@ class WindowToken extends WindowContainer<WindowState> { mDisplayContent.getConfiguration().uiMode); mDisplayContent.getConfiguration().uiMode); mFixedRotationTransformState = new FixedRotationTransformState(info, displayFrames, mFixedRotationTransformState = new FixedRotationTransformState(info, displayFrames, insetsState, new Configuration(config), mDisplayContent.getRotation()); insetsState, new Configuration(config), mDisplayContent.getRotation()); mFixedRotationTransformState.mAssociatedTokens.add(this); onConfigurationChanged(getParent().getConfiguration()); onConfigurationChanged(getParent().getConfiguration()); notifyFixedRotationTransform(true /* enabled */); notifyFixedRotationTransform(true /* enabled */); } } Loading Loading @@ -578,14 +579,12 @@ class WindowToken extends WindowContainer<WindowState> { for (int i = state.mAssociatedTokens.size() - 1; i >= 0; i--) { for (int i = state.mAssociatedTokens.size() - 1; i >= 0; i--) { state.mAssociatedTokens.get(i).cancelFixedRotationTransform(); state.mAssociatedTokens.get(i).cancelFixedRotationTransform(); } } cancelFixedRotationTransform(); } } // The state is cleared at the end, because it is used to indicate that other windows can // 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. // use seamless rotation when applying rotation to display. for (int i = state.mAssociatedTokens.size() - 1; i >= 0; i--) { for (int i = state.mAssociatedTokens.size() - 1; i >= 0; i--) { state.mAssociatedTokens.get(i).cleanUpFixedRotationTransformState(); state.mAssociatedTokens.get(i).cleanUpFixedRotationTransformState(); } } cleanUpFixedRotationTransformState(); } } private void cleanUpFixedRotationTransformState() { private void cleanUpFixedRotationTransformState() { Loading
services/tests/wmtests/src/com/android/server/wm/DisplayContentTests.java +3 −1 Original line number Original line Diff line number Diff line Loading @@ -1134,8 +1134,10 @@ public class DisplayContentTests extends WindowTestsBase { mDisplayContent.mOpeningApps.add(app2); mDisplayContent.mOpeningApps.add(app2); app2.setRequestedOrientation(newOrientation); 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(app.hasFixedRotationTransform(app2)); assertTrue(mDisplayContent.isFixedRotationLaunchingApp(app2)); // The display should be rotated after the launch is finished. // The display should be rotated after the launch is finished. mDisplayContent.mAppTransition.notifyAppTransitionFinishedLocked(app.token); mDisplayContent.mAppTransition.notifyAppTransitionFinishedLocked(app.token); Loading