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

Commit de56d35d authored by Marzia Favaro's avatar Marzia Favaro
Browse files

Correct behaviour of update function to handle multiple wallpapers

Fix: 285843200
Test: manual: open secure camera, take a picture and open it without
unlocking; verify that when going back to lockscreen, the home wallpaper
is never visible
(cherry picked from https://googleplex-android-review.googlesource.com/q/commit:a4eb5d06541c9de432346fb96a58e725a184fb78)

Change-Id: Ibe199a6678a27b4c8cbd38cb8085c9296e0a6e13
parent f5bb534e
Loading
Loading
Loading
Loading
+1 −1
Original line number Original line Diff line number Diff line
@@ -1065,7 +1065,7 @@ class DisplayContent extends RootDisplayArea implements WindowManagerPolicy.Disp
        if (obscuredChanged && w.isVisible() && mWallpaperController.isWallpaperTarget(w)) {
        if (obscuredChanged && w.isVisible() && mWallpaperController.isWallpaperTarget(w)) {
            // This is the wallpaper target and its obscured state changed... make sure the
            // This is the wallpaper target and its obscured state changed... make sure the
            // current wallpaper's visibility has been updated accordingly.
            // current wallpaper's visibility has been updated accordingly.
            mWallpaperController.updateWallpaperVisibility();
            mWallpaperController.updateWallpaperTokens(mDisplayContent.isKeyguardLocked());
        }
        }


        w.handleWindowMovedIfNeeded();
        w.handleWindowMovedIfNeeded();
+11 −19
Original line number Original line Diff line number Diff line
@@ -308,29 +308,12 @@ class WallpaperController {
        }
        }
    }
    }


    private boolean shouldWallpaperBeVisible(WindowState wallpaperTarget) {
        if (DEBUG_WALLPAPER) {
            Slog.v(TAG, "Wallpaper vis: target " + wallpaperTarget + " prev="
                    + mPrevWallpaperTarget);
        }
        return wallpaperTarget != null || mPrevWallpaperTarget != null;
    }

    boolean isWallpaperTargetAnimating() {
    boolean isWallpaperTargetAnimating() {
        return mWallpaperTarget != null && mWallpaperTarget.isAnimating(TRANSITION | PARENTS)
        return mWallpaperTarget != null && mWallpaperTarget.isAnimating(TRANSITION | PARENTS)
                && (mWallpaperTarget.mActivityRecord == null
                && (mWallpaperTarget.mActivityRecord == null
                        || !mWallpaperTarget.mActivityRecord.isWaitingForTransitionStart());
                        || !mWallpaperTarget.mActivityRecord.isWaitingForTransitionStart());
    }
    }


    void updateWallpaperVisibility() {
        final boolean visible = shouldWallpaperBeVisible(mWallpaperTarget);

        for (int curTokenNdx = mWallpaperTokens.size() - 1; curTokenNdx >= 0; curTokenNdx--) {
            final WallpaperWindowToken token = mWallpaperTokens.get(curTokenNdx);
            token.setVisibility(visible);
        }
    }

    /**
    /**
     * Make one wallpaper visible, according to {@attr showHome}.
     * Make one wallpaper visible, according to {@attr showHome}.
     * This is called during the keyguard unlocking transition
     * This is called during the keyguard unlocking transition
@@ -801,11 +784,20 @@ class WallpaperController {
        result.setWallpaperTarget(wallpaperTarget);
        result.setWallpaperTarget(wallpaperTarget);
    }
    }


    public void updateWallpaperTokens(boolean keyguardLocked) {
        if (DEBUG_WALLPAPER) {
            Slog.v(TAG, "Wallpaper vis: target " + mWallpaperTarget + " prev="
                    + mPrevWallpaperTarget);
        }
        updateWallpaperTokens(mWallpaperTarget != null || mPrevWallpaperTarget != null,
                keyguardLocked);
    }

    /**
    /**
     * Change the visibility of the top wallpaper to {@param visibility} and hide all the others.
     * Change the visibility of the top wallpaper to {@param visibility} and hide all the others.
     */
     */
    private void updateWallpaperTokens(boolean visibility, boolean locked) {
    private void updateWallpaperTokens(boolean visibility, boolean keyguardLocked) {
        WindowState topWallpaper = mFindResults.getTopWallpaper(locked);
        WindowState topWallpaper = mFindResults.getTopWallpaper(keyguardLocked);
        WallpaperWindowToken topWallpaperToken =
        WallpaperWindowToken topWallpaperToken =
                topWallpaper == null ? null : topWallpaper.mToken.asWallpaperToken();
                topWallpaper == null ? null : topWallpaper.mToken.asWallpaperToken();
        for (int curTokenNdx = mWallpaperTokens.size() - 1; curTokenNdx >= 0; curTokenNdx--) {
        for (int curTokenNdx = mWallpaperTokens.size() - 1; curTokenNdx >= 0; curTokenNdx--) {