Fix wallpaper restore from pre-N devices
am: ebadfb17e7
Change-Id: I4f88e555929bd9e48983dce64dc66f9e7fd46dc9
This commit is contained in:
@@ -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));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user