Loading api/system-current.txt +6 −0 Original line number Diff line number Diff line Loading @@ -6899,6 +6899,7 @@ package android.app.backup { method public int requestBackup(java.lang.String[], android.app.backup.BackupObserver); method public int requestBackup(java.lang.String[], android.app.backup.BackupObserver, android.app.backup.BackupManagerMonitor, int); method public int requestRestore(android.app.backup.RestoreObserver); method public int requestRestore(android.app.backup.RestoreObserver, android.app.backup.BackupManagerMonitor); method public deprecated java.lang.String selectBackupTransport(java.lang.String); method public void selectBackupTransport(android.content.ComponentName, android.app.backup.SelectBackupTransportCallback); method public void setAutoRestore(boolean); Loading Loading @@ -6927,7 +6928,9 @@ package android.app.backup { field public static final int LOG_EVENT_CATEGORY_BACKUP_MANAGER_POLICY = 3; // 0x3 field public static final int LOG_EVENT_CATEGORY_TRANSPORT = 1; // 0x1 field public static final int LOG_EVENT_ID_FULL_BACKUP_TIMEOUT = 4; // 0x4 field public static final int LOG_EVENT_ID_FULL_RESTORE_TIMEOUT = 45; // 0x2d field public static final int LOG_EVENT_ID_KEY_VALUE_BACKUP_TIMEOUT = 21; // 0x15 field public static final int LOG_EVENT_ID_KEY_VALUE_RESTORE_TIMEOUT = 31; // 0x1f field public static final int LOG_EVENT_ID_NO_PACKAGES = 49; // 0x31 } Loading Loading @@ -7024,8 +7027,11 @@ package android.app.backup { public class RestoreSession { method public void endRestoreSession(); method public int getAvailableRestoreSets(android.app.backup.RestoreObserver, android.app.backup.BackupManagerMonitor); method public int getAvailableRestoreSets(android.app.backup.RestoreObserver); method public int restoreAll(long, android.app.backup.RestoreObserver, android.app.backup.BackupManagerMonitor); method public int restoreAll(long, android.app.backup.RestoreObserver); method public int restorePackage(java.lang.String, android.app.backup.RestoreObserver, android.app.backup.BackupManagerMonitor); method public int restorePackage(java.lang.String, android.app.backup.RestoreObserver); } cmds/bmgr/src/com/android/commands/bmgr/Bmgr.java +9 −5 Original line number Diff line number Diff line Loading @@ -506,7 +506,8 @@ public final class Bmgr { private void doListRestoreSets() { try { RestoreObserver observer = new RestoreObserver(); int err = mRestore.getAvailableRestoreSets(observer); // TODO implement monitor here int err = mRestore.getAvailableRestoreSets(observer, null); if (err != 0) { System.out.println("Unable to request restore sets"); } else { Loading Loading @@ -609,7 +610,8 @@ public final class Bmgr { } RestoreObserver observer = new RestoreObserver(); int err = mRestore.restorePackage(pkg, observer); // TODO implement monitor here int err = mRestore.restorePackage(pkg, observer, null ); if (err == 0) { // Off and running -- wait for the restore to complete observer.waitForCompletion(); Loading @@ -636,7 +638,8 @@ public final class Bmgr { return; } RestoreSet[] sets = null; int err = mRestore.getAvailableRestoreSets(observer); // TODO implement monitor here int err = mRestore.getAvailableRestoreSets(observer, null); if (err == 0) { observer.waitForCompletion(); sets = observer.sets; Loading @@ -645,11 +648,12 @@ public final class Bmgr { if (s.token == token) { System.out.println("Scheduling restore: " + s.name); if (filter == null) { didRestore = (mRestore.restoreAll(token, observer) == 0); didRestore = (mRestore.restoreAll(token, observer, null) == 0); } else { String[] names = new String[filter.size()]; filter.toArray(names); didRestore = (mRestore.restoreSome(token, observer, names) == 0); didRestore = (mRestore.restoreSome(token, observer, null, names) == 0); } break; } Loading core/java/android/app/backup/BackupManager.java +32 −4 Original line number Diff line number Diff line Loading @@ -258,6 +258,36 @@ public class BackupManager { * @return Zero on success; nonzero on error. */ public int requestRestore(RestoreObserver observer) { return requestRestore(observer, null); } // system APIs start here /** * Restore the calling application from backup. The data will be restored from the * current backup dataset if the application has stored data there, or from * the dataset used during the last full device setup operation if the current * backup dataset has no matching data. If no backup data exists for this application * in either source, a nonzero value will be returned. * * <p>If this method returns zero (meaning success), the OS will attempt to retrieve * a backed-up dataset from the remote transport, instantiate the application's * backup agent, and pass the dataset to the agent's * {@link android.app.backup.BackupAgent#onRestore(BackupDataInput, int, android.os.ParcelFileDescriptor) onRestore()} * method. * * @param observer The {@link RestoreObserver} to receive callbacks during the restore * operation. This must not be null. * * @param monitor the {@link BackupManagerMonitor} to receive callbacks during the restore * operation. * * @return Zero on success; nonzero on error. * * @hide */ @SystemApi public int requestRestore(RestoreObserver observer, BackupManagerMonitor monitor) { int result = -1; checkServiceBinder(); if (sService != null) { Loading @@ -267,7 +297,7 @@ public class BackupManager { null); if (binder != null) { session = new RestoreSession(mContext, binder); result = session.restorePackage(mContext.getPackageName(), observer); result = session.restorePackage(mContext.getPackageName(), observer, monitor); } } catch (RemoteException e) { Log.e(TAG, "restoreSelf() unable to contact service"); Loading @@ -280,8 +310,6 @@ public class BackupManager { return result; } // system APIs start here /** * Begin the process of restoring data from backup. See the * {@link android.app.backup.RestoreSession} class for documentation on that process. Loading core/java/android/app/backup/BackupManagerMonitor.java +2 −0 Original line number Diff line number Diff line Loading @@ -57,6 +57,8 @@ public class BackupManagerMonitor { // TODO complete this list with all log messages. And document properly. public static final int LOG_EVENT_ID_FULL_BACKUP_TIMEOUT = 4; public static final int LOG_EVENT_ID_KEY_VALUE_BACKUP_TIMEOUT = 21; public static final int LOG_EVENT_ID_KEY_VALUE_RESTORE_TIMEOUT = 31; public static final int LOG_EVENT_ID_FULL_RESTORE_TIMEOUT = 45; public static final int LOG_EVENT_ID_NO_PACKAGES = 49; Loading core/java/android/app/backup/IRestoreSession.aidl +11 −5 Original line number Diff line number Diff line Loading @@ -18,7 +18,7 @@ package android.app.backup; import android.app.backup.RestoreSet; import android.app.backup.IRestoreObserver; import android.app.backup.IBackupManagerMonitor; /** * Binder interface used by clients who wish to manage a restore operation. Every * method in this interface requires the android.permission.BACKUP permission. Loading @@ -31,10 +31,11 @@ interface IRestoreSession { * * @param observer This binder points to an object whose onRestoreSetsAvailable() * method will be called to supply the results of the transport's lookup. * @param monitor If non null the binder will send important events to this monitor. * @return Zero on success; nonzero on error. The observer will only receive a * result callback if this method returned zero. */ int getAvailableRestoreSets(IRestoreObserver observer); int getAvailableRestoreSets(IRestoreObserver observer, IBackupManagerMonitor monitor); /** * Restore the given set onto the device, replacing the current data of any app Loading @@ -48,8 +49,9 @@ interface IRestoreSession { * the restore set that should be used. * @param observer If non-null, this binder points to an object that will receive * progress callbacks during the restore operation. * @param monitor If non null the binder will send important events to this monitor. */ int restoreAll(long token, IRestoreObserver observer); int restoreAll(long token, IRestoreObserver observer, IBackupManagerMonitor monitor); /** * Restore select packages from the given set onto the device, replacing the Loading @@ -67,8 +69,10 @@ interface IRestoreSession { * @param packages The set of packages for which to attempt a restore. Regardless of * the contents of the actual back-end dataset named by {@code token}, only * applications mentioned in this list will have their data restored. * @param monitor If non null the binder will send important events to this monitor. */ int restoreSome(long token, IRestoreObserver observer, in String[] packages); int restoreSome(long token, IRestoreObserver observer, IBackupManagerMonitor monitor, in String[] packages); /** * Restore a single application from backup. The data will be restored from the Loading @@ -84,8 +88,10 @@ interface IRestoreSession { * permission must be held. * @param observer If non-null, this binder points to an object that will receive * progress callbacks during the restore operation. * @param monitor If non null the binder will send important events to this monitor. */ int restorePackage(in String packageName, IRestoreObserver observer); int restorePackage(in String packageName, IRestoreObserver observer, IBackupManagerMonitor monitor); /** * End this restore session. After this method is called, the IRestoreSession binder Loading Loading
api/system-current.txt +6 −0 Original line number Diff line number Diff line Loading @@ -6899,6 +6899,7 @@ package android.app.backup { method public int requestBackup(java.lang.String[], android.app.backup.BackupObserver); method public int requestBackup(java.lang.String[], android.app.backup.BackupObserver, android.app.backup.BackupManagerMonitor, int); method public int requestRestore(android.app.backup.RestoreObserver); method public int requestRestore(android.app.backup.RestoreObserver, android.app.backup.BackupManagerMonitor); method public deprecated java.lang.String selectBackupTransport(java.lang.String); method public void selectBackupTransport(android.content.ComponentName, android.app.backup.SelectBackupTransportCallback); method public void setAutoRestore(boolean); Loading Loading @@ -6927,7 +6928,9 @@ package android.app.backup { field public static final int LOG_EVENT_CATEGORY_BACKUP_MANAGER_POLICY = 3; // 0x3 field public static final int LOG_EVENT_CATEGORY_TRANSPORT = 1; // 0x1 field public static final int LOG_EVENT_ID_FULL_BACKUP_TIMEOUT = 4; // 0x4 field public static final int LOG_EVENT_ID_FULL_RESTORE_TIMEOUT = 45; // 0x2d field public static final int LOG_EVENT_ID_KEY_VALUE_BACKUP_TIMEOUT = 21; // 0x15 field public static final int LOG_EVENT_ID_KEY_VALUE_RESTORE_TIMEOUT = 31; // 0x1f field public static final int LOG_EVENT_ID_NO_PACKAGES = 49; // 0x31 } Loading Loading @@ -7024,8 +7027,11 @@ package android.app.backup { public class RestoreSession { method public void endRestoreSession(); method public int getAvailableRestoreSets(android.app.backup.RestoreObserver, android.app.backup.BackupManagerMonitor); method public int getAvailableRestoreSets(android.app.backup.RestoreObserver); method public int restoreAll(long, android.app.backup.RestoreObserver, android.app.backup.BackupManagerMonitor); method public int restoreAll(long, android.app.backup.RestoreObserver); method public int restorePackage(java.lang.String, android.app.backup.RestoreObserver, android.app.backup.BackupManagerMonitor); method public int restorePackage(java.lang.String, android.app.backup.RestoreObserver); }
cmds/bmgr/src/com/android/commands/bmgr/Bmgr.java +9 −5 Original line number Diff line number Diff line Loading @@ -506,7 +506,8 @@ public final class Bmgr { private void doListRestoreSets() { try { RestoreObserver observer = new RestoreObserver(); int err = mRestore.getAvailableRestoreSets(observer); // TODO implement monitor here int err = mRestore.getAvailableRestoreSets(observer, null); if (err != 0) { System.out.println("Unable to request restore sets"); } else { Loading Loading @@ -609,7 +610,8 @@ public final class Bmgr { } RestoreObserver observer = new RestoreObserver(); int err = mRestore.restorePackage(pkg, observer); // TODO implement monitor here int err = mRestore.restorePackage(pkg, observer, null ); if (err == 0) { // Off and running -- wait for the restore to complete observer.waitForCompletion(); Loading @@ -636,7 +638,8 @@ public final class Bmgr { return; } RestoreSet[] sets = null; int err = mRestore.getAvailableRestoreSets(observer); // TODO implement monitor here int err = mRestore.getAvailableRestoreSets(observer, null); if (err == 0) { observer.waitForCompletion(); sets = observer.sets; Loading @@ -645,11 +648,12 @@ public final class Bmgr { if (s.token == token) { System.out.println("Scheduling restore: " + s.name); if (filter == null) { didRestore = (mRestore.restoreAll(token, observer) == 0); didRestore = (mRestore.restoreAll(token, observer, null) == 0); } else { String[] names = new String[filter.size()]; filter.toArray(names); didRestore = (mRestore.restoreSome(token, observer, names) == 0); didRestore = (mRestore.restoreSome(token, observer, null, names) == 0); } break; } Loading
core/java/android/app/backup/BackupManager.java +32 −4 Original line number Diff line number Diff line Loading @@ -258,6 +258,36 @@ public class BackupManager { * @return Zero on success; nonzero on error. */ public int requestRestore(RestoreObserver observer) { return requestRestore(observer, null); } // system APIs start here /** * Restore the calling application from backup. The data will be restored from the * current backup dataset if the application has stored data there, or from * the dataset used during the last full device setup operation if the current * backup dataset has no matching data. If no backup data exists for this application * in either source, a nonzero value will be returned. * * <p>If this method returns zero (meaning success), the OS will attempt to retrieve * a backed-up dataset from the remote transport, instantiate the application's * backup agent, and pass the dataset to the agent's * {@link android.app.backup.BackupAgent#onRestore(BackupDataInput, int, android.os.ParcelFileDescriptor) onRestore()} * method. * * @param observer The {@link RestoreObserver} to receive callbacks during the restore * operation. This must not be null. * * @param monitor the {@link BackupManagerMonitor} to receive callbacks during the restore * operation. * * @return Zero on success; nonzero on error. * * @hide */ @SystemApi public int requestRestore(RestoreObserver observer, BackupManagerMonitor monitor) { int result = -1; checkServiceBinder(); if (sService != null) { Loading @@ -267,7 +297,7 @@ public class BackupManager { null); if (binder != null) { session = new RestoreSession(mContext, binder); result = session.restorePackage(mContext.getPackageName(), observer); result = session.restorePackage(mContext.getPackageName(), observer, monitor); } } catch (RemoteException e) { Log.e(TAG, "restoreSelf() unable to contact service"); Loading @@ -280,8 +310,6 @@ public class BackupManager { return result; } // system APIs start here /** * Begin the process of restoring data from backup. See the * {@link android.app.backup.RestoreSession} class for documentation on that process. Loading
core/java/android/app/backup/BackupManagerMonitor.java +2 −0 Original line number Diff line number Diff line Loading @@ -57,6 +57,8 @@ public class BackupManagerMonitor { // TODO complete this list with all log messages. And document properly. public static final int LOG_EVENT_ID_FULL_BACKUP_TIMEOUT = 4; public static final int LOG_EVENT_ID_KEY_VALUE_BACKUP_TIMEOUT = 21; public static final int LOG_EVENT_ID_KEY_VALUE_RESTORE_TIMEOUT = 31; public static final int LOG_EVENT_ID_FULL_RESTORE_TIMEOUT = 45; public static final int LOG_EVENT_ID_NO_PACKAGES = 49; Loading
core/java/android/app/backup/IRestoreSession.aidl +11 −5 Original line number Diff line number Diff line Loading @@ -18,7 +18,7 @@ package android.app.backup; import android.app.backup.RestoreSet; import android.app.backup.IRestoreObserver; import android.app.backup.IBackupManagerMonitor; /** * Binder interface used by clients who wish to manage a restore operation. Every * method in this interface requires the android.permission.BACKUP permission. Loading @@ -31,10 +31,11 @@ interface IRestoreSession { * * @param observer This binder points to an object whose onRestoreSetsAvailable() * method will be called to supply the results of the transport's lookup. * @param monitor If non null the binder will send important events to this monitor. * @return Zero on success; nonzero on error. The observer will only receive a * result callback if this method returned zero. */ int getAvailableRestoreSets(IRestoreObserver observer); int getAvailableRestoreSets(IRestoreObserver observer, IBackupManagerMonitor monitor); /** * Restore the given set onto the device, replacing the current data of any app Loading @@ -48,8 +49,9 @@ interface IRestoreSession { * the restore set that should be used. * @param observer If non-null, this binder points to an object that will receive * progress callbacks during the restore operation. * @param monitor If non null the binder will send important events to this monitor. */ int restoreAll(long token, IRestoreObserver observer); int restoreAll(long token, IRestoreObserver observer, IBackupManagerMonitor monitor); /** * Restore select packages from the given set onto the device, replacing the Loading @@ -67,8 +69,10 @@ interface IRestoreSession { * @param packages The set of packages for which to attempt a restore. Regardless of * the contents of the actual back-end dataset named by {@code token}, only * applications mentioned in this list will have their data restored. * @param monitor If non null the binder will send important events to this monitor. */ int restoreSome(long token, IRestoreObserver observer, in String[] packages); int restoreSome(long token, IRestoreObserver observer, IBackupManagerMonitor monitor, in String[] packages); /** * Restore a single application from backup. The data will be restored from the Loading @@ -84,8 +88,10 @@ interface IRestoreSession { * permission must be held. * @param observer If non-null, this binder points to an object that will receive * progress callbacks during the restore operation. * @param monitor If non null the binder will send important events to this monitor. */ int restorePackage(in String packageName, IRestoreObserver observer); int restorePackage(in String packageName, IRestoreObserver observer, IBackupManagerMonitor monitor); /** * End this restore session. After this method is called, the IRestoreSession binder Loading