Merge "Don't set ImageWallpaper to home only the first time" into udc-dev am: 4e5473b67e

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

Change-Id: I35c5b41a4ad3c9aed8ae88c9d7430c95aa9cbfb1
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
This commit is contained in:
Lucas Dupin
2023-06-30 18:48:26 +00:00
committed by Automerger Merge Worker

View File

@@ -3050,7 +3050,10 @@ public class WallpaperManagerService extends IWallpaperManager.Stub
if (which == FLAG_SYSTEM && systemIsStatic && systemIsBoth) {
Slog.i(TAG, "Migrating current wallpaper to be lock-only before"
+ " updating system wallpaper");
migrateStaticSystemToLockWallpaperLocked(userId);
if (!migrateStaticSystemToLockWallpaperLocked(userId)
&& !isLockscreenLiveWallpaperEnabled()) {
which |= FLAG_LOCK;
}
}
wallpaper = getWallpaperSafeLocked(userId, which);
@@ -3078,13 +3081,13 @@ public class WallpaperManagerService extends IWallpaperManager.Stub
}
}
private void migrateStaticSystemToLockWallpaperLocked(int userId) {
private boolean migrateStaticSystemToLockWallpaperLocked(int userId) {
WallpaperData sysWP = mWallpaperMap.get(userId);
if (sysWP == null) {
if (DEBUG) {
Slog.i(TAG, "No system wallpaper? Not tracking for lock-only");
}
return;
return true;
}
// We know a-priori that there is no lock-only wallpaper currently
@@ -3105,11 +3108,13 @@ public class WallpaperManagerService extends IWallpaperManager.Stub
SELinux.restorecon(lockWP.wallpaperFile);
mLastLockWallpaper = lockWP;
}
return true;
} catch (ErrnoException e) {
Slog.e(TAG, "Can't migrate system wallpaper: " + e.getMessage());
// can happen when migrating default wallpaper (which is not stored in wallpaperFile)
Slog.w(TAG, "Couldn't migrate system wallpaper: " + e.getMessage());
lockWP.wallpaperFile.delete();
lockWP.cropFile.delete();
return;
return false;
}
}
@@ -3310,7 +3315,9 @@ public class WallpaperManagerService extends IWallpaperManager.Stub
// therefore it's a shared system+lock image that we need to migrate.
Slog.i(TAG, "Migrating current wallpaper to be lock-only before"
+ "updating system wallpaper");
migrateStaticSystemToLockWallpaperLocked(userId);
if (!migrateStaticSystemToLockWallpaperLocked(userId)) {
which |= FLAG_LOCK;
}
}
}