From d71d7c350c76d3494dd6688c26a837fa41ea18f8 Mon Sep 17 00:00:00 2001 From: Christopher Tate Date: Mon, 17 Aug 2015 12:16:19 -0700 Subject: [PATCH] Clean up properly if outcall for doRestoreFinished() fails The target app crashed at an inopportune time but this shouldn't invalidate the whole ongoing restore operation; it's a problem local to the specific app undergoing restore. Recognize this, clean up the app's possibly-incomplete data, and continue running the restore queue as planned. Bug 23228982 Change-Id: If9a19d2fe6a0ce5339c893630d7a61a5a5ccd9b1 --- .../com/android/server/backup/BackupManagerService.java | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/services/backup/java/com/android/server/backup/BackupManagerService.java b/services/backup/java/com/android/server/backup/BackupManagerService.java index 83b953ebf179c..8d9c965847b1d 100644 --- a/services/backup/java/com/android/server/backup/BackupManagerService.java +++ b/services/backup/java/com/android/server/backup/BackupManagerService.java @@ -7848,8 +7848,12 @@ if (MORE_DEBUG) Slog.v(TAG, " + got " + nRead + "; now wanting " + (size - soF // If we get this far, the callback or timeout will schedule the // next restore state, so we're done } catch (Exception e) { - Slog.e(TAG, "Unable to finalize restore of " + mCurrentPackage.packageName); - executeNextState(UnifiedRestoreState.FINAL); + final String packageName = mCurrentPackage.packageName; + Slog.e(TAG, "Unable to finalize restore of " + packageName); + EventLog.writeEvent(EventLogTags.RESTORE_AGENT_FAILURE, + packageName, e.toString()); + keyValueAgentErrorCleanup(); + executeNextState(UnifiedRestoreState.RUNNING_QUEUE); } }