diff options
author | Christopher Tate <ctate@google.com> | 2010-12-10 17:12:19 -0800 |
---|---|---|
committer | Christopher Tate <ctate@google.com> | 2010-12-13 16:41:24 -0800 |
commit | 3f64f8d8fc05189777e83b4efd3882cbc661fdeb (patch) | |
tree | 124c21826f04e229fa22a9478794381b98c82eff /services/java/com/android/server/SystemBackupAgent.java | |
parent | ffdd591a829af7fddd36a7b80d2a3b8188c871a6 (diff) | |
download | frameworks_base-3f64f8d8fc05189777e83b4efd3882cbc661fdeb.zip frameworks_base-3f64f8d8fc05189777e83b4efd3882cbc661fdeb.tar.gz frameworks_base-3f64f8d8fc05189777e83b4efd3882cbc661fdeb.tar.bz2 |
Don't restore wildly wrong sized wallpapers
If the dimensions of the original are sufficiently different from the
device's preferred dimensions, just don't restore the image. This
avoids bad letterboxing / clipping on e.g. phone <-> tablet data
migration.
The expansion/shrinkage ratios used here allow restores of saved
wallpaper images among HVGA devices, among WVGA variants, and
among tablets; but skip restoring wallpapers across those
categories (where severe clipping or letterboxing would occur).
Bug 3261863
Change-Id: I75e75d6401d18f1df10d75796ee04e21d2302cfa
Diffstat (limited to 'services/java/com/android/server/SystemBackupAgent.java')
-rw-r--r-- | services/java/com/android/server/SystemBackupAgent.java | 15 |
1 files changed, 6 insertions, 9 deletions
diff --git a/services/java/com/android/server/SystemBackupAgent.java b/services/java/com/android/server/SystemBackupAgent.java index fff1874..a1f43b4 100644 --- a/services/java/com/android/server/SystemBackupAgent.java +++ b/services/java/com/android/server/SystemBackupAgent.java @@ -16,18 +16,16 @@ package com.android.server; -import android.app.backup.AbsoluteFileBackupHelper; import android.app.backup.BackupDataInput; -import android.app.backup.BackupDataInputStream; import android.app.backup.BackupDataOutput; -import android.app.backup.BackupHelper; import android.app.backup.BackupAgentHelper; +import android.app.backup.WallpaperBackupHelper; import android.content.Context; import android.os.ParcelFileDescriptor; import android.os.ServiceManager; -import android.os.SystemService; import android.util.Slog; + import java.io.File; import java.io.IOException; @@ -54,7 +52,7 @@ public class SystemBackupAgent extends BackupAgentHelper { // TODO: Send a delete for any stored wallpaper image in this case? files = new String[] { WALLPAPER_INFO }; } - addHelper("wallpaper", new AbsoluteFileBackupHelper(SystemBackupAgent.this, files)); + addHelper("wallpaper", new WallpaperBackupHelper(SystemBackupAgent.this, files)); super.onBackup(oldState, data, newState); } @@ -62,12 +60,11 @@ public class SystemBackupAgent extends BackupAgentHelper { public void onRestore(BackupDataInput data, int appVersionCode, ParcelFileDescriptor newState) throws IOException { // On restore, we also support a previous data schema "system_files" - addHelper("wallpaper", new AbsoluteFileBackupHelper(SystemBackupAgent.this, + addHelper("wallpaper", new WallpaperBackupHelper(SystemBackupAgent.this, new String[] { WALLPAPER_IMAGE, WALLPAPER_INFO })); - addHelper("system_files", new AbsoluteFileBackupHelper(SystemBackupAgent.this, + addHelper("system_files", new WallpaperBackupHelper(SystemBackupAgent.this, new String[] { WALLPAPER_IMAGE })); - boolean success = false; try { super.onRestore(data, appVersionCode, newState); @@ -75,7 +72,7 @@ public class SystemBackupAgent extends BackupAgentHelper { Context.WALLPAPER_SERVICE); wallpaper.settingsRestored(); } catch (IOException ex) { - // If there was a failure, delete everything for the wallpaper, this is too aggresive, + // If there was a failure, delete everything for the wallpaper, this is too aggressive, // but this is hopefully a rare failure. Slog.d(TAG, "restore failed", ex); (new File(WALLPAPER_IMAGE)).delete(); |