1<?xml version="1.0" encoding="utf-8"?>
2
3<!--
4This XML allows OEMs to configure a driving state to UX restrictions.  There are 2 major classes
5of configuration:
61. Restriction Mapping as defined by the <RestrictionMapping> tag.
72. Restriction Parameters for restrictions that can be parametrized as defined by
8   <RestrictionParameters> tag.
9
10Note:
11   The tags and attributes are declared in
12   packages/services/Car/service/src/com/android/car/CarUxRestrictionsConfigurationXmlParser.java
13   Supported tags and attribute for each tag -
14       - UxRestrictions (Starting tag, defines the UX restrictions to be imposed for different
15       driving states of a vehicle)
16       - RestrictionMapping (Tag 1. UX restriction Mapping from a driving state of the vehicle)
17             - physicalPort (Attribute. Physical port that connects
18             to a display. Restrictions defined will apply to the display that connects to this
19             port. Only the lowest byte in the integer value is used. The value should be
20             interpreted as an signed int, namely the supported range is [-128, 127].
21             Optional field. 'physicalPort' is one way of specifying a display in the context of
22             UX restrictions. The combination of 'occupantZoneId' and 'displayType' is another way
23             of identifying a display. When 'physicalPort' is specified, 'occupantZoneId and
24             'displayType' should not be specified. If neither 'physicalPort' nor the combination
25             of 'occupantZoneId' and 'displayType' is specified, it defaults to the driver main
26             display. )
27             - occupantZoneId (Attribute. The id of the car occupant zone this display is in.
28             Optional field. The combination of 'occupantZoneId and 'displayType' is another way of
29             identifying a display. When 'occupantZoneId' is specified, 'displayType' should also
30             be specified while 'physicalPort' should not be specified. )
31             - displayType (Attribute. The type of the display in the occupant zone specified by
32             'occupantZoneId'. The integer values are defined in
33             packages/services/Car/car-lib/src/android/car/CarOccupantZoneManager.java.
34             Optional field. The combination of 'occupantZoneId and 'displayType' is another way of
35             identifying a display. When 'displayType' is specified, 'occupantZoneId' should also
36             be specified while 'physicalPort' should not be specified. )
37       - DrivingState (Tag 1.a. Driving states supported)
38             - state (Attribute. The driving states defined there should align with driving states
39             (@CarDrivingState) defined in
40             packages/services/Car/car-lib/src/android/car/drivingstate/CarDrivingStateEvent.java
41             Supported driving states attribute values - "parked", "idling" and "moving"
42             - minSpeed (Attribute)
43             - maxSpeed (Attribute. Minimum and Maximum speed attributes
44             useful to provide different restrictions for different speed ranges)
45       - Restrictions (Tag 1.b. UX restriction types)
46             - requiresDistractionOptimization (Attribute. This corresponds to what
47             CarUxRestrictions#mRequiresDistractionOptimization needs to be set to. This means that
48             apps will have to follow the general baseline distraction optimization rules defined in
49             the Driver Distraction Guidelines. )
50             - uxr (Attribute. These are the additional UX restrictions that OEMs can configure in
51             addition to the baseline restrictions defined in the above
52             requiresDistractionOptimization. The values here have to align with the UX
53              Restrictions defined in
54              packages/services/Car/car-lib/src/android/car/drivingstate/CarUxRestrictions.java.
55              Supported values are -"baseline", "no_dialpad", "no_filtering", "limit_string_length",
56              "no_keyboard", "no_video", "limit_content", "no_setup", "no_text_message",
57              "no_voice_transcription", "fully_restricted". )
58             - mode (Attribute. Supported attribute for Restrictions. UX restrictions service
59             supports returning different sets of UX restrictions for the same driving state,
60             through configurations for each "mode". These modes can be specified by any string
61             name, for example, "passenger". "baseline" is the default value. Note: "passenger"
62             mode can be generically supported by specifying UxR for passenger displays using
63             'physicalPort' or the combination of 'occupantZoneId' and 'displayType'. Mode attribute
64             supports multiple values separated by "|", thus a single restriction can be used in
65             different modes, and these restrictions apply to all mode values separated by "|".
66       - RestrictionParameters (Tag 2. Some of UX restrictions can be parameterized)
67             - the restriction parameters can be local or global to all the UX restrictions. A local
68             restriction parameters tag is within a <RestrictionMapping> container which is applied
69             to all the driving states in that container. A global restriction parameters tag is
70             within a <UxRestrictions> tag which is applied to all the <RestrictionMapping>
71             containers which do not have a local <RestrictionParameters> tag associated with them.
72             If the local <RestrictionParameters> tag is not defined for any RestrictionMapping, the
73             global <RestrictionParameters> is applied.
74       - StringRestrictions (Tag 2.a. Parameters to express displayed String related restrictions)
75             - maxLength (Attribute. Max allowed length of general purpose strings when
76             limit_string_length is imposed)
77       - ContentRestrictions (Tag 2.b. Parameters to express content related restrictions)
78             - maxCumulativeItems (Attribute. Max number of cumulative content items allowed to be
79             displayed when (limit_content is imposed)
80             - maxDepth (Attribute. Maximum levels deep that the user can navigate to when
81             limit_content is imposed)
82-->
83
84<UxRestrictions xmlns:car="http://schemas.android.com/apk/res-auto">
85    <!-- Map the driving states to UX restrictions here -->
86    <!-- Note - The platform takes a fully restricted approach when there is no information or if
87    the information is malformed.  As a result,
88    1. Default values for requiresDistractionOptimization is true, and uxr is fully_restricted.
89    2. If uxr != baseline, then requiresDistractionOptimization is automatically promoted to true,
90    even if it is declared as false.  Because it doesn't make sense to have an non baseline UX
91    restriction without requiresDistractionOptimization set to true.
92    So if we don't want any restrictions, requiresDistractionOptimization should be explicitly
93    marked as false and uxr should be explicitly set to baseline. -->
94
95    <RestrictionMapping>
96        <DrivingState state="parked">
97            <Restrictions requiresDistractionOptimization="false" uxr="baseline"/>
98        </DrivingState>
99
100        <DrivingState state="idling">
101            <Restrictions requiresDistractionOptimization="true" uxr="no_video" mode="baseline"/>
102        </DrivingState>
103
104        <!-- This is to illustrate how to add multiple speed ranges.  The restrictions here
105        are the same for both the speed ranges, but could be configured to be different.
106        NOTE:
107        1. The speed units is in meters per second to be in accordance with the
108        PERF_VEHICLE SPEED definition in hardware/interfaces/automotive/vehicle/2.0/types.hal
109        2. The speed ranges should be non overlapping, i.e. one speed value cannot be in more
110        than one range.  It is denoted in a left closed, right open interval [minSpeed, maxSpeed).
111        For ex: [0,5) indicates speed >= 0 && speed < 5.0m/s.
112        3. For a speed range with no high limit, maxSpeed is not filled.  For ex., if the speed
113        range is anything >=5m/s, only the minSpeed is filled with a value of 5m/s.  There cannot be
114        a range higher than this, which will violate the 2nd condition above.
115        4. If the above conditions are not met, mapping behavior is undefined. -->
116        <!-- This is restrictions for moving and speed [0,5m/s) -->
117        <DrivingState state="moving" minSpeed="0" maxSpeed="5.0">
118            <Restrictions requiresDistractionOptimization="true" uxr="no_dialpad|no_filtering|limit_string_length|no_keyboard|no_video|limit_content|no_setup|no_text_message"/>
119        </DrivingState>
120
121        <!-- Restrictions for speed >=5 -->
122        <DrivingState state="moving" minSpeed="5.0">
123            <Restrictions requiresDistractionOptimization="true" uxr="no_dialpad|no_filtering|limit_string_length|no_keyboard|no_video|limit_content|no_setup|no_text_message"/>
124        </DrivingState>
125
126    </RestrictionMapping>
127
128    <!-- Configure restriction parameters here-->
129    <RestrictionParameters>
130        <!-- Parameters to express displayed String related restrictions -->
131        <!-- Max allowed length of general purpose strings when limit_string_length is imposed-->
132        <StringRestrictions maxLength="120"/>
133        <!-- Parameters to express content related restrictions -->
134        <!-- Max number of cumulative content items allowed to be displayed when
135        limit_content is imposed. -->
136        <!-- Maximum levels deep that the user can navigate to when limit_content is imposed. -->
137        <ContentRestrictions maxCumulativeItems="21" maxDepth="3"/>
138    </RestrictionParameters>
139
140</UxRestrictions>
141