diff options
| author | Chris Tate <ctate@google.com> | 2010-11-10 11:53:26 -0800 |
|---|---|---|
| committer | Chris Tate <ctate@google.com> | 2010-11-10 14:45:07 -0800 |
| commit | a8ddef346cece1ad229e270ac4deebbd41ba6721 (patch) | |
| tree | 64d9d9adc4a3f386406f912c17c0209ace2fee2a | |
| parent | bb69143ef5dcfddd8bbf04070cf6ba690e2674bb (diff) | |
| download | frameworks_base-a8ddef346cece1ad229e270ac4deebbd41ba6721.zip frameworks_base-a8ddef346cece1ad229e270ac4deebbd41ba6721.tar.gz frameworks_base-a8ddef346cece1ad229e270ac4deebbd41ba6721.tar.bz2 | |
Add description and configuration methods to the transport interface
It's now possible for the transport to supply a descriptive string to inform
the user about the nature of the backup destination (e.g. telling the user
what account the data is being stored under), and to supply an Intent with
which the system can initiate a configuration Activity supplied by the
transport (e.g. allowing the user to select which account their data is
being stored under).
The transport interface is not public.
Part of bug 2753632 and bug 2987804
Change-Id: I911f70a3ea440daf2a7a04710e9d7e65b61a58db
| -rw-r--r-- | core/java/com/android/internal/backup/IBackupTransport.aidl | 27 | ||||
| -rw-r--r-- | core/java/com/android/internal/backup/LocalTransport.java | 14 |
2 files changed, 39 insertions, 2 deletions
diff --git a/core/java/com/android/internal/backup/IBackupTransport.aidl b/core/java/com/android/internal/backup/IBackupTransport.aidl index b535fc1..5bfa1b2 100644 --- a/core/java/com/android/internal/backup/IBackupTransport.aidl +++ b/core/java/com/android/internal/backup/IBackupTransport.aidl @@ -17,11 +17,38 @@ package com.android.internal.backup; import android.app.backup.RestoreSet; +import android.content.Intent; import android.content.pm.PackageInfo; import android.os.ParcelFileDescriptor; /** {@hide} */ interface IBackupTransport { + /** + * Ask the transport for an Intent that can be used to launch any internal + * configuration Activity that it wishes to present. For example, the transport + * may offer a UI for allowing the user to supply login credentials for the + * transport's off-device backend. + * + * If the transport does not supply any user-facing configuration UI, it should + * return null from this method. + * + * @return An Intent that can be passed to Context.startActivity() in order to + * launch the transport's configuration UI. This method will return null + * if the transport does not offer any user-facing configuration UI. + */ + Intent configurationIntent(); + + /** + * On demand, supply a one-line string that can be shown to the user that + * describes the current backend destination. For example, a transport that + * can potentially associate backup data with arbitrary user accounts should + * include the name of the currently-active account here. + * + * @return A string describing the destination to which the transport is currently + * sending data. This method should not return null. + */ + String currentDestinationString(); + /** * Ask the transport where, on local device storage, to keep backup state blobs. * This is per-transport so that mock transports used for testing can coexist with diff --git a/core/java/com/android/internal/backup/LocalTransport.java b/core/java/com/android/internal/backup/LocalTransport.java index b436363..45f8599 100644 --- a/core/java/com/android/internal/backup/LocalTransport.java +++ b/core/java/com/android/internal/backup/LocalTransport.java @@ -20,6 +20,7 @@ import android.app.backup.BackupDataInput; import android.app.backup.BackupDataOutput; import android.app.backup.RestoreSet; import android.content.Context; +import android.content.Intent; import android.content.pm.PackageInfo; import android.content.pm.PackageManager; import android.content.pm.PackageManager.NameNotFoundException; @@ -49,11 +50,13 @@ public class LocalTransport extends IBackupTransport.Stub { private static final String TRANSPORT_DIR_NAME = "com.android.internal.backup.LocalTransport"; + private static final String TRANSPORT_DESTINATION_STRING + = "Backing up to debug-only private cache"; + // 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"); private PackageInfo[] mRestorePackages = null; private int mRestorePackage = -1; // Index into mRestorePackages @@ -61,9 +64,16 @@ public class LocalTransport extends IBackupTransport.Stub { public LocalTransport(Context context) { mContext = context; - mPackageManager = context.getPackageManager(); } + public Intent configurationIntent() { + // The local transport is not user-configurable + return null; + } + + public String currentDestinationString() { + return TRANSPORT_DESTINATION_STRING; + } public String transportDirName() { return TRANSPORT_DIR_NAME; |
