summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--core/java/android/app/backup/BackupTransport.java53
-rw-r--r--core/java/com/android/internal/backup/IBackupTransport.aidl32
-rw-r--r--core/java/com/android/internal/backup/LocalTransport.java14
3 files changed, 96 insertions, 3 deletions
diff --git a/core/java/android/app/backup/BackupTransport.java b/core/java/android/app/backup/BackupTransport.java
index 28108a001566..446c03eea98d 100644
--- a/core/java/android/app/backup/BackupTransport.java
+++ b/core/java/android/app/backup/BackupTransport.java
@@ -72,11 +72,11 @@ public class BackupTransport {
* 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.
+ * <p>If the transport does not supply any user-facing configuration UI, it should
+ * return {@code 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
+ * launch the transport's configuration UI. This method will return {@code null}
* if the transport does not offer any user-facing configuration UI.
*/
public Intent configurationIntent() {
@@ -98,6 +98,43 @@ public class BackupTransport {
}
/**
+ * Ask the transport for an Intent that can be used to launch a more detailed
+ * secondary data management activity. For example, the configuration intent might
+ * be one for allowing the user to select which account they wish to associate
+ * their backups with, and the management intent might be one which presents a
+ * UI for managing the data on the backend.
+ *
+ * <p>In the Settings UI, the configuration intent will typically be invoked
+ * when the user taps on the preferences item labeled with the current
+ * destination string, and the management intent will be placed in an overflow
+ * menu labelled with the management label string.
+ *
+ * <p>If the transport does not supply any user-facing data management
+ * UI, then it should return {@code null} from this method.
+ *
+ * @return An intent that can be passed to Context.startActivity() in order to
+ * launch the transport's data-management UI. This method will return
+ * {@code null} if the transport does not offer any user-facing data
+ * management UI.
+ */
+ public Intent dataManagementIntent() {
+ return null;
+ }
+
+ /**
+ * On demand, supply a short string that can be shown to the user as the label
+ * on an overflow menu item used to invoked the data management UI.
+ *
+ * @return A string to be used as the label for the transport's data management
+ * affordance. If the transport supplies a data management intent, this
+ * method must not return {@code null}.
+ */
+ public String dataManagementLabel() {
+ throw new UnsupportedOperationException(
+ "Transport dataManagementLabel() not implemented");
+ }
+
+ /**
* 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
* "live" backup services without interfering with the live bookkeeping. The
@@ -446,6 +483,16 @@ public class BackupTransport {
}
@Override
+ public Intent dataManagementIntent() {
+ return BackupTransport.this.dataManagementIntent();
+ }
+
+ @Override
+ public String dataManagementLabel() {
+ return BackupTransport.this.dataManagementLabel();
+ }
+
+ @Override
public String transportDirName() throws RemoteException {
return BackupTransport.this.transportDirName();
}
diff --git a/core/java/com/android/internal/backup/IBackupTransport.aidl b/core/java/com/android/internal/backup/IBackupTransport.aidl
index 643225d7f031..36de52b2ed4e 100644
--- a/core/java/com/android/internal/backup/IBackupTransport.aidl
+++ b/core/java/com/android/internal/backup/IBackupTransport.aidl
@@ -57,6 +57,38 @@ interface IBackupTransport {
String currentDestinationString();
/**
+ * Ask the transport for an Intent that can be used to launch a more detailed
+ * secondary data management activity. For example, the configuration intent might
+ * be one for allowing the user to select which account they wish to associate
+ * their backups with, and the management intent might be one which presents a
+ * UI for managing the data on the backend.
+ *
+ * <p>In the Settings UI, the configuration intent will typically be invoked
+ * when the user taps on the preferences item labeled with the current
+ * destination string, and the management intent will be placed in an overflow
+ * menu labelled with the management label string.
+ *
+ * <p>If the transport does not supply any user-facing data management
+ * UI, then it should return {@code null} from this method.
+ *
+ * @return An intent that can be passed to Context.startActivity() in order to
+ * launch the transport's data-management UI. This method will return
+ * {@code null} if the transport does not offer any user-facing data
+ * management UI.
+ */
+ Intent dataManagementIntent();
+
+ /**
+ * On demand, supply a short string that can be shown to the user as the label
+ * on an overflow menu item used to invoked the data management UI.
+ *
+ * @return A string to be used as the label for the transport's data management
+ * affordance. If the transport supplies a data management intent, this
+ * method must not return {@code null}.
+ */
+ String dataManagementLabel();
+
+ /**
* 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
* "live" backup services without interfering with the live bookkeeping. The
diff --git a/core/java/com/android/internal/backup/LocalTransport.java b/core/java/com/android/internal/backup/LocalTransport.java
index 50e7bcfb9b22..97e1102d8cac 100644
--- a/core/java/com/android/internal/backup/LocalTransport.java
+++ b/core/java/com/android/internal/backup/LocalTransport.java
@@ -64,6 +64,9 @@ public class LocalTransport extends BackupTransport {
private static final String TRANSPORT_DESTINATION_STRING
= "Backing up to debug-only private cache";
+ private static final String TRANSPORT_DATA_MANAGEMENT_LABEL
+ = "";
+
private static final String INCREMENTAL_DIR = "_delta";
private static final String FULL_DATA_DIR = "_full";
@@ -123,6 +126,17 @@ public class LocalTransport extends BackupTransport {
return TRANSPORT_DESTINATION_STRING;
}
+ public Intent dataManagementIntent() {
+ // The local transport does not present a data-management UI
+ // TODO: consider adding simple UI to wipe the archives entirely,
+ // for cleaning up the cache partition.
+ return null;
+ }
+
+ public String dataManagementLabel() {
+ return TRANSPORT_DATA_MANAGEMENT_LABEL;
+ }
+
@Override
public String transportDirName() {
return TRANSPORT_DIR_NAME;