Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 5ae73328 authored by Riddle Hsu's avatar Riddle Hsu
Browse files

Skip collecting requesting-invisible wallpaper if no target

The transition of wallpaper target may have completed and then
the wallpaper target relayout to invisible which triggers refresh
new wallpaper target. If there is no new target, the wallpaper
will set to invisible. So it should not belong to any transition.
Otherwise the next transition may include wallpaper unexpectedly.

Fix: 334578612
Test: atest ActivityTransitionTests# \
      testAnimationBackgroundColorIsUsedDuringActivityTransition
Change-Id: I6db11773a1fe4aeb05b748b3c76424994befe0ce
parent b3942280
Loading
Loading
Loading
Loading
+5 −5
Original line number Diff line number Diff line
@@ -193,11 +193,11 @@ class WallpaperWindowToken extends WindowToken {
        if (mVisibleRequested != visible) {
            // Before setting mVisibleRequested so we can track changes.
            final WindowState wpTarget = mDisplayContent.mWallpaperController.getWallpaperTarget();
            final boolean isTargetNotCollectedActivity = wpTarget != null
                    && wpTarget.mActivityRecord != null
                    && !mTransitionController.isCollecting(wpTarget.mActivityRecord);
            // Skip collecting requesting-invisible wallpaper if the wallpaper target is an activity
            // and it is not collected. Because the visibility change may be called after the
            final boolean isTargetNotCollectedActivity = wpTarget == null
                    || (wpTarget.mActivityRecord != null
                            && !mTransitionController.isCollecting(wpTarget.mActivityRecord));
            // Skip collecting requesting-invisible wallpaper if the wallpaper target is empty or
            // a non-collected activity. Because the visibility change may be called after the
            // transition of activity is finished, e.g. WallpaperController#hideWallpapers from
            // hiding surface of the target. Then if there is a next transition, the wallpaper
            // change may be collected into the unrelated transition and cause a weird animation.
+2 −0
Original line number Diff line number Diff line
@@ -410,6 +410,8 @@ public class WallpaperControllerTests extends WindowTestsBase {
        final WindowState wallpaperWindow = createWallpaperWindow(dc);
        final WallpaperWindowToken token = wallpaperWindow.mToken.asWallpaperToken();
        wallpaperWindow.setHasSurface(true);
        spyOn(dc.mWallpaperController);
        doReturn(wallpaperWindow).when(dc.mWallpaperController).getWallpaperTarget();

        // Set-up mock shell transitions
        registerTestTransitionPlayer();