diff options
author | Christopher Tate <ctate@google.com> | 2010-01-29 12:48:20 -0800 |
---|---|---|
committer | Christopher Tate <ctate@google.com> | 2010-01-29 14:06:15 -0800 |
commit | 50c6df04cf17a99c3959c306a4e0e10da6d85c46 (patch) | |
tree | 11cef676c3f752f5262d27c05d7a2642f92369ff /core | |
parent | 4d3cef348b4350abd9d50230376ff8b1d2ac4654 (diff) | |
download | frameworks_base-50c6df04cf17a99c3959c306a4e0e10da6d85c46.zip frameworks_base-50c6df04cf17a99c3959c306a4e0e10da6d85c46.tar.gz frameworks_base-50c6df04cf17a99c3959c306a4e0e10da6d85c46.tar.bz2 |
Add a method to IBackupTransport to get the current backup set token
This will be used to specifically manage restores of last-known-good data
generated from the current device during its normal provisioned lifetime.
Diffstat (limited to 'core')
-rw-r--r-- | core/java/com/android/internal/backup/IBackupTransport.aidl | 15 | ||||
-rw-r--r-- | core/java/com/android/internal/backup/LocalTransport.java | 10 |
2 files changed, 22 insertions, 3 deletions
diff --git a/core/java/com/android/internal/backup/IBackupTransport.aidl b/core/java/com/android/internal/backup/IBackupTransport.aidl index a830ebd..9da1066 100644 --- a/core/java/com/android/internal/backup/IBackupTransport.aidl +++ b/core/java/com/android/internal/backup/IBackupTransport.aidl @@ -102,7 +102,7 @@ interface IBackupTransport { int finishBackup(); /** - * Get the set of backups currently available over this transport. + * Get the set of all backups currently available over this transport. * * @return Descriptions of the set of restore images available for this device, * or null if an error occurred (the attempt should be rescheduled). @@ -110,11 +110,22 @@ interface IBackupTransport { RestoreSet[] getAvailableRestoreSets(); /** + * 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. + * + * @return A token that can be passed to {@link #startRestore}, or 0 if there + * is no backup set available corresponding to the current device state. + */ + long getCurrentRestoreSet(); + + /** * 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. * - * @param token A backup token as returned by {@link #getAvailableRestoreSets}. + * @param token A backup token as returned by {@link #getAvailableRestoreSets} + * or {@link #getCurrentRestoreSet}. * @param packages List of applications to restore (if data is available). * Application data will be restored in the order given. * @return One of {@link BackupConstants#TRANSPORT_OK} (OK so far, call diff --git a/core/java/com/android/internal/backup/LocalTransport.java b/core/java/com/android/internal/backup/LocalTransport.java index 12bc5a8..23ec647 100644 --- a/core/java/com/android/internal/backup/LocalTransport.java +++ b/core/java/com/android/internal/backup/LocalTransport.java @@ -33,6 +33,9 @@ public class LocalTransport extends IBackupTransport.Stub { private static final String TRANSPORT_DIR_NAME = "com.android.internal.backup.LocalTransport"; + // The single hardcoded restore set always has the same (nonzero!) token + private static final long RESTORE_TOKEN = 1; + private Context mContext; private PackageManager mPackageManager; private File mDataDir = new File(Environment.getDownloadCacheDirectory(), "backup"); @@ -149,11 +152,16 @@ public class LocalTransport extends IBackupTransport.Stub { // Restore handling public RestoreSet[] getAvailableRestoreSets() throws android.os.RemoteException { // one hardcoded restore set - RestoreSet set = new RestoreSet("Local disk image", "flash", 0); + RestoreSet set = new RestoreSet("Local disk image", "flash", RESTORE_TOKEN); RestoreSet[] array = { set }; return array; } + public long getCurrentRestoreSet() { + // The hardcoded restore set always has the same token + return RESTORE_TOKEN; + } + public int startRestore(long token, PackageInfo[] packages) { if (DEBUG) Log.v(TAG, "start restore " + token); mRestorePackages = packages; |