am 5416d7c9: Merge change 5317 into donut
Merge commit '5416d7c905e723a978ac29ccaf22a91b76e9d5c2' * commit '5416d7c905e723a978ac29ccaf22a91b76e9d5c2': Start backing up wallpaper
This commit is contained in:
committed by
The Android Open Source Project
commit
cc79800a74
@@ -76,8 +76,7 @@ class BackupManagerService extends IBackupManager.Stub {
|
||||
private static final boolean DEBUG = true;
|
||||
|
||||
// Default time to wait after data changes before we back up the data
|
||||
private static final long COLLECTION_INTERVAL = 1000;
|
||||
//private static final long COLLECTION_INTERVAL = 3 * 60 * 1000;
|
||||
private static final long COLLECTION_INTERVAL = 3 * 60 * 1000;
|
||||
|
||||
private static final int MSG_RUN_BACKUP = 1;
|
||||
private static final int MSG_RUN_FULL_BACKUP = 2;
|
||||
@@ -360,7 +359,8 @@ class BackupManagerService extends IBackupManager.Stub {
|
||||
if (DEBUG) {
|
||||
Log.v(TAG, "Adding " + targetPkgs.size() + " backup participants:");
|
||||
for (PackageInfo p : targetPkgs) {
|
||||
Log.v(TAG, " " + p + " agent=" + p.applicationInfo.backupAgentName);
|
||||
Log.v(TAG, " " + p + " agent=" + p.applicationInfo.backupAgentName
|
||||
+ " uid=" + p.applicationInfo.uid);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -18,8 +18,10 @@ package com.android.server;
|
||||
|
||||
import static android.os.FileObserver.*;
|
||||
import static android.os.ParcelFileDescriptor.*;
|
||||
|
||||
import android.app.IWallpaperService;
|
||||
import android.app.IWallpaperServiceCallback;
|
||||
import android.backup.BackupManager;
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.content.SharedPreferences;
|
||||
@@ -154,7 +156,16 @@ class WallpaperService extends IWallpaperService.Stub {
|
||||
public ParcelFileDescriptor setWallpaper() {
|
||||
checkPermission(android.Manifest.permission.SET_WALLPAPER);
|
||||
try {
|
||||
return ParcelFileDescriptor.open(WALLPAPER_FILE, MODE_CREATE|MODE_READ_WRITE);
|
||||
ParcelFileDescriptor fd = ParcelFileDescriptor.open(WALLPAPER_FILE,
|
||||
MODE_CREATE|MODE_READ_WRITE);
|
||||
|
||||
// changing the wallpaper means we'll need to back up the new one
|
||||
long origId = Binder.clearCallingIdentity();
|
||||
BackupManager bm = new BackupManager(mContext);
|
||||
bm.dataChanged();
|
||||
Binder.restoreCallingIdentity(origId);
|
||||
|
||||
return fd;
|
||||
} catch (FileNotFoundException e) {
|
||||
if (Config.LOGD) Log.d(TAG, "Error setting wallpaper", e);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user