summaryrefslogtreecommitdiffstats
path: root/services/backup
diff options
context:
space:
mode:
authorChristopher Tate <ctate@google.com>2014-08-18 14:41:33 -0700
committerDi Wu <arete@google.com>2014-08-18 22:01:43 +0000
commit10ab095a5be2cc45354266b8fbe642c3facafd55 (patch)
tree6ac510265f3e9ac0c9f312feef8de7d1952a5c81 /services/backup
parent71809ee7f63229d0ea4f6169922ddfbfee330fd2 (diff)
downloadframeworks_base-10ab095a5be2cc45354266b8fbe642c3facafd55.zip
frameworks_base-10ab095a5be2cc45354266b8fbe642c3facafd55.tar.gz
frameworks_base-10ab095a5be2cc45354266b8fbe642c3facafd55.tar.bz2
Minor restore fixes
1. We were missing a 'break' in the session-timeout case of message dispatch, so were falling through into a different case. Oops. Fortunately it was benign; the other case's logic was merely logging "hey it doesn't look like there's anything to do here" and cleanly exiting. 2. After a restore operation finishes we were previously always leaving the session timeout clock running. However, this was not appropriate in the case of restore-at-install, when the restore was a one-shot kicked off by the package manager rather than an operation on an ongoing RestoreSession. That logic now properly tidies up the session timeout when winding up the restore in either situation. Bug 17080648 Change-Id: I51d4a50db4feefc4c355230a3bfb926ea2fb5944
Diffstat (limited to 'services/backup')
-rw-r--r--services/backup/java/com/android/server/backup/BackupManagerService.java14
1 files changed, 9 insertions, 5 deletions
diff --git a/services/backup/java/com/android/server/backup/BackupManagerService.java b/services/backup/java/com/android/server/backup/BackupManagerService.java
index c44474d..5900612 100644
--- a/services/backup/java/com/android/server/backup/BackupManagerService.java
+++ b/services/backup/java/com/android/server/backup/BackupManagerService.java
@@ -871,6 +871,7 @@ public class BackupManagerService extends IBackupManager.Stub {
BackupManagerService.this, mActiveRestoreSession));
}
}
+ break;
}
case MSG_FULL_CONFIRMATION_TIMEOUT:
@@ -7538,6 +7539,9 @@ if (MORE_DEBUG) Slog.v(TAG, " + got " + nRead + "; now wanting " + (size - soF
}
}
+ // Clear any ongoing session timeout.
+ mBackupHandler.removeMessages(MSG_RESTORE_TIMEOUT);
+
// If we have a PM token, we must under all circumstances be sure to
// handshake when we've finished.
if (mPmToken > 0) {
@@ -7545,6 +7549,11 @@ if (MORE_DEBUG) Slog.v(TAG, " + got " + nRead + "; now wanting " + (size - soF
try {
mPackageManagerBinder.finishPackageInstall(mPmToken);
} catch (RemoteException e) { /* can't happen */ }
+ } else {
+ // We were invoked via an active restore session, not by the Package
+ // Manager, so start up the session timeout again.
+ mBackupHandler.sendEmptyMessageDelayed(MSG_RESTORE_TIMEOUT,
+ TIMEOUT_RESTORE_INTERVAL);
}
// Kick off any work that may be needed regarding app widget restores
@@ -7558,11 +7567,6 @@ if (MORE_DEBUG) Slog.v(TAG, " + got " + nRead + "; now wanting " + (size - soF
writeRestoreTokens();
}
- // Furthermore we need to reset the session timeout clock
- mBackupHandler.removeMessages(MSG_RESTORE_TIMEOUT);
- mBackupHandler.sendEmptyMessageDelayed(MSG_RESTORE_TIMEOUT,
- TIMEOUT_RESTORE_INTERVAL);
-
// done; we can finally release the wakelock and be legitimately done.
Slog.i(TAG, "Restore complete.");
mWakelock.release();