Add new INSTALL_DPC_PACKAGES permission

Add a new permission that allows the holder to install a DPC package
without requiring user action.

Test: N/A
Bug: 204416562
Bug: 188410712
Change-Id: Ib0ef022d0af41562eeef89a027b23d9692488933
diff --git a/core/api/system-current.txt b/core/api/system-current.txt
index 4918eba..1a98673 100755
--- a/core/api/system-current.txt
+++ b/core/api/system-current.txt
@@ -118,6 +118,7 @@
     field public static final String HDMI_CEC = "android.permission.HDMI_CEC";
     field @Deprecated public static final String HIDE_NON_SYSTEM_OVERLAY_WINDOWS = "android.permission.HIDE_NON_SYSTEM_OVERLAY_WINDOWS";
     field public static final String INJECT_EVENTS = "android.permission.INJECT_EVENTS";
+    field public static final String INSTALL_DPC_PACKAGES = "android.permission.INSTALL_DPC_PACKAGES";
     field public static final String INSTALL_DYNAMIC_SYSTEM = "android.permission.INSTALL_DYNAMIC_SYSTEM";
     field public static final String INSTALL_GRANT_RUNTIME_PERMISSIONS = "android.permission.INSTALL_GRANT_RUNTIME_PERMISSIONS";
     field public static final String INSTALL_LOCATION_TIME_ZONE_PROVIDER_SERVICE = "android.permission.INSTALL_LOCATION_TIME_ZONE_PROVIDER_SERVICE";
diff --git a/core/res/AndroidManifest.xml b/core/res/AndroidManifest.xml
index df69ed0..2fdbe89 100644
--- a/core/res/AndroidManifest.xml
+++ b/core/res/AndroidManifest.xml
@@ -4215,6 +4215,16 @@
     <permission android:name="android.permission.INSTALL_TEST_ONLY_PACKAGE"
                 android:protectionLevel="signature" />
 
+    <!-- @SystemApi Allows an application to install DPCs only, an application is
+         considered a DPC if it has a {@link android.app.admin.DeviceAdminReceiver}
+         protected by {@link android.Manifest.permission#BIND_DEVICE_ADMIN).
+         This is a limited version of
+         {@link android.Manifest.permission#INSTALL_PACKAGES}.
+         @hide
+    -->
+    <permission android:name="android.permission.INSTALL_DPC_PACKAGES"
+                android:protectionLevel="signature|role" />
+
     <!-- Allows an application to use System Data Loaders.
          <p>Not for use by third-party applications.
          @hide
diff --git a/packages/Shell/AndroidManifest.xml b/packages/Shell/AndroidManifest.xml
index ddf0289..4bf1ad9 100644
--- a/packages/Shell/AndroidManifest.xml
+++ b/packages/Shell/AndroidManifest.xml
@@ -162,6 +162,7 @@
     <uses-permission android:name="android.permission.SET_ORIENTATION" />
     <uses-permission android:name="android.permission.INSTALL_PACKAGES" />
     <uses-permission android:name="android.permission.INSTALL_PACKAGE_UPDATES" />
+    <uses-permission android:name="android.permission.INSTALL_DPC_PACKAGES" />
     <uses-permission android:name="com.android.permission.USE_INSTALLER_V2" />
     <uses-permission android:name="android.permission.INSTALL_TEST_ONLY_PACKAGE" />
     <uses-permission android:name="com.android.permission.USE_SYSTEM_DATA_LOADERS" />