1<?xml version="1.0" encoding="UTF-8"?>
2<!--
3    Copyright (C) 2020 The Android Open Source Project
4
5    Licensed under the Apache License, Version 2.0 (the "License");
6    you may not use this file except in compliance with the License.
7    You may obtain a copy of the License at
8
9         http://www.apache.org/licenses/LICENSE-2.0
10
11    Unless required by applicable law or agreed to in writing, software
12    distributed under the License is distributed on an "AS IS" BASIS,
13    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14    See the License for the specific language governing permissions and
15    limitations under the License.
16-->
17
18<!--
19    This defines the format of the XML file used to provide static configuration values
20    for the displays on a device.
21    It is parsed in com/android/server/display/DisplayDeviceConfig.java
22-->
23<xs:schema version="2.0"
24           elementFormDefault="qualified"
25           xmlns:xs="http://www.w3.org/2001/XMLSchema">
26    <xs:element name="displayConfiguration">
27        <xs:complexType>
28            <xs:sequence>
29                <xs:element type="nitsMap" name="screenBrightnessMap">
30                    <xs:annotation name="nonnull"/>
31                    <xs:annotation name="final"/>
32                </xs:element>
33                <xs:element type="nonNegativeDecimal" name="screenBrightnessDefault">
34                    <xs:annotation name="nonnull"/>
35                    <xs:annotation name="final"/>
36                </xs:element>
37                <xs:element type="highBrightnessMode" name="highBrightnessMode" minOccurs="0"
38                            maxOccurs="1"/>
39                <xs:element type="displayQuirks" name="quirks" minOccurs="0" maxOccurs="1" />
40                <xs:element type="nonNegativeDecimal" name="screenBrightnessRampFastDecrease">
41                    <xs:annotation name="final"/>
42                </xs:element>
43                <xs:element type="nonNegativeDecimal" name="screenBrightnessRampFastIncrease">
44                    <xs:annotation name="final"/>
45                </xs:element>
46                <xs:element type="nonNegativeDecimal" name="screenBrightnessRampSlowDecrease">
47                    <xs:annotation name="final"/>
48                </xs:element>
49                <xs:element type="nonNegativeDecimal" name="screenBrightnessRampSlowIncrease">
50                    <xs:annotation name="final"/>
51                </xs:element>
52                <xs:element type="sensorDetails" name="lightSensor">
53                    <xs:annotation name="final"/>
54                </xs:element>
55                <xs:element type="sensorDetails" name="proxSensor">
56                    <xs:annotation name="final"/>
57                </xs:element>
58
59                <!-- Set of thresholds that dictate the change needed for screen brightness
60                adaptations -->
61                <xs:element type="thresholds" name="displayBrightnessChangeThresholds">
62                    <xs:annotation name="nonnull"/>
63                    <xs:annotation name="final"/>
64                </xs:element>
65                <!-- Set of thresholds that dictate the change needed for ambient brightness
66                adaptations -->
67                <xs:element type="thresholds" name="ambientBrightnessChangeThresholds">
68                    <xs:annotation name="nonnull"/>
69                    <xs:annotation name="final"/>
70                </xs:element>
71            </xs:sequence>
72        </xs:complexType>
73    </xs:element>
74
75    <!-- Type definitions -->
76
77    <xs:complexType name="displayQuirks">
78        <xs:sequence>
79            <xs:element name="quirk" type="xs:string" minOccurs="0" maxOccurs="unbounded" />
80        </xs:sequence>
81    </xs:complexType>
82
83    <xs:complexType name="highBrightnessMode">
84        <xs:all>
85            <xs:element name="transitionPoint" type="nonNegativeDecimal" minOccurs="1"
86                        maxOccurs="1">
87                <xs:annotation name="nonnull"/>
88                <xs:annotation name="final"/>
89            </xs:element>
90            <xs:element name="minimumLux" type="nonNegativeDecimal" minOccurs="1" maxOccurs="1">
91                <xs:annotation name="nonnull"/>
92                <xs:annotation name="final"/>
93            </xs:element>
94            <xs:element name="timing" type="hbmTiming" minOccurs="1" maxOccurs="1"/>
95            <xs:element type="refreshRateRange" name="refreshRate" minOccurs="0" maxOccurs="1">
96                <xs:annotation name="nullable"/>
97                <xs:annotation name="final"/>
98            </xs:element>
99            <!-- The highest (most severe) thermal status at which high-brightness-mode is allowed
100                 to operate. -->
101            <xs:element name="thermalStatusLimit" type="thermalStatus" minOccurs="0" maxOccurs="1">
102                <xs:annotation name="nonnull"/>
103                <xs:annotation name="final"/>
104            </xs:element>
105            <xs:element name="allowInLowPowerMode" type="xs:boolean" minOccurs="0" maxOccurs="1">
106                <xs:annotation name="nonnull"/>
107                <xs:annotation name="final"/>
108            </xs:element>
109        </xs:all>
110        <xs:attribute name="enabled" type="xs:boolean" use="optional"/>
111    </xs:complexType>
112
113    <xs:complexType name="hbmTiming">
114        <xs:all>
115            <xs:element name="timeWindowSecs" type="xs:nonNegativeInteger" minOccurs="1"
116                        maxOccurs="1">
117                <xs:annotation name="nonnull"/>
118                <xs:annotation name="final"/>
119            </xs:element>
120            <xs:element name="timeMaxSecs" type="xs:nonNegativeInteger" minOccurs="1" maxOccurs="1">
121                <xs:annotation name="nonnull"/>
122                <xs:annotation name="final"/>
123            </xs:element>
124            <xs:element name="timeMinSecs" type="xs:nonNegativeInteger" minOccurs="1" maxOccurs="1">
125                <xs:annotation name="nonnull"/>
126                <xs:annotation name="final"/>
127            </xs:element>
128        </xs:all>
129    </xs:complexType>
130
131    <!-- Maps to PowerManager.THERMAL_STATUS_* values. -->
132    <xs:simpleType name="thermalStatus">
133        <xs:restriction base="xs:string">
134            <xs:enumeration value="none"/>
135            <xs:enumeration value="light"/>
136            <xs:enumeration value="moderate"/>
137            <xs:enumeration value="severe"/>
138            <xs:enumeration value="critical"/>
139            <xs:enumeration value="emergency"/>
140            <xs:enumeration value="shutdown"/>
141        </xs:restriction>
142    </xs:simpleType>
143
144    <xs:complexType name="nitsMap">
145        <xs:sequence>
146            <xs:element name="point" type="point" maxOccurs="unbounded" minOccurs="2">
147                <xs:annotation name="nonnull"/>
148                <xs:annotation name="final"/>
149            </xs:element>
150        </xs:sequence>
151    </xs:complexType>
152
153    <xs:complexType name="point">
154        <xs:sequence>
155            <xs:element type="nonNegativeDecimal" name="value">
156                <xs:annotation name="nonnull"/>
157                <xs:annotation name="final"/>
158            </xs:element>
159            <xs:element type="nonNegativeDecimal" name="nits">
160                <xs:annotation name="nonnull"/>
161                <xs:annotation name="final"/>
162            </xs:element>
163        </xs:sequence>
164    </xs:complexType>
165
166    <xs:simpleType name="nonNegativeDecimal">
167        <xs:restriction base="xs:decimal">
168            <xs:minInclusive value="0.0"/>
169        </xs:restriction>
170    </xs:simpleType>
171
172    <xs:complexType name="sensorDetails">
173        <xs:sequence>
174            <xs:element type="xs:string" name="type" minOccurs="0" maxOccurs="1">
175                <xs:annotation name="nullable"/>
176                <xs:annotation name="final"/>
177            </xs:element>
178            <xs:element type="xs:string" name="name" minOccurs="0" maxOccurs="1">
179                <xs:annotation name="nullable"/>
180                <xs:annotation name="final"/>
181            </xs:element>
182            <xs:element type="refreshRateRange" name="refreshRate" minOccurs="0" maxOccurs="1">
183                <xs:annotation name="nullable"/>
184                <xs:annotation name="final"/>
185            </xs:element>
186        </xs:sequence>
187    </xs:complexType>
188
189    <xs:complexType name="refreshRateRange">
190        <xs:sequence>
191            <xs:element type="xs:nonNegativeInteger" name="minimum" minOccurs="1" maxOccurs="1">
192                <xs:annotation name="final"/>
193            </xs:element>
194            <xs:element type="xs:nonNegativeInteger" name="maximum" minOccurs="1" maxOccurs="1">
195                <xs:annotation name="final"/>
196            </xs:element>
197        </xs:sequence>
198    </xs:complexType>
199
200    <!-- Thresholds for brightness changes. -->
201    <xs:complexType name="thresholds">
202        <xs:sequence>
203            <!-- Brightening thresholds. -->
204            <xs:element name="brighteningThresholds" type="brightnessThresholds" minOccurs="0"
205                        maxOccurs="1" >
206                <xs:annotation name="nonnull"/>
207                <xs:annotation name="final"/>
208            </xs:element>
209            <!-- Darkening thresholds. -->
210            <xs:element name="darkeningThresholds" type="brightnessThresholds" minOccurs="0"
211                        maxOccurs="1" >
212                <xs:annotation name="nonnull"/>
213                <xs:annotation name="final"/>
214            </xs:element>
215        </xs:sequence>
216    </xs:complexType>
217
218    <!-- Brightening and darkening minimum change thresholds. -->
219    <xs:complexType name="brightnessThresholds">
220        <!-- Minimum brightness change needed. -->
221        <xs:element name="minimum" type="nonNegativeDecimal" minOccurs="0" maxOccurs="1" >
222            <xs:annotation name="nonnull"/>
223            <xs:annotation name="final"/>
224        </xs:element>
225    </xs:complexType>
226
227</xs:schema>
228