summaryrefslogtreecommitdiffstats
path: root/core
diff options
context:
space:
mode:
authorChristopher Tate <ctate@google.com>2011-03-10 17:50:31 -0800
committerChristopher Tate <ctate@google.com>2011-03-10 17:53:53 -0800
commit9b95a4fcdce4b1a7a418e36de2ddc4d2c3acfc69 (patch)
treee1f1e403ae72e0e07a1c4f8ed3e1cc5ac6f69f13 /core
parent8d257f85acc3316b9ba451337f7cbea9000eb8cf (diff)
downloadframeworks_base-9b95a4fcdce4b1a7a418e36de2ddc4d2c3acfc69.zip
frameworks_base-9b95a4fcdce4b1a7a418e36de2ddc4d2c3acfc69.tar.gz
frameworks_base-9b95a4fcdce4b1a7a418e36de2ddc4d2c3acfc69.tar.bz2
Broaden the filter for wallpaper restore
Tweak the filter parameters so that we now use any restored wallpaper image that is larger than our ideal size, and will reject any smaller images only if they are *much* smaller than our ideal size. The specific threshold used here will just barely reject Nexus One or Droid sized wallpapers for restore onto a Xoom, but will pass anything larger. Bug 4070129 Change-Id: I889bdb3ef5011343b2fccb2f81c6abc2f4603ee2
Diffstat (limited to 'core')
-rw-r--r--core/java/android/app/backup/WallpaperBackupHelper.java11
1 files changed, 8 insertions, 3 deletions
diff --git a/core/java/android/app/backup/WallpaperBackupHelper.java b/core/java/android/app/backup/WallpaperBackupHelper.java
index 6539711..55368d6 100644
--- a/core/java/android/app/backup/WallpaperBackupHelper.java
+++ b/core/java/android/app/backup/WallpaperBackupHelper.java
@@ -110,11 +110,16 @@ public class WallpaperBackupHelper extends FileBackupHelperBase implements Backu
if (DEBUG) Slog.d(TAG, "Restoring wallpaper image w=" + options.outWidth
+ " h=" + options.outHeight);
- // how much does the image differ from our preference?
+ // How much does the image differ from our preference? The threshold
+ // here is set to accept any image larger than our target, because
+ // scaling down is acceptable; but to reject images that are deemed
+ // "too small" to scale up attractively. The value 1.33 is just barely
+ // too low to pass Nexus 1 or Droid wallpapers for use on a Xoom, but
+ // will pass anything relatively larger.
double widthRatio = mDesiredMinWidth / options.outWidth;
double heightRatio = mDesiredMinHeight / options.outHeight;
- if (widthRatio > 0.8 && widthRatio < 1.25
- && heightRatio > 0.8 && heightRatio < 1.25) {
+ if (widthRatio > 0 && widthRatio < 1.33
+ && heightRatio > 0 && heightRatio < 1.33) {
// sufficiently close to our resolution; go ahead and use it
if (DEBUG) Slog.d(TAG, "wallpaper dimension match; using");
f.renameTo(new File(WALLPAPER_IMAGE));