From 3da318202f401583cef6d548266f67c365fd1805 Mon Sep 17 00:00:00 2001 From: Dianne Hackborn Date: Fri, 21 Oct 2011 12:29:10 -0700 Subject: [PATCH] Fix issue #5342788: Setting wallpaper from gallery set default... ...wallpaper first time IRK81. We were monitoring for file creates when those are not needed, and receiving the initial file create was causing us to be confused. Change-Id: Iccd3b7492c82895dba87f25c4881c538f300d342 --- .../java/com/android/server/WallpaperManagerService.java | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/services/java/com/android/server/WallpaperManagerService.java b/services/java/com/android/server/WallpaperManagerService.java index a0e28ed47f977..7fa404e854940 100644 --- a/services/java/com/android/server/WallpaperManagerService.java +++ b/services/java/com/android/server/WallpaperManagerService.java @@ -102,7 +102,7 @@ class WallpaperManagerService extends IWallpaperManager.Stub { * everytime the wallpaper is changed. */ private final FileObserver mWallpaperObserver = new FileObserver( - WALLPAPER_DIR.getAbsolutePath(), CREATE | CLOSE_WRITE | DELETE | DELETE_SELF) { + WALLPAPER_DIR.getAbsolutePath(), CLOSE_WRITE | DELETE | DELETE_SELF) { @Override public void onEvent(int event, String path) { if (path == null) { @@ -118,8 +118,11 @@ class WallpaperManagerService extends IWallpaperManager.Stub { File changedFile = new File(WALLPAPER_DIR, path); if (WALLPAPER_FILE.equals(changedFile)) { notifyCallbacksLocked(); - if (mWallpaperComponent == null || mImageWallpaperPending) { - mImageWallpaperPending = false; + if (mWallpaperComponent == null || event != CLOSE_WRITE + || mImageWallpaperPending) { + if (event == CLOSE_WRITE) { + mImageWallpaperPending = false; + } bindWallpaperComponentLocked(mImageWallpaperComponent, true, false); saveSettingsLocked();