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<!--
18This xml file allows customization of Android multiuser user types.
19It is parsed by frameworks/base/services/core/java/com/android/server/pm/UserTypeFactory.java.
20
21++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
22++++++++++++++++++++++++++++++++++++++++   IMPORTANT NOTE   ++++++++++++++++++++++++++++++++++++++++
23Although device customization is possible here, it is largely untested.
24In particular, although this file allows new profile types to be created, and allows modifying the
25number of managed profiles allowed on the device, the consequences of doing so is untested.
26OEMs are advised to test very carefully any significant customization.
27Further support is planned for later releases.
28++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
29
30Pre-defined (AOSP) user types can be customized and new types can be defined. The syntax is the
31same in both cases.
32
33Currently, only profiles (not full or system users) can be freely customized/defined.
34Full users (i.e. non-system, non-profile) users cannot be defined, and the only property of them
35that can be customized are the default-restrictions.
36System users cannot be customized here; their default-restrictions must be set using
37com.android.internal.R.array.config_defaultFirstUserRestrictions.
38
39The following example modifies two AOSP user types (the FULL user android.os.usertype.full.SECONDARY
40and 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
79Mandatory attributes:
80    name
81
82Supported optional properties (to be used as shown in the example above) are as follows.
83For profile and full users:
84    default-restrictions (with values defined in UserRestrictionUtils.USER_RESTRICTIONS)
85    enabled
86    user-properties
87    max-allowed
88For profile users only:
89    max-allowed-per-parent
90    icon-badge
91    badge-plain
92    badge-no-background
93    badge-labels
94    badge-colors
95
96See UserTypeFactory.java and UserTypeDetails.java for the meaning (and default values) of these
97fields.
98
99Any property that is specified overwrites the AOSP default. For example, if there is no
100default-restrictions element, then the AOSP defaults for that user type will be used; however, if
101there is a default-restrictions element, then the AOSP default restrictions will be completely
102ignored and will instead obey this configuration.
103
104If this file is updated, the properties of any pre-existing user types will be updated too.
105Note, however, that default-restrictions refers to the restrictions applied at the time of user
106creation; therefore, the active restrictions of any pre-existing users will not be updated.
107
108If a user type is disabled, by setting enabled='0', then no further users of that type may be
109created; however, any pre-existing users of that type will remain.
110
111The 'change-user-type' tag should be used in conjunction with the 'version' property of
112'user-types'. It defines a type change for all pre-existing users of 'from' type to the new 'to'
113type, if the former 'user-type's version of device is less than or equal to 'whenVersionLeq'.
114
115-->
116<user-types>
117</user-types>
118