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

Commit edfc3b7f authored by Marzia Favaro's avatar Marzia Favaro Committed by Automerger Merge Worker
Browse files

Merge "Include the wallpaper visibility change in the existing keyguard...

Merge "Include the wallpaper visibility change in the existing keyguard unlocking transition" into udc-dev am: dc80918e am: 56529d0f

Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/22336603



Change-Id: Ib26d0c5f776e33ae9fe99f2b93da107fef757bb3
Signed-off-by: default avatarAutomerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
parents 6a9efb41 56529d0f
Loading
Loading
Loading
Loading
+6 −2
Original line number Original line Diff line number Diff line
@@ -533,8 +533,12 @@ public class Transitions implements RemoteCallable<Transitions>,
            final int layer;
            final int layer;
            // Put all the OPEN/SHOW on top
            // Put all the OPEN/SHOW on top
            if ((change.getFlags() & FLAG_IS_WALLPAPER) != 0) {
            if ((change.getFlags() & FLAG_IS_WALLPAPER) != 0) {
                // Wallpaper is always at the bottom.
                // Wallpaper is always at the bottom, opening wallpaper on top of closing one.
                layer = -zSplitLine;
                if (mode == TRANSIT_OPEN || mode == TRANSIT_TO_FRONT) {
                    layer = -zSplitLine + numChanges - i;
                } else {
                    layer = -zSplitLine - i;
                }
            } else if (mode == TRANSIT_OPEN || mode == TRANSIT_TO_FRONT) {
            } else if (mode == TRANSIT_OPEN || mode == TRANSIT_TO_FRONT) {
                if (isOpening) {
                if (isOpening) {
                    // put on top
                    // put on top
+2 −0
Original line number Original line Diff line number Diff line
@@ -269,6 +269,8 @@ class KeyguardController {
                    TRANSIT_TO_BACK, transitFlags, null /* trigger */, dc);
                    TRANSIT_TO_BACK, transitFlags, null /* trigger */, dc);
            updateKeyguardSleepToken();
            updateKeyguardSleepToken();


            // Make the home wallpaper visible
            dc.mWallpaperController.showHomeWallpaperInTransition();
            // Some stack visibility might change (e.g. docked stack)
            // Some stack visibility might change (e.g. docked stack)
            mRootWindowContainer.resumeFocusedTasksTopActivities();
            mRootWindowContainer.resumeFocusedTasksTopActivities();
            mRootWindowContainer.ensureActivitiesVisible(null, 0, !PRESERVE_WINDOWS);
            mRootWindowContainer.ensureActivitiesVisible(null, 0, !PRESERVE_WINDOWS);
+26 −0
Original line number Original line Diff line number Diff line
@@ -1325,6 +1325,7 @@ class Transition implements BLASTSyncEngine.TransactionReadyListener {
        // ActivityRecord#canShowWindows() may reject to show its window. The visibility also
        // ActivityRecord#canShowWindows() may reject to show its window. The visibility also
        // needs to be updated for STATE_ABORT.
        // needs to be updated for STATE_ABORT.
        commitVisibleActivities(transaction);
        commitVisibleActivities(transaction);
        commitVisibleWallpapers();


        // Fall-back to the default display if there isn't one participating.
        // Fall-back to the default display if there isn't one participating.
        final DisplayContent primaryDisplay = !mTargetDisplays.isEmpty() ? mTargetDisplays.get(0)
        final DisplayContent primaryDisplay = !mTargetDisplays.isEmpty() ? mTargetDisplays.get(0)
@@ -1357,6 +1358,7 @@ class Transition implements BLASTSyncEngine.TransactionReadyListener {
        }
        }
        // Resolve the animating targets from the participants.
        // Resolve the animating targets from the participants.
        mTargets = calculateTargets(mParticipants, mChanges);
        mTargets = calculateTargets(mParticipants, mChanges);

        // Check whether the participants were animated from back navigation.
        // Check whether the participants were animated from back navigation.
        mController.mAtm.mBackNavigationController.onTransactionReady(this, mTargets);
        mController.mAtm.mBackNavigationController.onTransactionReady(this, mTargets);
        final TransitionInfo info = calculateTransitionInfo(mType, mFlags, mTargets, transaction);
        final TransitionInfo info = calculateTransitionInfo(mType, mFlags, mTargets, transaction);
@@ -1633,6 +1635,30 @@ class Transition implements BLASTSyncEngine.TransactionReadyListener {
        }
        }
    }
    }


    /**
     * Reset waitingToshow for all wallpapers, and commit the visibility of the visible ones
     */
    private void commitVisibleWallpapers() {
        boolean showWallpaper = shouldWallpaperBeVisible();
        for (int i = mParticipants.size() - 1; i >= 0; --i) {
            final WallpaperWindowToken wallpaper = mParticipants.valueAt(i).asWallpaperToken();
            if (wallpaper != null) {
                wallpaper.waitingToShow = false;
                if (!wallpaper.isVisible() && wallpaper.isVisibleRequested()) {
                    wallpaper.commitVisibility(showWallpaper);
                }
            }
        }
    }

    private boolean shouldWallpaperBeVisible() {
        for (int i = mParticipants.size() - 1; i >= 0; --i) {
            WindowContainer participant = mParticipants.valueAt(i);
            if (participant.showWallpaper()) return true;
        }
        return false;
    }

    // TODO(b/188595497): Remove after migrating to shell.
    // TODO(b/188595497): Remove after migrating to shell.
    /** @see RecentsAnimationController#attachNavigationBarToApp */
    /** @see RecentsAnimationController#attachNavigationBarToApp */
    private void handleLegacyRecentsStartBehavior(DisplayContent dc, TransitionInfo info) {
    private void handleLegacyRecentsStartBehavior(DisplayContent dc, TransitionInfo info) {
+25 −1
Original line number Original line Diff line number Diff line
@@ -339,6 +339,31 @@ class WallpaperController {
        }
        }
    }
    }


    /**
     * Change the visibility if wallpaper is home screen only.
     * This is called during the keyguard unlocking transition
     * (see {@link KeyguardController#keyguardGoingAway(int, int)}) and thus assumes that if the
     * system wallpaper is shared with lock, then it needs no animation.
     */
    public void showHomeWallpaperInTransition() {
        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 home wallpaper and hide lock
            hideWhenLocked.mToken.asWallpaperToken().updateWallpaperWindowsInTransition(true);
            showWhenLocked.mToken.asWallpaperToken().updateWallpaperWindowsInTransition(false);
        }
    }

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


        // Keep both wallpapers visible unless the keyguard is locked (then hide private wp)
        if (!mDisplayContent.isKeyguardGoingAway() || !mIsLockscreenLiveWallpaperEnabled) {
        if (!mDisplayContent.isKeyguardGoingAway() || !mIsLockscreenLiveWallpaperEnabled) {
            // When keyguard goes away, KeyguardController handles the visibility
            // When keyguard goes away, KeyguardController handles the visibility
            updateWallpaperTokens(visible, mDisplayContent.isKeyguardLocked());
            updateWallpaperTokens(visible, mDisplayContent.isKeyguardLocked());
+17 −3
Original line number Original line Diff line number Diff line
@@ -128,6 +128,20 @@ 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) {
    void updateWallpaperWindows(boolean visible) {
        if (mVisibleRequested != visible) {
        if (mVisibleRequested != visible) {
            ProtoLog.d(WM_DEBUG_WALLPAPER, "Wallpaper token %s visible=%b",
            ProtoLog.d(WM_DEBUG_WALLPAPER, "Wallpaper token %s visible=%b",
@@ -199,11 +213,11 @@ class WallpaperWindowToken extends WindowToken {
    }
    }


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


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