1<?xml version="1.0" encoding="UTF-8"?>
2<!--
3    Copyright (C) 2021 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 defines how displays are laid out
20    for a given device-state.
21    It is parsed in com/android/server/display/layout/DeviceStateToLayoutMap.java
22    More information on device-state can be found in DeviceStateManager.java
23-->
24<xs:schema version="2.0"
25           elementFormDefault="qualified"
26           xmlns:xs="http://www.w3.org/2001/XMLSchema">
27    <xs:element name="layouts">
28        <xs:complexType>
29            <xs:sequence>
30                <xs:element type="layout" name="layout" minOccurs="1" maxOccurs="unbounded" />
31            </xs:sequence>
32        </xs:complexType>
33
34        <!-- Ensures only one layout is allowed per device state. -->
35        <xs:unique name="UniqueState">
36            <xs:selector xpath="layout" />
37            <xs:field xpath="@state" />
38        </xs:unique>
39    </xs:element>
40
41    <!-- Type definitions -->
42
43    <xs:complexType name="layout">
44        <xs:sequence>
45            <xs:element name="state" type="xs:nonNegativeInteger" />
46            <xs:element name="display" type="display" maxOccurs="unbounded"/>
47        </xs:sequence>
48    </xs:complexType>
49
50    <xs:complexType name="display">
51        <xs:sequence>
52            <xs:group ref="displayReference" minOccurs="1" maxOccurs="1"/>
53            <xs:element name="position" type="xs:string" minOccurs="0" maxOccurs="1" />
54            <xs:element name="brightnessThrottlingMapId" type="xs:string" minOccurs="0" maxOccurs="1" />
55            <xs:element name="powerThrottlingMapId" type="xs:string" minOccurs="0" maxOccurs="1" />
56            <xs:element name="refreshRateThermalThrottlingMapId" type="xs:string" minOccurs="0" />
57            <xs:element name="leadDisplayAddress" type="xs:nonNegativeInteger" minOccurs="0" maxOccurs="1" />
58        </xs:sequence>
59        <xs:attribute name="enabled" type="xs:boolean" use="optional" />
60        <xs:attribute name="defaultDisplay" type="xs:boolean" use="optional" />
61        <xs:attribute name="refreshRateZoneId" type="xs:string" use="optional" />
62        <xs:attribute name="displayGroup" use="optional" default="">
63            <xs:simpleType>
64                <xs:restriction base="xs:string">
65                    <xs:pattern value="|[_a-zA-Z0-9]+(\.[_a-zA-Z0-9]+)*" />
66                </xs:restriction>
67            </xs:simpleType>
68        </xs:attribute>
69    </xs:complexType>
70
71    <xs:group name="displayReference">
72        <xs:choice>
73            <xs:element name="address" type="xs:nonNegativeInteger" minOccurs="0"/>
74            <xs:element name="port" type="xs:nonNegativeInteger" minOccurs="0"/>
75        </xs:choice>
76    </xs:group>
77</xs:schema>
78