summaryrefslogtreecommitdiffstats
path: root/services
diff options
context:
space:
mode:
authorChristopher Tate <ctate@google.com>2011-09-15 15:51:29 -0700
committerChristopher Tate <ctate@google.com>2011-09-15 15:51:29 -0700
commitd2c0cd4313896924886c3be03b28d092c51eb522 (patch)
tree5ca3a9b9f758df5e499f3ea02347341daea4095e /services
parent98c8b52b0ac7c108b03a5e73c1dcfb94a0a69868 (diff)
downloadframeworks_base-d2c0cd4313896924886c3be03b28d092c51eb522.zip
frameworks_base-d2c0cd4313896924886c3be03b28d092c51eb522.tar.gz
frameworks_base-d2c0cd4313896924886c3be03b28d092c51eb522.tar.bz2
Don't do full backup/restore before setup
On the restore side, there's a bunch of one-time setup, device provisioning, etc that we're very much not prepared to do in lieu of running setup wizard, at least at this time. On the backup side, it simply doesn't make sense to back up stuff before the device has been set up. Part of bug 5290261 Change-Id: If1c65e88e2da589d6204232d2b59c3e994f4ed3f
Diffstat (limited to 'services')
-rw-r--r--services/java/com/android/server/BackupManagerService.java35
1 files changed, 28 insertions, 7 deletions
diff --git a/services/java/com/android/server/BackupManagerService.java b/services/java/com/android/server/BackupManagerService.java
index 2938c45..6ac6c98 100644
--- a/services/java/com/android/server/BackupManagerService.java
+++ b/services/java/com/android/server/BackupManagerService.java
@@ -34,6 +34,7 @@ import android.app.backup.IRestoreSession;
import android.content.ActivityNotFoundException;
import android.content.BroadcastReceiver;
import android.content.ComponentName;
+import android.content.ContentResolver;
import android.content.Context;
import android.content.Intent;
import android.content.IntentFilter;
@@ -4765,6 +4766,11 @@ class BackupManagerService extends IBackupManager.Stub {
}
}
+ boolean deviceIsProvisioned() {
+ final ContentResolver resolver = mContext.getContentResolver();
+ return (Settings.Secure.getInt(resolver, Settings.Secure.DEVICE_PROVISIONED, 0) != 0);
+ }
+
// Run a *full* backup pass for the given package, writing the resulting data stream
// to the supplied file descriptor. This method is synchronous and does not return
// to the caller until the backup has been completed.
@@ -4785,12 +4791,19 @@ class BackupManagerService extends IBackupManager.Stub {
}
}
- if (DEBUG) Slog.v(TAG, "Requesting full backup: apks=" + includeApks
- + " shared=" + includeShared + " all=" + doAllApps
- + " pkgs=" + pkgList);
-
long oldId = Binder.clearCallingIdentity();
try {
+ // Doesn't make sense to do a full backup prior to setup
+ if (!deviceIsProvisioned()) {
+ Slog.i(TAG, "Full backup not supported before setup");
+ return;
+ }
+
+ if (DEBUG) Slog.v(TAG, "Requesting full backup: apks=" + includeApks
+ + " shared=" + includeShared + " all=" + doAllApps
+ + " pkgs=" + pkgList);
+ Slog.i(TAG, "Beginning full backup...");
+
FullBackupParams params = new FullBackupParams(fd, includeApks, includeShared,
doAllApps, pkgList);
final int token = generateToken();
@@ -4822,17 +4835,25 @@ class BackupManagerService extends IBackupManager.Stub {
// just eat it
}
Binder.restoreCallingIdentity(oldId);
+ Slog.d(TAG, "Full backup processing complete.");
}
- if (MORE_DEBUG) Slog.d(TAG, "Full backup done; returning to caller");
}
public void fullRestore(ParcelFileDescriptor fd) {
mContext.enforceCallingPermission(android.Manifest.permission.BACKUP, "fullRestore");
- Slog.i(TAG, "Beginning full restore...");
long oldId = Binder.clearCallingIdentity();
try {
+ // Check whether the device has been provisioned -- we don't handle
+ // full restores prior to completing the setup process.
+ if (!deviceIsProvisioned()) {
+ Slog.i(TAG, "Full restore not permitted before setup");
+ return;
+ }
+
+ Slog.i(TAG, "Beginning full restore...");
+
FullRestoreParams params = new FullRestoreParams(fd);
final int token = generateToken();
synchronized (mFullConfirmations) {
@@ -4863,7 +4884,7 @@ class BackupManagerService extends IBackupManager.Stub {
Slog.w(TAG, "Error trying to close fd after full restore: " + e);
}
Binder.restoreCallingIdentity(oldId);
- Slog.i(TAG, "Full restore completed");
+ Slog.i(TAG, "Full restore processing complete.");
}
}