Methods Summary |
---|
public int | abortFullRestore()If the OS encounters an error while processing {@link RestoreDescription#TYPE_FULL_STREAM}
data for restore, it will invoke this method to tell the transport that it should
abandon the data download for the current package. The OS will then either call
{@link #nextRestorePackage()} again to move on to restoring the next package in the
set being iterated over, or will call {@link #finishRestore()} to shut down the restore
operation.
|
public void | cancelFullBackup()
|
public int | clearBackupData(android.content.pm.PackageInfo packageInfo)Erase the give application's data from the backup destination. This clears
out the given package's data from the current backup set, making it as though
the app had never yet been backed up. After this is called, {@link finishBackup}
must be called to ensure that the operation is recorded successfully.
|
public android.content.Intent | configurationIntent()Ask the transport for an Intent that can be used to launch any internal
configuration Activity that it wishes to present. For example, the transport
may offer a UI for allowing the user to supply login credentials for the
transport's off-device backend.
If the transport does not supply any user-facing configuration UI, it should
return null from this method.
|
public java.lang.String | currentDestinationString()On demand, supply a one-line string that can be shown to the user that
describes the current backend destination. For example, a transport that
can potentially associate backup data with arbitrary user accounts should
include the name of the currently-active account here.
|
public android.content.Intent | dataManagementIntent()Ask the transport for an Intent that can be used to launch a more detailed
secondary data management activity. For example, the configuration intent might
be one for allowing the user to select which account they wish to associate
their backups with, and the management intent might be one which presents a
UI for managing the data on the backend.
In the Settings UI, the configuration intent will typically be invoked
when the user taps on the preferences item labeled with the current
destination string, and the management intent will be placed in an overflow
menu labelled with the management label string.
If the transport does not supply any user-facing data management
UI, then it should return {@code null} from this method.
|
public java.lang.String | dataManagementLabel()On demand, supply a short string that can be shown to the user as the label
on an overflow menu item used to invoked the data management UI.
|
public int | finishBackup()Finish sending application data to the backup destination. This must be
called after {@link #performBackup} or {@link clearBackupData} to ensure that
all data is sent. Only when this method returns true can a backup be assumed
to have succeeded.
|
public void | finishRestore()End a restore session (aborting any in-process data transfer as necessary),
freeing any resources and connections used during the restore process.
|
public android.app.backup.RestoreSet[] | getAvailableRestoreSets()Get the set of all backups currently available over this transport.
|
public long | getCurrentRestoreSet()Get the identifying token of the backup set currently being stored from
this device. This is used in the case of applications wishing to restore
their last-known-good data.
|
public int | getNextFullRestoreDataChunk(android.os.ParcelFileDescriptor socket)Ask the transport to provide data for the "current" package being restored. This
is the package that was just reported by {@link #nextRestorePackage()} as having
{@link RestoreDescription#TYPE_FULL_STREAM} data.
The transport writes some data to the socket supplied to this call, and returns
the number of bytes written. The system will then read that many bytes and
stream them to the application's agent for restore, then will call this method again
to receive the next chunk of the archive. This sequence will be repeated until the
transport returns zero indicating that all of the package's data has been delivered
(or returns a negative value indicating some sort of hard error condition at the
transport level).
After this method returns zero, the system will then call
{@link #getNextFullRestorePackage()} to begin the restore process for the next
application, and the sequence begins again.
The transport should always close this socket when returning from this method.
Do not cache this socket across multiple calls or you may leak file descriptors.
|
public int | getRestoreData(android.os.ParcelFileDescriptor outFd)Get the data for the application returned by {@link #nextRestorePackage}.
|
public int | initializeDevice()Initialize the server side storage for this device, erasing all stored data.
The transport may send the request immediately, or may buffer it. After
this is called, {@link #finishBackup} must be called to ensure the request
is sent and received successfully.
|
public java.lang.String | name()Ask the transport for the name under which it should be registered. This will
typically be its host service's component name, but need not be.
|
public android.app.backup.RestoreDescription | nextRestorePackage()Get the package name of the next application with data in the backup store, plus
a description of the structure of the restored archive: either TYPE_KEY_VALUE for
an original-API key/value dataset, or TYPE_FULL_STREAM for a tarball-type archive stream.
If the package name in the returned RestoreDescription object is the singleton
{@link RestoreDescription#NO_MORE_PACKAGES}, it indicates that no further data is available
in the current restore session: all packages described in startRestore() have been
processed.
If this method returns {@code null}, it means that a transport-level error has
occurred and the entire restore operation should be abandoned.
|
public int | performBackup(android.content.pm.PackageInfo packageInfo, android.os.ParcelFileDescriptor inFd)Send one application's data to the backup destination. The transport may send
the data immediately, or may buffer it. After this is called, {@link #finishBackup}
must be called to ensure the data is sent and recorded successfully.
|
public int | performFullBackup(android.content.pm.PackageInfo targetPackage, android.os.ParcelFileDescriptor socket)
|
public long | requestBackupTime()Verify that this is a suitable time for a backup pass. This should return zero
if a backup is reasonable right now, some positive value otherwise. This method
will be called outside of the {@link #startSession}/{@link #endSession} pair.
If this is not a suitable time for a backup, the transport should return a
backoff delay, in milliseconds, after which the Backup Manager should try again.
|
public long | requestFullBackupTime()
|
public int | sendBackupData(int numBytes)
|
public int | startRestore(long token, android.content.pm.PackageInfo[] packages)Start restoring application data from backup. After calling this function,
alternate calls to {@link #nextRestorePackage} and {@link #nextRestoreData}
to walk through the actual application data.
|
public java.lang.String | transportDirName()Ask the transport where, on local device storage, to keep backup state blobs.
This is per-transport so that mock transports used for testing can coexist with
"live" backup services without interfering with the live bookkeeping. The
returned string should be a name that is expected to be unambiguous among all
available backup transports; the name of the class implementing the transport
is a good choice.
|