BackupHelperpublic interface BackupHelper Defines the calling interface that {@link BackupAgentHelper} uses
when dispatching backup and restore operations to the installed helpers.
Applications can define and install their own helpers as well as using those
provided as part of the Android framework.
Although multiple helper objects may be installed simultaneously, each helper
is responsible only for handling its own data, and will not see entities
created by other components within the backup system. Invocations of multiple
helpers are performed sequentially by the {@link BackupAgentHelper}, with each
helper given a chance to access its own saved state from within the state record
produced during the previous backup operation. |
Methods Summary |
---|
public void | performBackup(android.os.ParcelFileDescriptor oldState, BackupDataOutput data, android.os.ParcelFileDescriptor newState)Based on oldState , determine what application content
needs to be backed up, write it to data , and fill in
newState with the complete state as it exists now.
Implementing this method is much like implementing
{@link BackupAgent#onBackup(ParcelFileDescriptor, BackupDataOutput, ParcelFileDescriptor)
onBackup()} — the method parameters are the same. When this method is invoked the
{@code oldState} descriptor points to the beginning of the state data
written during this helper's previous backup operation, and the {@code newState}
descriptor points to the file location at which the helper should write its
new state after performing the backup operation.
Note: The helper should not close or seek either the {@code oldState} or
the {@code newState} file descriptors.
| public void | restoreEntity(BackupDataInputStream data)Called by {@link android.app.backup.BackupAgentHelper BackupAgentHelper}
to restore a single entity from the restore data set. This method will be
called for each entity in the data set that belongs to this handler.
Note: Do not close the data stream. Do not read more than
{@link android.app.backup.BackupDataInputStream#size() size()} bytes from
data .
| public void | writeNewStateDescription(android.os.ParcelFileDescriptor newState)Called by {@link android.app.backup.BackupAgentHelper BackupAgentHelper}
after a restore operation to write the backup state file corresponding to
the data as processed by the helper. The data written here will be
available to the helper during the next call to its
{@link #performBackup(ParcelFileDescriptor, BackupDataOutput, ParcelFileDescriptor)
performBackup()} method.
This method will be called even if the handler's
{@link #restoreEntity(BackupDataInputStream) restoreEntity()} method was never invoked during
the restore operation.
Note: The helper should not close or seek the {@code newState}
file descriptor.
|
|