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

Commit 0afddcb7 authored by Craig Mautner's avatar Craig Mautner
Browse files

Fix wallpaper exposure bugs.

Qualify the test for wallpaper animation to exclude the dummy
animation. This keeps us from treating a dummy-animating wallpaper
as an exiting wallpaper and providing the wrong animation.

Hide wallpapers when the wallpaper target window is hidden. This
fixes a timing issue where the wallpaper was exposed for one pass
through performLayout after the launcher was hidden.

Fixes bug 6454992.

Change-Id: Ib4f9205c01a37e6f48f1f93ddcf2476e40ff942f
parent 989c7532
Loading
Loading
Loading
Loading
+9 −0
Original line number Diff line number Diff line
@@ -85,6 +85,15 @@ public class WindowAnimator {
        mPolicy = policy;
    }

    void hideWallpapersLocked() {
        for (final WindowToken token : mService.mWallpaperTokens) {
            for (final WindowState wallpaper : token.windows) {
                wallpaper.mWinAnimator.hide();
            }
            token.hidden = true;
        }
    }

    private void testWallpaperAndBackgroundLocked() {
        if (mWindowDetachedWallpaper != mDetachedWallpaper) {
            if (WindowManagerService.DEBUG_WALLPAPER) Slog.v(TAG,
+5 −2
Original line number Diff line number Diff line
@@ -3825,7 +3825,8 @@ public class WindowManagerService extends IWindowManager.Stub
        synchronized(mWindowMap) {
            if (DEBUG_APP_TRANSITIONS) Slog.v(
                    TAG, "Prepare app transition: transit=" + transit
                    + " mNextAppTransition=" + mNextAppTransition);
                    + " mNextAppTransition=" + mNextAppTransition
                    + "\nCallers=" + Debug.getCallers(3));
            if (okToDisplay()) {
                if (mNextAppTransition == WindowManagerPolicy.TRANSIT_UNSET
                        || mNextAppTransition == WindowManagerPolicy.TRANSIT_NONE) {
@@ -4237,7 +4238,7 @@ public class WindowManagerService extends IWindowManager.Stub
                    e = new RuntimeException();
                    e.fillInStackTrace();
                }
                Slog.v(TAG, "setAppVisibility(" + token + ", " + visible
                Slog.v(TAG, "setAppVisibility(" + token + ", visible=" + visible
                        + "): mNextAppTransition=" + mNextAppTransition
                        + " hidden=" + wtoken.hidden
                        + " hiddenRequested=" + wtoken.hiddenRequested, e);
@@ -7866,8 +7867,10 @@ public class WindowManagerService extends IWindowManager.Stub
                mToTopApps.clear();
            }

            // if wallpaper is animating in or out set oldWallpaper to null else to wallpaper
            WindowState oldWallpaper =
                    mWallpaperTarget != null && mWallpaperTarget.mWinAnimator.isAnimating()
                        && !mWallpaperTarget.mWinAnimator.isDummyAnimation()
                    ? null : mWallpaperTarget;

            adjustWallpaperWindowsLocked();
+29 −21
Original line number Diff line number Diff line
@@ -177,6 +177,13 @@ class WindowStateAnimator {
                                || atoken.inPendingTransaction));
    }

    /** Is the window animating the DummyAnimation? */
    boolean isDummyAnimation() {
        final AppWindowToken atoken = mWin.mAppToken;
        return atoken != null
                && atoken.mAppAnimator.animation == AppWindowAnimator.sDummyAnimation;
    }

    /** Is this window currently animating? */
    boolean isWindowAnimating() {
        return mAnimation != null;
@@ -363,18 +370,32 @@ class WindowStateAnimator {
            mWin.mDestroying = true;
            if (WindowState.SHOW_TRANSACTIONS) WindowManagerService.logSurface(
                mWin, "HIDE (finishExit)", null);
            hide();
        }
        mWin.mExiting = false;
        if (mWin.mRemoveOnExit) {
            mService.mPendingRemove.add(mWin);
            mWin.mRemoveOnExit = false;
        }
        if (mService.mWallpaperTarget == mWin) {
            mAnimator.hideWallpapersLocked();
        }
    }

    void hide() {
        if (!mLastHidden) {
            //dump();
            mLastHidden = true;
            if (WindowManagerService.SHOW_TRANSACTIONS) WindowManagerService.logSurface(mWin,
                    "HIDE (performLayout)", null);
            if (mSurface != null) {
                mSurfaceShown = false;
                try {
                    mSurface.hide();
                } catch (RuntimeException e) {
                Slog.w(TAG, "Error hiding surface in " + this, e);
                    Slog.w(TAG, "Exception hiding surface in " + mWin);
                }
            mLastHidden = true;
            }
        mWin.mExiting = false;
        if (mWin.mRemoveOnExit) {
            mService.mPendingRemove.add(mWin);
            mWin.mRemoveOnExit = false;
        }
    }

@@ -983,20 +1004,7 @@ class WindowStateAnimator {
        setSurfaceBoundaries(recoveringMemory);

        if (w.mAttachedHidden || !w.isReadyForDisplay()) {
            if (!mLastHidden) {
                //dump();
                mLastHidden = true;
                if (WindowManagerService.SHOW_TRANSACTIONS) WindowManagerService.logSurface(w,
                        "HIDE (performLayout)", null);
                if (mSurface != null) {
                    mSurfaceShown = false;
                    try {
                        mSurface.hide();
                    } catch (RuntimeException e) {
                        Slog.w(TAG, "Exception hiding surface in " + w);
                    }
                }
            }
            hide();
            // If we are waiting for this window to handle an
            // orientation change, well, it is hidden, so
            // doesn't really matter.  Note that this does