summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--api/system-current.txt9
-rw-r--r--api/test-current.txt3
-rw-r--r--core/java/android/app/backup/BackupManager.java107
-rw-r--r--core/java/android/app/backup/BackupTransport.java32
-rw-r--r--core/java/android/app/backup/IBackupManager.aidl16
-rw-r--r--core/java/com/android/internal/backup/IBackupTransport.aidl8
-rw-r--r--services/backup/java/com/android/server/backup/BackupManagerService.java8
-rw-r--r--services/backup/java/com/android/server/backup/Trampoline.java11
-rw-r--r--services/backup/java/com/android/server/backup/TransportManager.java10
-rw-r--r--services/backup/java/com/android/server/backup/UserBackupManagerService.java12
-rw-r--r--services/robotests/backup/src/com/android/server/backup/TransportManagerTest.java2
-rw-r--r--services/robotests/backup/src/com/android/server/backup/testing/TransportData.java6
-rw-r--r--services/robotests/backup/src/com/android/server/backup/testing/TransportTestUtils.java3
-rw-r--r--services/tests/servicestests/src/com/android/server/backup/TrampolineTest.java17
14 files changed, 154 insertions, 90 deletions
diff --git a/api/system-current.txt b/api/system-current.txt
index 0154e282775c..5119d1c1cff2 100644
--- a/api/system-current.txt
+++ b/api/system-current.txt
@@ -744,7 +744,8 @@ package android.app.backup {
method @RequiresPermission(android.Manifest.permission.BACKUP) public String getCurrentTransport();
method @Nullable @RequiresPermission(android.Manifest.permission.BACKUP) public android.content.ComponentName getCurrentTransportComponent();
method @RequiresPermission(android.Manifest.permission.BACKUP) public android.content.Intent getDataManagementIntent(String);
- method @RequiresPermission(android.Manifest.permission.BACKUP) public String getDataManagementLabel(String);
+ method @Nullable @RequiresPermission(android.Manifest.permission.BACKUP) public CharSequence getDataManagementIntentLabel(@NonNull String);
+ method @Deprecated @Nullable @RequiresPermission(android.Manifest.permission.BACKUP) public String getDataManagementLabel(@NonNull String);
method @RequiresPermission(android.Manifest.permission.BACKUP) public String getDestinationString(String);
method @RequiresPermission(android.Manifest.permission.BACKUP) public boolean isAppEligibleForBackup(String);
method @RequiresPermission(android.Manifest.permission.BACKUP) public boolean isBackupEnabled();
@@ -758,7 +759,8 @@ package android.app.backup {
method @RequiresPermission(android.Manifest.permission.BACKUP) public void setAncestralSerialNumber(long);
method @RequiresPermission(android.Manifest.permission.BACKUP) public void setAutoRestore(boolean);
method @RequiresPermission(android.Manifest.permission.BACKUP) public void setBackupEnabled(boolean);
- method @RequiresPermission(android.Manifest.permission.BACKUP) public void updateTransportAttributes(android.content.ComponentName, String, @Nullable android.content.Intent, String, @Nullable android.content.Intent, @Nullable String);
+ method @Deprecated @RequiresPermission(android.Manifest.permission.BACKUP) public void updateTransportAttributes(@NonNull android.content.ComponentName, @NonNull String, @Nullable android.content.Intent, @NonNull String, @Nullable android.content.Intent, @Nullable String);
+ method @RequiresPermission(android.Manifest.permission.BACKUP) public void updateTransportAttributes(@NonNull android.content.ComponentName, @NonNull String, @Nullable android.content.Intent, @NonNull String, @Nullable android.content.Intent, @Nullable CharSequence);
field public static final int ERROR_AGENT_FAILURE = -1003; // 0xfffffc15
field public static final int ERROR_BACKUP_CANCELLED = -2003; // 0xfffff82d
field public static final int ERROR_BACKUP_NOT_ALLOWED = -2001; // 0xfffff82f
@@ -863,7 +865,8 @@ package android.app.backup {
method public android.content.Intent configurationIntent();
method public String currentDestinationString();
method public android.content.Intent dataManagementIntent();
- method public String dataManagementLabel();
+ method @Nullable public CharSequence dataManagementIntentLabel();
+ method @Deprecated @Nullable public String dataManagementLabel();
method public int finishBackup();
method public void finishRestore();
method public android.app.backup.RestoreSet[] getAvailableRestoreSets();
diff --git a/api/test-current.txt b/api/test-current.txt
index 583bf62160de..e2d2d540e54a 100644
--- a/api/test-current.txt
+++ b/api/test-current.txt
@@ -420,7 +420,8 @@ package android.app.backup {
public class BackupManager {
method @RequiresPermission("android.permission.BACKUP") public android.content.Intent getConfigurationIntent(String);
method @RequiresPermission("android.permission.BACKUP") public android.content.Intent getDataManagementIntent(String);
- method @RequiresPermission("android.permission.BACKUP") public String getDataManagementLabel(String);
+ method @Nullable @RequiresPermission("android.permission.BACKUP") public CharSequence getDataManagementIntentLabel(@NonNull String);
+ method @Deprecated @Nullable @RequiresPermission("android.permission.BACKUP") public String getDataManagementLabel(@NonNull String);
method @RequiresPermission("android.permission.BACKUP") public String getDestinationString(String);
}
diff --git a/core/java/android/app/backup/BackupManager.java b/core/java/android/app/backup/BackupManager.java
index bcc4974e4e64..25caaaa6e5ad 100644
--- a/core/java/android/app/backup/BackupManager.java
+++ b/core/java/android/app/backup/BackupManager.java
@@ -16,6 +16,7 @@
package android.app.backup;
+import android.annotation.NonNull;
import android.annotation.Nullable;
import android.annotation.RequiresPermission;
import android.annotation.SystemApi;
@@ -502,32 +503,76 @@ public class BackupManager {
* @param transportComponent The identity of the transport being described.
* @param name A {@link String} with the new name for the transport. This is NOT for
* identification. MUST NOT be {@code null}.
- * @param configurationIntent An {@link Intent} that can be passed to
- * {@link Context#startActivity} in order to launch the transport's configuration UI. It may
- * be {@code null} if the transport does not offer any user-facing configuration UI.
+ * @param configurationIntent An {@link Intent} that can be passed to {@link
+ * Context#startActivity} in order to launch the transport's configuration UI. It may be
+ * {@code null} if the transport does not offer any user-facing configuration UI.
* @param currentDestinationString A {@link String} describing the destination to which the
* transport is currently sending data. MUST NOT be {@code null}.
- * @param dataManagementIntent An {@link Intent} that can be passed to
- * {@link Context#startActivity} in order to launch the transport's data-management UI. It
- * may be {@code null} if the transport does not offer any user-facing data
- * management UI.
+ * @param dataManagementIntent An {@link Intent} that can be passed to {@link
+ * Context#startActivity} in order to launch the transport's data-management UI. It may be
+ * {@code null} if the transport does not offer any user-facing data management UI.
* @param dataManagementLabel A {@link String} to be used as the label for the transport's data
- * management affordance. This MUST be {@code null} when dataManagementIntent is
- * {@code null} and MUST NOT be {@code null} when dataManagementIntent is not {@code null}.
+ * management affordance. This MUST be {@code null} when dataManagementIntent is {@code
+ * null} and MUST NOT be {@code null} when dataManagementIntent is not {@code null}.
* @throws SecurityException If the UID of the calling process differs from the package UID of
* {@code transportComponent} or if the caller does NOT have BACKUP permission.
- *
+ * @deprecated Since Android Q, please use the variant {@link
+ * #updateTransportAttributes(ComponentName, String, Intent, String, Intent, CharSequence)}
+ * instead.
* @hide
*/
+ @Deprecated
@SystemApi
@RequiresPermission(android.Manifest.permission.BACKUP)
public void updateTransportAttributes(
- ComponentName transportComponent,
- String name,
+ @NonNull ComponentName transportComponent,
+ @NonNull String name,
@Nullable Intent configurationIntent,
- String currentDestinationString,
+ @NonNull String currentDestinationString,
@Nullable Intent dataManagementIntent,
@Nullable String dataManagementLabel) {
+ updateTransportAttributes(
+ transportComponent,
+ name,
+ configurationIntent,
+ currentDestinationString,
+ dataManagementIntent,
+ (CharSequence) dataManagementLabel);
+ }
+
+ /**
+ * Update the attributes of the transport identified by {@code transportComponent}. If the
+ * specified transport has not been bound at least once (for registration), this call will be
+ * ignored. Only the host process of the transport can change its description, otherwise a
+ * {@link SecurityException} will be thrown.
+ *
+ * @param transportComponent The identity of the transport being described.
+ * @param name A {@link String} with the new name for the transport. This is NOT for
+ * identification. MUST NOT be {@code null}.
+ * @param configurationIntent An {@link Intent} that can be passed to {@link
+ * Context#startActivity} in order to launch the transport's configuration UI. It may be
+ * {@code null} if the transport does not offer any user-facing configuration UI.
+ * @param currentDestinationString A {@link String} describing the destination to which the
+ * transport is currently sending data. MUST NOT be {@code null}.
+ * @param dataManagementIntent An {@link Intent} that can be passed to {@link
+ * Context#startActivity} in order to launch the transport's data-management UI. It may be
+ * {@code null} if the transport does not offer any user-facing data management UI.
+ * @param dataManagementLabel A {@link CharSequence} to be used as the label for the transport's
+ * data management affordance. This MUST be {@code null} when dataManagementIntent is {@code
+ * null} and MUST NOT be {@code null} when dataManagementIntent is not {@code null}.
+ * @throws SecurityException If the UID of the calling process differs from the package UID of
+ * {@code transportComponent} or if the caller does NOT have BACKUP permission.
+ * @hide
+ */
+ @SystemApi
+ @RequiresPermission(android.Manifest.permission.BACKUP)
+ public void updateTransportAttributes(
+ @NonNull ComponentName transportComponent,
+ @NonNull String name,
+ @Nullable Intent configurationIntent,
+ @NonNull String currentDestinationString,
+ @Nullable Intent dataManagementIntent,
+ @Nullable CharSequence dataManagementLabel) {
checkServiceBinder();
if (sService != null) {
try {
@@ -796,7 +841,7 @@ public class BackupManager {
/**
* Returns an {@link Intent} for the specified transport's configuration UI.
* This value is set by {@link #updateTransportAttributes(ComponentName, String, Intent, String,
- * Intent, String)}.
+ * Intent, CharSequence)}.
* @param transportName The name of the registered transport.
* @hide
*/
@@ -818,7 +863,7 @@ public class BackupManager {
/**
* Returns a {@link String} describing where the specified transport is sending data.
* This value is set by {@link #updateTransportAttributes(ComponentName, String, Intent, String,
- * Intent, String)}.
+ * Intent, CharSequence)}.
* @param transportName The name of the registered transport.
* @hide
*/
@@ -840,7 +885,7 @@ public class BackupManager {
/**
* Returns an {@link Intent} for the specified transport's data management UI.
* This value is set by {@link #updateTransportAttributes(ComponentName, String, Intent, String,
- * Intent, String)}.
+ * Intent, CharSequence)}.
* @param transportName The name of the registered transport.
* @hide
*/
@@ -861,23 +906,43 @@ public class BackupManager {
/**
* Returns a {@link String} describing what the specified transport's data management intent is
- * used for.
- * This value is set by {@link #updateTransportAttributes(ComponentName, String, Intent, String,
- * Intent, String)}.
+ * used for. This value is set by {@link #updateTransportAttributes(ComponentName, String,
+ * Intent, String, Intent, CharSequence)}.
*
* @param transportName The name of the registered transport.
+ * @deprecated Since Android Q, please use the variant {@link
+ * #getDataManagementIntentLabel(String)} instead.
* @hide
*/
+ @Deprecated
@SystemApi
@TestApi
@RequiresPermission(android.Manifest.permission.BACKUP)
- public String getDataManagementLabel(String transportName) {
+ @Nullable
+ public String getDataManagementLabel(@NonNull String transportName) {
+ CharSequence label = getDataManagementIntentLabel(transportName);
+ return label == null ? null : label.toString();
+ }
+
+ /**
+ * Returns a {@link CharSequence} describing what the specified transport's data management
+ * intent is used for. This value is set by {@link #updateTransportAttributes(ComponentName,
+ * String, Intent, String, Intent, CharSequence)}.
+ *
+ * @param transportName The name of the registered transport.
+ * @hide
+ */
+ @SystemApi
+ @TestApi
+ @RequiresPermission(android.Manifest.permission.BACKUP)
+ @Nullable
+ public CharSequence getDataManagementIntentLabel(@NonNull String transportName) {
checkServiceBinder();
if (sService != null) {
try {
return sService.getDataManagementLabelForUser(mContext.getUserId(), transportName);
} catch (RemoteException e) {
- Log.e(TAG, "getDataManagementLabel() couldn't connect");
+ Log.e(TAG, "getDataManagementIntentLabel() couldn't connect");
}
}
return null;
diff --git a/core/java/android/app/backup/BackupTransport.java b/core/java/android/app/backup/BackupTransport.java
index 0963594bc00e..c8f2ff34a70c 100644
--- a/core/java/android/app/backup/BackupTransport.java
+++ b/core/java/android/app/backup/BackupTransport.java
@@ -16,6 +16,7 @@
package android.app.backup;
+import android.annotation.Nullable;
import android.annotation.SystemApi;
import android.content.Intent;
import android.content.pm.PackageInfo;
@@ -164,19 +165,36 @@ public class BackupTransport {
}
/**
- * 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.
+ * On demand, supply a short string that can be shown to the user as the label on an overflow
+ * menu item used to invoke 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}.
+ * @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}.
+ * @deprecated Since Android Q, please use the variant {@link #dataManagementIntentLabel()}
+ * instead.
*/
+ @Deprecated
+ @Nullable
public String dataManagementLabel() {
throw new UnsupportedOperationException(
"Transport dataManagementLabel() not implemented");
}
/**
+ * On demand, supply a short CharSequence that can be shown to the user as the label on an
+ * overflow menu item used to invoke the data management UI.
+ *
+ * @return A CharSequence 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}.
+ */
+ @Nullable
+ public CharSequence dataManagementIntentLabel() {
+ return 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
@@ -651,8 +669,8 @@ public class BackupTransport {
}
@Override
- public String dataManagementLabel() {
- return BackupTransport.this.dataManagementLabel();
+ public CharSequence dataManagementIntentLabel() {
+ return BackupTransport.this.dataManagementIntentLabel();
}
@Override
diff --git a/core/java/android/app/backup/IBackupManager.aidl b/core/java/android/app/backup/IBackupManager.aidl
index 70ecdae92652..2dfaad759d3f 100644
--- a/core/java/android/app/backup/IBackupManager.aidl
+++ b/core/java/android/app/backup/IBackupManager.aidl
@@ -353,16 +353,16 @@ interface IBackupManager {
* {@link Context#startActivity} in order to launch the transport's data-management UI. It
* may be {@code null} if the transport does not offer any user-facing data
* management UI.
- * @param dataManagementLabel A {@link String} to be used as the label for the transport's data
- * management affordance. This MUST be {@code null} when dataManagementIntent is
- * {@code null} and MUST NOT be {@code null} when dataManagementIntent is not {@code null}.
+ * @param dataManagementLabel A {@link CharSequence} to be used as the label for the transport's
+ * data management affordance. This MUST be {@code null} when dataManagementIntent is {@code
+ * null} and MUST NOT be {@code null} when dataManagementIntent is not {@code null}.
* @throws SecurityException If the UID of the calling process differs from the package UID of
* {@code transportComponent} or if the caller does NOT have BACKUP permission.
*/
void updateTransportAttributesForUser(int userId, in ComponentName transportComponent,
in String name,
in Intent configurationIntent, in String currentDestinationString,
- in Intent dataManagementIntent, in String dataManagementLabel);
+ in Intent dataManagementIntent, in CharSequence dataManagementLabel);
/**
* Identify the currently selected transport. Callers must hold the
@@ -525,13 +525,7 @@ interface IBackupManager {
*
* @param userId User id for which the manage-data menu label should be reported.
*/
- String getDataManagementLabelForUser(int userId, String transport);
-
- /**
- * {@link android.app.backup.IBackupManager.getDataManagementLabelForUser} for the calling user
- * id.
- */
- String getDataManagementLabel(String transport);
+ CharSequence getDataManagementLabelForUser(int userId, String transport);
/**
* Begin a restore session. Either or both of packageName and transportID
diff --git a/core/java/com/android/internal/backup/IBackupTransport.aidl b/core/java/com/android/internal/backup/IBackupTransport.aidl
index f8117a7e9260..c9baf004d798 100644
--- a/core/java/com/android/internal/backup/IBackupTransport.aidl
+++ b/core/java/com/android/internal/backup/IBackupTransport.aidl
@@ -79,14 +79,14 @@ interface IBackupTransport {
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.
+ * On demand, supply a short {@link CharSequence} that can be shown to the user as the label on
+ * an overflow menu item used to invoke the data management UI.
*
- * @return A string to be used as the label for the transport's data management
+ * @return A {@link CharSequence} 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();
+ CharSequence dataManagementIntentLabel();
/**
* Ask the transport where, on local device storage, to keep backup state blobs.
diff --git a/services/backup/java/com/android/server/backup/BackupManagerService.java b/services/backup/java/com/android/server/backup/BackupManagerService.java
index ffda5819927b..7106664d0699 100644
--- a/services/backup/java/com/android/server/backup/BackupManagerService.java
+++ b/services/backup/java/com/android/server/backup/BackupManagerService.java
@@ -362,8 +362,8 @@ public class BackupManagerService {
* @param dataManagementIntent An {@link Intent} that can be passed to {@link
* Context#startActivity} in order to launch the transport's data-management UI. It may be
* {@code null} if the transport does not offer any user-facing data management UI.
- * @param dataManagementLabel A {@link String} to be used as the label for the transport's data
- * management affordance. This MUST be {@code null} when dataManagementIntent is {@code
+ * @param dataManagementLabel A {@link CharSequence} to be used as the label for the transport's
+ * data management affordance. This MUST be {@code null} when dataManagementIntent is {@code
* null} and MUST NOT be {@code null} when dataManagementIntent is not {@code null}.
* @throws SecurityException If the UID of the calling process differs from the package UID of
* {@code transportComponent} or if the caller does NOT have BACKUP permission.
@@ -375,7 +375,7 @@ public class BackupManagerService {
@Nullable Intent configurationIntent,
String currentDestinationString,
@Nullable Intent dataManagementIntent,
- String dataManagementLabel) {
+ CharSequence dataManagementLabel) {
UserBackupManagerService userBackupManagerService =
getServiceForUserIfCallerHasPermission(userId, "updateTransportAttributes()");
@@ -521,7 +521,7 @@ public class BackupManagerService {
* transport.
*/
@Nullable
- public String getDataManagementLabel(@UserIdInt int userId, String transportName) {
+ public CharSequence getDataManagementLabel(@UserIdInt int userId, String transportName) {
UserBackupManagerService userBackupManagerService =
getServiceForUserIfCallerHasPermission(userId, "getDataManagementLabel()");
diff --git a/services/backup/java/com/android/server/backup/Trampoline.java b/services/backup/java/com/android/server/backup/Trampoline.java
index 00cb6d3a0a26..8f0c5d812e1c 100644
--- a/services/backup/java/com/android/server/backup/Trampoline.java
+++ b/services/backup/java/com/android/server/backup/Trampoline.java
@@ -630,8 +630,7 @@ public class Trampoline extends IBackupManager.Stub {
@Nullable Intent configurationIntent,
String currentDestinationString,
@Nullable Intent dataManagementIntent,
- String dataManagementLabel) {
-
+ CharSequence dataManagementLabel) {
if (isUserReadyForBackup(userId)) {
mService.updateTransportAttributes(
userId,
@@ -710,19 +709,13 @@ public class Trampoline extends IBackupManager.Stub {
}
@Override
- public String getDataManagementLabelForUser(int userId, String transport)
+ public CharSequence getDataManagementLabelForUser(int userId, String transport)
throws RemoteException {
return isUserReadyForBackup(userId) ? mService.getDataManagementLabel(userId, transport)
: null;
}
@Override
- public String getDataManagementLabel(String transport)
- throws RemoteException {
- return getDataManagementLabelForUser(binderGetCallingUserId(), transport);
- }
-
- @Override
public IRestoreSession beginRestoreSessionForUser(
int userId, String packageName, String transportID) throws RemoteException {
return isUserReadyForBackup(userId) ? mService.beginRestoreSession(userId, packageName,
diff --git a/services/backup/java/com/android/server/backup/TransportManager.java b/services/backup/java/com/android/server/backup/TransportManager.java
index a7bada07ffa8..30ce4cf2fd3f 100644
--- a/services/backup/java/com/android/server/backup/TransportManager.java
+++ b/services/backup/java/com/android/server/backup/TransportManager.java
@@ -284,7 +284,7 @@ public class TransportManager {
* @throws TransportNotRegisteredException if the transport is not registered.
*/
@Nullable
- public String getTransportDataManagementLabel(String transportName)
+ public CharSequence getTransportDataManagementLabel(String transportName)
throws TransportNotRegisteredException {
synchronized (mTransportLock) {
return getRegisteredTransportDescriptionOrThrowLocked(transportName)
@@ -327,7 +327,7 @@ public class TransportManager {
@Nullable Intent configurationIntent,
String currentDestinationString,
@Nullable Intent dataManagementIntent,
- @Nullable String dataManagementLabel) {
+ @Nullable CharSequence dataManagementLabel) {
synchronized (mTransportLock) {
TransportDescription description =
mRegisteredTransportsDescriptionMap.get(transportComponent);
@@ -678,7 +678,7 @@ public class TransportManager {
transport.configurationIntent(),
transport.currentDestinationString(),
transport.dataManagementIntent(),
- transport.dataManagementLabel());
+ transport.dataManagementIntentLabel());
synchronized (mTransportLock) {
mRegisteredTransportsDescriptionMap.put(transportComponent, description);
}
@@ -707,7 +707,7 @@ public class TransportManager {
@Nullable private Intent configurationIntent;
private String currentDestinationString;
@Nullable private Intent dataManagementIntent;
- @Nullable private String dataManagementLabel;
+ @Nullable private CharSequence dataManagementLabel;
private TransportDescription(
String name,
@@ -715,7 +715,7 @@ public class TransportManager {
@Nullable Intent configurationIntent,
String currentDestinationString,
@Nullable Intent dataManagementIntent,
- @Nullable String dataManagementLabel) {
+ @Nullable CharSequence dataManagementLabel) {
this.name = name;
this.transportDirName = transportDirName;
this.configurationIntent = configurationIntent;
diff --git a/services/backup/java/com/android/server/backup/UserBackupManagerService.java b/services/backup/java/com/android/server/backup/UserBackupManagerService.java
index 32e2cacbb37b..447bd8c237dd 100644
--- a/services/backup/java/com/android/server/backup/UserBackupManagerService.java
+++ b/services/backup/java/com/android/server/backup/UserBackupManagerService.java
@@ -2929,8 +2929,8 @@ public class UserBackupManagerService {
* {@link Context#startActivity} in order to launch the transport's data-management UI. It
* may be {@code null} if the transport does not offer any user-facing data
* management UI.
- * @param dataManagementLabel A {@link String} to be used as the label for the transport's data
- * management affordance. This MUST be {@code null} when dataManagementIntent is
+ * @param dataManagementLabel A {@link CharSequence} to be used as the label for the transport's
+ * data management affordance. This MUST be {@code null} when dataManagementIntent is
* {@code null} and MUST NOT be {@code null} when dataManagementIntent is not {@code null}.
* @throws SecurityException If the UID of the calling process differs from the package UID of
* {@code transportComponent} or if the caller does NOT have BACKUP permission.
@@ -2941,7 +2941,7 @@ public class UserBackupManagerService {
@Nullable Intent configurationIntent,
String currentDestinationString,
@Nullable Intent dataManagementIntent,
- @Nullable String dataManagementLabel) {
+ @Nullable CharSequence dataManagementLabel) {
updateTransportAttributes(
Binder.getCallingUid(),
transportComponent,
@@ -2960,7 +2960,7 @@ public class UserBackupManagerService {
@Nullable Intent configurationIntent,
String currentDestinationString,
@Nullable Intent dataManagementIntent,
- @Nullable String dataManagementLabel) {
+ @Nullable CharSequence dataManagementLabel) {
mContext.enforceCallingOrSelfPermission(
android.Manifest.permission.BACKUP, "updateTransportAttributes");
@@ -3159,12 +3159,12 @@ public class UserBackupManagerService {
* Supply the menu label for affordances that fire the manage-data intent for the given
* transport.
*/
- public String getDataManagementLabel(String transportName) {
+ public CharSequence getDataManagementLabel(String transportName) {
mContext.enforceCallingOrSelfPermission(android.Manifest.permission.BACKUP,
"getDataManagementLabel");
try {
- String label = mTransportManager.getTransportDataManagementLabel(transportName);
+ CharSequence label = mTransportManager.getTransportDataManagementLabel(transportName);
if (MORE_DEBUG) {
Slog.d(TAG, "getDataManagementLabel() returning " + label);
}
diff --git a/services/robotests/backup/src/com/android/server/backup/TransportManagerTest.java b/services/robotests/backup/src/com/android/server/backup/TransportManagerTest.java
index 9a6e003c1317..42115d437ee0 100644
--- a/services/robotests/backup/src/com/android/server/backup/TransportManagerTest.java
+++ b/services/robotests/backup/src/com/android/server/backup/TransportManagerTest.java
@@ -554,7 +554,7 @@ public class TransportManagerTest {
transportManager.getTransportCurrentDestinationString(mTransportA1.transportName);
Intent dataManagementIntent =
transportManager.getTransportDataManagementIntent(mTransportA1.transportName);
- String dataManagementLabel =
+ CharSequence dataManagementLabel =
transportManager.getTransportDataManagementLabel(mTransportA1.transportName);
String transportDirName = transportManager.getTransportDirName(mTransportA1.transportName);
String transportDirNameByComponent =
diff --git a/services/robotests/backup/src/com/android/server/backup/testing/TransportData.java b/services/robotests/backup/src/com/android/server/backup/testing/TransportData.java
index 77f5d9a48c18..3c2981067fe8 100644
--- a/services/robotests/backup/src/com/android/server/backup/testing/TransportData.java
+++ b/services/robotests/backup/src/com/android/server/backup/testing/TransportData.java
@@ -75,7 +75,7 @@ public class TransportData {
@Nullable public Intent configurationIntent;
@Nullable public String currentDestinationString;
@Nullable public Intent dataManagementIntent;
- @Nullable public String dataManagementLabel;
+ @Nullable public CharSequence dataManagementLabel;
private TransportData(
@TransportStatus int transportStatus,
@@ -85,7 +85,7 @@ public class TransportData {
Intent configurationIntent,
String currentDestinationString,
Intent dataManagementIntent,
- String dataManagementLabel) {
+ CharSequence dataManagementLabel) {
this.transportStatus = transportStatus;
this.transportName = transportName;
this.transportComponentShort = transportComponentShort;
@@ -103,7 +103,7 @@ public class TransportData {
Intent configurationIntent,
String currentDestinationString,
Intent dataManagementIntent,
- String dataManagementLabel) {
+ CharSequence dataManagementLabel) {
this(
TransportStatus.REGISTERED_AVAILABLE,
transportName,
diff --git a/services/robotests/backup/src/com/android/server/backup/testing/TransportTestUtils.java b/services/robotests/backup/src/com/android/server/backup/testing/TransportTestUtils.java
index f6ed6307c82f..7dd5be53157b 100644
--- a/services/robotests/backup/src/com/android/server/backup/testing/TransportTestUtils.java
+++ b/services/robotests/backup/src/com/android/server/backup/testing/TransportTestUtils.java
@@ -188,7 +188,8 @@ public class TransportTestUtils {
when(transportBinder.currentDestinationString())
.thenReturn(transport.currentDestinationString);
when(transportBinder.dataManagementIntent()).thenReturn(transport.dataManagementIntent);
- when(transportBinder.dataManagementLabel()).thenReturn(transport.dataManagementLabel);
+ when(transportBinder.dataManagementIntentLabel())
+ .thenReturn(transport.dataManagementLabel);
} catch (RemoteException e) {
fail("RemoteException?");
}
diff --git a/services/tests/servicestests/src/com/android/server/backup/TrampolineTest.java b/services/tests/servicestests/src/com/android/server/backup/TrampolineTest.java
index 3e5ce46e8e3a..dd79aad52fd2 100644
--- a/services/tests/servicestests/src/com/android/server/backup/TrampolineTest.java
+++ b/services/tests/servicestests/src/com/android/server/backup/TrampolineTest.java
@@ -82,7 +82,7 @@ public class TrampolineTest {
private static final String CURRENT_PASSWORD = "current_password";
private static final String NEW_PASSWORD = "new_password";
private static final String ENCRYPTION_PASSWORD = "encryption_password";
- private static final String DATA_MANAGEMENT_LABEL = "data_management_label";
+ private static final CharSequence DATA_MANAGEMENT_LABEL = "data_management_label";
private static final String DESTINATION_STRING = "destination_string";
private static final String[] PACKAGE_NAMES =
new String[]{"some.package.name._1", "some.package.name._2"};
@@ -1104,8 +1104,8 @@ public class TrampolineTest {
}
@Test
- public void getDataManagementLabel_calledBeforeInitialize_ignored() throws Exception {
- assertNull(mTrampoline.getDataManagementLabel(TRANSPORT_NAME));
+ public void getDataManagementLabelForUser_calledBeforeInitialize_ignored() throws Exception {
+ assertNull(mTrampoline.getDataManagementLabelForUser(mUserId, TRANSPORT_NAME));
verifyNoMoreInteractions(mBackupManagerServiceMock);
}
@@ -1122,17 +1122,6 @@ public class TrampolineTest {
}
@Test
- public void getDataManagementLabel_forwarded() throws Exception {
- TrampolineTestable.sCallingUserId = mUserId;
- when(mBackupManagerServiceMock.getDataManagementLabel(mUserId, TRANSPORT_NAME)).thenReturn(
- DATA_MANAGEMENT_LABEL);
- mTrampoline.initializeService();
-
- assertEquals(DATA_MANAGEMENT_LABEL, mTrampoline.getDataManagementLabel(TRANSPORT_NAME));
- verify(mBackupManagerServiceMock).getDataManagementLabel(mUserId, TRANSPORT_NAME);
- }
-
- @Test
public void beginRestoreSession_calledBeforeInitialize_ignored() throws Exception {
mTrampoline.beginRestoreSessionForUser(mUserId, PACKAGE_NAME, TRANSPORT_NAME);
verifyNoMoreInteractions(mBackupManagerServiceMock);