Loading api/current.xml +41 −0 Original line number Diff line number Diff line Loading @@ -27381,6 +27381,47 @@ visibility="public" > </constructor> <method name="onUpdate" return="void" abstract="false" native="false" synchronized="false" static="false" final="false" deprecated="not deprecated" visibility="public" > <parameter name="nowBeingRestored" type="int"> </parameter> <parameter name="currentPackage" type="java.lang.String"> </parameter> </method> <method name="restoreFinished" return="void" abstract="false" native="false" synchronized="false" static="false" final="false" deprecated="not deprecated" visibility="public" > <parameter name="error" type="int"> </parameter> </method> <method name="restoreStarting" return="void" abstract="false" native="false" synchronized="false" static="false" final="false" deprecated="not deprecated" visibility="public" > <parameter name="numPackages" type="int"> </parameter> </method> </class> <class name="SharedPreferencesBackupHelper" extends="android.app.backup.FileBackupHelperBase" cmds/bmgr/src/com/android/commands/bmgr/Bmgr.java +21 −6 Original line number Diff line number Diff line Loading @@ -254,11 +254,13 @@ public final class Bmgr { private void doListRestoreSets() { try { RestoreSet[] sets = mRestore.getAvailableRestoreSets(); if (sets == null || sets.length == 0) { System.out.println("No restore sets available"); RestoreObserver observer = new RestoreObserver(); int err = mRestore.getAvailableRestoreSets(observer); if (err != 0) { System.out.println("Unable to request restore sets"); } else { printRestoreSets(sets); observer.waitForCompletion(); printRestoreSets(observer.sets); } } catch (RemoteException e) { System.err.println(e.toString()); Loading @@ -274,6 +276,16 @@ public final class Bmgr { class RestoreObserver extends IRestoreObserver.Stub { boolean done; RestoreSet[] sets = null; public void restoreSetsAvailable(RestoreSet[] result) { synchronized (this) { sets = result; done = true; this.notify(); } } public void restoreStarting(int numPackages) { System.out.println("restoreStarting: " + numPackages + " packages"); } Loading Loading @@ -359,8 +371,11 @@ public final class Bmgr { System.err.println(BMGR_NOT_RUNNING_ERR); return; } RestoreSet[] sets = mRestore.getAvailableRestoreSets(); if (sets != null) { RestoreSet[] sets = null; int err = mRestore.getAvailableRestoreSets(observer); if (err != 0) { observer.waitForCompletion(); sets = observer.sets; for (RestoreSet s : sets) { if (s.token == token) { System.out.println("Scheduling restore: " + s.name); Loading core/java/android/app/backup/IRestoreObserver.aidl +17 −3 Original line number Diff line number Diff line Loading @@ -16,12 +16,26 @@ package android.app.backup; import android.app.backup.RestoreSet; /** * Callback class for receiving progress reports during a restore operation. * * @hide */ interface IRestoreObserver { oneway interface IRestoreObserver { /** * Supply a list of the restore datasets available from the current transport. This * method is invoked as a callback following the application's use of the * {@link android.app.backup.IRestoreSession.getAvailableRestoreSets} method. * * @param result An array of {@link android.app.backup.RestoreSet RestoreSet} objects * describing all of the available datasets that are candidates for restoring to * the current device. If no applicable datasets exist, {@code result} will be * {@code null}. */ void restoreSetsAvailable(in RestoreSet[] result); /** * The restore operation has begun. * Loading @@ -32,8 +46,8 @@ interface IRestoreObserver { /** * An indication of which package is being restored currently, out of the * total number provided in the restoreStarting() callback. This method * is not guaranteed to be called. * total number provided in the {@link #restoreStarting(int numPackages)} callback. * This method is not guaranteed to be called. * * @param nowBeingRestored The index, between 1 and the numPackages parameter * to the restoreStarting() callback, of the package now being restored. Loading core/java/android/app/backup/IRestoreSession.aidl +5 −5 Original line number Diff line number Diff line Loading @@ -29,12 +29,12 @@ interface IRestoreSession { /** * Ask the current transport what the available restore sets are. * * @return A bundle containing two elements: an int array under the key * "tokens" whose entries are a transport-private identifier for each backup set; * and a String array under the key "names" whose entries are the user-meaningful * text corresponding to the backup sets at each index in the tokens array. * @param observer This binder points to an object whose onRestoreSetsAvailable() * method will be called to supply the results of the transport's lookup. * @return Zero on success; nonzero on error. The observer will only receive a * result callback if this method returned zero. */ RestoreSet[] getAvailableRestoreSets(); int getAvailableRestoreSets(IRestoreObserver observer); /** * Restore the given set onto the device, replacing the current data of any app Loading core/java/android/app/backup/RestoreObserver.java +19 −3 Original line number Diff line number Diff line Loading @@ -17,19 +17,35 @@ package android.app.backup; import java.lang.String; import android.app.backup.RestoreSet; /** * Callback class for receiving progress reports during a restore operation. These * methods will all be called on your application's main thread. */ public abstract class RestoreObserver { /** * Supply a list of the restore datasets available from the current transport. This * method is invoked as a callback following the application's use of the * {@link android.app.backup.IRestoreSession.getAvailableRestoreSets} method. * * @param result An array of {@link android.app.backup.RestoreSet RestoreSet} objects * describing all of the available datasets that are candidates for restoring to * the current device. If no applicable datasets exist, {@code result} will be * {@code null}. * * @hide */ public void restoreSetsAvailable(RestoreSet[] result) { } /** * The restore operation has begun. * * @param numPackages The total number of packages being processed in * this restore operation. */ void restoreStarting(int numPackages) { public void restoreStarting(int numPackages) { } /** Loading @@ -45,7 +61,7 @@ public abstract class RestoreObserver { * indication of the backup manager's progress through the overall restore process. * @param currentPackage The name of the package now being restored. */ void onUpdate(int nowBeingRestored, String currentPackage) { public void onUpdate(int nowBeingRestored, String currentPackage) { } /** Loading @@ -55,6 +71,6 @@ public abstract class RestoreObserver { * @param error Zero on success; a nonzero error code if the restore operation * as a whole failed. */ void restoreFinished(int error) { public void restoreFinished(int error) { } } Loading
api/current.xml +41 −0 Original line number Diff line number Diff line Loading @@ -27381,6 +27381,47 @@ visibility="public" > </constructor> <method name="onUpdate" return="void" abstract="false" native="false" synchronized="false" static="false" final="false" deprecated="not deprecated" visibility="public" > <parameter name="nowBeingRestored" type="int"> </parameter> <parameter name="currentPackage" type="java.lang.String"> </parameter> </method> <method name="restoreFinished" return="void" abstract="false" native="false" synchronized="false" static="false" final="false" deprecated="not deprecated" visibility="public" > <parameter name="error" type="int"> </parameter> </method> <method name="restoreStarting" return="void" abstract="false" native="false" synchronized="false" static="false" final="false" deprecated="not deprecated" visibility="public" > <parameter name="numPackages" type="int"> </parameter> </method> </class> <class name="SharedPreferencesBackupHelper" extends="android.app.backup.FileBackupHelperBase"
cmds/bmgr/src/com/android/commands/bmgr/Bmgr.java +21 −6 Original line number Diff line number Diff line Loading @@ -254,11 +254,13 @@ public final class Bmgr { private void doListRestoreSets() { try { RestoreSet[] sets = mRestore.getAvailableRestoreSets(); if (sets == null || sets.length == 0) { System.out.println("No restore sets available"); RestoreObserver observer = new RestoreObserver(); int err = mRestore.getAvailableRestoreSets(observer); if (err != 0) { System.out.println("Unable to request restore sets"); } else { printRestoreSets(sets); observer.waitForCompletion(); printRestoreSets(observer.sets); } } catch (RemoteException e) { System.err.println(e.toString()); Loading @@ -274,6 +276,16 @@ public final class Bmgr { class RestoreObserver extends IRestoreObserver.Stub { boolean done; RestoreSet[] sets = null; public void restoreSetsAvailable(RestoreSet[] result) { synchronized (this) { sets = result; done = true; this.notify(); } } public void restoreStarting(int numPackages) { System.out.println("restoreStarting: " + numPackages + " packages"); } Loading Loading @@ -359,8 +371,11 @@ public final class Bmgr { System.err.println(BMGR_NOT_RUNNING_ERR); return; } RestoreSet[] sets = mRestore.getAvailableRestoreSets(); if (sets != null) { RestoreSet[] sets = null; int err = mRestore.getAvailableRestoreSets(observer); if (err != 0) { observer.waitForCompletion(); sets = observer.sets; for (RestoreSet s : sets) { if (s.token == token) { System.out.println("Scheduling restore: " + s.name); Loading
core/java/android/app/backup/IRestoreObserver.aidl +17 −3 Original line number Diff line number Diff line Loading @@ -16,12 +16,26 @@ package android.app.backup; import android.app.backup.RestoreSet; /** * Callback class for receiving progress reports during a restore operation. * * @hide */ interface IRestoreObserver { oneway interface IRestoreObserver { /** * Supply a list of the restore datasets available from the current transport. This * method is invoked as a callback following the application's use of the * {@link android.app.backup.IRestoreSession.getAvailableRestoreSets} method. * * @param result An array of {@link android.app.backup.RestoreSet RestoreSet} objects * describing all of the available datasets that are candidates for restoring to * the current device. If no applicable datasets exist, {@code result} will be * {@code null}. */ void restoreSetsAvailable(in RestoreSet[] result); /** * The restore operation has begun. * Loading @@ -32,8 +46,8 @@ interface IRestoreObserver { /** * An indication of which package is being restored currently, out of the * total number provided in the restoreStarting() callback. This method * is not guaranteed to be called. * total number provided in the {@link #restoreStarting(int numPackages)} callback. * This method is not guaranteed to be called. * * @param nowBeingRestored The index, between 1 and the numPackages parameter * to the restoreStarting() callback, of the package now being restored. Loading
core/java/android/app/backup/IRestoreSession.aidl +5 −5 Original line number Diff line number Diff line Loading @@ -29,12 +29,12 @@ interface IRestoreSession { /** * Ask the current transport what the available restore sets are. * * @return A bundle containing two elements: an int array under the key * "tokens" whose entries are a transport-private identifier for each backup set; * and a String array under the key "names" whose entries are the user-meaningful * text corresponding to the backup sets at each index in the tokens array. * @param observer This binder points to an object whose onRestoreSetsAvailable() * method will be called to supply the results of the transport's lookup. * @return Zero on success; nonzero on error. The observer will only receive a * result callback if this method returned zero. */ RestoreSet[] getAvailableRestoreSets(); int getAvailableRestoreSets(IRestoreObserver observer); /** * Restore the given set onto the device, replacing the current data of any app Loading
core/java/android/app/backup/RestoreObserver.java +19 −3 Original line number Diff line number Diff line Loading @@ -17,19 +17,35 @@ package android.app.backup; import java.lang.String; import android.app.backup.RestoreSet; /** * Callback class for receiving progress reports during a restore operation. These * methods will all be called on your application's main thread. */ public abstract class RestoreObserver { /** * Supply a list of the restore datasets available from the current transport. This * method is invoked as a callback following the application's use of the * {@link android.app.backup.IRestoreSession.getAvailableRestoreSets} method. * * @param result An array of {@link android.app.backup.RestoreSet RestoreSet} objects * describing all of the available datasets that are candidates for restoring to * the current device. If no applicable datasets exist, {@code result} will be * {@code null}. * * @hide */ public void restoreSetsAvailable(RestoreSet[] result) { } /** * The restore operation has begun. * * @param numPackages The total number of packages being processed in * this restore operation. */ void restoreStarting(int numPackages) { public void restoreStarting(int numPackages) { } /** Loading @@ -45,7 +61,7 @@ public abstract class RestoreObserver { * indication of the backup manager's progress through the overall restore process. * @param currentPackage The name of the package now being restored. */ void onUpdate(int nowBeingRestored, String currentPackage) { public void onUpdate(int nowBeingRestored, String currentPackage) { } /** Loading @@ -55,6 +71,6 @@ public abstract class RestoreObserver { * @param error Zero on success; a nonzero error code if the restore operation * as a whole failed. */ void restoreFinished(int error) { public void restoreFinished(int error) { } }