Move com.android.managedprovisioning package constant to config.xml

Fixes: 71839817
Test: builds
Change-Id: Ia48b2812d54192447cf3a76c8d2b73d776400bb2
diff --git a/core/res/res/values/config.xml b/core/res/res/values/config.xml
index 375627d..c8eb1a9 100644
--- a/core/res/res/values/config.xml
+++ b/core/res/res/values/config.xml
@@ -3362,4 +3362,6 @@
         <item>"wifi"</item>
     </string-array>
 
+    <!-- Package name for ManagedProvisioning which is responsible for provisioning work profiles. -->
+    <string name="config_managed_provisioning_package" translatable="false">com.android.managedprovisioning</string>
 </resources>
diff --git a/core/res/res/values/symbols.xml b/core/res/res/values/symbols.xml
index 0cd1007..979a0d6 100644
--- a/core/res/res/values/symbols.xml
+++ b/core/res/res/values/symbols.xml
@@ -3288,4 +3288,6 @@
   <java-symbol type="string" name="zen_upgrade_notification_title" />
   <java-symbol type="string" name="zen_upgrade_notification_content" />
 
+  <java-symbol type="string" name="config_managed_provisioning_package" />
+
 </resources>
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);