Loading core/java/com/android/internal/backup/IBackupTransport.aidl +13 −2 Original line number Diff line number Diff line Loading @@ -102,19 +102,30 @@ 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). **/ 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 Loading core/java/com/android/internal/backup/LocalTransport.java +9 −1 Original line number Diff line number Diff line Loading @@ -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"); Loading Loading @@ -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; Loading Loading
core/java/com/android/internal/backup/IBackupTransport.aidl +13 −2 Original line number Diff line number Diff line Loading @@ -102,19 +102,30 @@ 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). **/ 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 Loading
core/java/com/android/internal/backup/LocalTransport.java +9 −1 Original line number Diff line number Diff line Loading @@ -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"); Loading Loading @@ -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; Loading