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                    <enumeration value="fwk_only" /> <!-- java as @hide. Not included in NDK. Not included in hal interfaces. -->
209                </restriction>
210            </simpleType>
211        </attribute>
212        <attribute name="synthetic" default="false">
213            <simpleType>
214                <restriction base="string">
215                    <enumeration value="false" /> <!-- expose to C -->
216                    <enumeration value="true" /> <!-- do not expose to C -->
217                </restriction>
218            </simpleType>
219        </attribute>
220        <attribute name="deprecated" default="false">
221            <simpleType>
222                <restriction base="string">
223                    <enumeration value="false" /> <!-- normal -->
224                    <enumeration value="true" /> <!-- mark @Deprecated -->
225                </restriction>
226            </simpleType>
227        </attribute>
228        <attribute name="optional" default="false">
229            <simpleType>
230                <restriction base="string">
231                    <enumeration value="false" />
232                    <enumeration value="true" />
233                </restriction>
234            </simpleType>
235        </attribute>
236        <attribute name="typedef" type="string" />
237        <attribute name="hwlevel" default="full">
238            <simpleType>
239                <restriction base="string">
240                    <enumeration value="full" />
241                    <enumeration value="limited" />
242                    <enumeration value="legacy" />
243                </restriction>
244            </simpleType>
245        </attribute>
246        <attribute name="hal_version" type="decimal" default="3.2" />
247        <attribute name="permission_needed" default="false">
248            <simpleType>
249                <restriction base="string">
250                    <enumeration value="true" />
251                    <enumeration value="false" />
252                </restriction>
253            </simpleType>
254        </attribute>
255    </complexType>
256
257    <complexType name="EnumType">
258        <sequence>
259            <element name="value" type="tns:EnumValueType" maxOccurs="unbounded"></element>
260        </sequence>
261    </complexType>
262
263    <complexType name="TupleType">
264        <sequence>
265            <element name="value" type="string" minOccurs="1" maxOccurs="unbounded"></element>
266        </sequence>
267    </complexType>
268
269    <complexType name="ArrayType">
270        <sequence>
271            <element name="size" type="string" minOccurs="1" maxOccurs="unbounded"></element>
272        </sequence>
273    </complexType>
274
275    <complexType name="EnumValueType" mixed="true">
276
277        <all>
278            <element name="notes" type="string" minOccurs="0" maxOccurs="1"/>
279            <element name="sdk_notes" type="string" minOccurs="0" maxOccurs="1"/>
280            <element name="ndk_notes" type="string" minOccurs="0" maxOccurs="1" />
281        </all>
282
283        <attribute name="deprecated" default="false">
284            <simpleType>
285                <restriction base="string">
286                    <enumeration value="true"></enumeration>
287                    <enumeration value="false"></enumeration>
288                </restriction>
289            </simpleType>
290        </attribute>
291        <attribute name="optional">
292            <simpleType>
293                <restriction base="string">
294                    <enumeration value="true"></enumeration>
295                    <enumeration value="false"></enumeration>
296                </restriction>
297            </simpleType>
298        </attribute>
299        <attribute name="hidden">
300            <simpleType>
301                <restriction base="string">
302                    <enumeration value="true"></enumeration>
303                    <enumeration value="false"></enumeration>
304                </restriction>
305            </simpleType>
306        </attribute>
307        <attribute name="ndk_hidden">
308            <simpleType>
309                <restriction base="string">
310                    <enumeration value="true"></enumeration>
311                    <enumeration value="false"></enumeration>
312                </restriction>
313            </simpleType>
314        </attribute>
315        <attribute name="visibility">
316            <simpleType>
317                <restriction base="string">
318                    <enumeration value="system" /> <!-- do not expose to java/NDK API -->
319                    <enumeration value="java_public" /> <!-- java as public SDK. Not included in NDK -->
320                    <enumeration value="ndk_public" /> <!-- public in NDK. @hide in java -->
321                    <enumeration value="hidden" /> <!-- java as @hide. Not included in NDK -->
322                    <enumeration value="test" /> <!-- java as @TestApi. Not included in NDK -->
323                    <enumeration value="public" /> <!-- public to both java and NDK -->
324                </restriction>
325            </simpleType>
326        </attribute>
327        <attribute name="id" type="string" />
328        <attribute name="hal_version" type="decimal" default="3.2" />
329    </complexType>
330
331    <complexType name="CloneType">
332        <sequence>
333                <group ref="tns:BaseEntryGroup" />
334        </sequence>
335
336        <!--
337             the semantic correctness of the next 2 attributes
338             are validated by metadata_validate.py
339
340             due to the inability of XSD to generate paths recursively
341        -->
342        <attribute name="entry">
343        </attribute>
344        <attribute name="kind">
345            <simpleType>
346                <restriction base="string">
347                    <enumeration value="controls"></enumeration>
348                    <enumeration value="static"></enumeration>
349                    <enumeration value="dynamic"></enumeration>
350                </restriction>
351            </simpleType>
352        </attribute>
353        <attribute name="hal_version" type="decimal" default="3.2" />
354    </complexType>
355</schema>
356