summaryrefslogtreecommitdiff
path: root/services/backup/java
diff options
context:
space:
mode:
authorBernardo Rufino <brufino@google.com>2019-08-14 15:51:14 +0100
committerBernardo Rufino <brufino@google.com>2019-08-14 15:53:51 +0100
commitb188863fcc626e23f1a5da3e870fbd3d1b8b31b0 (patch)
treeed7b5724000e8129d26756cf8874bb00a599a983 /services/backup/java
parentdd1fbf2b15fcfa905c1f701e7f4241e0708393fd (diff)
Move more transport operations to Trampoline
From BMS. Namely: * selectBackupTransport() * selectBackupTransportAsync() * getConfigurationIntent() * getDestinationString() * getDataManagementIntent() * getDataManagementLabel() Test: atest BackupManagerServiceTest TrampolineRoboTest TrampolineTest Bug: 135661048 Change-Id: I9dbc0c4dfa73bd9738ae658ff24f986000ffc54b
Diffstat (limited to 'services/backup/java')
-rw-r--r--services/backup/java/com/android/server/backup/BackupManagerService.java93
-rw-r--r--services/backup/java/com/android/server/backup/Trampoline.java104
2 files changed, 98 insertions, 99 deletions
diff --git a/services/backup/java/com/android/server/backup/BackupManagerService.java b/services/backup/java/com/android/server/backup/BackupManagerService.java
index eae0158f0c18..7fbfb33091ab 100644
--- a/services/backup/java/com/android/server/backup/BackupManagerService.java
+++ b/services/backup/java/com/android/server/backup/BackupManagerService.java
@@ -25,7 +25,6 @@ import android.app.backup.IBackupManagerMonitor;
import android.app.backup.IBackupObserver;
import android.app.backup.IFullBackupRestoreObserver;
import android.app.backup.IRestoreSession;
-import android.app.backup.ISelectBackupTransportCallback;
import android.app.job.JobParameters;
import android.app.job.JobScheduler;
import android.app.job.JobService;
@@ -153,54 +152,6 @@ public class BackupManagerService {
}
/**
- * Selects transport {@code transportName} and returns the previously selected transport.
- *
- * @deprecated Use {@link #selectBackupTransportAsync(ComponentName,
- * ISelectBackupTransportCallback)} instead.
- */
- @Deprecated
- @Nullable
- public String selectBackupTransport(@UserIdInt int userId, String transportName) {
- UserBackupManagerService userBackupManagerService =
- getServiceForUserIfCallerHasPermission(userId, "selectBackupTransport()");
-
- return userBackupManagerService == null
- ? null
- : userBackupManagerService.selectBackupTransport(transportName);
- }
-
- /**
- * Selects transport {@code transportComponent} asynchronously and notifies {@code listener}
- * with the result upon completion.
- */
- public void selectBackupTransportAsync(
- @UserIdInt int userId,
- ComponentName transportComponent,
- ISelectBackupTransportCallback listener) {
- UserBackupManagerService userBackupManagerService =
- getServiceForUserIfCallerHasPermission(userId, "selectBackupTransportAsync()");
-
- if (userBackupManagerService != null) {
- userBackupManagerService.selectBackupTransportAsync(transportComponent, listener);
- }
- }
-
- /**
- * Supply the configuration intent for the given transport. If the name is not one of the
- * available transports, or if the transport does not supply any configuration UI, the method
- * returns {@code null}.
- */
- @Nullable
- public Intent getConfigurationIntent(@UserIdInt int userId, String transportName) {
- UserBackupManagerService userBackupManagerService =
- getServiceForUserIfCallerHasPermission(userId, "getConfigurationIntent()");
-
- return userBackupManagerService == null
- ? null
- : userBackupManagerService.getConfigurationIntent(transportName);
- }
-
- /**
* Sets the ancestral work profile for the calling user.
*
* <p> The ancestral work profile corresponds to the profile that was used to restore to the
@@ -251,50 +202,6 @@ public class BackupManagerService {
return null;
}
- /**
- * Supply the current destination string for the given transport. If the name is not one of the
- * registered transports the method will return null.
- *
- * <p>This string is used VERBATIM as the summary text of the relevant Settings item.
- *
- * @param transportName The name of the registered transport.
- * @return The current destination string or null if the transport is not registered.
- */
- @Nullable
- public String getDestinationString(@UserIdInt int userId, String transportName) {
- UserBackupManagerService userBackupManagerService =
- getServiceForUserIfCallerHasPermission(userId, "getDestinationString()");
-
- return userBackupManagerService == null
- ? null
- : userBackupManagerService.getDestinationString(transportName);
- }
-
- /** Supply the manage-data intent for the given transport. */
- @Nullable
- public Intent getDataManagementIntent(@UserIdInt int userId, String transportName) {
- UserBackupManagerService userBackupManagerService =
- getServiceForUserIfCallerHasPermission(userId, "getDataManagementIntent()");
-
- return userBackupManagerService == null
- ? null
- : userBackupManagerService.getDataManagementIntent(transportName);
- }
-
- /**
- * Supply the menu label for affordances that fire the manage-data intent for the given
- * transport.
- */
- @Nullable
- public CharSequence getDataManagementLabel(@UserIdInt int userId, String transportName) {
- UserBackupManagerService userBackupManagerService =
- getServiceForUserIfCallerHasPermission(userId, "getDataManagementLabel()");
-
- return userBackupManagerService == null
- ? null
- : userBackupManagerService.getDataManagementLabel(transportName);
- }
-
// ---------------------------------------------
// SETTINGS OPERATIONS
// ---------------------------------------------
diff --git a/services/backup/java/com/android/server/backup/Trampoline.java b/services/backup/java/com/android/server/backup/Trampoline.java
index 55cac327d131..f32fa1785969 100644
--- a/services/backup/java/com/android/server/backup/Trampoline.java
+++ b/services/backup/java/com/android/server/backup/Trampoline.java
@@ -872,7 +872,7 @@ public class Trampoline extends IBackupManager.Stub {
public String selectBackupTransportForUser(int userId, String transport)
throws RemoteException {
return (isUserReadyForBackup(userId))
- ? mService.selectBackupTransport(userId, transport) : null;
+ ? selectBackupTransport(userId, transport) : null;
}
@Override
@@ -880,11 +880,28 @@ public class Trampoline extends IBackupManager.Stub {
return selectBackupTransportForUser(binderGetCallingUserId(), transport);
}
+ /**
+ * Selects transport {@code transportName} and returns the previously selected transport.
+ *
+ * @deprecated Use {@link #selectBackupTransportAsync(ComponentName,
+ * ISelectBackupTransportCallback)} instead.
+ */
+ @Deprecated
+ @Nullable
+ public String selectBackupTransport(@UserIdInt int userId, String transportName) {
+ UserBackupManagerService userBackupManagerService =
+ getServiceForUserIfCallerHasPermission(userId, "selectBackupTransport()");
+
+ return userBackupManagerService == null
+ ? null
+ : userBackupManagerService.selectBackupTransport(transportName);
+ }
+
@Override
public void selectBackupTransportAsyncForUser(int userId, ComponentName transport,
ISelectBackupTransportCallback listener) throws RemoteException {
if (isUserReadyForBackup(userId)) {
- mService.selectBackupTransportAsync(userId, transport, listener);
+ selectBackupTransportAsync(userId, transport, listener);
} else {
if (listener != null) {
try {
@@ -896,10 +913,26 @@ public class Trampoline extends IBackupManager.Stub {
}
}
+ /**
+ * Selects transport {@code transportComponent} asynchronously and notifies {@code listener}
+ * with the result upon completion.
+ */
+ public void selectBackupTransportAsync(
+ @UserIdInt int userId,
+ ComponentName transportComponent,
+ ISelectBackupTransportCallback listener) {
+ UserBackupManagerService userBackupManagerService =
+ getServiceForUserIfCallerHasPermission(userId, "selectBackupTransportAsync()");
+
+ if (userBackupManagerService != null) {
+ userBackupManagerService.selectBackupTransportAsync(transportComponent, listener);
+ }
+ }
+
@Override
public Intent getConfigurationIntentForUser(int userId, String transport)
throws RemoteException {
- return isUserReadyForBackup(userId) ? mService.getConfigurationIntent(userId, transport)
+ return isUserReadyForBackup(userId) ? getConfigurationIntent(userId, transport)
: null;
}
@@ -909,9 +942,24 @@ public class Trampoline extends IBackupManager.Stub {
return getConfigurationIntentForUser(binderGetCallingUserId(), transport);
}
+ /**
+ * Supply the configuration intent for the given transport. If the name is not one of the
+ * available transports, or if the transport does not supply any configuration UI, the method
+ * returns {@code null}.
+ */
+ @Nullable
+ public Intent getConfigurationIntent(@UserIdInt int userId, String transportName) {
+ UserBackupManagerService userBackupManagerService =
+ getServiceForUserIfCallerHasPermission(userId, "getConfigurationIntent()");
+
+ return userBackupManagerService == null
+ ? null
+ : userBackupManagerService.getConfigurationIntent(transportName);
+ }
+
@Override
public String getDestinationStringForUser(int userId, String transport) throws RemoteException {
- return isUserReadyForBackup(userId) ? mService.getDestinationString(userId, transport)
+ return isUserReadyForBackup(userId) ? getDestinationString(userId, transport)
: null;
}
@@ -920,11 +968,30 @@ public class Trampoline extends IBackupManager.Stub {
return getDestinationStringForUser(binderGetCallingUserId(), transport);
}
+ /**
+ * Supply the current destination string for the given transport. If the name is not one of the
+ * registered transports the method will return null.
+ *
+ * <p>This string is used VERBATIM as the summary text of the relevant Settings item.
+ *
+ * @param transportName The name of the registered transport.
+ * @return The current destination string or null if the transport is not registered.
+ */
+ @Nullable
+ public String getDestinationString(@UserIdInt int userId, String transportName) {
+ UserBackupManagerService userBackupManagerService =
+ getServiceForUserIfCallerHasPermission(userId, "getDestinationString()");
+
+ return userBackupManagerService == null
+ ? null
+ : userBackupManagerService.getDestinationString(transportName);
+ }
+
@Override
public Intent getDataManagementIntentForUser(int userId, String transport)
throws RemoteException {
return isUserReadyForBackup(userId)
- ? mService.getDataManagementIntent(userId, transport) : null;
+ ? getDataManagementIntent(userId, transport) : null;
}
@Override
@@ -933,13 +1000,38 @@ public class Trampoline extends IBackupManager.Stub {
return getDataManagementIntentForUser(binderGetCallingUserId(), transport);
}
+ /** Supply the manage-data intent for the given transport. */
+ @Nullable
+ public Intent getDataManagementIntent(@UserIdInt int userId, String transportName) {
+ UserBackupManagerService userBackupManagerService =
+ getServiceForUserIfCallerHasPermission(userId, "getDataManagementIntent()");
+
+ return userBackupManagerService == null
+ ? null
+ : userBackupManagerService.getDataManagementIntent(transportName);
+ }
+
@Override
public CharSequence getDataManagementLabelForUser(int userId, String transport)
throws RemoteException {
- return isUserReadyForBackup(userId) ? mService.getDataManagementLabel(userId, transport)
+ return isUserReadyForBackup(userId) ? getDataManagementLabel(userId, transport)
: null;
}
+ /**
+ * Supply the menu label for affordances that fire the manage-data intent for the given
+ * transport.
+ */
+ @Nullable
+ public CharSequence getDataManagementLabel(@UserIdInt int userId, String transportName) {
+ UserBackupManagerService userBackupManagerService =
+ getServiceForUserIfCallerHasPermission(userId, "getDataManagementLabel()");
+
+ return userBackupManagerService == null
+ ? null
+ : userBackupManagerService.getDataManagementLabel(transportName);
+ }
+
@Override
public IRestoreSession beginRestoreSessionForUser(
int userId, String packageName, String transportID) throws RemoteException {