public class RestoreSession extends Object
Modifier and Type | Method and Description |
---|---|
void |
endRestoreSession()
End this restore session.
|
int |
getAvailableRestoreSets(RestoreObserver observer)
Ask the current transport what the available restore sets are.
|
int |
restoreAll(long token,
RestoreObserver observer)
Restore the given set onto the device, replacing the current data of any app
contained in the restore set with the data previously backed up.
|
int |
restorePackage(String packageName,
RestoreObserver observer)
Restore a single application from backup.
|
int |
restoreSome(long token,
RestoreObserver observer,
String[] packages)
Restore select packages from the given set onto the device, replacing the
current data of any app contained in the set with the data previously
backed up.
|
public int getAvailableRestoreSets(RestoreObserver observer)
observer
- a RestoreObserver object whose restoreSetsAvailable() method will
be called on the application's main thread in order to supply the results of
the restore set lookup by the backup transport. This parameter must not be
null.public int restoreAll(long token, RestoreObserver observer)
Callers must hold the android.permission.BACKUP permission to use this method.
token
- The token from #getAvailableRestoreSets()
corresponding to
the restore set that should be used.observer
- If non-null, this binder points to an object that will receive
progress callbacks during the restore operation.public int restoreSome(long token, RestoreObserver observer, String[] packages)
Callers must hold the android.permission.BACKUP permission to use this method.
token
- The token from getAvailableRestoreSets()
corresponding to
the restore set that should be used.observer
- If non-null, this binder points to an object that will receive
progress callbacks during the restore operation.packages
- The set of packages for which to attempt a restore. Regardless of
the contents of the actual back-end dataset named by token
, only
applications mentioned in this list will have their data restored.public int restorePackage(String packageName, RestoreObserver observer)
packageName
- The name of the package whose data to restore. If this is
not the name of the caller's own package, then the android.permission.BACKUP
permission must be held.observer
- If non-null, this binder points to an object that will receive
progress callbacks during the restore operation.public void endRestoreSession()
Note: The caller must invoke this method to end the restore session,
even if restorePackage(String, RestoreObserver)
failed.