summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author Anton Philippov <philippov@google.com> 2017-03-27 14:49:04 +0100
committer Anton Philippov <philippov@google.com> 2017-03-28 11:25:44 +0000
commitbc44678fb13fbad0b29a92587e9c807a7b185cb5 (patch)
treebae110b5a15e87a2cd3ed1ecfec416f995246c74
parent5149be455cc3eaa1282da369498063c4c83124fc (diff)
Add null check in BackupManagerService$PerformBackupTask.handleCancel()
handleCancel() can be called before we start backing up any particular package, therefore we need to properly handle log messages in that case. Bug: 36638539 Test: manual Change-Id: Ic96e2fbad5c0a79640a3419d187e8b5e4d265de3 (cherry picked from commit 519a87db8fabb49f299aa384aeb5cfe4dfedf907)
-rw-r--r--services/backup/java/com/android/server/backup/BackupManagerService.java18
1 files changed, 10 insertions, 8 deletions
diff --git a/services/backup/java/com/android/server/backup/BackupManagerService.java b/services/backup/java/com/android/server/backup/BackupManagerService.java
index 037804e0c5e9..57d357044e5f 100644
--- a/services/backup/java/com/android/server/backup/BackupManagerService.java
+++ b/services/backup/java/com/android/server/backup/BackupManagerService.java
@@ -3537,21 +3537,23 @@ public class BackupManagerService {
return;
}
mCancelAll = cancelAll;
- // Whoops, the current agent timed out running doBackup(). Tidy up and restage
- // it for the next time we run a backup pass.
- // !!! TODO: keep track of failure counts per agent, and blacklist those which
- // fail repeatedly (i.e. have proved themselves to be buggy).
- Slog.e(TAG, "Cancel backing up " + mCurrentPackage.packageName);
- EventLog.writeEvent(EventLogTags.BACKUP_AGENT_FAILURE, mCurrentPackage.packageName);
+ final String logPackageName = (mCurrentPackage != null)
+ ? mCurrentPackage.packageName
+ : "no_package_yet";
+ Slog.i(TAG, "Cancel backing up " + logPackageName);
+ EventLog.writeEvent(EventLogTags.BACKUP_AGENT_FAILURE, logPackageName);
+ addBackupTrace("cancel of " + logPackageName + ", cancelAll=" + cancelAll);
mMonitor = monitorEvent(mMonitor,
BackupManagerMonitor.LOG_EVENT_ID_KEY_VALUE_BACKUP_CANCEL,
mCurrentPackage, BackupManagerMonitor.LOG_EVENT_CATEGORY_AGENT,
putMonitoringExtra(null, BackupManagerMonitor.EXTRA_LOG_CANCEL_ALL,
mCancelAll));
- addBackupTrace(
- "cancel of " + mCurrentPackage.packageName + ", cancelAll=" + cancelAll);
errorCleanup();
if (!cancelAll) {
+ // The current agent either timed out or was cancelled running doBackup().
+ // Restage it for the next time we run a backup pass.
+ // !!! TODO: keep track of failure counts per agent, and blacklist those which
+ // fail repeatedly (i.e. have proved themselves to be buggy).
executeNextState(
mQueue.isEmpty() ? BackupState.FINAL : BackupState.RUNNING_QUEUE);
dataChangedImpl(mCurrentPackage.packageName);