Merge "Gracefully handle "needs init" transport errors at finish"
This commit is contained in:
committed by
Android (Google) Code Review
commit
b765e45f00
@@ -1966,6 +1966,9 @@ class BackupManagerService extends IBackupManager.Stub {
|
|||||||
synchronized (mQueueLock) {
|
synchronized (mQueueLock) {
|
||||||
mBackupRunning = false;
|
mBackupRunning = false;
|
||||||
if (mStatus == BackupConstants.TRANSPORT_NOT_INITIALIZED) {
|
if (mStatus == BackupConstants.TRANSPORT_NOT_INITIALIZED) {
|
||||||
|
// Make sure we back up everything and perform the one-time init
|
||||||
|
clearMetadata();
|
||||||
|
if (DEBUG) Slog.d(TAG, "Server requires init; rerunning");
|
||||||
backupNow();
|
backupNow();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1975,6 +1978,12 @@ class BackupManagerService extends IBackupManager.Stub {
|
|||||||
mWakelock.release();
|
mWakelock.release();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Remove the PM metadata state. This will generate an init on the next pass.
|
||||||
|
void clearMetadata() {
|
||||||
|
final File pmState = new File(mStateDir, PACKAGE_MANAGER_SENTINEL);
|
||||||
|
if (pmState.exists()) pmState.delete();
|
||||||
|
}
|
||||||
|
|
||||||
// Invoke an agent's doBackup() and start a timeout message spinning on the main
|
// Invoke an agent's doBackup() and start a timeout message spinning on the main
|
||||||
// handler in case it doesn't get back to us.
|
// handler in case it doesn't get back to us.
|
||||||
int invokeAgentForBackup(String packageName, IBackupAgent agent,
|
int invokeAgentForBackup(String packageName, IBackupAgent agent,
|
||||||
|
|||||||
Reference in New Issue
Block a user