diff options
| author | 2023-05-02 15:16:32 +0000 | |
|---|---|---|
| committer | 2023-05-02 15:16:32 +0000 | |
| commit | 47e1b24e2e352bcdb13a84ae89a315fda311d930 (patch) | |
| tree | f10e63af78ef0ccafea9ef5825b3133428a07bb6 | |
| parent | 2098b1c5d476b9fa08ad66aeb3b08bac09886542 (diff) | |
| parent | dc80918e174ce1576020a489468441e5dd5a704d (diff) | |
Merge "Include the wallpaper visibility change in the existing keyguard unlocking transition" into udc-dev am: dc80918e17
Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/22336603
Change-Id: I4a6ff80519c9816cd4956fedb989bfe36bd71826
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
5 files changed, 76 insertions, 6 deletions
diff --git a/libs/WindowManager/Shell/src/com/android/wm/shell/transition/Transitions.java b/libs/WindowManager/Shell/src/com/android/wm/shell/transition/Transitions.java index f79f1f7a27b1..a73ab776486b 100644 --- a/libs/WindowManager/Shell/src/com/android/wm/shell/transition/Transitions.java +++ b/libs/WindowManager/Shell/src/com/android/wm/shell/transition/Transitions.java @@ -533,8 +533,12 @@ public class Transitions implements RemoteCallable<Transitions>, final int layer; // Put all the OPEN/SHOW on top if ((change.getFlags() & FLAG_IS_WALLPAPER) != 0) { - // Wallpaper is always at the bottom. - layer = -zSplitLine; + // Wallpaper is always at the bottom, opening wallpaper on top of closing one. + 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) { if (isOpening) { // put on top diff --git a/services/core/java/com/android/server/wm/KeyguardController.java b/services/core/java/com/android/server/wm/KeyguardController.java index 08a6358afbc7..5f6d66011768 100644 --- a/services/core/java/com/android/server/wm/KeyguardController.java +++ b/services/core/java/com/android/server/wm/KeyguardController.java @@ -269,6 +269,8 @@ class KeyguardController { TRANSIT_TO_BACK, transitFlags, null /* trigger */, dc); updateKeyguardSleepToken(); + // Make the home wallpaper visible + dc.mWallpaperController.showHomeWallpaperInTransition(); // Some stack visibility might change (e.g. docked stack) mRootWindowContainer.resumeFocusedTasksTopActivities(); mRootWindowContainer.ensureActivitiesVisible(null, 0, !PRESERVE_WINDOWS); diff --git a/services/core/java/com/android/server/wm/Transition.java b/services/core/java/com/android/server/wm/Transition.java index 5caf6636d912..80f918b9bcab 100644 --- a/services/core/java/com/android/server/wm/Transition.java +++ b/services/core/java/com/android/server/wm/Transition.java @@ -1325,6 +1325,7 @@ class Transition implements BLASTSyncEngine.TransactionReadyListener { // ActivityRecord#canShowWindows() may reject to show its window. The visibility also // needs to be updated for STATE_ABORT. commitVisibleActivities(transaction); + commitVisibleWallpapers(); // Fall-back to the default display if there isn't one participating. final DisplayContent primaryDisplay = !mTargetDisplays.isEmpty() ? mTargetDisplays.get(0) @@ -1357,6 +1358,7 @@ class Transition implements BLASTSyncEngine.TransactionReadyListener { } // Resolve the animating targets from the participants. mTargets = calculateTargets(mParticipants, mChanges); + // Check whether the participants were animated from back navigation. mController.mAtm.mBackNavigationController.onTransactionReady(this, mTargets); 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. /** @see RecentsAnimationController#attachNavigationBarToApp */ private void handleLegacyRecentsStartBehavior(DisplayContent dc, TransitionInfo info) { diff --git a/services/core/java/com/android/server/wm/WallpaperController.java b/services/core/java/com/android/server/wm/WallpaperController.java index f41631683e83..edafe0606b13 100644 --- a/services/core/java/com/android/server/wm/WallpaperController.java +++ b/services/core/java/com/android/server/wm/WallpaperController.java @@ -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() { for (int i = mWallpaperTokens.size() - 1; i >= 0; 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) { // When keyguard goes away, KeyguardController handles the visibility updateWallpaperTokens(visible, mDisplayContent.isKeyguardLocked()); diff --git a/services/core/java/com/android/server/wm/WallpaperWindowToken.java b/services/core/java/com/android/server/wm/WallpaperWindowToken.java index 1ffee05d20ec..5ea8f65b759c 100644 --- a/services/core/java/com/android/server/wm/WallpaperWindowToken.java +++ b/services/core/java/com/android/server/wm/WallpaperWindowToken.java @@ -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) { if (mVisibleRequested != visible) { 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 - * regard for other state (like being in a transition). + * Commits the visibility of this token. This will directly update the visibility unless the + * wallpaper is in a transition. */ void commitVisibility(boolean visible) { - if (visible == isVisible()) return; + if (visible == isVisible() || waitingToShow) return; ProtoLog.v(WM_DEBUG_APP_TRANSITIONS, "commitVisibility: %s: visible=%b mVisibleRequested=%b", this, |