From be88ec9e5d18d9b7f72807d06cc5195f253d7aa5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Aur=C3=A9lien=20Pomini?= <pomini@google.com> Date: Mon, 16 Oct 2023 17:15:49 +0000 Subject: [PATCH] Fix getWallpaperSafeLocked The first time this method is called for a system-only wallpaper, if the lock wallpaper is not loaded yet, it will not be aware of the lock wallpaper and will think that the system wallpaper is sys+lock. This happens after a reboot + user switch when the secondary user have two different wallpapers. This may fix other cases where the lock screen wallpaper is set to same as home screen Bug: 300537586 Test: atest WallpaperManagerTest Test: manually check that the bug is fixed (cherry picked from https://googleplex-android-review.googlesource.com/q/commit:58e3cfe430ed60bd4bb56117824d6736831562ef) Merged-In: Ib37f83233deac7198997910991ffcce75b357aae Change-Id: Ib37f83233deac7198997910991ffcce75b357aae --- .../com/android/server/wallpaper/WallpaperManagerService.java | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/services/core/java/com/android/server/wallpaper/WallpaperManagerService.java b/services/core/java/com/android/server/wallpaper/WallpaperManagerService.java index 6601467e22246..999e09e9d55fc 100644 --- a/services/core/java/com/android/server/wallpaper/WallpaperManagerService.java +++ b/services/core/java/com/android/server/wallpaper/WallpaperManagerService.java @@ -3906,7 +3906,9 @@ public class WallpaperManagerService extends IWallpaperManager.Stub if (wallpaper == null) { // common case, this is the first lookup post-boot of the system or // unified lock, so we bring up the saved state lazily now and recheck. - int whichLoad = (which == FLAG_LOCK) ? FLAG_LOCK : FLAG_SYSTEM; + // if we're loading the system wallpaper for the first time, also load the lock + // wallpaper to determine if the system wallpaper is system+lock or system only. + int whichLoad = (which == FLAG_LOCK) ? FLAG_LOCK : FLAG_SYSTEM | FLAG_LOCK; loadSettingsLocked(userId, false, whichLoad); wallpaper = whichSet.get(userId); if (wallpaper == null) { -- GitLab