Skip to content

Commit 3da3182

Browse files
author
Dianne Hackborn
committed
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
1 parent 0d6ff01 commit 3da3182

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

services/java/com/android/server/WallpaperManagerService.java

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,7 @@ class WallpaperManagerService extends IWallpaperManager.Stub {
102102
* everytime the wallpaper is changed.
103103
*/
104104
private final FileObserver mWallpaperObserver = new FileObserver(
105-
WALLPAPER_DIR.getAbsolutePath(), CREATE | CLOSE_WRITE | DELETE | DELETE_SELF) {
105+
WALLPAPER_DIR.getAbsolutePath(), CLOSE_WRITE | DELETE | DELETE_SELF) {
106106
@Override
107107
public void onEvent(int event, String path) {
108108
if (path == null) {
@@ -118,8 +118,11 @@ public void onEvent(int event, String path) {
118118
File changedFile = new File(WALLPAPER_DIR, path);
119119
if (WALLPAPER_FILE.equals(changedFile)) {
120120
notifyCallbacksLocked();
121-
if (mWallpaperComponent == null || mImageWallpaperPending) {
122-
mImageWallpaperPending = false;
121+
if (mWallpaperComponent == null || event != CLOSE_WRITE
122+
|| mImageWallpaperPending) {
123+
if (event == CLOSE_WRITE) {
124+
mImageWallpaperPending = false;
125+
}
123126
bindWallpaperComponentLocked(mImageWallpaperComponent,
124127
true, false);
125128
saveSettingsLocked();

0 commit comments

Comments
 (0)