diff options
author | Christopher Tate <ctate@google.com> | 2015-01-29 13:17:37 -0800 |
---|---|---|
committer | Christopher Tate <ctate@google.com> | 2015-01-29 15:47:43 -0800 |
commit | e77c12ba37b7358ef6b6a6010e778926cc4194b8 (patch) | |
tree | 7220c96c1f5da422c8681ffe6082c0f2fb2e4501 /services | |
parent | 6efc3ac6d2094c72b6a2e288101a5349b017274d (diff) | |
download | frameworks_base-e77c12ba37b7358ef6b6a6010e778926cc4194b8.zip frameworks_base-e77c12ba37b7358ef6b6a6010e778926cc4194b8.tar.gz frameworks_base-e77c12ba37b7358ef6b6a6010e778926cc4194b8.tar.bz2 |
Don't run full-data backups when backup is disabled
If the scheduled job fires but backup is disabled or the device is
not yet provisioned (i.e. has not yet finished going through setup),
bow out gracefully without running any backup operations. Also, even
if a backup is directly invoked (e.g. via adb), verify again right
before we start collecting app data, and abandon the operation in
that path as well.
(This is redundant; having only the latter test would suffice, but
this lets us distinguish in the logging more easily.)
Finally, make sure that if we were waiting on setup before permitting
backup operations to begin, that we startup the full-data scheduling
as well as the [separate] key/value scheduling.
Bug 19197062
Change-Id: I3d8fb650c50f946d8ed7ac7170df361c707f2528
Diffstat (limited to 'services')
-rw-r--r-- | services/backup/java/com/android/server/backup/BackupManagerService.java | 22 |
1 files changed, 22 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 289152b..c1e4994 100644 --- a/services/backup/java/com/android/server/backup/BackupManagerService.java +++ b/services/backup/java/com/android/server/backup/BackupManagerService.java @@ -382,6 +382,7 @@ public class BackupManagerService { // we're now good to go, so start the backup alarms if (MORE_DEBUG) Slog.d(TAG, "Now provisioned, so starting backups"); startBackupAlarmsLocked(FIRST_BACKUP_INTERVAL); + scheduleNextFullBackupJob(); } } } @@ -3853,6 +3854,16 @@ public class BackupManagerService { PackageInfo currentPackage; try { + if (!mEnabled || !mProvisioned) { + // Backups are globally disabled, so don't proceed. + if (DEBUG) { + Slog.i(TAG, "full backup requested but e=" + mEnabled + + " p=" + mProvisioned + "; ignoring"); + } + mUpdateSchedule = false; + return; + } + IBackupTransport transport = getTransport(mCurrentTransport); if (transport == null) { Slog.w(TAG, "Transport not present; full data backup not performed"); @@ -4150,6 +4161,17 @@ public class BackupManagerService { long now = System.currentTimeMillis(); FullBackupEntry entry = null; + if (!mEnabled || !mProvisioned) { + // Backups are globally disabled, so don't proceed. We also don't reschedule + // the job driving automatic backups; that job will be scheduled again when + // the user enables backup. + if (MORE_DEBUG) { + Slog.i(TAG, "beginFullBackup but e=" + mEnabled + + " p=" + mProvisioned + "; ignoring"); + } + return false; + } + if (DEBUG_SCHEDULING) { Slog.i(TAG, "Beginning scheduled full backup operation"); } |