Merge "Check which file changed before requesting backup" into lmp-mr1-dev
This commit is contained in:
committed by
Android (Google) Code Review
commit
90c0ae637a
@@ -116,6 +116,7 @@ public class WallpaperManagerService extends IWallpaperManager.Stub {
|
|||||||
final WallpaperData mWallpaper;
|
final WallpaperData mWallpaper;
|
||||||
final File mWallpaperDir;
|
final File mWallpaperDir;
|
||||||
final File mWallpaperFile;
|
final File mWallpaperFile;
|
||||||
|
final File mWallpaperInfoFile;
|
||||||
|
|
||||||
public WallpaperObserver(WallpaperData wallpaper) {
|
public WallpaperObserver(WallpaperData wallpaper) {
|
||||||
super(getWallpaperDir(wallpaper.userId).getAbsolutePath(),
|
super(getWallpaperDir(wallpaper.userId).getAbsolutePath(),
|
||||||
@@ -123,6 +124,7 @@ public class WallpaperManagerService extends IWallpaperManager.Stub {
|
|||||||
mWallpaperDir = getWallpaperDir(wallpaper.userId);
|
mWallpaperDir = getWallpaperDir(wallpaper.userId);
|
||||||
mWallpaper = wallpaper;
|
mWallpaper = wallpaper;
|
||||||
mWallpaperFile = new File(mWallpaperDir, WALLPAPER);
|
mWallpaperFile = new File(mWallpaperDir, WALLPAPER);
|
||||||
|
mWallpaperInfoFile = new File(mWallpaperDir, WALLPAPER_INFO);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -131,13 +133,15 @@ public class WallpaperManagerService extends IWallpaperManager.Stub {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
synchronized (mLock) {
|
synchronized (mLock) {
|
||||||
|
File changedFile = new File(mWallpaperDir, path);
|
||||||
|
if (mWallpaperFile.equals(changedFile)
|
||||||
|
|| mWallpaperInfoFile.equals(changedFile)) {
|
||||||
// changing the wallpaper means we'll need to back up the new one
|
// changing the wallpaper means we'll need to back up the new one
|
||||||
long origId = Binder.clearCallingIdentity();
|
long origId = Binder.clearCallingIdentity();
|
||||||
BackupManager bm = new BackupManager(mContext);
|
BackupManager bm = new BackupManager(mContext);
|
||||||
bm.dataChanged();
|
bm.dataChanged();
|
||||||
Binder.restoreCallingIdentity(origId);
|
Binder.restoreCallingIdentity(origId);
|
||||||
|
}
|
||||||
File changedFile = new File(mWallpaperDir, path);
|
|
||||||
if (mWallpaperFile.equals(changedFile)) {
|
if (mWallpaperFile.equals(changedFile)) {
|
||||||
notifyCallbacksLocked(mWallpaper);
|
notifyCallbacksLocked(mWallpaper);
|
||||||
final boolean written = (event == CLOSE_WRITE || event == MOVED_TO);
|
final boolean written = (event == CLOSE_WRITE || event == MOVED_TO);
|
||||||
|
|||||||
Reference in New Issue
Block a user