Move com.android.managedprovisioning package constant to config.xml
Fixes: 71839817
Test: builds
Change-Id: Ia48b2812d54192447cf3a76c8d2b73d776400bb2
diff --git a/services/devicepolicy/java/com/android/server/devicepolicy/DevicePolicyManagerService.java b/services/devicepolicy/java/com/android/server/devicepolicy/DevicePolicyManagerService.java
index 6a468b1..ab8a6c4 100644
--- a/services/devicepolicy/java/com/android/server/devicepolicy/DevicePolicyManagerService.java
+++ b/services/devicepolicy/java/com/android/server/devicepolicy/DevicePolicyManagerService.java
@@ -332,8 +332,6 @@
private static final String ATTR_APPLICATION_RESTRICTIONS_MANAGER
= "application-restrictions-manager";
- private static final String MANAGED_PROVISIONING_PKG = "com.android.managedprovisioning";
-
// Comprehensive list of delegations.
private static final String DELEGATIONS[] = {
DELEGATION_CERT_INSTALL,
@@ -766,7 +764,7 @@
// Notify ManagedProvisioning to update the built-in cross profile intent filters.
Intent intent = new Intent(
DevicePolicyManager.ACTION_DATA_SHARING_RESTRICTION_CHANGED);
- intent.setPackage(MANAGED_PROVISIONING_PKG);
+ intent.setPackage(getManagedProvisioningPackage(mContext));
intent.putExtra(Intent.EXTRA_USER_ID, userId);
intent.addFlags(Intent.FLAG_RECEIVER_FOREGROUND);
mContext.sendBroadcastAsUser(intent, UserHandle.SYSTEM);
@@ -8957,7 +8955,7 @@
.putExtra(
DevicePolicyManager.EXTRA_PROVISIONING_LEAVE_ALL_SYSTEM_APPS_ENABLED,
leaveAllSystemAppsEnabled)
- .setPackage(MANAGED_PROVISIONING_PKG)
+ .setPackage(getManagedProvisioningPackage(mContext))
.addFlags(Intent.FLAG_RECEIVER_FOREGROUND);
mContext.sendBroadcastAsUser(intent, UserHandle.SYSTEM);
@@ -11591,7 +11589,7 @@
if (profileOwner == null) {
return false;
}
-
+
final Set<String> userAffiliationIds = getUserData(userId).mAffiliationIds;
final Set<String> deviceAffiliationIds =
getUserData(UserHandle.USER_SYSTEM).mAffiliationIds;
@@ -13093,4 +13091,8 @@
metrics.symbols);
}
}
+
+ private static String getManagedProvisioningPackage(Context context) {
+ return context.getResources().getString(R.string.config_managed_provisioning_package);
+ }
}
diff --git a/services/tests/servicestests/src/com/android/server/devicepolicy/DevicePolicyManagerTest.java b/services/tests/servicestests/src/com/android/server/devicepolicy/DevicePolicyManagerTest.java
index f58766f..e8170ee 100644
--- a/services/tests/servicestests/src/com/android/server/devicepolicy/DevicePolicyManagerTest.java
+++ b/services/tests/servicestests/src/com/android/server/devicepolicy/DevicePolicyManagerTest.java
@@ -4694,6 +4694,8 @@
}
public void testDisallowSharingIntoProfileSetRestriction() {
+ when(mServiceContext.resources.getString(R.string.config_managed_provisioning_package))
+ .thenReturn("com.android.managedprovisioning");
Bundle restriction = new Bundle();
restriction.putBoolean(UserManager.DISALLOW_SHARE_INTO_MANAGED_PROFILE, true);
@@ -4705,6 +4707,8 @@
}
public void testDisallowSharingIntoProfileClearRestriction() {
+ when(mServiceContext.resources.getString(R.string.config_managed_provisioning_package))
+ .thenReturn("com.android.managedprovisioning");
Bundle restriction = new Bundle();
restriction.putBoolean(UserManager.DISALLOW_SHARE_INTO_MANAGED_PROFILE, true);