Move HsumConfigOverlay to frameworks/base

Provides the basic framework config overlay for adopting HSUM.

Bug: 331960280
Bug: 347341495
Flag: EXEMPT refactor
Test: builds with correct config

Change-Id: Id01e027e6e814c30cc1b0604b2f51a6c52475deb
diff --git a/core/res/res/values/config.xml b/core/res/res/values/config.xml
index dc3d935..1eaeb2b 100644
--- a/core/res/res/values/config.xml
+++ b/core/res/res/values/config.xml
@@ -3061,10 +3061,13 @@
         frameworks/base/services/core/java/com/android/server/pm/UserSystemPackageInstaller.java -->
     <integer name="config_userTypePackageWhitelistMode">13</integer> <!-- 1+4+8 -->
 
-    <!-- Whether the main user is a permanent admin user. If the main user is a permanent admin user
-     it can't be deleted or downgraded to non-admin status.
-     This is generally only relevant on headless system user mode devices; on other devices, the
-     main user is the system user which is always a permanent admin anyway. -->
+    <!-- Whether the device will automatically (at first boot) have a designated main user and treat
+         it as a permanent admin.
+         Since the main user is a permanent admin user it can't be deleted or downgraded to
+         non-admin status.
+         This is generally only relevant on headless system user mode (HSUM) devices; on other
+         devices, the main user is the system user which is always a permanent admin anyway.
+         Note that HSUM devices without this enabled will not automatically have a main user. -->
     <bool name="config_isMainUserPermanentAdmin">true</bool>
 
     <!-- Whether switch to headless system user is allowed. If allowed,
@@ -3075,7 +3078,7 @@
     <bool name="config_enableMultiUserUI">false</bool>
 
     <!-- Whether multiple admins are allowed on the device. If set to true, new users can be created
-     with admin privileges and admin privileges can be granted/revoked from existing users. -->
+         with admin privileges and admin privileges can be granted/revoked from existing users. -->
     <bool name="config_enableMultipleAdmins">false</bool>
 
     <!-- Whether there is a communal profile which should always be running.
diff --git a/packages/overlays/HsumConfigOverlay/Android.bp b/packages/overlays/HsumConfigOverlay/Android.bp
new file mode 100644
index 0000000..050b1f0
--- /dev/null
+++ b/packages/overlays/HsumConfigOverlay/Android.bp
@@ -0,0 +1,16 @@
+package {
+    // See: http://go/android-license-faq
+    // A large-scale-change added 'default_applicable_licenses' to import
+    // all of the 'license_kinds' from "frameworks_base_license"
+    // to get the below license kinds:
+    //   SPDX-license-identifier-Apache-2.0
+    default_applicable_licenses: ["frameworks_base_license"],
+}
+
+runtime_resource_overlay {
+    name: "HsumConfigOverlay",
+    certificate: "platform",
+
+    product_specific: true,
+    sdk_version: "current",
+}
diff --git a/packages/overlays/HsumConfigOverlay/AndroidManifest.xml b/packages/overlays/HsumConfigOverlay/AndroidManifest.xml
new file mode 100644
index 0000000..cd7a879
--- /dev/null
+++ b/packages/overlays/HsumConfigOverlay/AndroidManifest.xml
@@ -0,0 +1,22 @@
+<!--
+  ~ Copyright (C) 2024 The Android Open Source Project
+  ~
+  ~ Licensed under the Apache License, Version 2.0 (the "License");
+  ~ you may not use this file except in compliance with the License.
+  ~ You may obtain a copy of the License at
+  ~
+  ~      http://www.apache.org/licenses/LICENSE-2.0
+  ~
+  ~ Unless required by applicable law or agreed to in writing, software
+  ~ distributed under the License is distributed on an "AS IS" BASIS,
+  ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+  ~ See the License for the specific language governing permissions and
+  ~ limitations under the License.
+  -->
+
+<manifest xmlns:android="http://schemas.android.com/apk/res/android"
+    package="com.android.internal.overlay.hsumconfig"
+    android:versionCode="1"
+    android:versionName="1.0">
+    <overlay android:targetPackage="android" android:priority="2" android:isStatic="true" />
+</manifest>
diff --git a/packages/overlays/HsumConfigOverlay/OWNERS b/packages/overlays/HsumConfigOverlay/OWNERS
new file mode 100644
index 0000000..79dd1c9
--- /dev/null
+++ b/packages/overlays/HsumConfigOverlay/OWNERS
@@ -0,0 +1,2 @@
+# People who can approve submission
+include platform/frameworks/base:/MULTIUSER_OWNERS
diff --git a/packages/overlays/HsumConfigOverlay/res/values/config.xml b/packages/overlays/HsumConfigOverlay/res/values/config.xml
new file mode 100644
index 0000000..7dbdfc7
--- /dev/null
+++ b/packages/overlays/HsumConfigOverlay/res/values/config.xml
@@ -0,0 +1,38 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+  ~ Copyright (C) 2024 The Android Open Source Project
+  ~
+  ~ Licensed under the Apache License, Version 2.0 (the "License");
+  ~ you may not use this file except in compliance with the License.
+  ~ You may obtain a copy of the License at
+  ~
+  ~      http://www.apache.org/licenses/LICENSE-2.0
+  ~
+  ~ Unless required by applicable law or agreed to in writing, software
+  ~ distributed under the License is distributed on an "AS IS" BASIS,
+  ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+  ~ See the License for the specific language governing permissions and
+  ~ limitations under the License.
+  -->
+
+<!-- Default configuration for Headless System User Mode (HSUM) builds. -->
+<resources xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2">
+
+  <!-- Whether multiple admins are allowed on the device. If set to true, new users can be created
+       with admin privileges and admin privileges can be granted/revoked from existing users. -->
+  <bool name="config_enableMultipleAdmins">true</bool>
+
+  <!-- Whether the device will automatically (at first boot) have a designated main user and treat
+       it as a permanent admin.
+       Since the main user is a permanent admin user it can't be deleted or downgraded to
+       non-admin status.
+       This is generally only relevant on headless system user mode (HSUM) devices; on other
+       devices, the main user is the system user which is always a permanent admin anyway.
+       Note that HSUM devices without this enabled will not automatically have a main user. -->
+  <bool name="config_isMainUserPermanentAdmin">true</bool>
+
+  <!-- Maximum number of users we allow to be running at a time.
+       Note that this includes the headless system user. -->
+  <integer name="config_multiuserMaxRunningUsers">4</integer>
+
+</resources>