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

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

Remove outdated wallpaper visibility update

The code was added in e9e9bca8 (2009).
The current logic relies on isOnScreen() of wallpaper target.
Such as WallpaperController#mFindWallpaperTargetFunction use it
to decide wallpaper target and WindowStateAnimator#
prepareSurfaceLocked uses it to hideWallpapers.

This avoids wallpaper becomes visible again right after hiding
it. Such as wallpaper target's isOnScreen() returns false because
it's close transition is done, i.e. token.isVisible() is false.
But isVisible() can still be true because it doesn't consider
the visibility of WindowToken for non-wallpaper window
(see wouldBeVisibleIfPolicyIgnored).

Though it can also be fixed by changing from checking isVisible()
to isOnScreen(). It is better to avoid multiple similar entries
to change wallpaper visibility. Also updateWallpaperTokens should
only be called after updating target (updateWallpaperWindowsTarget)
in case the target is no longer valid.

Bug: 330457044
Bug: 329916266
Test: atest ActivityTransitionTests# \
            testCustomTransitionCanOverrideBackgroundColor
Change-Id: I6c294b510f4b6f53d31e276a98564222e64e7f44
parent eb10002c
Loading
Loading
Loading
Loading
+0 −8
Original line number Diff line number Diff line
@@ -1007,8 +1007,6 @@ class DisplayContent extends RootDisplayArea implements WindowManagerPolicy.Disp

    private final Consumer<WindowState> mApplySurfaceChangesTransaction = w -> {
        final WindowSurfacePlacer surfacePlacer = mWmService.mWindowPlacerLocked;
        final boolean obscuredChanged = w.mObscured !=
                mTmpApplySurfaceChangesTransactionState.obscured;
        final RootWindowContainer root = mWmService.mRoot;

        if (w.mHasSurface) {
@@ -1107,12 +1105,6 @@ class DisplayContent extends RootDisplayArea implements WindowManagerPolicy.Disp
            }
        }

        if (obscuredChanged && w.isVisible() && mWallpaperController.isWallpaperTarget(w)) {
            // This is the wallpaper target and its obscured state changed... make sure the
            // current wallpaper's visibility has been updated accordingly.
            mWallpaperController.updateWallpaperTokens(mDisplayContent.isKeyguardLocked());
        }

        w.handleWindowMovedIfNeeded();

        //Slog.i(TAG, "Window " + this + " clearing mContentChanged - done placing");
+0 −5
Original line number Diff line number Diff line
@@ -856,11 +856,6 @@ class WallpaperController {
        result.setWallpaperTarget(wallpaperTarget);
    }

    public void updateWallpaperTokens(boolean keyguardLocked) {
        updateWallpaperTokens(mWallpaperTarget != null || mPrevWallpaperTarget != null,
                keyguardLocked);
    }

    /**
     * Change the visibility of the top wallpaper to {@param visibility} and hide all the others.
     */