diff options
author | TreeHugger Robot <treehugger-gerrit@google.com> | 2020-07-07 18:43:26 +0000 |
---|---|---|
committer | Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com> | 2020-07-07 18:43:26 +0000 |
commit | 90abbee47fdc312c203e10038efa05b5e8e1b0e7 (patch) | |
tree | 8dbcf908e40b6855fb96899d187b60a1b74dffcc /services/backup | |
parent | 088dd265daf4d26ed98c265c68426268a74915b4 (diff) | |
parent | 2170ba0f9fc1fed9b98b077af4c4422de0020332 (diff) |
Merge "Fix state deletion for transient backup issues." into rvc-qpr-dev am: 2170ba0f9f
Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/12086616
Change-Id: Ife1bcb70febb986e465689224dedc47d5025a5b2
Diffstat (limited to 'services/backup')
-rw-r--r-- | services/backup/java/com/android/server/backup/keyvalue/KeyValueBackupTask.java | 25 |
1 files changed, 21 insertions, 4 deletions
diff --git a/services/backup/java/com/android/server/backup/keyvalue/KeyValueBackupTask.java b/services/backup/java/com/android/server/backup/keyvalue/KeyValueBackupTask.java index 5e10916c4491..a4e58a1faeac 100644 --- a/services/backup/java/com/android/server/backup/keyvalue/KeyValueBackupTask.java +++ b/services/backup/java/com/android/server/backup/keyvalue/KeyValueBackupTask.java @@ -649,16 +649,33 @@ public class KeyValueBackupTask implements BackupRestoreTask, Runnable { mReporter.onStartPackageBackup(PM_PACKAGE); mCurrentPackage = new PackageInfo(); mCurrentPackage.packageName = PM_PACKAGE; - try { - extractPmAgentData(mCurrentPackage); + // If we can't even extractPmAgentData(), then we treat the local state as + // compromised, just in case. This means that we will clear data and will + // start from a clean slate in the next attempt. It's not clear whether that's + // the right thing to do, but matches what we have historically done. + try { + extractPmAgentData(mCurrentPackage); + } catch (TaskException e) { + throw TaskException.stateCompromised(e); // force stateCompromised + } + // During sendDataToTransport, we generally trust any thrown TaskException + // about whether stateCompromised because those are likely transient; + // clearing state for those would have the potential to lead to cascading + // failures, as discussed in http://b/144030477. + // For specific status codes (e.g. TRANSPORT_NON_INCREMENTAL_BACKUP_REQUIRED), + // cleanUpAgentForTransportStatus() or theoretically handleTransportStatus() + // still have the opportunity to perform additional clean-up tasks. int status = sendDataToTransport(mCurrentPackage); cleanUpAgentForTransportStatus(status); } catch (AgentException | TaskException e) { mReporter.onExtractPmAgentDataError(e); cleanUpAgentForError(e); - // PM agent failure is task failure. - throw TaskException.stateCompromised(e); + if (e instanceof TaskException) { + throw (TaskException) e; + } else { + throw TaskException.stateCompromised(e); // PM agent failure is task failure. + } } } |