am a7de3845: Only write to the pending-backup journal when necessary

Merge commit 'a7de3845507b7bf57a2c7b26fb08f05b193697d6'

* commit 'a7de3845507b7bf57a2c7b26fb08f05b193697d6':
  Only write to the pending-backup journal when necessary
This commit is contained in:
Christopher Tate
2009-07-07 14:53:56 -07:00
committed by The Android Open Source Project

View File

@@ -1212,10 +1212,12 @@ class BackupManagerService extends IBackupManager.Stub {
// Add the caller to the set of pending backups. If there is
// one already there, then overwrite it, but no harm done.
BackupRequest req = new BackupRequest(app, false);
mPendingBackups.put(app, req);
// Journal this request in case of crash
writeToJournalLocked(packageName);
if (mPendingBackups.put(app, req) == null) {
// Journal this request in case of crash. The put()
// operation returned null when this package was not already
// in the set; we want to avoid touching the disk redundantly.
writeToJournalLocked(packageName);
}
}
}