From 2cdd3f2b62188ae5d688553ac9ddfcf8b5dfa322 Mon Sep 17 00:00:00 2001 From: Christopher Tate Date: Mon, 14 Mar 2016 17:36:16 -0700 Subject: [PATCH] Don't stomp live wallpapers when tidying up imagery Tidying up the wallpaper imagery bookkeeping mustn't accidentally overwrite any user-selected live wallpaper usage. Only do the full reset when it's needful *and* we expect to need it. Bug 27537903 Change-Id: Iaacc750a24ef36ee4e4cc436b62055b51b49b235 --- .../wallpaper/WallpaperManagerService.java | 28 ++++++++++++++----- 1 file changed, 21 insertions(+), 7 deletions(-) diff --git a/services/core/java/com/android/server/wallpaper/WallpaperManagerService.java b/services/core/java/com/android/server/wallpaper/WallpaperManagerService.java index ffdd89ae364cb..3cf95900edde6 100644 --- a/services/core/java/com/android/server/wallpaper/WallpaperManagerService.java +++ b/services/core/java/com/android/server/wallpaper/WallpaperManagerService.java @@ -730,13 +730,27 @@ public class WallpaperManagerService extends IWallpaperManager.Stub { public void systemRunning() { if (DEBUG) Slog.v(TAG, "systemReady"); WallpaperData wallpaper = mWallpaperMap.get(UserHandle.USER_SYSTEM); - // No crop file? Make sure we've finished the processing sequence if necessary - if (!wallpaper.cropExists()) { - generateCrop(wallpaper); - } - // Still nothing? Fall back to default. - if (!wallpaper.cropExists()) { - clearWallpaperLocked(false, FLAG_SET_SYSTEM, UserHandle.USER_SYSTEM, null); + // If we think we're going to be using the system image wallpaper imagery, make + // sure we have something to render + if (mImageWallpaper.equals(wallpaper.nextWallpaperComponent)) { + // No crop file? Make sure we've finished the processing sequence if necessary + if (!wallpaper.cropExists()) { + if (DEBUG) { + Slog.i(TAG, "No crop; regenerating from source"); + } + generateCrop(wallpaper); + } + // Still nothing? Fall back to default. + if (!wallpaper.cropExists()) { + if (DEBUG) { + Slog.i(TAG, "Unable to regenerate crop; resetting"); + } + clearWallpaperLocked(false, FLAG_SET_SYSTEM, UserHandle.USER_SYSTEM, null); + } + } else { + if (DEBUG) { + Slog.i(TAG, "Nondefault wallpaper component; gracefully ignoring"); + } } switchWallpaper(wallpaper, null); wallpaper.wallpaperObserver = new WallpaperObserver(wallpaper);