Loading core/java/android/backup/IBackupManager.aidl +15 −0 Original line number Diff line number Diff line Loading @@ -72,6 +72,21 @@ interface IBackupManager { */ void setBackupEnabled(boolean isEnabled); /** * Enable/disable automatic restore of application data at install time. When * enabled, installation of any package will involve the Backup Manager. If data * exists for the newly-installed package, either from the device's current [enabled] * backup dataset or from the restore set used in the last wholesale restore operation, * that data will be supplied to the new package's restore agent before the package * is made generally available for launch. * * <p>Callers must hold the android.permission.BACKUP permission to use this method. * * @param doAutoRestore When true, enables the automatic app-data restore facility. When * false, this facility will be disabled. */ void setAutoRestore(boolean doAutoRestore); /** * Indicate that any necessary one-time provisioning has occurred. * Loading core/java/android/provider/Settings.java +8 −0 Original line number Diff line number Diff line Loading @@ -2424,6 +2424,14 @@ public final class Settings { */ public static final String BACKUP_ENABLED = "backup_enabled"; /** * Controls whether application data is automatically restored from backup * at install time. * Type: int ( 0 = disabled, 1 = enabled ) * @hide */ public static final String BACKUP_AUTO_RESTORE = "backup_auto_restore"; /** * Indicates whether settings backup has been fully provisioned. * Type: int ( 0 = unprovisioned, 1 = fully provisioned ) Loading services/java/com/android/server/BackupManagerService.java +17 −0 Original line number Diff line number Diff line Loading @@ -118,6 +118,7 @@ class BackupManagerService extends IBackupManager.Stub { boolean mEnabled; // access to this is synchronized on 'this' boolean mProvisioned; boolean mAutoRestore; PowerManager.WakeLock mWakelock; HandlerThread mHandlerThread = new HandlerThread("backup", Process.THREAD_PRIORITY_BACKGROUND); BackupHandler mBackupHandler; Loading Loading @@ -340,6 +341,8 @@ class BackupManagerService extends IBackupManager.Stub { Settings.Secure.BACKUP_ENABLED, 0) != 0; mProvisioned = Settings.Secure.getInt(context.getContentResolver(), Settings.Secure.BACKUP_PROVISIONED, 0) != 0; mAutoRestore = Settings.Secure.getInt(context.getContentResolver(), Settings.Secure.BACKUP_AUTO_RESTORE, 0) != 0; // If Encrypted file systems is enabled or disabled, this call will return the // correct directory. mBaseStateDir = new File(Environment.getSecureDataDirectory(), "backup"); Loading Loading @@ -2019,6 +2022,20 @@ class BackupManagerService extends IBackupManager.Stub { } } // Enable/disable automatic restore of app data at install time public void setAutoRestore(boolean doAutoRestore) { mContext.enforceCallingOrSelfPermission(android.Manifest.permission.BACKUP, "setBackupEnabled"); Log.i(TAG, "Auto restore => " + doAutoRestore); synchronized (this) { Settings.Secure.putInt(mContext.getContentResolver(), Settings.Secure.BACKUP_AUTO_RESTORE, doAutoRestore ? 1 : 0); mAutoRestore = doAutoRestore; } } // Mark the backup service as having been provisioned public void setBackupProvisioned(boolean available) { mContext.enforceCallingOrSelfPermission(android.Manifest.permission.BACKUP, Loading Loading
core/java/android/backup/IBackupManager.aidl +15 −0 Original line number Diff line number Diff line Loading @@ -72,6 +72,21 @@ interface IBackupManager { */ void setBackupEnabled(boolean isEnabled); /** * Enable/disable automatic restore of application data at install time. When * enabled, installation of any package will involve the Backup Manager. If data * exists for the newly-installed package, either from the device's current [enabled] * backup dataset or from the restore set used in the last wholesale restore operation, * that data will be supplied to the new package's restore agent before the package * is made generally available for launch. * * <p>Callers must hold the android.permission.BACKUP permission to use this method. * * @param doAutoRestore When true, enables the automatic app-data restore facility. When * false, this facility will be disabled. */ void setAutoRestore(boolean doAutoRestore); /** * Indicate that any necessary one-time provisioning has occurred. * Loading
core/java/android/provider/Settings.java +8 −0 Original line number Diff line number Diff line Loading @@ -2424,6 +2424,14 @@ public final class Settings { */ public static final String BACKUP_ENABLED = "backup_enabled"; /** * Controls whether application data is automatically restored from backup * at install time. * Type: int ( 0 = disabled, 1 = enabled ) * @hide */ public static final String BACKUP_AUTO_RESTORE = "backup_auto_restore"; /** * Indicates whether settings backup has been fully provisioned. * Type: int ( 0 = unprovisioned, 1 = fully provisioned ) Loading
services/java/com/android/server/BackupManagerService.java +17 −0 Original line number Diff line number Diff line Loading @@ -118,6 +118,7 @@ class BackupManagerService extends IBackupManager.Stub { boolean mEnabled; // access to this is synchronized on 'this' boolean mProvisioned; boolean mAutoRestore; PowerManager.WakeLock mWakelock; HandlerThread mHandlerThread = new HandlerThread("backup", Process.THREAD_PRIORITY_BACKGROUND); BackupHandler mBackupHandler; Loading Loading @@ -340,6 +341,8 @@ class BackupManagerService extends IBackupManager.Stub { Settings.Secure.BACKUP_ENABLED, 0) != 0; mProvisioned = Settings.Secure.getInt(context.getContentResolver(), Settings.Secure.BACKUP_PROVISIONED, 0) != 0; mAutoRestore = Settings.Secure.getInt(context.getContentResolver(), Settings.Secure.BACKUP_AUTO_RESTORE, 0) != 0; // If Encrypted file systems is enabled or disabled, this call will return the // correct directory. mBaseStateDir = new File(Environment.getSecureDataDirectory(), "backup"); Loading Loading @@ -2019,6 +2022,20 @@ class BackupManagerService extends IBackupManager.Stub { } } // Enable/disable automatic restore of app data at install time public void setAutoRestore(boolean doAutoRestore) { mContext.enforceCallingOrSelfPermission(android.Manifest.permission.BACKUP, "setBackupEnabled"); Log.i(TAG, "Auto restore => " + doAutoRestore); synchronized (this) { Settings.Secure.putInt(mContext.getContentResolver(), Settings.Secure.BACKUP_AUTO_RESTORE, doAutoRestore ? 1 : 0); mAutoRestore = doAutoRestore; } } // Mark the backup service as having been provisioned public void setBackupProvisioned(boolean available) { mContext.enforceCallingOrSelfPermission(android.Manifest.permission.BACKUP, Loading