am 9856fbd4: Merge "Broaden the filter for wallpaper restore" into honeycomb-mr1

* commit '9856fbd40470c9f441b6c38b980210cfdef821e9':
  Broaden the filter for wallpaper restore
This commit is contained in:
Christopher Tate
2011-03-11 10:48:46 -08:00
committed by Android Git Automerger

View File

@@ -110,11 +110,16 @@ public class WallpaperBackupHelper extends FileBackupHelperBase implements Backu
if (DEBUG) Slog.d(TAG, "Restoring wallpaper image w=" + options.outWidth if (DEBUG) Slog.d(TAG, "Restoring wallpaper image w=" + options.outWidth
+ " h=" + options.outHeight); + " 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 widthRatio = mDesiredMinWidth / options.outWidth;
double heightRatio = mDesiredMinHeight / options.outHeight; double heightRatio = mDesiredMinHeight / options.outHeight;
if (widthRatio > 0.8 && widthRatio < 1.25 if (widthRatio > 0 && widthRatio < 1.33
&& heightRatio > 0.8 && heightRatio < 1.25) { && heightRatio > 0 && heightRatio < 1.33) {
// sufficiently close to our resolution; go ahead and use it // sufficiently close to our resolution; go ahead and use it
if (DEBUG) Slog.d(TAG, "wallpaper dimension match; using"); if (DEBUG) Slog.d(TAG, "wallpaper dimension match; using");
f.renameTo(new File(WALLPAPER_IMAGE)); f.renameTo(new File(WALLPAPER_IMAGE));