OSDN Git Service

Handle empty/unspecified crop properly in wallpaper restore
authorChristopher Tate <ctate@google.com>
Mon, 8 Aug 2016 20:09:02 +0000 (13:09 -0700)
committerChristopher Tate <ctate@google.com>
Mon, 8 Aug 2016 23:15:52 +0000 (16:15 -0700)
Pass 'null' as the crop hint when the crop as expressed in the restored
wallpaper metadata is either unspecified or effectively empty.

Bug 30521402
Bug 30274136

Change-Id: I14e5d2bae1ec30fb27e8fd45b340b2ca87f35a01

packages/WallpaperBackup/src/com/android/wallpaperbackup/WallpaperBackupAgent.java

index 402d9ad..82b3050 100644 (file)
@@ -238,7 +238,7 @@ public class WallpaperBackupAgent extends BackupAgent {
                     Slog.v(TAG, "Restored crop hint " + cropHint);
                 }
                 try (FileInputStream in = new FileInputStream(stage)) {
-                    mWm.setStream(in, cropHint, true, which);
+                    mWm.setStream(in, cropHint.isEmpty() ? null : cropHint, true, which);
                 } finally {} // auto-closes 'in'
             }
         }