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

Commit f249de2a authored by Josh Yang's avatar Josh Yang Committed by Marzia Favaro
Browse files

Do not bypass wallpaper visibility update during keyguard going away.

Reason for cherry-pick: Remove `waitingToShow`, which was causing issues when the wallpaper was being discarded from a transition. Remove redundant logic to include wallpaper in unlocking transition. 

Fix: 296909507
Test: WallpaperManagerTest
Test: Manual, unlock from AOD

Change-Id: I373760932de76ea89b890e64fbd97fa43600103c
(cherry picked from commit 9a566e3c)
parent a8bf032c
Loading
Loading
Loading
Loading
+0 −3
Original line number Diff line number Diff line
@@ -225,7 +225,6 @@ class KeyguardController {
                final DisplayContent dc = mRootWindowContainer.getDefaultDisplay();
                dc.requestTransitionAndLegacyPrepare(
                        TRANSIT_TO_FRONT, TRANSIT_FLAG_KEYGUARD_APPEARING);
                dc.mWallpaperController.showWallpaperInTransition(false /* showHome */);
                mWindowManager.executeAppTransition();
            }
        }
@@ -282,8 +281,6 @@ class KeyguardController {
                    TRANSIT_TO_BACK, transitFlags, null /* trigger */, dc);
            updateKeyguardSleepToken();

            // Make the home wallpaper visible
            dc.mWallpaperController.showWallpaperInTransition(true /* showHome */);
            // Some stack visibility might change (e.g. docked stack)
            mRootWindowContainer.resumeFocusedTasksTopActivities();
            mRootWindowContainer.ensureActivitiesVisible(null, 0, !PRESERVE_WINDOWS);
+1 −29
Original line number Diff line number Diff line
@@ -314,31 +314,6 @@ class WallpaperController {
                        || !mWallpaperTarget.mActivityRecord.isWaitingForTransitionStart());
    }

    /**
     * Make one wallpaper visible, according to {@attr showHome}.
     * This is called during the keyguard unlocking transition
     * (see {@link KeyguardController#keyguardGoingAway(int, int)}),
     * or when a keyguard unlock is cancelled (see {@link KeyguardController})
     */
    public void showWallpaperInTransition(boolean showHome) {
        updateWallpaperWindowsTarget(mFindResults);

        if (!mFindResults.hasTopShowWhenLockedWallpaper()) {
            Slog.w(TAG, "There is no wallpaper for the lock screen");
            return;
        }
        WindowState hideWhenLocked = mFindResults.mTopWallpaper.mTopHideWhenLockedWallpaper;
        WindowState showWhenLocked = mFindResults.mTopWallpaper.mTopShowWhenLockedWallpaper;
        if (!mFindResults.hasTopHideWhenLockedWallpaper()) {
            // Shared wallpaper, ensure its visibility
            showWhenLocked.mToken.asWallpaperToken().updateWallpaperWindows(true);
        } else {
            // Separate lock and home wallpapers: show the correct wallpaper in transition
            hideWhenLocked.mToken.asWallpaperToken().updateWallpaperWindowsInTransition(showHome);
            showWhenLocked.mToken.asWallpaperToken().updateWallpaperWindowsInTransition(!showHome);
        }
    }

    void hideDeferredWallpapersIfNeededLegacy() {
        for (int i = mWallpaperTokens.size() - 1; i >= 0; i--) {
            final WallpaperWindowToken token = mWallpaperTokens.get(i);
@@ -840,10 +815,7 @@ class WallpaperController {
            }
        }

        if (!mDisplayContent.isKeyguardGoingAway() || !mIsLockscreenLiveWallpaperEnabled) {
            // When keyguard goes away, KeyguardController handles the visibility
        updateWallpaperTokens(visible, mDisplayContent.isKeyguardLocked());
        }

        if (DEBUG_WALLPAPER) {
            Slog.v(TAG, "adjustWallpaperWindows: wallpaper visibility " + visible
+2 −19
Original line number Diff line number Diff line
@@ -128,20 +128,6 @@ class WallpaperWindowToken extends WindowToken {
        }
    }

    /**
     * Update the visibility of the token to {@param visible}. If a transition will collect the
     * wallpaper, then the visibility will be committed during the execution of the transition.
     *
     * waitingToShow is reset at the beginning of the transition:
     * {@link Transition#onTransactionReady(int, SurfaceControl.Transaction)}
     */
    void updateWallpaperWindowsInTransition(boolean visible) {
        if (mTransitionController.isCollecting() && mVisibleRequested != visible) {
            waitingToShow = true;
        }
        updateWallpaperWindows(visible);
    }

    void updateWallpaperWindows(boolean visible) {
        if (mVisibleRequested != visible) {
            ProtoLog.d(WM_DEBUG_WALLPAPER, "Wallpaper token %s visible=%b",
@@ -212,12 +198,9 @@ class WallpaperWindowToken extends WindowToken {
        commitVisibility(visible);
    }

    /**
     * Commits the visibility of this token. This will directly update the visibility unless the
     * wallpaper is in a transition.
     */
    /** Commits the visibility of this token. This will directly update the visibility. */
    void commitVisibility(boolean visible) {
        if (visible == isVisible() || waitingToShow) return;
        if (visible == isVisible()) return;

        ProtoLog.v(WM_DEBUG_APP_TRANSITIONS,
                "commitVisibility: %s: visible=%b mVisibleRequested=%b", this,