summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChristopher Tate <ctate@google.com>2014-09-11 12:37:19 -0700
committerChristopher Tate <ctate@google.com>2014-09-11 12:41:52 -0700
commit90f86baebdb53f2edb5e2bd2b3f6f43bc802f9a9 (patch)
tree081d54c2d7dca987ee075ba5871549893136fd01
parentcde5bb45cc86d181d96ee69da1832e6132162871 (diff)
downloadframeworks_base-90f86baebdb53f2edb5e2bd2b3f6f43bc802f9a9.zip
frameworks_base-90f86baebdb53f2edb5e2bd2b3f6f43bc802f9a9.tar.gz
frameworks_base-90f86baebdb53f2edb5e2bd2b3f6f43bc802f9a9.tar.bz2
Write new wallpaper files from scratch...
...rather than overwriting the existing wallpaper bitmap file "in place." If the new bitmap is smaller than the previous one, we wind up with the previous image's contents as spurious trailing file contents. Also, it means that if any wallpaper image is particularly large on disk, then we'll forever be backing up that high-water-mark amount of data every time the wallpaper is changed. The fix is to open the "write the new bitmap to disk" fd with MODE_TRUNCATE. Bug 17285333 Change-Id: I3d8708d72e316834b7ecec20386153a703efddd9
-rw-r--r--services/core/java/com/android/server/wallpaper/WallpaperManagerService.java2
1 files changed, 1 insertions, 1 deletions
diff --git a/services/core/java/com/android/server/wallpaper/WallpaperManagerService.java b/services/core/java/com/android/server/wallpaper/WallpaperManagerService.java
index e1ade63..a8245e7 100644
--- a/services/core/java/com/android/server/wallpaper/WallpaperManagerService.java
+++ b/services/core/java/com/android/server/wallpaper/WallpaperManagerService.java
@@ -843,7 +843,7 @@ public class WallpaperManagerService extends IWallpaperManager.Stub {
}
File file = new File(dir, WALLPAPER);
ParcelFileDescriptor fd = ParcelFileDescriptor.open(file,
- MODE_CREATE|MODE_READ_WRITE);
+ MODE_CREATE|MODE_READ_WRITE|MODE_TRUNCATE);
if (!SELinux.restorecon(file)) {
return null;
}