diff options
author | Christopher Tate <ctate@google.com> | 2015-01-06 15:48:33 -0800 |
---|---|---|
committer | Christopher Tate <ctate@google.com> | 2015-01-06 15:48:33 -0800 |
commit | b89e1405cf9f1da533dc0843390a1b6783abb0f4 (patch) | |
tree | c3c9a188e6f2627c4bb04330b9fd31f7a64f3497 /services/backup/java | |
parent | 1c6014e77dfad1a7af229d642df7b7300beee721 (diff) | |
download | frameworks_base-b89e1405cf9f1da533dc0843390a1b6783abb0f4.zip frameworks_base-b89e1405cf9f1da533dc0843390a1b6783abb0f4.tar.gz frameworks_base-b89e1405cf9f1da533dc0843390a1b6783abb0f4.tar.bz2 |
Support single-package backup rejection by the transport
We now cleanly handle the case of the transport blacklisting specific
packages from key/value backup. Previously we would halt the entire
backup pass and reschedule if the transport returned any error from
performBackup(pkg). Now, we recognize the TRANSPORT_PACKAGE_REJECTED
result from that invocation, and properly drop that package's work
but proceed with running the rest of the backup queue as expected.
Bug 18694053
Change-Id: Id0dd6d59492bdea9f970540d776f37db0cc5d99c
Diffstat (limited to 'services/backup/java')
-rw-r--r-- | services/backup/java/com/android/server/backup/BackupManagerService.java | 29 |
1 files changed, 20 insertions, 9 deletions
diff --git a/services/backup/java/com/android/server/backup/BackupManagerService.java b/services/backup/java/com/android/server/backup/BackupManagerService.java index 8c74ca5..7d085a3 100644 --- a/services/backup/java/com/android/server/backup/BackupManagerService.java +++ b/services/backup/java/com/android/server/backup/BackupManagerService.java @@ -2786,21 +2786,30 @@ public class BackupManagerService { addBackupTrace("finishing op on transport"); mStatus = mTransport.finishBackup(); addBackupTrace("finished: " + mStatus); + } else if (mStatus == BackupTransport.TRANSPORT_PACKAGE_REJECTED) { + addBackupTrace("transport rejected package"); } } else { if (DEBUG) Slog.i(TAG, "no backup data written; not calling transport"); addBackupTrace("no data to send"); } - // After successful transport, delete the now-stale data - // and juggle the files so that next time we supply the agent - // with the new state file it just created. if (mStatus == BackupTransport.TRANSPORT_OK) { + // After successful transport, delete the now-stale data + // and juggle the files so that next time we supply the agent + // with the new state file it just created. mBackupDataName.delete(); mNewStateName.renameTo(mSavedStateName); EventLog.writeEvent(EventLogTags.BACKUP_PACKAGE, pkgName, size); logBackupComplete(pkgName); + } else if (mStatus == BackupTransport.TRANSPORT_PACKAGE_REJECTED) { + // The transport has rejected backup of this specific package. Roll it + // back but proceed with running the rest of the queue. + mBackupDataName.delete(); + mNewStateName.delete(); + EventLogTags.writeBackupAgentFailure(pkgName, "Transport rejected"); } else { + // Actual transport-level failure to communicate the data to the backend EventLog.writeEvent(EventLogTags.BACKUP_TRANSPORT_FAILURE, pkgName); } } catch (Exception e) { @@ -2811,15 +2820,17 @@ public class BackupManagerService { try { if (backupData != null) backupData.close(); } catch (IOException e) {} } - // If we encountered an error here it's a transport-level failure. That - // means we need to halt everything and reschedule everything for next time. final BackupState nextState; - if (mStatus != BackupTransport.TRANSPORT_OK) { + if (mStatus == BackupTransport.TRANSPORT_OK + || mStatus == BackupTransport.TRANSPORT_PACKAGE_REJECTED) { + // Success or single-package rejection. Proceed with the next app if any, + // otherwise we're done. + nextState = (mQueue.isEmpty()) ? BackupState.FINAL : BackupState.RUNNING_QUEUE; + } else { + // Any other error here indicates a transport-level failure. That means + // we need to halt everything and reschedule everything for next time. revertAndEndBackup(); nextState = BackupState.FINAL; - } else { - // Success! Proceed with the next app if any, otherwise we're done. - nextState = (mQueue.isEmpty()) ? BackupState.FINAL : BackupState.RUNNING_QUEUE; } executeNextState(nextState); |