Loading services/core/java/com/android/server/wm/RecentsAnimationController.java +2 −2 Original line number Diff line number Diff line Loading @@ -804,11 +804,11 @@ public class RecentsAnimationController implements DeathRecipient { * * This avoids any screen rotation animation when animating to the Recents view. */ void applyFixedRotationTransformIfNeeded(@NonNull WindowToken wallpaper) { void linkFixedRotationTransformIfNeeded(@NonNull WindowToken wallpaper) { if (mTargetActivityRecord == null) { return; } wallpaper.applyFixedRotationTransform(mTargetActivityRecord); wallpaper.linkFixedRotationTransform(mTargetActivityRecord); } @VisibleForTesting Loading services/core/java/com/android/server/wm/WallpaperWindowToken.java +2 −4 Original line number Diff line number Diff line Loading @@ -134,14 +134,12 @@ class WallpaperWindowToken extends WindowToken { // If the Recents animation is running, and the wallpaper target is the animating // task we want the wallpaper to be rotated in the same orientation as the // RecentsAnimation's target (e.g the launcher) recentsAnimationController.applyFixedRotationTransformIfNeeded(this); recentsAnimationController.linkFixedRotationTransformIfNeeded(this); } else if (wallpaperTarget != null && wallpaperTarget.mToken.hasFixedRotationTransform()) { // If the wallpaper target has a fixed rotation, we want the wallpaper to follow its // rotation applyFixedRotationTransform(wallpaperTarget.mToken); } else if (hasFixedRotationTransform()) { clearFixedRotationTransform(); linkFixedRotationTransform(wallpaperTarget.mToken); } } Loading services/core/java/com/android/server/wm/WindowToken.java +33 −14 Original line number Diff line number Diff line Loading @@ -106,17 +106,24 @@ class WindowToken extends WindowContainer<WindowState> { * rotated by the given rotated display info, frames and insets. */ private static class FixedRotationTransformState { final WindowToken mOwner; final DisplayInfo mDisplayInfo; final DisplayFrames mDisplayFrames; final InsetsState mInsetsState; final Configuration mRotatedOverrideConfiguration; final SeamlessRotator mRotator; final ArrayList<WindowContainer<?>> mRotatedContainers = new ArrayList<>(); /** * The tokens that share the same transform. Their end time of transform are the same as * {@link #mOwner}. */ final ArrayList<WindowToken> mAssociatedTokens = new ArrayList<>(1); final ArrayList<WindowContainer<?>> mRotatedContainers = new ArrayList<>(3); boolean mIsTransforming = true; FixedRotationTransformState(DisplayInfo rotatedDisplayInfo, FixedRotationTransformState(WindowToken owner, DisplayInfo rotatedDisplayInfo, DisplayFrames rotatedDisplayFrames, InsetsState rotatedInsetsState, Configuration rotatedConfig, int currentRotation) { mOwner = owner; mDisplayInfo = rotatedDisplayInfo; mDisplayFrames = rotatedDisplayFrames; mInsetsState = rotatedInsetsState; Loading Loading @@ -428,34 +435,43 @@ class WindowToken extends WindowContainer<WindowState> { final InsetsState insetsState = new InsetsState(); mDisplayContent.getDisplayPolicy().simulateLayoutDisplay(displayFrames, insetsState, mDisplayContent.getConfiguration().uiMode); mFixedRotationTransformState = new FixedRotationTransformState(info, displayFrames, mFixedRotationTransformState = new FixedRotationTransformState(this, info, displayFrames, insetsState, new Configuration(config), mDisplayContent.getRotation()); onConfigurationChanged(getParent().getConfiguration()); } /** * Copies the {@link FixedRotationTransformState} (if any) from the other WindowToken to this * one. * Reuses the {@link FixedRotationTransformState} (if any) from the other WindowToken to this * one. This takes the same effect as {@link #applyFixedRotationTransform}, but the linked state * can only be cleared by the state owner. */ void applyFixedRotationTransform(WindowToken other) { void linkFixedRotationTransform(WindowToken other) { if (mFixedRotationTransformState != null) { return; } final FixedRotationTransformState fixedRotationState = other.mFixedRotationTransformState; if (fixedRotationState != null) { applyFixedRotationTransform(fixedRotationState.mDisplayInfo, fixedRotationState.mDisplayFrames, fixedRotationState.mRotatedOverrideConfiguration); if (fixedRotationState == null) { return; } mFixedRotationTransformState = fixedRotationState; fixedRotationState.mAssociatedTokens.add(this); onConfigurationChanged(getParent().getConfiguration()); } /** Clears the transformation and continue updating the orientation change of display. */ /** * Clears the transformation and continue updating the orientation change of display. Only the * state owner can clear the transform state. */ void clearFixedRotationTransform() { if (mFixedRotationTransformState == null) { final FixedRotationTransformState state = mFixedRotationTransformState; if (state == null || state.mOwner != this) { return; } mFixedRotationTransformState.resetTransform(); state.resetTransform(); // Clear the flag so if the display will be updated to the same orientation, the transform // won't take effect. 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. mFixedRotationTransformState.mIsTransforming = false; state.mIsTransforming = false; final boolean changed = mDisplayContent.continueUpdateOrientationForDiffOrienLaunchingApp(this); // If it is not the launching app or the display is not rotated, make sure the merged Loading @@ -463,6 +479,9 @@ class WindowToken extends WindowContainer<WindowState> { if (!changed) { onMergedOverrideConfigurationChanged(); } for (int i = state.mAssociatedTokens.size() - 1; i >= 0; i--) { state.mAssociatedTokens.get(i).mFixedRotationTransformState = null; } mFixedRotationTransformState = null; } Loading services/tests/wmtests/src/com/android/server/wm/RecentsAnimationControllerTest.java +80 −97 File changed.Preview size limit exceeded, changes collapsed. Show changes Loading
services/core/java/com/android/server/wm/RecentsAnimationController.java +2 −2 Original line number Diff line number Diff line Loading @@ -804,11 +804,11 @@ public class RecentsAnimationController implements DeathRecipient { * * This avoids any screen rotation animation when animating to the Recents view. */ void applyFixedRotationTransformIfNeeded(@NonNull WindowToken wallpaper) { void linkFixedRotationTransformIfNeeded(@NonNull WindowToken wallpaper) { if (mTargetActivityRecord == null) { return; } wallpaper.applyFixedRotationTransform(mTargetActivityRecord); wallpaper.linkFixedRotationTransform(mTargetActivityRecord); } @VisibleForTesting Loading
services/core/java/com/android/server/wm/WallpaperWindowToken.java +2 −4 Original line number Diff line number Diff line Loading @@ -134,14 +134,12 @@ class WallpaperWindowToken extends WindowToken { // If the Recents animation is running, and the wallpaper target is the animating // task we want the wallpaper to be rotated in the same orientation as the // RecentsAnimation's target (e.g the launcher) recentsAnimationController.applyFixedRotationTransformIfNeeded(this); recentsAnimationController.linkFixedRotationTransformIfNeeded(this); } else if (wallpaperTarget != null && wallpaperTarget.mToken.hasFixedRotationTransform()) { // If the wallpaper target has a fixed rotation, we want the wallpaper to follow its // rotation applyFixedRotationTransform(wallpaperTarget.mToken); } else if (hasFixedRotationTransform()) { clearFixedRotationTransform(); linkFixedRotationTransform(wallpaperTarget.mToken); } } Loading
services/core/java/com/android/server/wm/WindowToken.java +33 −14 Original line number Diff line number Diff line Loading @@ -106,17 +106,24 @@ class WindowToken extends WindowContainer<WindowState> { * rotated by the given rotated display info, frames and insets. */ private static class FixedRotationTransformState { final WindowToken mOwner; final DisplayInfo mDisplayInfo; final DisplayFrames mDisplayFrames; final InsetsState mInsetsState; final Configuration mRotatedOverrideConfiguration; final SeamlessRotator mRotator; final ArrayList<WindowContainer<?>> mRotatedContainers = new ArrayList<>(); /** * The tokens that share the same transform. Their end time of transform are the same as * {@link #mOwner}. */ final ArrayList<WindowToken> mAssociatedTokens = new ArrayList<>(1); final ArrayList<WindowContainer<?>> mRotatedContainers = new ArrayList<>(3); boolean mIsTransforming = true; FixedRotationTransformState(DisplayInfo rotatedDisplayInfo, FixedRotationTransformState(WindowToken owner, DisplayInfo rotatedDisplayInfo, DisplayFrames rotatedDisplayFrames, InsetsState rotatedInsetsState, Configuration rotatedConfig, int currentRotation) { mOwner = owner; mDisplayInfo = rotatedDisplayInfo; mDisplayFrames = rotatedDisplayFrames; mInsetsState = rotatedInsetsState; Loading Loading @@ -428,34 +435,43 @@ class WindowToken extends WindowContainer<WindowState> { final InsetsState insetsState = new InsetsState(); mDisplayContent.getDisplayPolicy().simulateLayoutDisplay(displayFrames, insetsState, mDisplayContent.getConfiguration().uiMode); mFixedRotationTransformState = new FixedRotationTransformState(info, displayFrames, mFixedRotationTransformState = new FixedRotationTransformState(this, info, displayFrames, insetsState, new Configuration(config), mDisplayContent.getRotation()); onConfigurationChanged(getParent().getConfiguration()); } /** * Copies the {@link FixedRotationTransformState} (if any) from the other WindowToken to this * one. * Reuses the {@link FixedRotationTransformState} (if any) from the other WindowToken to this * one. This takes the same effect as {@link #applyFixedRotationTransform}, but the linked state * can only be cleared by the state owner. */ void applyFixedRotationTransform(WindowToken other) { void linkFixedRotationTransform(WindowToken other) { if (mFixedRotationTransformState != null) { return; } final FixedRotationTransformState fixedRotationState = other.mFixedRotationTransformState; if (fixedRotationState != null) { applyFixedRotationTransform(fixedRotationState.mDisplayInfo, fixedRotationState.mDisplayFrames, fixedRotationState.mRotatedOverrideConfiguration); if (fixedRotationState == null) { return; } mFixedRotationTransformState = fixedRotationState; fixedRotationState.mAssociatedTokens.add(this); onConfigurationChanged(getParent().getConfiguration()); } /** Clears the transformation and continue updating the orientation change of display. */ /** * Clears the transformation and continue updating the orientation change of display. Only the * state owner can clear the transform state. */ void clearFixedRotationTransform() { if (mFixedRotationTransformState == null) { final FixedRotationTransformState state = mFixedRotationTransformState; if (state == null || state.mOwner != this) { return; } mFixedRotationTransformState.resetTransform(); state.resetTransform(); // Clear the flag so if the display will be updated to the same orientation, the transform // won't take effect. 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. mFixedRotationTransformState.mIsTransforming = false; state.mIsTransforming = false; final boolean changed = mDisplayContent.continueUpdateOrientationForDiffOrienLaunchingApp(this); // If it is not the launching app or the display is not rotated, make sure the merged Loading @@ -463,6 +479,9 @@ class WindowToken extends WindowContainer<WindowState> { if (!changed) { onMergedOverrideConfigurationChanged(); } for (int i = state.mAssociatedTokens.size() - 1; i >= 0; i--) { state.mAssociatedTokens.get(i).mFixedRotationTransformState = null; } mFixedRotationTransformState = null; } Loading
services/tests/wmtests/src/com/android/server/wm/RecentsAnimationControllerTest.java +80 −97 File changed.Preview size limit exceeded, changes collapsed. Show changes