• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
2<!-- Copyright (C) 2019 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
17 <xs:schema version="2.0"
18            elementFormDefault="qualified"
19            attributeFormDefault="unqualified"
20            xmlns:xs="http://www.w3.org/2001/XMLSchema">
21    <!-- List the config versions supported by audio policy engine. -->
22    <xs:simpleType name="version">
23        <xs:restriction base="xs:decimal">
24            <xs:enumeration value="1.0"/>
25        </xs:restriction>
26    </xs:simpleType>
27
28    <xs:element name="configuration">
29        <xs:complexType>
30            <xs:sequence>
31                <xs:element name="ProductStrategies" type="ProductStrategies"  minOccurs="0" maxOccurs="unbounded"/>
32                <xs:element name="criterion_types" type="criterionTypesType"  minOccurs="0" maxOccurs="unbounded"/>
33                <xs:element name="criteria" type="criteriaType"  minOccurs="0" maxOccurs="unbounded"/>
34                <xs:element name="volumeGroups" type="volumeGroupsType"  minOccurs="0" maxOccurs="unbounded"/>
35                <xs:element name="volumes" type="volumesType" minOccurs="0" maxOccurs="unbounded"/>
36                <xs:element name="attributesRef" type="attributesRef"  minOccurs="0" maxOccurs="unbounded"/>
37            </xs:sequence>
38            <xs:attribute name="version" type="version" use="required"/>
39        </xs:complexType>
40
41        <xs:key name="volumeCurveNameKey">
42            <xs:selector xpath="volumes/reference"/>
43            <xs:field xpath="@name"/>
44        </xs:key>
45        <xs:keyref name="volumeCurveRef" refer="volumeCurveNameKey">
46            <xs:selector xpath="volumeGroups/volumeGroup"/>
47            <xs:field xpath="@ref"/>
48        </xs:keyref>
49
50        <xs:key name="attributesRefNameKey">
51            <xs:selector xpath="attributesRef/reference"/>
52            <xs:field xpath="@name"/>
53        </xs:key>
54        <xs:keyref name="volumeGroupAttributesRef" refer="attributesRefNameKey">
55            <xs:selector xpath="volumeGroups/volumeGroup/volume"/>
56            <xs:field xpath="@attributesRef"/>
57        </xs:keyref>
58        <xs:keyref name="ProductStrategyAttributesRef" refer="attributesRefNameKey">
59            <xs:selector xpath="ProductStrategies/ProductStrategy/Attributes"/>
60            <xs:field xpath="@attributesRef"/>
61        </xs:keyref>
62
63        <xs:unique name="productStrategyNameUniqueness">
64            <xs:selector xpath="ProductStrategies/ProductStrategy"/>
65            <xs:field xpath="@name"/>
66        </xs:unique>
67
68        <!-- ensure validity of volume group referred in product strategy-->
69        <xs:key name="volumeGroupKey">
70            <xs:selector xpath="volumeGroups/volumeGroup/name"/>
71            <xs:field xpath="."/>
72        </xs:key>
73        <xs:keyref name="volumeGroupRef" refer="volumeGroupKey">
74            <xs:selector xpath="ProductStrategies/ProductStrategy/AttributesGroup"/>
75            <xs:field xpath="@volumeGroup"/>
76        </xs:keyref>
77
78        <xs:unique name="volumeTargetUniqueness">
79            <xs:selector xpath="volumeGroups/volumeGroup"/>
80            <xs:field xpath="@name"/>
81            <xs:field xpath="@deviceCategory"/>
82        </xs:unique>
83
84        <!-- ensure validity of criterion type referred in criterion-->
85        <xs:key name="criterionTypeKey">
86            <xs:selector xpath="criterion_types/criterion_type"/>
87            <xs:field xpath="@name"/>
88        </xs:key>
89        <xs:keyref name="criterionTypeKeyRef" refer="criterionTypeKey">
90            <xs:selector xpath="criteria/criterion"/>
91            <xs:field xpath="@type"/>
92        </xs:keyref>
93
94    </xs:element>
95
96    <xs:complexType name="ProductStrategies">
97        <xs:annotation>
98            <xs:documentation xml:lang="en">
99            </xs:documentation>
100        </xs:annotation>
101        <xs:sequence>
102            <xs:element name="ProductStrategy" maxOccurs="unbounded">
103                <xs:complexType>
104                    <xs:sequence>
105                        <xs:element name="AttributesGroup" type="AttributesGroup" minOccurs="1" maxOccurs="unbounded"/>
106                    </xs:sequence>
107                    <xs:attribute name="name" type="xs:string" use="required"/>
108                </xs:complexType>
109            </xs:element>
110        </xs:sequence>
111    </xs:complexType>
112
113    <xs:complexType name="AttributesGroup">
114        <xs:sequence>
115            <xs:choice minOccurs="0">
116                <xs:element name="Attributes" type="AttributesType" minOccurs="1" maxOccurs="unbounded"/>
117                <xs:sequence>
118                    <xs:element name="ContentType" type="ContentTypeType" minOccurs="0" maxOccurs="1"/>
119                    <xs:element name="Usage" type="UsageType" minOccurs="1" maxOccurs="1"/>
120                    <xs:element name="Source" type="SourceType" minOccurs="0" maxOccurs="1"/>
121                    <xs:element name="Flags" type="FlagsType" minOccurs="0" maxOccurs="1"/>
122                    <xs:element name="Bundle" type="BundleType" minOccurs="0" maxOccurs="1"/>
123                </xs:sequence>
124            </xs:choice>
125        </xs:sequence>
126        <xs:attribute name="streamType" type="stream" use="optional"/>
127        <xs:attribute name="volumeGroup" type="xs:string" use="optional"/>
128    </xs:complexType>
129
130    <xs:complexType name="volumeGroupsType">
131        <xs:sequence>
132             <xs:element name="volumeGroup" minOccurs="0" maxOccurs="unbounded">
133                <xs:complexType>
134                    <xs:sequence>
135                         <xs:element name="name" type="xs:token"/>
136                         <xs:element name="indexMin" type="xs:int" minOccurs="0" maxOccurs="1"/>
137                         <xs:element name="indexMax" type="xs:int" minOccurs="0" maxOccurs="1"/>
138                         <xs:element name="volume" type="volume" minOccurs="1" maxOccurs="unbounded"/>
139                     </xs:sequence>
140                </xs:complexType>
141                <xs:unique name="volumeAttributesUniqueness">
142                    <xs:selector xpath="volume"/>
143                    <xs:field xpath="deviceCategory"/>
144                </xs:unique>
145             </xs:element>
146        </xs:sequence>
147    </xs:complexType>
148
149    <xs:complexType name="volumesType">
150        <xs:sequence>
151            <xs:element name="reference" type="volumeRef" minOccurs="0" maxOccurs="unbounded"/>
152        </xs:sequence>
153    </xs:complexType>
154
155    <xs:complexType name="attributesRef">
156        <xs:sequence>
157            <xs:element name="reference" type="attributesRefType" minOccurs="0" maxOccurs="unbounded"/>
158        </xs:sequence>
159    </xs:complexType>
160
161    <xs:complexType name="criteriaType">
162        <xs:sequence>
163            <xs:element name="criterion" type="criterionType" maxOccurs="unbounded"/>
164        </xs:sequence>
165    </xs:complexType>
166    <xs:complexType name="criterionType">
167        <xs:attribute name="name" type="xs:string" use="required"/>
168        <xs:attribute name="type" type="xs:string" use="required"/>
169        <xs:attribute name="default" type="xs:string" use="optional"/>
170    </xs:complexType>
171
172    <xs:complexType name="criterionTypesType">
173        <xs:sequence>
174            <xs:element name="criterion_type" type="criterionTypeType" maxOccurs="unbounded"/>
175        </xs:sequence>
176    </xs:complexType>
177    <xs:complexType name="criterionTypeType">
178        <xs:sequence>
179            <xs:element name="values" type="valuesType" minOccurs="0" maxOccurs="1"/>
180        </xs:sequence>
181        <xs:attribute name="name" type="xs:token" use="required"/>
182        <xs:attribute name="type" type="pfwCriterionTypeEnum" use="required"/>
183    </xs:complexType>
184
185    <xs:complexType name="valuesType">
186        <xs:sequence>
187            <xs:element name="value" type="valueType" maxOccurs="unbounded"/>
188        </xs:sequence>
189    </xs:complexType>
190    <xs:complexType name="valueType">
191        <xs:attribute name="literal" type="xs:string" use="required"/>
192        <xs:attribute name="numerical" type="xs:long" use="required"/>
193        <xs:attribute name="android_type" type="longDecimalOrHexType" use="optional"/>
194    </xs:complexType>
195
196    <xs:simpleType name="longDecimalOrHexType">
197      <xs:union memberTypes="xs:long longHexType" />
198    </xs:simpleType>
199
200    <xs:simpleType name="longHexType">
201      <xs:restriction base="xs:string">
202        <xs:pattern value="0x[0-9A-Fa-f]{1,16}"/>
203      </xs:restriction>
204    </xs:simpleType>
205
206    <xs:complexType name="attributesRefType">
207        <xs:sequence>
208            <xs:element name="Attributes" type="AttributesType" minOccurs="1" maxOccurs="1"/>
209        </xs:sequence>
210        <xs:attribute name="name" type="xs:token" use="required"/>
211    </xs:complexType>
212
213    <xs:complexType name="AttributesType">
214        <xs:sequence>
215            <xs:element name="ContentType" type="ContentTypeType" minOccurs="0" maxOccurs="1"/>
216            <xs:element name="Usage" type="UsageType" minOccurs="0" maxOccurs="1"/>
217            <xs:element name="Source" type="SourceType" minOccurs="0" maxOccurs="1"/>
218            <xs:element name="Flags" type="FlagsType" minOccurs="0" maxOccurs="1"/>
219            <xs:element name="Bundle" type="BundleType" minOccurs="0" maxOccurs="1"/>
220        </xs:sequence>
221        <xs:attribute name="attributesRef" type="xs:token" use="optional"/>
222        <!-- with xsd 1.1, it is impossible to make choice on either attributes or element...-->
223    </xs:complexType>
224
225    <xs:complexType name="ContentTypeType">
226        <xs:attribute name="value" type="contentType" use="required"/>
227    </xs:complexType>
228    <xs:complexType name="UsageType">
229        <xs:attribute name="value" type="usageEnumType" use="required"/>
230    </xs:complexType>
231    <xs:complexType name="SourceType">
232        <xs:attribute name="value" type="sourceEnumType" use="required"/>
233    </xs:complexType>
234    <xs:complexType name="FlagsType">
235        <xs:attribute name="value" type="flagsEnumType" use="required"/>
236    </xs:complexType>
237    <xs:complexType name="BundleType">
238        <xs:attribute name="key" type="xs:string" use="required"/>
239        <xs:attribute name="value" type="xs:string" use="required"/>
240    </xs:complexType>
241
242    <xs:complexType name="volume">
243        <xs:annotation>
244            <xs:documentation xml:lang="en">
245                Volume section defines a volume curve for a given use case and device category.
246                It contains a list of points of this curve expressing the attenuation in Millibels
247                for a given volume index from 0 to 100.
248                <volume deviceCategory="DEVICE_CATEGORY_SPEAKER">
249                    <point>0,-9600</point>
250                    <point>100,0</point>
251                </volume>
252
253                It may also reference a reference/@name to avoid duplicating curves.
254                <volume deviceCategory="DEVICE_CATEGORY_SPEAKER" ref="DEFAULT_MEDIA_VOLUME_CURVE"/>
255                <reference name="DEFAULT_MEDIA_VOLUME_CURVE">
256                    <point>0,-9600</point>
257                    <point>100,0</point>
258                </reference>
259            </xs:documentation>
260        </xs:annotation>
261        <xs:sequence>
262            <xs:element name="point" type="volumePoint" minOccurs="0" maxOccurs="unbounded"/>
263        </xs:sequence>
264        <xs:attribute name="deviceCategory" type="deviceCategory"/>
265        <xs:attribute name="ref" type="xs:token" use="optional"/>
266    </xs:complexType>
267
268    <xs:complexType name="volumeRef">
269        <xs:sequence>
270            <xs:element name="point" type="volumePoint" minOccurs="2" maxOccurs="unbounded"/>
271        </xs:sequence>
272        <xs:attribute name="name" type="xs:token" use="required"/>
273    </xs:complexType>
274
275    <xs:simpleType name="volumePoint">
276        <xs:annotation>
277            <xs:documentation xml:lang="en">
278                Comma separated pair of number.
279                The fist one is the framework level (between 0 and 100).
280                The second one is the volume to send to the HAL.
281                The framework will interpolate volumes not specified.
282                Their MUST be at least 2 points specified.
283            </xs:documentation>
284        </xs:annotation>
285        <xs:restriction base="xs:string">
286            <xs:pattern value="([0-9]{1,2}|100),-?[0-9]+"/>
287        </xs:restriction>
288    </xs:simpleType>
289
290
291    <xs:simpleType name="streamsCsv">
292        <xs:list>
293            <xs:simpleType>
294                <xs:restriction base="stream">
295                </xs:restriction>
296            </xs:simpleType>
297        </xs:list>
298    </xs:simpleType>
299
300    <!-- Enum values of audio_stream_type_t in audio-base.h
301         TODO: avoid manual sync. -->
302    <xs:simpleType name="stream">
303        <xs:restriction base="xs:NMTOKEN">
304            <!--xs:pattern value="\c+(,\c+)*"/-->
305            <xs:enumeration value="AUDIO_STREAM_DEFAULT"/>
306            <xs:enumeration value="AUDIO_STREAM_VOICE_CALL"/>
307            <xs:enumeration value="AUDIO_STREAM_SYSTEM"/>
308            <xs:enumeration value="AUDIO_STREAM_RING"/>
309            <xs:enumeration value="AUDIO_STREAM_MUSIC"/>
310            <xs:enumeration value="AUDIO_STREAM_ALARM"/>
311            <xs:enumeration value="AUDIO_STREAM_NOTIFICATION"/>
312            <xs:enumeration value="AUDIO_STREAM_BLUETOOTH_SCO"/>
313            <xs:enumeration value="AUDIO_STREAM_ENFORCED_AUDIBLE"/>
314            <xs:enumeration value="AUDIO_STREAM_DTMF"/>
315            <xs:enumeration value="AUDIO_STREAM_TTS"/>
316            <xs:enumeration value="AUDIO_STREAM_ACCESSIBILITY"/>
317            <xs:enumeration value="AUDIO_STREAM_ASSISTANT"/>
318        </xs:restriction>
319    </xs:simpleType>
320
321    <xs:simpleType name="deviceCategory">
322        <xs:restriction base="xs:string">
323            <xs:enumeration value="DEVICE_CATEGORY_HEADSET"/>
324            <xs:enumeration value="DEVICE_CATEGORY_SPEAKER"/>
325            <xs:enumeration value="DEVICE_CATEGORY_EARPIECE"/>
326            <xs:enumeration value="DEVICE_CATEGORY_EXT_MEDIA"/>
327            <xs:enumeration value="DEVICE_CATEGORY_HEARING_AID"/>
328        </xs:restriction>
329    </xs:simpleType>
330
331    <xs:simpleType name="contentType">
332        <xs:restriction base="xs:string">
333            <xs:enumeration value="AUDIO_CONTENT_TYPE_UNKNOWN"/>
334            <xs:enumeration value="AUDIO_CONTENT_TYPE_SPEECH"/>
335            <xs:enumeration value="AUDIO_CONTENT_TYPE_MUSIC"/>
336            <xs:enumeration value="AUDIO_CONTENT_TYPE_MOVIE"/>
337            <xs:enumeration value="AUDIO_CONTENT_TYPE_SONIFICATION"/>
338        </xs:restriction>
339    </xs:simpleType>
340
341    <xs:simpleType name="usageEnumType">
342        <xs:restriction base="xs:string">
343            <xs:enumeration value="AUDIO_USAGE_UNKNOWN"/>
344            <xs:enumeration value="AUDIO_USAGE_MEDIA"/>
345            <xs:enumeration value="AUDIO_USAGE_VOICE_COMMUNICATION"/>
346            <xs:enumeration value="AUDIO_USAGE_VOICE_COMMUNICATION_SIGNALLING"/>
347            <xs:enumeration value="AUDIO_USAGE_ALARM"/>
348            <xs:enumeration value="AUDIO_USAGE_NOTIFICATION"/>
349            <xs:enumeration value="AUDIO_USAGE_NOTIFICATION_TELEPHONY_RINGTONE"/>
350            <!-- Note: the following 3 values were deprecated in Android T (13) SDK -->
351            <xs:enumeration value="AUDIO_USAGE_NOTIFICATION_COMMUNICATION_REQUEST"/>
352            <xs:enumeration value="AUDIO_USAGE_NOTIFICATION_COMMUNICATION_INSTANT"/>
353            <xs:enumeration value="AUDIO_USAGE_NOTIFICATION_COMMUNICATION_DELAYED"/>
354            <xs:enumeration value="AUDIO_USAGE_NOTIFICATION_EVENT"/>
355            <xs:enumeration value="AUDIO_USAGE_ASSISTANCE_ACCESSIBILITY"/>
356            <xs:enumeration value="AUDIO_USAGE_ASSISTANCE_NAVIGATION_GUIDANCE"/>
357            <xs:enumeration value="AUDIO_USAGE_ASSISTANCE_SONIFICATION"/>
358            <xs:enumeration value="AUDIO_USAGE_GAME"/>
359            <xs:enumeration value="AUDIO_USAGE_VIRTUAL_SOURCE"/>
360            <xs:enumeration value="AUDIO_USAGE_ASSISTANT"/>
361            <xs:enumeration value="AUDIO_USAGE_CALL_ASSISTANT"/>
362            <xs:enumeration value="AUDIO_USAGE_EMERGENCY" />
363            <xs:enumeration value="AUDIO_USAGE_SAFETY" />
364            <xs:enumeration value="AUDIO_USAGE_VEHICLE_STATUS" />
365            <xs:enumeration value="AUDIO_USAGE_ANNOUNCEMENT" />
366        </xs:restriction>
367    </xs:simpleType>
368
369    <xs:simpleType name="flagsEnumType">
370        <xs:list>
371            <xs:simpleType>
372                <xs:restriction base="flagType">
373                </xs:restriction>
374            </xs:simpleType>
375        </xs:list>
376    </xs:simpleType>
377
378    <xs:simpleType name="flagType">
379        <xs:restriction base="xs:NMTOKEN">
380            <xs:enumeration value="AUDIO_FLAG_NONE"/>
381            <xs:enumeration value="AUDIO_FLAG_AUDIBILITY_ENFORCED"/>
382            <xs:enumeration value="AUDIO_FLAG_SECURE"/>
383            <xs:enumeration value="AUDIO_FLAG_SCO"/>
384            <xs:enumeration value="AUDIO_FLAG_BEACON"/>
385            <xs:enumeration value="AUDIO_FLAG_HW_AV_SYNC"/>
386            <xs:enumeration value="AUDIO_FLAG_HW_HOTWORD"/>
387            <xs:enumeration value="AUDIO_FLAG_BYPASS_INTERRUPTION_POLICY"/>
388            <xs:enumeration value="AUDIO_FLAG_BYPASS_MUTE"/>
389            <xs:enumeration value="AUDIO_FLAG_LOW_LATENCY"/>
390            <xs:enumeration value="AUDIO_FLAG_DEEP_BUFFER"/>
391            <xs:enumeration value="AUDIO_FLAG_NO_MEDIA_PROJECTION"/>
392            <xs:enumeration value="AUDIO_FLAG_MUTE_HAPTIC"/>
393            <xs:enumeration value="AUDIO_FLAG_NO_SYSTEM_CAPTURE"/>
394            <xs:enumeration value="AUDIO_FLAG_CAPTURE_PRIVATE"/>
395        </xs:restriction>
396    </xs:simpleType>
397
398    <xs:simpleType name="sourceEnumType">
399        <xs:restriction base="xs:string">
400            <xs:enumeration value="AUDIO_SOURCE_DEFAULT"/>
401            <xs:enumeration value="AUDIO_SOURCE_MIC"/>
402            <xs:enumeration value="AUDIO_SOURCE_VOICE_UPLINK"/>
403            <xs:enumeration value="AUDIO_SOURCE_VOICE_DOWNLINK"/>
404            <xs:enumeration value="AUDIO_SOURCE_VOICE_CALL"/>
405            <xs:enumeration value="AUDIO_SOURCE_CAMCORDER"/>
406            <xs:enumeration value="AUDIO_SOURCE_VOICE_RECOGNITION"/>
407            <xs:enumeration value="AUDIO_SOURCE_VOICE_COMMUNICATION"/>
408            <xs:enumeration value="AUDIO_SOURCE_REMOTE_SUBMIX"/>
409            <xs:enumeration value="AUDIO_SOURCE_UNPROCESSED"/>
410            <xs:enumeration value="AUDIO_SOURCE_VOICE_PERFORMANCE"/>
411            <xs:enumeration value="AUDIO_SOURCE_ECHO_REFERENCE"/>
412            <xs:enumeration value="AUDIO_SOURCE_FM_TUNER"/>
413        </xs:restriction>
414    </xs:simpleType>
415
416    <xs:simpleType name="pfwCriterionTypeEnum">
417        <xs:restriction base="xs:string">
418            <xs:enumeration value="inclusive"/>
419            <xs:enumeration value="exclusive"/>
420        </xs:restriction>
421    </xs:simpleType>
422</xs:schema>
423