summaryrefslogtreecommitdiffstats
path: root/services/java
diff options
context:
space:
mode:
authorChristopher Tate <ctate@google.com>2009-06-24 17:29:38 -0700
committerChristopher Tate <ctate@google.com>2009-06-24 18:45:56 -0700
commit111bd4acdb378266221b430a284f88a3990a3958 (patch)
tree1ca7da34b22ffc0ab846151633916e203544ecae /services/java
parent69e1f472c33e241f729c470285a5680866ede75c (diff)
downloadframeworks_base-111bd4acdb378266221b430a284f88a3990a3958.zip
frameworks_base-111bd4acdb378266221b430a284f88a3990a3958.tar.gz
frameworks_base-111bd4acdb378266221b430a284f88a3990a3958.tar.bz2
Start backing up wallpaper
This CL does the following: + adds an AbsoluteFileBackupHelper class for managing backup of files known by absolute path, not based off of the app's getFilesDir() root + bumps up the collection interval from its testing-only default of 1 second to 3 minutes + adds a SystemBackupAgent class to the main system package and names it as the android:backupAgent for the main OS package. Right now this agent only backs up & restores the wallpaper file. + amend the Wallpaper Service to inform the Backup Manager when the wallpaper changes. On the subject of the 3-minute collection interval before the backup actually occurs: this can be short-circuited from an adb shell. Running the command 'bmgr run' will cause the Backup Manager to kick off any pending backup operations immediately.
Diffstat (limited to 'services/java')
-rw-r--r--services/java/com/android/server/BackupManagerService.java6
-rw-r--r--services/java/com/android/server/WallpaperService.java13
2 files changed, 15 insertions, 4 deletions
diff --git a/services/java/com/android/server/BackupManagerService.java b/services/java/com/android/server/BackupManagerService.java
index fdd4617..efa6179 100644
--- a/services/java/com/android/server/BackupManagerService.java
+++ b/services/java/com/android/server/BackupManagerService.java
@@ -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);
}
}
diff --git a/services/java/com/android/server/WallpaperService.java b/services/java/com/android/server/WallpaperService.java
index 5532894..d921baf 100644
--- a/services/java/com/android/server/WallpaperService.java
+++ b/services/java/com/android/server/WallpaperService.java
@@ -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);
}