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
This commit is contained in:
Marzia Favaro
2023-06-05 13:50:48 +00:00
parent f5bb534ecc
commit de56d35db1
2 changed files with 12 additions and 20 deletions

View File

@@ -1065,7 +1065,7 @@ class DisplayContent extends RootDisplayArea implements WindowManagerPolicy.Disp
if (obscuredChanged && w.isVisible() && mWallpaperController.isWallpaperTarget(w)) {
// This is the wallpaper target and its obscured state changed... make sure the
// current wallpaper's visibility has been updated accordingly.
mWallpaperController.updateWallpaperVisibility();
mWallpaperController.updateWallpaperTokens(mDisplayContent.isKeyguardLocked());
}
w.handleWindowMovedIfNeeded();

View File

@@ -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() {
return mWallpaperTarget != null && mWallpaperTarget.isAnimating(TRANSITION | PARENTS)
&& (mWallpaperTarget.mActivityRecord == null
|| !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}.
* This is called during the keyguard unlocking transition
@@ -801,11 +784,20 @@ class WallpaperController {
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.
*/
private void updateWallpaperTokens(boolean visibility, boolean locked) {
WindowState topWallpaper = mFindResults.getTopWallpaper(locked);
private void updateWallpaperTokens(boolean visibility, boolean keyguardLocked) {
WindowState topWallpaper = mFindResults.getTopWallpaper(keyguardLocked);
WallpaperWindowToken topWallpaperToken =
topWallpaper == null ? null : topWallpaper.mToken.asWallpaperToken();
for (int curTokenNdx = mWallpaperTokens.size() - 1; curTokenNdx >= 0; curTokenNdx--) {