Gurpreet Singh | 7138788 | 2023-01-09 19:07:43 +0000 | [diff] [blame] | 1 | <?xml version="1.0" encoding="utf-8"?> |
| 2 | <!-- Copyright (C) 2019 The Android Open Source Project |
| 3 | |
| 4 | Licensed under the Apache License, Version 2.0 (the "License"); |
| 5 | you may not use this file except in compliance with the License. |
| 6 | You may obtain a copy of the License at |
| 7 | |
| 8 | http://www.apache.org/licenses/LICENSE-2.0 |
| 9 | |
| 10 | Unless required by applicable law or agreed to in writing, software |
| 11 | distributed under the License is distributed on an "AS IS" BASIS, |
| 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 13 | See the License for the specific language governing permissions and |
| 14 | limitations under the License. |
| 15 | --> |
| 16 | |
| 17 | <!-- |
| 18 | This xml file allows customization of Android multiuser user types. |
| 19 | It is parsed by frameworks/base/services/core/java/com/android/server/pm/UserTypeFactory.java. |
| 20 | |
| 21 | ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
| 22 | ++++++++++++++++++++++++++++++++++++++++ IMPORTANT NOTE ++++++++++++++++++++++++++++++++++++++++ |
| 23 | Although device customization is possible here, it is largely untested. |
| 24 | In particular, although this file allows new profile types to be created, and allows modifying the |
| 25 | number of managed profiles allowed on the device, the consequences of doing so is untested. |
| 26 | OEMs are advised to test very carefully any significant customization. |
| 27 | Further support is planned for later releases. |
| 28 | ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
| 29 | |
| 30 | Pre-defined (AOSP) user types can be customized and new types can be defined. The syntax is the |
| 31 | same in both cases. |
| 32 | |
| 33 | Currently, only profiles (not full or system users) can be freely customized/defined. |
| 34 | Full users (i.e. non-system, non-profile) users cannot be defined, and the only property of them |
| 35 | that can be customized are the default-restrictions. |
| 36 | System users cannot be customized here; their default-restrictions must be set using |
| 37 | com.android.internal.R.array.config_defaultFirstUserRestrictions. |
| 38 | |
| 39 | The following example modifies two AOSP user types (the FULL user android.os.usertype.full.SECONDARY |
| 40 | and the PROFILE user android.os.usertype.profile.MANAGED) and creates a new PROFILE user type |
| 41 | (com.example.profilename): |
| 42 | |
| 43 | <user-types version="0"> |
| 44 | <full-type name="android.os.usertype.full.SECONDARY" > |
| 45 | <default-restrictions no_sms="true" /> |
| 46 | </full-type> |
| 47 | |
| 48 | <profile-type |
| 49 | name='android.os.usertype.profile.MANAGED' |
| 50 | max-allowed-per-parent='2' |
| 51 | icon-badge='@android:drawable/ic_corp_icon_badge_case' |
| 52 | badge-plain='@android:drawable/ic_corp_badge_case' |
| 53 | badge-no-background='@android:drawable/ic_corp_badge_no_background' > |
| 54 | <badge-labels> |
| 55 | <item res='@android:string/managed_profile_label_badge' /> |
| 56 | <item res='@android:string/managed_profile_label_badge_2' /> |
| 57 | </badge-labels> |
| 58 | <badge-colors> |
| 59 | <item res='@android:color/profile_badge_1' /> |
| 60 | <item res='@android:color/profile_badge_2' /> |
| 61 | </badge-colors> |
| 62 | <default-restrictions no_sms="true" no_outgoing_calls="true" /> |
| 63 | </profile-type> |
| 64 | |
| 65 | <full-type |
| 66 | name="android.os.usertype.full.RESTRICTED" |
| 67 | enabled='0' /> |
| 68 | |
| 69 | <profile-type |
| 70 | name="com.example.profilename" |
| 71 | max-allowed-per-parent="2" /> |
| 72 | |
| 73 | <change-user-type |
| 74 | from="android.os.usertype.profile.MANAGED" |
| 75 | to="com.example.profilename" |
| 76 | whenVersionLeq="1" /> |
| 77 | </user-types> |
| 78 | |
| 79 | Mandatory attributes: |
| 80 | name |
| 81 | |
| 82 | Supported optional properties (to be used as shown in the example above) are as follows. |
| 83 | For profile and full users: |
| 84 | default-restrictions (with values defined in UserRestrictionUtils.USER_RESTRICTIONS) |
| 85 | enabled |
| 86 | For profile users only: |
| 87 | max-allowed-per-parent |
| 88 | icon-badge |
| 89 | badge-plain |
| 90 | badge-no-background |
| 91 | badge-labels |
| 92 | badge-colors |
| 93 | |
| 94 | See UserTypeFactory.java and UserTypeDetails.java for the meaning (and default values) of these |
| 95 | fields. |
| 96 | |
| 97 | Any property that is specified overwrites the AOSP default. For example, if there is no |
| 98 | default-restrictions element, then the AOSP defaults for that user type will be used; however, if |
| 99 | there is a default-restrictions element, then the AOSP default restrictions will be completely |
| 100 | ignored and will instead obey this configuration. |
| 101 | |
| 102 | If this file is updated, the properties of any pre-existing user types will be updated too. |
| 103 | Note, however, that default-restrictions refers to the restrictions applied at the time of user |
| 104 | creation; therefore, the active restrictions of any pre-existing users will not be updated. |
| 105 | |
| 106 | If a user type is disabled, by setting enabled='0', then no further users of that type may be |
| 107 | created; however, any pre-existing users of that type will remain. |
| 108 | |
| 109 | The 'change-user-type' tag should be used in conjunction with the 'version' property of |
| 110 | 'user-types'. It defines a type change for all pre-existing users of 'from' type to the new 'to' |
| 111 | type, if the former 'user-type's version of device is less than or equal to 'whenVersionLeq'. |
| 112 | |
| 113 | --> |
| 114 | <user-types> |
| 115 | </user-types> |