diff --git a/core/java/android/app/backup/WallpaperBackupHelper.java b/core/java/android/app/backup/WallpaperBackupHelper.java index f256a9536061b..f987468516786 100644 --- a/core/java/android/app/backup/WallpaperBackupHelper.java +++ b/core/java/android/app/backup/WallpaperBackupHelper.java @@ -42,7 +42,7 @@ public class WallpaperBackupHelper extends FileBackupHelperBase implements Backu // If 'true', then apply an acceptable-size heuristic at restore time, dropping back // to the factory default wallpaper if the restored one differs "too much" from the // device's preferred wallpaper image dimensions. - private static final boolean REJECT_OUTSIZED_RESTORE = true; + private static final boolean REJECT_OUTSIZED_RESTORE = false; // When outsized restore rejection is enabled, this is the maximum ratio between the // source and target image heights that will be permitted. The ratio is checked both @@ -60,6 +60,9 @@ public class WallpaperBackupHelper extends FileBackupHelperBase implements Backu public static final String WALLPAPER_IMAGE = new File(Environment.getUserSystemDirectory(UserHandle.USER_SYSTEM), "wallpaper").getAbsolutePath(); + public static final String WALLPAPER_ORIG_IMAGE = + new File(Environment.getUserSystemDirectory(UserHandle.USER_SYSTEM), + "wallpaper_orig").getAbsolutePath(); public static final String WALLPAPER_INFO = new File(Environment.getUserSystemDirectory(UserHandle.USER_SYSTEM), "wallpaper_info.xml").getAbsolutePath(); @@ -199,7 +202,7 @@ public class WallpaperBackupHelper extends FileBackupHelperBase implements Backu // since it does not exist anywhere other than the private wallpaper // file. Slog.d(TAG, "Applying restored wallpaper image."); - f.renameTo(new File(WALLPAPER_IMAGE)); + f.renameTo(new File(WALLPAPER_ORIG_IMAGE)); } } } diff --git a/services/core/java/com/android/server/wallpaper/WallpaperManagerService.java b/services/core/java/com/android/server/wallpaper/WallpaperManagerService.java index 75f6120c51e2b..74a6131b11eb2 100644 --- a/services/core/java/com/android/server/wallpaper/WallpaperManagerService.java +++ b/services/core/java/com/android/server/wallpaper/WallpaperManagerService.java @@ -252,6 +252,7 @@ public class WallpaperManagerService extends IWallpaperManager.Stub { if (DEBUG) { Slog.v(TAG, "Wallpaper written; generating crop"); } + SELinux.restorecon(changedFile); if (moved) { // This is a restore, so generate the crop using any just-restored new // crop guidelines, making sure to preserve our local dimension hints. @@ -259,7 +260,6 @@ public class WallpaperManagerService extends IWallpaperManager.Stub { if (DEBUG) { Slog.v(TAG, "moved-to, therefore restore; reloading metadata"); } - SELinux.restorecon(changedFile); loadSettingsLocked(wallpaper.userId, true); } generateCrop(wallpaper); @@ -353,8 +353,8 @@ public class WallpaperManagerService extends IWallpaperManager.Stub { (cropHint.bottom > options.outHeight ? options.outHeight - cropHint.bottom : 0)); // Don't bother cropping if what we're left with is identity - needCrop = (options.outHeight >= cropHint.height() - && options.outWidth >= cropHint.width()); + needCrop = (options.outHeight > cropHint.height() + && options.outWidth > cropHint.width()); } // scale if the crop height winds up not matching the recommended metrics