diff options
| -rw-r--r-- | services/core/java/com/android/server/wm/WallpaperWindowToken.java | 11 | ||||
| -rw-r--r-- | services/tests/wmtests/src/com/android/server/wm/WallpaperControllerTests.java | 23 |
2 files changed, 29 insertions, 5 deletions
diff --git a/services/core/java/com/android/server/wm/WallpaperWindowToken.java b/services/core/java/com/android/server/wm/WallpaperWindowToken.java index 5f3c63352015..132d00ac91c1 100644 --- a/services/core/java/com/android/server/wm/WallpaperWindowToken.java +++ b/services/core/java/com/android/server/wm/WallpaperWindowToken.java @@ -123,19 +123,20 @@ class WallpaperWindowToken extends WindowToken { } final WallpaperController wallpaperController = mDisplayContent.mWallpaperController; + final WindowState wallpaperTarget = wallpaperController.getWallpaperTarget(); - if (visible) { - final WindowState wallpaperTarget = wallpaperController.getWallpaperTarget(); + if (visible && wallpaperTarget != null) { final RecentsAnimationController recentsAnimationController = mWmService.getRecentsAnimationController(); - if (wallpaperTarget != null - && recentsAnimationController != null + if (recentsAnimationController != null && recentsAnimationController.isAnimatingTask(wallpaperTarget.getTask())) { // 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.linkFixedRotationTransformIfNeeded(this); - } else if (wallpaperTarget != null + } else if ((wallpaperTarget.mActivityRecord == null + // Ignore invisible activity because it may be moving to background. + || wallpaperTarget.mActivityRecord.mVisibleRequested) && wallpaperTarget.mToken.hasFixedRotationTransform()) { // If the wallpaper target has a fixed rotation, we want the wallpaper to follow its // rotation diff --git a/services/tests/wmtests/src/com/android/server/wm/WallpaperControllerTests.java b/services/tests/wmtests/src/com/android/server/wm/WallpaperControllerTests.java index 520ac19b89a8..373f363e31ff 100644 --- a/services/tests/wmtests/src/com/android/server/wm/WallpaperControllerTests.java +++ b/services/tests/wmtests/src/com/android/server/wm/WallpaperControllerTests.java @@ -271,6 +271,29 @@ public class WallpaperControllerTests extends WindowTestsBase { assertEquals(WINDOWING_MODE_FULLSCREEN, token.getWindowingMode()); } + @Test + public void testFixedRotationRecentsAnimatingTask() { + final RecentsAnimationController recentsController = mock(RecentsAnimationController.class); + doReturn(true).when(recentsController).isWallpaperVisible(eq(mAppWindow)); + mWm.setRecentsAnimationController(recentsController); + + mAppWindow.mActivityRecord.applyFixedRotationTransform(mDisplayContent.getDisplayInfo(), + mDisplayContent.mDisplayFrames, mDisplayContent.getConfiguration()); + mAppWindow.mActivityRecord.mVisibleRequested = true; + mDisplayContent.mWallpaperController.adjustWallpaperWindows(); + + assertEquals(mAppWindow, mDisplayContent.mWallpaperController.getWallpaperTarget()); + // Wallpaper should link the transform of its target. + assertTrue(mAppWindow.mActivityRecord.hasFixedRotationTransform()); + + mAppWindow.mActivityRecord.finishFixedRotationTransform(); + // Invisible requested activity should not share its rotation transform. + mAppWindow.mActivityRecord.mVisibleRequested = false; + mDisplayContent.mWallpaperController.adjustWallpaperWindows(); + + assertFalse(mAppWindow.mActivityRecord.hasFixedRotationTransform()); + } + private WindowState createWallpaperTargetWindow(DisplayContent dc) { final ActivityRecord homeActivity = new ActivityTestsBase.ActivityBuilder(mWm.mAtmService) .setStack(dc.getDefaultTaskDisplayArea().getRootHomeTask()) |