summaryrefslogtreecommitdiffstats
path: root/services/backup
diff options
context:
space:
mode:
authorChristopher Tate <ctate@google.com>2014-10-15 17:49:42 -0700
committerChristopher Tate <ctate@android.com>2014-10-16 01:34:01 +0000
commit0f32717a17307ee581381d7f8527b686aacb3ac4 (patch)
tree14bacccb9409dcf741f43c55e81aeeeb66175b22 /services/backup
parent20de619d66a594fd9e6e76a3a2cb79422aef577c (diff)
downloadframeworks_base-0f32717a17307ee581381d7f8527b686aacb3ac4.zip
frameworks_base-0f32717a17307ee581381d7f8527b686aacb3ac4.tar.gz
frameworks_base-0f32717a17307ee581381d7f8527b686aacb3ac4.tar.bz2
Fix spurious restore session timeouts
The restore-session idle timeout should not be ticking while we're doing legitimate restore work. We now explicitly stop the timeout ticker [a delayed message on our handler thread] whenever we undertake a valid restore operation. The timer is already correctly resumed when restore operations conclude. (In practice we need to suspend the timeout tracking at exactly those times when we're entering the wakelock-protected restore flow. The timeout is reestablished when the wakelock is released; this part is already in the code.) Bug 17990544 Change-Id: I7318020ce30fd9c35bc3a644f8c101fd3d063c8b
Diffstat (limited to 'services/backup')
-rw-r--r--services/backup/java/com/android/server/backup/BackupManagerService.java15
1 files changed, 15 insertions, 0 deletions
diff --git a/services/backup/java/com/android/server/backup/BackupManagerService.java b/services/backup/java/com/android/server/backup/BackupManagerService.java
index 3694d61..60801fb 100644
--- a/services/backup/java/com/android/server/backup/BackupManagerService.java
+++ b/services/backup/java/com/android/server/backup/BackupManagerService.java
@@ -8857,6 +8857,12 @@ if (MORE_DEBUG) Slog.v(TAG, " + got " + nRead + "; now wanting " + (size - soF
Slog.w(TAG, "Null transport getting restore sets");
return -1;
}
+
+ // We know we're doing legit work now, so halt the timeout
+ // until we're done. It gets started again when the result
+ // comes in.
+ mBackupHandler.removeMessages(MSG_RESTORE_TIMEOUT);
+
// spin off the transport request to our service thread
mWakelock.acquire();
Message msg = mBackupHandler.obtainMessage(MSG_RUN_GET_RESTORE_SETS,
@@ -8909,6 +8915,9 @@ if (MORE_DEBUG) Slog.v(TAG, " + got " + nRead + "; now wanting " + (size - soF
synchronized (mQueueLock) {
for (int i = 0; i < mRestoreSets.length; i++) {
if (token == mRestoreSets[i].token) {
+ // Real work, so stop the session timeout until we finalize the restore
+ mBackupHandler.removeMessages(MSG_RESTORE_TIMEOUT);
+
long oldId = Binder.clearCallingIdentity();
mWakelock.acquire();
if (MORE_DEBUG) {
@@ -8988,6 +8997,9 @@ if (MORE_DEBUG) Slog.v(TAG, " + got " + nRead + "; now wanting " + (size - soF
synchronized (mQueueLock) {
for (int i = 0; i < mRestoreSets.length; i++) {
if (token == mRestoreSets[i].token) {
+ // Stop the session timeout until we finalize the restore
+ mBackupHandler.removeMessages(MSG_RESTORE_TIMEOUT);
+
long oldId = Binder.clearCallingIdentity();
mWakelock.acquire();
if (MORE_DEBUG) {
@@ -9068,6 +9080,9 @@ if (MORE_DEBUG) Slog.v(TAG, " + got " + nRead + "; now wanting " + (size - soF
return -1;
}
+ // Stop the session timeout until we finalize the restore
+ mBackupHandler.removeMessages(MSG_RESTORE_TIMEOUT);
+
// Ready to go: enqueue the restore request and claim success
long oldId = Binder.clearCallingIdentity();
mWakelock.acquire();