summaryrefslogtreecommitdiffstats
path: root/services/java
diff options
context:
space:
mode:
authorJoe Onorato <joeo@android.com>2009-05-19 13:41:21 -0700
committerJoe Onorato <joeo@android.com>2009-05-20 11:24:20 -0700
commitd2110dbce071a236b6176de344ca797b737542eb (patch)
tree996e044c8c7bf49463394bc911f0277d969bde5d /services/java
parent40f5a4ea3bc90e43a442ab336f2342020bba86b3 (diff)
downloadframeworks_base-d2110dbce071a236b6176de344ca797b737542eb.zip
frameworks_base-d2110dbce071a236b6176de344ca797b737542eb.tar.gz
frameworks_base-d2110dbce071a236b6176de344ca797b737542eb.tar.bz2
Hook up the backup data writer, and add a utility to read the backup data files.
Diffstat (limited to 'services/java')
-rw-r--r--services/java/com/android/server/BackupManagerService.java21
1 files changed, 15 insertions, 6 deletions
diff --git a/services/java/com/android/server/BackupManagerService.java b/services/java/com/android/server/BackupManagerService.java
index 983329b..e3fff81 100644
--- a/services/java/com/android/server/BackupManagerService.java
+++ b/services/java/com/android/server/BackupManagerService.java
@@ -158,11 +158,13 @@ class BackupManagerService extends IBackupManager.Stub {
case MSG_RUN_BACKUP:
// snapshot the pending-backup set and work on that
synchronized (mQueueLock) {
- mBackupQueue = new ArrayList();
- for (BackupRequest b: mPendingBackups.values()) {
- mBackupQueue.add(b);
+ if (mBackupQueue == null) {
+ mBackupQueue = new ArrayList();
+ for (BackupRequest b: mPendingBackups.values()) {
+ mBackupQueue.add(b);
+ }
+ mPendingBackups = new HashMap<ComponentName,BackupRequest>();
}
- mPendingBackups = new HashMap<ComponentName,BackupRequest>();
// !!! TODO: start a new backup-queue journal file too
// WARNING: If we crash after this line, anything in mPendingBackups will
// be lost. FIX THIS.
@@ -190,9 +192,13 @@ class BackupManagerService extends IBackupManager.Stub {
BackupRequest request;
synchronized (mQueueLock) {
int queueSize = mBackupQueue.size();
+ Log.d(TAG, "mBackupQueue.size=" + queueSize);
if (queueSize == 0) {
mBackupQueue = null;
- // TODO: Anything else to do here?
+ // if there are pending backups, start those after a short delay
+ if (mPendingBackups.size() > 0) {
+ mBackupHandler.sendEmptyMessageDelayed(MSG_RUN_BACKUP, COLLECTION_INTERVAL);
+ }
return;
}
request = mBackupQueue.get(0);
@@ -267,7 +273,7 @@ class BackupManagerService extends IBackupManager.Stub {
// !!! TODO: After successful transport, delete the now-stale data
// and juggle the files so that next time the new state is passed
- backupDataName.delete();
+ //backupDataName.delete();
newStateName.renameTo(savedStateName);
} catch (FileNotFoundException fnf) {
@@ -284,6 +290,9 @@ class BackupManagerService extends IBackupManager.Stub {
mBackupQueue.remove(0);
}
mContext.unbindService(mBackupHandler);
+
+ // start the next one
+ startOneService();
}
// Add the backup services in the given package to our set of known backup participants.