diff options
| -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; |
