1<?xml version="1.0" encoding="UTF-8"?>
2<!-- Copyright (C) 2012 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<schema xmlns="http://www.w3.org/2001/XMLSchema"
17    xmlns:tns="http://schemas.android.com/service/camera/metadata/"
18    targetNamespace="http://schemas.android.com/service/camera/metadata/"
19    elementFormDefault="qualified">
20
21    <element name="metadata" type="tns:MetadataType">
22        <key name="TypeNameKey">
23            <selector xpath="tns:types/tns:typedef" />
24            <field xpath="@name" />
25        </key>
26
27        <!-- ensure that <entry typedef="..."> refers to a valid <typedef name='..."/> -->
28        <keyref name="TypeNameKeyRef" refer="tns:TypeNameKey">
29            <selector xpath=".//tns:entry" /> <!-- recursively find any descendant entry -->
30            <field xpath="@typedef" />
31        </keyref>
32    </element>
33
34    <complexType name="MetadataType">
35        <sequence>
36            <element name="tags" type="tns:TagsType" maxOccurs="1" minOccurs="0"></element>
37            <element name="types" type="tns:TypesType" maxOccurs="1" minOccurs="0"></element>
38            <element name="namespace" type="tns:NamespaceType"
39                maxOccurs="unbounded" minOccurs="1">
40            </element>
41        </sequence>
42    </complexType>
43
44    <complexType name="NamespaceType">
45        <sequence>
46            <element name="section" type="tns:SectionType" maxOccurs="unbounded" minOccurs="1"></element>
47        </sequence>
48        <attribute name="name" type="string" use="required"></attribute>
49    </complexType>
50
51    <complexType name="SectionType">
52        <sequence>
53            <choice maxOccurs="unbounded">
54                <element name="controls" type="tns:SectionKindType" maxOccurs="unbounded" minOccurs="0"></element>
55                <element name="static" type="tns:SectionKindType" maxOccurs="unbounded" minOccurs="0"></element>
56                <element name="dynamic" type="tns:SectionKindType" maxOccurs="unbounded" minOccurs="0"></element>
57            </choice>
58        </sequence>
59        <attribute name="name" type="string" use="required"></attribute>
60    </complexType>
61
62    <complexType name="SectionKindType">
63        <complexContent>
64            <extension base="tns:BaseNamespaceOrSectionKindType">
65            </extension>
66        </complexContent>
67    </complexType>
68
69    <complexType name="InnerNamespaceType">
70        <complexContent>
71            <extension base="tns:BaseNamespaceOrSectionKindType">
72                <attribute name="name" type="string" use="required"></attribute>
73            </extension>
74        </complexContent>
75    </complexType>
76
77    <complexType name="BaseNamespaceOrSectionKindType">
78        <sequence maxOccurs="unbounded">
79            <choice>
80                <element name="namespace" type="tns:InnerNamespaceType"></element>
81                <element name="entry" type="tns:EntryType"></element>
82                <element name="clone" type="tns:CloneType"></element>
83            </choice>
84        </sequence>
85    </complexType>
86
87    <complexType name="TagsType">
88        <sequence>
89            <element name="tag" type="tns:TagType" maxOccurs="unbounded" minOccurs="0"></element>
90        </sequence>
91    </complexType>
92
93    <complexType name="TagType">
94        <simpleContent>
95            <extension base="string">
96                <attribute name="id" type="string" use="required"></attribute>
97            </extension>
98        </simpleContent>
99    </complexType>
100
101    <complexType name="TypesType">
102        <sequence>
103            <element name="typedef" type="tns:TypedefType" maxOccurs="unbounded" minOccurs="0">
104            </element>
105        </sequence>
106    </complexType>
107
108    <complexType name="TypedefType">
109        <sequence>
110            <element name="language" type="tns:LanguageType" maxOccurs="unbounded" minOccurs="1"></element>
111        </sequence>
112        <attribute name="name" type="string" use="required" />
113    </complexType>
114
115    <complexType name="LanguageType">
116        <simpleContent>
117            <extension base="string">
118                <attribute name="name" use="required">
119                    <simpleType>
120                        <restriction base="string">
121                            <enumeration value="java" />
122                            <enumeration value="c" />
123                            <enumeration value="c++" />
124                        </restriction>
125                    </simpleType>
126                </attribute>
127            </extension>
128        </simpleContent>
129    </complexType>
130
131    <group name="BaseEntryGroup">
132        <sequence>
133            <element name="description" type="string" maxOccurs="1"
134                minOccurs="0">
135            </element>
136            <element name="deprecation_description" type="string" maxOccurs="1"
137                     minOccurs="0">
138            </element>
139            <element name="units" type="string" maxOccurs="1"
140                minOccurs="0">
141            </element>
142            <element name="range" type="string" maxOccurs="1"
143                minOccurs="0">
144            </element>
145            <element name="details" type="string" maxOccurs="1"
146                minOccurs="0">
147            </element>
148            <element name="ndk_details" type="string" maxOccurs="1"
149                minOccurs="0">
150            </element>
151            <element name="hal_details" type="string" maxOccurs="1"
152                minOccurs="0">
153            </element>
154
155            <element name="tag" type="tns:TagType" maxOccurs="unbounded"
156                minOccurs="0">
157            </element>
158        </sequence>
159    </group>
160
161    <complexType name="EntryType">
162        <sequence>
163            <element name="array" type="tns:ArrayType" maxOccurs="1" minOccurs="0"></element>
164            <element name="enum" type="tns:EnumType" maxOccurs="1" minOccurs="0"></element>
165            <element name="tuple" type="tns:TupleType" maxOccurs="1" minOccurs="0"></element>
166
167            <group ref="tns:BaseEntryGroup" />
168        </sequence>
169
170        <attribute name="name" type="string" use="required" />
171        <attribute name="type" use="required">
172            <simpleType>
173                <restriction base="string">
174                    <enumeration value="byte" />
175                    <enumeration value="int32" />
176                    <enumeration value="int64" />
177                    <enumeration value="float" />
178                    <enumeration value="double" />
179                    <enumeration value="rational" />
180                </restriction>
181            </simpleType>
182        </attribute>
183        <attribute name="type_notes" type="string" />
184        <attribute name="container">
185            <simpleType>
186                <restriction base="string">
187                    <enumeration value="array" />
188                    <enumeration value="tuple" />
189                </restriction>
190            </simpleType>
191        </attribute>
192        <attribute name="enum">
193            <simpleType>
194                <restriction base="string">
195                    <enumeration value="true"></enumeration>
196                    <enumeration value="false"></enumeration>
197                </restriction>
198            </simpleType>
199        </attribute>
200        <attribute name="visibility">
201            <simpleType>
202                <restriction base="string">
203                    <enumeration value="system" /> <!-- do not expose to java/NDK API -->
204                    <enumeration value="java_public" /> <!-- java as public SDK. Not included in NDK -->
205                    <enumeration value="ndk_public" /> <!-- public in NDK. @hide in java -->
206                    <enumeration value="hidden" /> <!-- java as @hide. Not included in NDK -->
207                    <enumeration value="public" /> <!-- public to both java and NDK -->
208                </restriction>
209            </simpleType>
210        </attribute>
211        <attribute name="synthetic" default="false">
212            <simpleType>
213                <restriction base="string">
214                    <enumeration value="false" /> <!-- expose to C -->
215                    <enumeration value="true" /> <!-- do not expose to C -->
216                </restriction>
217            </simpleType>
218        </attribute>
219        <attribute name="deprecated" default="false">
220            <simpleType>
221                <restriction base="string">
222                    <enumeration value="false" /> <!-- normal -->
223                    <enumeration value="true" /> <!-- mark @Deprecated -->
224                </restriction>
225            </simpleType>
226        </attribute>
227        <attribute name="optional" default="false">
228            <simpleType>
229                <restriction base="string">
230                    <enumeration value="false" />
231                    <enumeration value="true" />
232                </restriction>
233            </simpleType>
234        </attribute>
235        <attribute name="typedef" type="string" />
236        <attribute name="hwlevel" default="full">
237            <simpleType>
238                <restriction base="string">
239                    <enumeration value="full" />
240                    <enumeration value="limited" />
241                    <enumeration value="legacy" />
242                </restriction>
243            </simpleType>
244        </attribute>
245        <attribute name="hal_version" type="decimal" default="3.2" />
246        <attribute name="permission_needed" default="false">
247            <simpleType>
248                <restriction base="string">
249                    <enumeration value="true" />
250                    <enumeration value="false" />
251                </restriction>
252            </simpleType>
253        </attribute>
254    </complexType>
255
256    <complexType name="EnumType">
257        <sequence>
258            <element name="value" type="tns:EnumValueType" maxOccurs="unbounded"></element>
259        </sequence>
260    </complexType>
261
262    <complexType name="TupleType">
263        <sequence>
264            <element name="value" type="string" minOccurs="1" maxOccurs="unbounded"></element>
265        </sequence>
266    </complexType>
267
268    <complexType name="ArrayType">
269        <sequence>
270            <element name="size" type="string" minOccurs="1" maxOccurs="unbounded"></element>
271        </sequence>
272    </complexType>
273
274    <complexType name="EnumValueType" mixed="true">
275
276        <all>
277            <element name="notes" type="string" minOccurs="0" maxOccurs="1"/>
278            <element name="sdk_notes" type="string" minOccurs="0" maxOccurs="1"/>
279            <element name="ndk_notes" type="string" minOccurs="0" maxOccurs="1" />
280        </all>
281
282        <attribute name="deprecated" default="false">
283            <simpleType>
284                <restriction base="string">
285                    <enumeration value="true"></enumeration>
286                    <enumeration value="false"></enumeration>
287                </restriction>
288            </simpleType>
289        </attribute>
290        <attribute name="optional">
291            <simpleType>
292                <restriction base="string">
293                    <enumeration value="true"></enumeration>
294                    <enumeration value="false"></enumeration>
295                </restriction>
296            </simpleType>
297        </attribute>
298        <attribute name="hidden">
299            <simpleType>
300                <restriction base="string">
301                    <enumeration value="true"></enumeration>
302                    <enumeration value="false"></enumeration>
303                </restriction>
304            </simpleType>
305        </attribute>
306        <attribute name="ndk_hidden">
307            <simpleType>
308                <restriction base="string">
309                    <enumeration value="true"></enumeration>
310                    <enumeration value="false"></enumeration>
311                </restriction>
312            </simpleType>
313        </attribute>
314        <attribute name="id" type="string" />
315        <attribute name="hal_version" type="decimal" default="3.2" />
316    </complexType>
317
318    <complexType name="CloneType">
319        <sequence>
320                <group ref="tns:BaseEntryGroup" />
321        </sequence>
322
323        <!--
324             the semantic correctness of the next 2 attributes
325             are validated by metadata_validate.py
326
327             due to the inability of XSD to generate paths recursively
328        -->
329        <attribute name="entry">
330        </attribute>
331        <attribute name="kind">
332            <simpleType>
333                <restriction base="string">
334                    <enumeration value="controls"></enumeration>
335                    <enumeration value="static"></enumeration>
336                    <enumeration value="dynamic"></enumeration>
337                </restriction>
338            </simpleType>
339        </attribute>
340        <attribute name="hal_version" type="decimal" default="3.2" />
341    </complexType>
342</schema>
343