diff options
author | Bernardo Rufino <brufino@google.com> | 2019-08-14 15:59:06 +0100 |
---|---|---|
committer | Bernardo Rufino <brufino@google.com> | 2019-08-14 16:02:29 +0100 |
commit | 470f8be8b4e3efae9ddf5a624852657a4cd6df0d (patch) | |
tree | 391bf25ef928d284ae596c27dc9009aea29b2ce5 /services/backup/java | |
parent | b188863fcc626e23f1a5da3e870fbd3d1b8b31b0 (diff) |
Move updateTransportAttributes() to Trampoline
From BMS.
Test: atest BackupManagerServiceTest TrampolineRoboTest TrampolineTest
Bug: 135661048
Change-Id: I4527e24a35f8a65f87cb3d9d383485546b4b64e8
Diffstat (limited to 'services/backup/java')
-rw-r--r-- | services/backup/java/com/android/server/backup/BackupManagerService.java | 51 | ||||
-rw-r--r-- | services/backup/java/com/android/server/backup/Trampoline.java | 47 |
2 files changed, 46 insertions, 52 deletions
diff --git a/services/backup/java/com/android/server/backup/BackupManagerService.java b/services/backup/java/com/android/server/backup/BackupManagerService.java index 7fbfb33091ab..56d612642c56 100644 --- a/services/backup/java/com/android/server/backup/BackupManagerService.java +++ b/services/backup/java/com/android/server/backup/BackupManagerService.java @@ -28,9 +28,7 @@ import android.app.backup.IRestoreSession; import android.app.job.JobParameters; import android.app.job.JobScheduler; import android.app.job.JobService; -import android.content.ComponentName; import android.content.Context; -import android.content.Intent; import android.content.pm.PackageManager; import android.os.Binder; import android.os.IBinder; @@ -102,55 +100,6 @@ public class BackupManagerService { */ // TODO (b/118520567): Stop hardcoding system user when we pass in user id as a parameter - // --------------------------------------------- - // TRANSPORT OPERATIONS - // --------------------------------------------- - - /** - * 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. - */ - public void updateTransportAttributes( - @UserIdInt int userId, - ComponentName transportComponent, - String name, - @Nullable Intent configurationIntent, - String currentDestinationString, - @Nullable Intent dataManagementIntent, - CharSequence dataManagementLabel) { - UserBackupManagerService userBackupManagerService = - getServiceForUserIfCallerHasPermission(userId, "updateTransportAttributes()"); - - if (userBackupManagerService != null) { - userBackupManagerService.updateTransportAttributes( - transportComponent, - name, - configurationIntent, - currentDestinationString, - dataManagementIntent, - dataManagementLabel); - } - } - /** * Sets the ancestral work profile for the calling user. * diff --git a/services/backup/java/com/android/server/backup/Trampoline.java b/services/backup/java/com/android/server/backup/Trampoline.java index f32fa1785969..d7fa04a1538f 100644 --- a/services/backup/java/com/android/server/backup/Trampoline.java +++ b/services/backup/java/com/android/server/backup/Trampoline.java @@ -857,7 +857,7 @@ public class Trampoline extends IBackupManager.Stub { @Nullable Intent dataManagementIntent, CharSequence dataManagementLabel) { if (isUserReadyForBackup(userId)) { - mService.updateTransportAttributes( + updateTransportAttributes( userId, transportComponent, name, @@ -868,6 +868,51 @@ public class Trampoline extends IBackupManager.Stub { } } + /** + * 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. + */ + public void updateTransportAttributes( + @UserIdInt int userId, + ComponentName transportComponent, + String name, + @Nullable Intent configurationIntent, + String currentDestinationString, + @Nullable Intent dataManagementIntent, + CharSequence dataManagementLabel) { + UserBackupManagerService userBackupManagerService = + getServiceForUserIfCallerHasPermission(userId, "updateTransportAttributes()"); + + if (userBackupManagerService != null) { + userBackupManagerService.updateTransportAttributes( + transportComponent, + name, + configurationIntent, + currentDestinationString, + dataManagementIntent, + dataManagementLabel); + } + } + @Override public String selectBackupTransportForUser(int userId, String transport) throws RemoteException { |