diff options
author | Christopher Tate <ctate@google.com> | 2009-06-07 15:19:32 -0700 |
---|---|---|
committer | Christopher Tate <ctate@google.com> | 2009-06-07 15:30:44 -0700 |
commit | b4a6188a74273611abcae05f3a3b1f0547548301 (patch) | |
tree | 8facd44ea2e5e13668fd6f42454c9b42f152603f /core/java/com | |
parent | da55569b0aaf98ff4d472d85ae1b038e76e1e9c3 (diff) | |
download | frameworks_base-b4a6188a74273611abcae05f3a3b1f0547548301.zip frameworks_base-b4a6188a74273611abcae05f3a3b1f0547548301.tar.gz frameworks_base-b4a6188a74273611abcae05f3a3b1f0547548301.tar.bz2 |
Add rough-draft restore API set to IBackupTransport
* getAvailableBackups returns the list of backup sets available for restore
* getAppSet() returns the set of apps available from a given backup set
* getRestoreData() streams the full backup data for a given application
(within a given backup set) into a FD; that data will be handed to the
app's backup agent for processing.
Diffstat (limited to 'core/java/com')
3 files changed, 78 insertions, 2 deletions
diff --git a/core/java/com/android/internal/backup/AdbTransport.java b/core/java/com/android/internal/backup/AdbTransport.java index 6e72b7b..db98062 100644 --- a/core/java/com/android/internal/backup/AdbTransport.java +++ b/core/java/com/android/internal/backup/AdbTransport.java @@ -1,6 +1,7 @@ package com.android.internal.backup; import android.content.pm.PackageInfo; +import android.os.Bundle; import android.os.ParcelFileDescriptor; import android.os.RemoteException; @@ -27,4 +28,24 @@ public class AdbTransport extends IBackupTransport.Stub { // TODO Auto-generated method stub return 0; } + + // Restore handling + public Bundle getAvailableBackups() throws android.os.RemoteException { + // !!! TODO: real implementation + Bundle b = new Bundle(); + b.putIntArray("tokens", new int[0]); + b.putStringArray("names", new String[0]); + return b; + } + + public PackageInfo[] getAppSet(int token) throws android.os.RemoteException { + // !!! TODO: real implementation + return new PackageInfo[0]; + } + + public int getRestoreData(int token, PackageInfo packageInfo, ParcelFileDescriptor data) + throws android.os.RemoteException { + // !!! TODO: real implementation + return 0; + } } diff --git a/core/java/com/android/internal/backup/GoogleTransport.java b/core/java/com/android/internal/backup/GoogleTransport.java index 7d1d269..124677e 100644 --- a/core/java/com/android/internal/backup/GoogleTransport.java +++ b/core/java/com/android/internal/backup/GoogleTransport.java @@ -1,6 +1,7 @@ package com.android.internal.backup; import android.content.pm.PackageInfo; +import android.os.Bundle; import android.os.ParcelFileDescriptor; import android.os.RemoteException; @@ -26,4 +27,23 @@ public class GoogleTransport extends IBackupTransport.Stub { return 0; } + // Restore handling + public Bundle getAvailableBackups() throws android.os.RemoteException { + // !!! TODO: real implementation + Bundle b = new Bundle(); + b.putIntArray("tokens", new int[0]); + b.putStringArray("names", new String[0]); + return b; + } + + public PackageInfo[] getAppSet(int token) throws android.os.RemoteException { + // !!! TODO: real implementation + return new PackageInfo[0]; + } + + public int getRestoreData(int token, PackageInfo packageInfo, ParcelFileDescriptor data) + throws android.os.RemoteException { + // !!! TODO: real implementation + return 0; + } } diff --git a/core/java/com/android/internal/backup/IBackupTransport.aidl b/core/java/com/android/internal/backup/IBackupTransport.aidl index 6f9df65..63c1bd4 100644 --- a/core/java/com/android/internal/backup/IBackupTransport.aidl +++ b/core/java/com/android/internal/backup/IBackupTransport.aidl @@ -17,6 +17,7 @@ package com.android.internal.backup; import android.content.pm.PackageInfo; +import android.os.Bundle; import android.os.ParcelFileDescriptor; /** {@hide} */ @@ -51,8 +52,8 @@ interface IBackupTransport { /** * Send one application's data to the backup destination. * - * @param package The identity of the application whose data is being backed up. This - * specifically includes the signature list for the package. + * @param packageInfo The identity of the application whose data is being backed up. + * This specifically includes the signature list for the package. * @param data The data stream that resulted from invoking the application's * BackupService.doBackup() method. This may be a pipe rather than a file on * persistent media, so it may not be seekable. @@ -61,6 +62,40 @@ interface IBackupTransport { int performBackup(in PackageInfo packageInfo, in ParcelFileDescriptor data); /** + * Get the set of backups currently available over this transport. + * + * @return backups 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 + * names corresponding to the backup sets at each index in the tokens array. + **/ + Bundle getAvailableBackups(); + + /** + * Get the set of applications from a given backup image. + * + * @param token A backup token as returned by {@link availableBackups}. + * @return An array of PackageInfo objects describing all of the applications + * available for restore from the given backup set. This should include the list + * of signatures for each package so that the Backup Manager can filter using that + * information. + */ + PackageInfo[] getAppSet(int token); + + /** + * Retrieve one application's data from the backup destination. + * + * @param token The backup record from which a restore is being requested. + * @param packageInfo The identity of the application whose data is being restored. + * This must include the signature list for the package; it is up to the transport + * to verify that the requested app's signatures match the saved backup record + * because the transport cannot necessarily trust the client device. + * @param data An open, writeable file into which the backup image should be stored. + * @return Zero on success; a nonzero error code on failure. + */ + int getRestoreData(int token, in PackageInfo packageInfo, in ParcelFileDescriptor data); + + /** * Terminate the backup session, closing files, freeing memory, and cleaning up whatever * other state the transport required. * |