diff options
| author | Christopher Tate <ctate@google.com> | 2009-06-26 21:07:13 -0700 |
|---|---|---|
| committer | Christopher Tate <ctate@google.com> | 2009-06-26 21:14:41 -0700 |
| commit | 9171749700853305f3e6abbcdbd9e02f3a71d459 (patch) | |
| tree | 7aaa1fada6783a588d1662165730e8d3f4ef591c /core/java/android/backup | |
| parent | 4cb1276e143e175590c69ceefa58eb721aa52846 (diff) | |
| download | frameworks_base-9171749700853305f3e6abbcdbd9e02f3a71d459.zip frameworks_base-9171749700853305f3e6abbcdbd9e02f3a71d459.tar.gz frameworks_base-9171749700853305f3e6abbcdbd9e02f3a71d459.tar.bz2 | |
Use system properties to track the current transport
This change retools the transport selection mechanism a fair bit. Transports
are now specified by name rather than by numeric ID, and the name of the
currently selected transport is stored in a persistent system property under the
name "persist.service.bkup.trans".
The name -> IBackupTransport translation is now handled by maintaining a map
from the names to the live IBackupTransport objects that correspond. The Google
transport service observer now registers and unregisters the transport as the
service goes up and down.
The bmgr command has been expanded to include real transport interrogation and
selection by name, and some documentation has been written for it.
Diffstat (limited to 'core/java/android/backup')
| -rw-r--r-- | core/java/android/backup/BackupManager.java | 4 | ||||
| -rw-r--r-- | core/java/android/backup/IBackupManager.aidl | 21 |
2 files changed, 17 insertions, 8 deletions
diff --git a/core/java/android/backup/BackupManager.java b/core/java/android/backup/BackupManager.java index 79e2c03..5b4ac0d 100644 --- a/core/java/android/backup/BackupManager.java +++ b/core/java/android/backup/BackupManager.java @@ -83,11 +83,11 @@ public class BackupManager { * * {@hide} */ - public IRestoreSession beginRestoreSession(int transportID) { + public IRestoreSession beginRestoreSession(String transport) { IRestoreSession binder = null; if (mService != null) { try { - binder = mService.beginRestoreSession(transportID); + binder = mService.beginRestoreSession(transport); } catch (RemoteException e) { } } diff --git a/core/java/android/backup/IBackupManager.aidl b/core/java/android/backup/IBackupManager.aidl index d6283d0..39e160b 100644 --- a/core/java/android/backup/IBackupManager.aidl +++ b/core/java/android/backup/IBackupManager.aidl @@ -63,23 +63,32 @@ interface IBackupManager { * Identify the currently selected transport. Callers must hold the * android.permission.BACKUP permission to use this method. */ - int getCurrentTransport(); + String getCurrentTransport(); /** - * Specify a default backup transport. Callers must hold the + * Request a list of all available backup transports' names. Callers must + * hold the android.permission.BACKUP permission to use this method. + */ + String[] listAllTransports(); + + /** + * Specify the current backup transport. Callers must hold the * android.permission.BACKUP permission to use this method. * - * @param transportID The ID of the transport to select. This should be one + * @param transport The name of the transport to select. This should be one * of {@link BackupManager.TRANSPORT_GOOGLE} or {@link BackupManager.TRANSPORT_ADB}. - * @return The ID of the previously selected transport. + * @return The name of the previously selected transport. If the given transport + * name is not one of the currently available transports, no change is made to + * the current transport setting and the method returns null. */ - int selectBackupTransport(int transportID); + String selectBackupTransport(String transport); /** * Begin a restore session with the given transport (which may differ from the * currently-active backup transport). * + * @param transport The name of the transport to use for the restore operation. * @return An interface to the restore session, or null on error. */ - IRestoreSession beginRestoreSession(int transportID); + IRestoreSession beginRestoreSession(String transportID); } |
