diff options
| author | 2022-03-01 17:14:30 +0000 | |
|---|---|---|
| committer | 2022-03-01 17:14:30 +0000 | |
| commit | 1cb902278522316b975d20d13f7b48633776efc7 (patch) | |
| tree | 9a6dc44d5c889a0dd39939cca10f53beee6fb472 | |
| parent | c04cf3c4b93c51c2970fef7243612eb402bb1b4a (diff) | |
| parent | 0b6456d3ecd2cca9c21d07ea9f26aaf9ab9ab9f3 (diff) | |
Merge "Rename device management role holder role name" into tm-dev
9 files changed, 71 insertions, 65 deletions
diff --git a/core/api/current.txt b/core/api/current.txt index 4d14d13424c1..4ab172d98d35 100644 --- a/core/api/current.txt +++ b/core/api/current.txt @@ -7388,8 +7388,8 @@ package android.app.admin { method public int getCurrentFailedPasswordAttempts(); method @Nullable public java.util.List<java.lang.String> getDelegatePackages(@NonNull android.content.ComponentName, @NonNull String); method @NonNull public java.util.List<java.lang.String> getDelegatedScopes(@Nullable android.content.ComponentName, @NonNull String); - method @Nullable public String getDeviceManagerRoleHolderPackageName(); method public CharSequence getDeviceOwnerLockScreenInfo(); + method @Nullable public String getDevicePolicyManagementRoleHolderPackage(); method @Nullable public android.graphics.drawable.Drawable getDrawable(@NonNull String, @NonNull String, @NonNull java.util.function.Supplier<android.graphics.drawable.Drawable>); method @Nullable public android.graphics.drawable.Drawable getDrawable(@NonNull String, @NonNull String, @NonNull String, @NonNull java.util.function.Supplier<android.graphics.drawable.Drawable>); method @Nullable public android.graphics.drawable.Icon getDrawableAsIcon(@NonNull String, @NonNull String, @NonNull String, @Nullable android.graphics.drawable.Icon); diff --git a/core/api/system-current.txt b/core/api/system-current.txt index e611d6b16bd7..e34498736467 100644 --- a/core/api/system-current.txt +++ b/core/api/system-current.txt @@ -416,7 +416,7 @@ package android { field public static final int config_defaultCallScreening = 17039398; // 0x1040026 field public static final int config_defaultDialer = 17039395; // 0x1040023 field public static final int config_defaultSms = 17039396; // 0x1040024 - field public static final int config_deviceManager; + field public static final int config_devicePolicyManagement; field public static final int config_feedbackIntentExtraKey = 17039391; // 0x104001f field public static final int config_feedbackIntentNameKey = 17039392; // 0x1040020 field public static final int config_helpIntentExtraKey = 17039389; // 0x104001d diff --git a/core/java/android/app/admin/DevicePolicyManager.java b/core/java/android/app/admin/DevicePolicyManager.java index b944468f10b1..d5d14c6c0fbb 100644 --- a/core/java/android/app/admin/DevicePolicyManager.java +++ b/core/java/android/app/admin/DevicePolicyManager.java @@ -545,15 +545,16 @@ public class DevicePolicyManager { = "android.app.action.PROVISION_FINALIZATION"; /** - * Activity action: starts the managed profile provisioning flow inside the device management - * role holder. + * Activity action: starts the managed profile provisioning flow inside the device policy + * management role holder. * * <p>During the managed profile provisioning flow, the platform-provided provisioning handler - * will delegate provisioning to the device management role holder, by firing this intent. - * Third-party mobile device management applications attempting to fire this intent will + * will delegate provisioning to the device policy management role holder, by firing this + * intent. Third-party mobile device management applications attempting to fire this intent will * receive a {@link SecurityException}. * - * <p>Device management role holders are required to have a handler for this intent action. + * <p>Device policy management role holders are required to have a handler for this intent + * action. * * <p>If {@link #EXTRA_ROLE_HOLDER_STATE} is supplied to this intent, it is the responsibility * of the role holder to restore its state from this extra. This is the same {@link Bundle} @@ -596,15 +597,16 @@ public class DevicePolicyManager { public static final int RESULT_DEVICE_OWNER_SET = 123; /** - * Activity action: starts the trusted source provisioning flow inside the device management - * role holder. + * Activity action: starts the trusted source provisioning flow inside the device policy + * management role holder. * * <p>During the trusted source provisioning flow, the platform-provided provisioning handler - * will delegate provisioning to the device management role holder, by firing this intent. - * Third-party mobile device management applications attempting to fire this intent will + * will delegate provisioning to the device policy management role holder, by firing this + * intent. Third-party mobile device management applications attempting to fire this intent will * receive a {@link SecurityException}. * - * <p>Device management role holders are required to have a handler for this intent action. + * <p>Device policy management role holders are required to have a handler for this intent + * action. * * <p>If {@link #EXTRA_ROLE_HOLDER_STATE} is supplied to this intent, it is the responsibility * of the role holder to restore its state from this extra. This is the same {@link Bundle} @@ -624,15 +626,16 @@ public class DevicePolicyManager { "android.app.action.ROLE_HOLDER_PROVISION_MANAGED_DEVICE_FROM_TRUSTED_SOURCE"; /** - * Activity action: starts the provisioning finalization flow inside the device management - * role holder. + * Activity action: starts the provisioning finalization flow inside the device policy + * management role holder. * * <p>During the provisioning finalization flow, the platform-provided provisioning handler - * will delegate provisioning to the device management role holder, by firing this intent. - * Third-party mobile device management applications attempting to fire this intent will + * will delegate provisioning to the device policy management role holder, by firing this + * intent. Third-party mobile device management applications attempting to fire this intent will * receive a {@link SecurityException}. * - * <p>Device management role holders are required to have a handler for this intent action. + * <p>Device policy management role holders are required to have a handler for this intent + * action. * * <p>This handler forwards the result from the admin app's {@link * #ACTION_ADMIN_POLICY_COMPLIANCE} handler. Result code {@link Activity#RESULT_CANCELED} @@ -697,9 +700,9 @@ public class DevicePolicyManager { * A boolean extra indicating whether offline provisioning is allowed. * * <p>For the online provisioning flow, there will be an attempt to download and install - * the latest version of the device management role holder. The platform will then delegate - * provisioning to the device management role holder via role holder-specific provisioning - * actions. + * the latest version of the device policy management role holder. The platform will then + * delegate provisioning to the device policy management role holder via role holder-specific + * provisioning actions. * * <p>For the offline provisioning flow, the provisioning flow will always be handled by * the platform. @@ -720,8 +723,8 @@ public class DevicePolicyManager { "android.app.extra.PROVISIONING_ALLOW_OFFLINE"; /** - * A String extra holding a url that specifies the download location of the device manager - * role holder package. + * A String extra holding a url that specifies the download location of the device policy + * management role holder package. * * <p>This is only meant to be used in cases when a specific variant of the role holder package * is needed (such as a debug variant). If not provided, the default variant of the device @@ -777,13 +780,13 @@ public class DevicePolicyManager { /** * An extra of type {@link android.os.PersistableBundle} that allows the provisioning initiator - * to pass data to the device manager role holder. + * to pass data to the device policy management role holder. * - * <p>The device manager role holder will receive this extra via the {@link + * <p>The device policy management role holder will receive this extra via the {@link * #ACTION_ROLE_HOLDER_PROVISION_MANAGED_DEVICE_FROM_TRUSTED_SOURCE} intent. * * <p>The contents of this extra are up to the contract between the provisioning initiator - * and the device manager role holder. + * and the device policy management role holder. * * <p>Use in an intent with action {@link #ACTION_PROVISION_MANAGED_DEVICE_FROM_TRUSTED_SOURCE} * or in an NFC record with {@link #MIME_TYPE_PROVISIONING_NFC} that starts device owner @@ -814,18 +817,19 @@ public class DevicePolicyManager { * <p>If {@link #EXTRA_PROVISIONING_SHOULD_LAUNCH_RESULT_INTENT} is set to {@code false}, * this result will be supplied as part of the result {@link Intent} for provisioning actions * such as {@link #ACTION_PROVISION_MANAGED_PROFILE}. This result will also be supplied as - * part of the result {@link Intent} for the device manager role holder provisioning actions. + * part of the result {@link Intent} for the device policy management role holder provisioning + * actions. */ public static final String EXTRA_RESULT_LAUNCH_INTENT = "android.app.extra.RESULT_LAUNCH_INTENT"; /** * A boolean extra that determines whether the provisioning flow should launch the resulting - * launch intent, if one is supplied by the device manager role holder via {@link + * launch intent, if one is supplied by the device policy management role holder via {@link * #EXTRA_RESULT_LAUNCH_INTENT}. Default value is {@code false}. * * <p>If {@code true}, the resulting intent will be launched by the provisioning flow, if one - * is supplied by the device manager role holder. + * is supplied by the device policy management role holder. * * <p>If {@code false}, the resulting intent will be returned as {@link * #EXTRA_RESULT_LAUNCH_INTENT} to the provisioning initiator, if one is supplied by the device @@ -3220,10 +3224,10 @@ public class DevicePolicyManager { "android.app.action.ADMIN_POLICY_COMPLIANCE"; /** - * Activity action: Starts the device management role holder updater. + * Activity action: Starts the device policy management role holder updater. * - * <p>The activity must handle the device management role holder update and set the intent - * result to either {@link Activity#RESULT_OK} if the update was successful, {@link + * <p>The activity must handle the device policy management role holder update and set the + * intent result to either {@link Activity#RESULT_OK} if the update was successful, {@link * #RESULT_UPDATE_DEVICE_MANAGEMENT_ROLE_HOLDER_RECOVERABLE_ERROR} if it encounters a problem * that may be solved by relaunching it again, or {@link * #RESULT_UPDATE_DEVICE_MANAGEMENT_ROLE_HOLDER_UNRECOVERABLE_ERROR} if it encounters a problem @@ -3261,9 +3265,9 @@ public class DevicePolicyManager { /** * An {@link Intent} extra which resolves to a custom user consent screen. * - * <p>If this extra is provided to the device management role holder via either {@link + * <p>If this extra is provided to the device policy management role holder via either {@link * #ACTION_ROLE_HOLDER_PROVISION_MANAGED_DEVICE_FROM_TRUSTED_SOURCE} or {@link - * #ACTION_ROLE_HOLDER_PROVISION_MANAGED_PROFILE}, the device management role holder must + * #ACTION_ROLE_HOLDER_PROVISION_MANAGED_PROFILE}, the device policy management role holder must * launch this intent which shows the custom user consent screen, replacing its own standard * consent screen. * @@ -3279,9 +3283,9 @@ public class DevicePolicyManager { * </ul> * * <p>If the custom consent screens are granted by the user {@link Activity#RESULT_OK} is - * returned, otherwise {@link Activity#RESULT_CANCELED} is returned. The device management - * role holder should ensure that the provisioning flow terminates immediately if consent - * is not granted by the user. + * returned, otherwise {@link Activity#RESULT_CANCELED} is returned. The device policy + * management role holder should ensure that the provisioning flow terminates immediately if + * consent is not granted by the user. * * @hide */ @@ -15647,14 +15651,15 @@ public class DevicePolicyManager { } /** - * Returns the package name of the device manager role holder. + * Returns the package name of the device policy management role holder. * - * <p>If the device manager role holder is not configured for this device, returns {@code null}. + * <p>If the device policy management role holder is not configured for this device, returns + * {@code null}. */ @Nullable - public String getDeviceManagerRoleHolderPackageName() { - String deviceManagerConfig = - mContext.getString(com.android.internal.R.string.config_deviceManager); + public String getDevicePolicyManagementRoleHolderPackage() { + String deviceManagerConfig = mContext.getString( + com.android.internal.R.string.config_devicePolicyManagement); return extractPackageNameFromDeviceManagerConfig(deviceManagerConfig); } diff --git a/core/res/res/values/config.xml b/core/res/res/values/config.xml index 4648f8a54686..0763ddb0be94 100644 --- a/core/res/res/values/config.xml +++ b/core/res/res/values/config.xml @@ -2113,7 +2113,7 @@ TODO(b/189347385) make this a @SystemAPI --> <string name="config_systemTelevisionRemoteService" translatable="false">@string/config_tvRemoteServicePackage</string> <!-- The name of the package that will hold the device management role --> - <string name="config_deviceManager" translatable="false"></string> + <string name="config_devicePolicyManagement" translatable="false"></string> <!-- The name of the package that will hold the app protection service role. --> <string name="config_systemAppProtectionService" translatable="false"></string> <!-- The name of the package that will hold the system calendar sync manager role. --> @@ -2122,7 +2122,7 @@ <string name="config_defaultAutomotiveNavigation" translatable="false"></string> <!-- The name of the package that will handle updating the device management role. --> - <string name="config_deviceManagerUpdater" translatable="false"></string> + <string name="config_devicePolicyManagementUpdater" translatable="false"></string> <!-- The name of the package that will be allowed to change its components' label/icon. --> <string name="config_overrideComponentUiPackage" translatable="false">com.android.stk</string> diff --git a/core/res/res/values/public.xml b/core/res/res/values/public.xml index 3beb4b2f7ee3..3467e1b40470 100644 --- a/core/res/res/values/public.xml +++ b/core/res/res/values/public.xml @@ -3301,7 +3301,7 @@ <!-- @hide @SystemApi --> <public name="config_systemSupervision" /> <!-- @hide @SystemApi --> - <public name="config_deviceManager" /> + <public name="config_devicePolicyManagement" /> <!-- @hide @SystemApi --> <public name="config_systemAppProtectionService" /> <!-- @hide @SystemApi @TestApi --> diff --git a/core/res/res/values/symbols.xml b/core/res/res/values/symbols.xml index ffd1f125b225..dae746b4bb7c 100644 --- a/core/res/res/values/symbols.xml +++ b/core/res/res/values/symbols.xml @@ -4726,7 +4726,7 @@ <java-symbol type="bool" name="config_enableSafetyCenter" /> - <java-symbol type="string" name="config_deviceManagerUpdater" /> + <java-symbol type="string" name="config_devicePolicyManagementUpdater" /> <java-symbol type="string" name="config_deviceSpecificDeviceStatePolicyProvider" /> diff --git a/services/devicepolicy/java/com/android/server/devicepolicy/DevicePolicyManagerService.java b/services/devicepolicy/java/com/android/server/devicepolicy/DevicePolicyManagerService.java index 1ac0c26164c1..28bf0d239b26 100644 --- a/services/devicepolicy/java/com/android/server/devicepolicy/DevicePolicyManagerService.java +++ b/services/devicepolicy/java/com/android/server/devicepolicy/DevicePolicyManagerService.java @@ -10853,7 +10853,7 @@ public class DevicePolicyManagerService extends BaseIDevicePolicyManager { final int userHandle = user.getIdentifier(); final long id = mInjector.binderClearCallingIdentity(); try { - maybeInstallDeviceManagerRoleHolderInUser(userHandle); + maybeInstallDevicePolicyManagementRoleHolderInUser(userHandle); manageUserUnchecked(admin, profileOwner, userHandle, adminExtras, /* showDisclaimer= */ true); @@ -17732,7 +17732,7 @@ public class DevicePolicyManagerService extends BaseIDevicePolicyManager { startTime, callerPackage); - maybeInstallDeviceManagerRoleHolderInUser(userInfo.id); + maybeInstallDevicePolicyManagementRoleHolderInUser(userInfo.id); installExistingAdminPackage(userInfo.id, admin.getPackageName()); if (!enableAdminAndSetProfileOwner( @@ -17800,24 +17800,25 @@ public class DevicePolicyManagerService extends BaseIDevicePolicyManager { private void onCreateAndProvisionManagedProfileCompleted( ManagedProfileProvisioningParams provisioningParams) {} - private void maybeInstallDeviceManagerRoleHolderInUser(int targetUserId) { - String deviceManagerRoleHolderPackageName = getDeviceManagerRoleHolderPackageName(mContext); - if (deviceManagerRoleHolderPackageName == null) { - Slogf.d(LOG_TAG, "No device manager role holder specified."); + private void maybeInstallDevicePolicyManagementRoleHolderInUser(int targetUserId) { + String devicePolicyManagerRoleHolderPackageName = + getDevicePolicyManagementRoleHolderPackageName(mContext); + if (devicePolicyManagerRoleHolderPackageName == null) { + Slogf.d(LOG_TAG, "No device policy management role holder specified."); return; } try { if (mIPackageManager.isPackageAvailable( - deviceManagerRoleHolderPackageName, targetUserId)) { - Slogf.d(LOG_TAG, "The device manager role holder " - + deviceManagerRoleHolderPackageName + " is already installed in " + devicePolicyManagerRoleHolderPackageName, targetUserId)) { + Slogf.d(LOG_TAG, "The device policy management role holder " + + devicePolicyManagerRoleHolderPackageName + " is already installed in " + "user " + targetUserId); return; } - Slogf.d(LOG_TAG, "Installing the device manager role holder " - + deviceManagerRoleHolderPackageName + " in user " + targetUserId); + Slogf.d(LOG_TAG, "Installing the device policy management role holder " + + devicePolicyManagerRoleHolderPackageName + " in user " + targetUserId); mIPackageManager.installExistingPackageAsUser( - deviceManagerRoleHolderPackageName, + devicePolicyManagerRoleHolderPackageName, targetUserId, PackageManager.INSTALL_ALL_WHITELIST_RESTRICTED_PERMISSIONS, PackageManager.INSTALL_REASON_POLICY, @@ -17827,10 +17828,10 @@ public class DevicePolicyManagerService extends BaseIDevicePolicyManager { } } - private String getDeviceManagerRoleHolderPackageName(Context context) { + private String getDevicePolicyManagementRoleHolderPackageName(Context context) { RoleManager roleManager = context.getSystemService(RoleManager.class); List<String> roleHolders = - roleManager.getRoleHolders(RoleManager.ROLE_DEVICE_MANAGER); + roleManager.getRoleHolders(RoleManager.ROLE_DEVICE_POLICY_MANAGEMENT); if (roleHolders.isEmpty()) { return null; } diff --git a/services/devicepolicy/java/com/android/server/devicepolicy/OverlayPackagesProvider.java b/services/devicepolicy/java/com/android/server/devicepolicy/OverlayPackagesProvider.java index 598f9e88ac6d..f3b164c6501c 100644 --- a/services/devicepolicy/java/com/android/server/devicepolicy/OverlayPackagesProvider.java +++ b/services/devicepolicy/java/com/android/server/devicepolicy/OverlayPackagesProvider.java @@ -94,7 +94,7 @@ public class OverlayPackagesProvider { String getActiveApexPackageNameContainingPackage(String packageName); - String getDeviceManagerRoleHolderPackageName(Context context); + String getDevicePolicyManagementRoleHolderPackageName(Context context); } private static final class DefaultInjector implements Injector { @@ -110,11 +110,11 @@ public class OverlayPackagesProvider { } @Override - public String getDeviceManagerRoleHolderPackageName(Context context) { + public String getDevicePolicyManagementRoleHolderPackageName(Context context) { return Binder.withCleanCallingIdentity(() -> { RoleManager roleManager = context.getSystemService(RoleManager.class); List<String> roleHolders = - roleManager.getRoleHolders(RoleManager.ROLE_DEVICE_MANAGER); + roleManager.getRoleHolders(RoleManager.ROLE_DEVICE_POLICY_MANAGEMENT); if (roleHolders.isEmpty()) { return null; } @@ -166,7 +166,7 @@ public class OverlayPackagesProvider { private Set<String> getDeviceManagerRoleHolders() { HashSet<String> result = new HashSet<>(); String deviceManagerRoleHolderPackageName = - mInjector.getDeviceManagerRoleHolderPackageName(mContext); + mInjector.getDevicePolicyManagementRoleHolderPackageName(mContext); if (deviceManagerRoleHolderPackageName != null) { result.add(deviceManagerRoleHolderPackageName); } diff --git a/services/tests/servicestests/src/com/android/server/devicepolicy/OverlayPackagesProviderTest.java b/services/tests/servicestests/src/com/android/server/devicepolicy/OverlayPackagesProviderTest.java index 533fb2d8d214..4f6fc3dc1f93 100644 --- a/services/tests/servicestests/src/com/android/server/devicepolicy/OverlayPackagesProviderTest.java +++ b/services/tests/servicestests/src/com/android/server/devicepolicy/OverlayPackagesProviderTest.java @@ -309,7 +309,7 @@ public class OverlayPackagesProviderTest { @Test public void testGetNonRequiredApps_managedProfile_roleHolder_works() { - when(mInjector.getDeviceManagerRoleHolderPackageName(any())) + when(mInjector.getDevicePolicyManagementRoleHolderPackageName(any())) .thenReturn(ROLE_HOLDER_PACKAGE_NAME); setSystemAppsWithLauncher("package1", "package2", ROLE_HOLDER_PACKAGE_NAME); @@ -319,7 +319,7 @@ public class OverlayPackagesProviderTest { @Test public void testGetNonRequiredApps_managedDevice_roleHolder_works() { - when(mInjector.getDeviceManagerRoleHolderPackageName(any())) + when(mInjector.getDevicePolicyManagementRoleHolderPackageName(any())) .thenReturn(ROLE_HOLDER_PACKAGE_NAME); setSystemAppsWithLauncher("package1", "package2", ROLE_HOLDER_PACKAGE_NAME); |