1<?xml version="1.0" encoding="UTF-8"?>
2<!-- Copyright (C) 2020 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<xs:schema version="2.0"
17           elementFormDefault="qualified"
18           attributeFormDefault="unqualified"
19           xmlns:xs="http://www.w3.org/2001/XMLSchema">
20    <!-- List the config versions supported by audio policy. -->
21    <xs:simpleType name="version">
22        <xs:restriction base="xs:decimal">
23            <xs:enumeration value="7.0"/>
24            <xs:enumeration value="7.1"/>
25        </xs:restriction>
26    </xs:simpleType>
27    <xs:simpleType name="halVersion">
28        <xs:annotation>
29            <xs:documentation xml:lang="en">
30                Version of the interface the hal implements. Note that this
31                relates to legacy HAL API versions since HIDL APIs are versioned
32                using other mechanisms.
33            </xs:documentation>
34        </xs:annotation>
35        <xs:restriction base="xs:decimal">
36            <!-- List of HAL versions supported by the framework. -->
37            <xs:enumeration value="2.0"/>
38            <xs:enumeration value="3.0"/>
39        </xs:restriction>
40    </xs:simpleType>
41    <xs:element name="audioPolicyConfiguration">
42        <xs:complexType>
43            <xs:sequence>
44                <xs:element name="globalConfiguration" type="globalConfiguration"/>
45                <xs:element name="modules" type="modules" maxOccurs="unbounded"/>
46                <xs:element name="volumes" type="volumes" maxOccurs="unbounded"/>
47                <xs:element name="surroundSound" type="surroundSound" minOccurs="0" />
48            </xs:sequence>
49            <xs:attribute name="version" type="version"/>
50        </xs:complexType>
51        <xs:key name="moduleNameKey">
52            <xs:selector xpath="modules/module"/>
53            <xs:field xpath="@name"/>
54        </xs:key>
55        <xs:unique name="volumeTargetUniqueness">
56            <xs:selector xpath="volumes/volume"/>
57            <xs:field xpath="@stream"/>
58            <xs:field xpath="@deviceCategory"/>
59        </xs:unique>
60        <xs:key name="volumeCurveNameKey">
61            <xs:selector xpath="volumes/reference"/>
62            <xs:field xpath="@name"/>
63        </xs:key>
64        <xs:keyref name="volumeCurveRef" refer="volumeCurveNameKey">
65            <xs:selector xpath="volumes/volume"/>
66            <xs:field xpath="@ref"/>
67        </xs:keyref>
68    </xs:element>
69    <xs:complexType name="globalConfiguration">
70        <xs:attribute name="speaker_drc_enabled" type="xs:boolean" use="required"/>
71        <xs:attribute name="call_screen_mode_supported" type="xs:boolean" use="optional"/>
72        <xs:attribute name="engine_library" type="engineSuffix" use="optional"/>
73    </xs:complexType>
74    <xs:complexType name="modules">
75        <xs:annotation>
76            <xs:documentation xml:lang="en">
77                There should be one section per audio HW module present on the platform.
78                Each <module/> contains two mandatory tags: “halVersion” and “name”.
79                The module "name" is the same as in previous .conf file.
80                Each module must contain the following sections:
81                 - <devicePorts/>: a list of device descriptors for all
82                   input and output devices accessible via this module.
83                   This contains both permanently attached devices and removable devices.
84                 - <mixPorts/>: listing all output and input streams exposed by the audio HAL
85                 - <routes/>: list of possible connections between input
86                   and output devices or between stream and devices.
87                   A <route/> is defined by a set of 3 attributes:
88                        -"type": mux|mix means all sources are mutual exclusive (mux) or can be mixed (mix)
89                        -"sink": the sink involved in this route
90                        -"sources": all the sources than can be connected to the sink via this route
91                 - <attachedDevices/>: permanently attached devices.
92                   The attachedDevices section is a list of devices names.
93                   Their names correspond to device names defined in "devicePorts" section.
94                 - <defaultOutputDevice/> is the device to be used when no policy rule applies
95            </xs:documentation>
96        </xs:annotation>
97        <xs:sequence>
98            <xs:element name="module" maxOccurs="unbounded">
99                <xs:complexType>
100                    <xs:sequence>
101                        <xs:element name="attachedDevices" type="attachedDevices" minOccurs="0">
102                            <xs:unique name="attachedDevicesUniqueness">
103                                <xs:selector xpath="item"/>
104                                <xs:field xpath="."/>
105                            </xs:unique>
106                        </xs:element>
107                        <xs:element name="defaultOutputDevice" type="xs:token" minOccurs="0"/>
108                        <xs:element name="mixPorts" type="mixPorts" minOccurs="0"/>
109                        <xs:element name="devicePorts" type="devicePorts" minOccurs="0"/>
110                        <xs:element name="routes" type="routes" minOccurs="0"/>
111                    </xs:sequence>
112                    <xs:attribute name="name" type="xs:string" use="required"/>
113                    <xs:attribute name="halVersion" type="halVersion" use="required"/>
114                </xs:complexType>
115                <xs:unique name="mixPortNameUniqueness">
116                    <xs:selector xpath="mixPorts/mixPort"/>
117                    <xs:field xpath="@name"/>
118                </xs:unique>
119                <xs:key name="devicePortNameKey">
120                    <xs:selector xpath="devicePorts/devicePort"/>
121                    <xs:field xpath="@tagName"/>
122                </xs:key>
123                <xs:unique name="devicePortUniqueness">
124                    <xs:selector xpath="devicePorts/devicePort"/>
125                    <xs:field xpath="@type"/>
126                    <xs:field xpath="@address"/>
127                </xs:unique>
128                <xs:keyref name="defaultOutputDeviceRef" refer="devicePortNameKey">
129                    <xs:selector xpath="defaultOutputDevice"/>
130                    <xs:field xpath="."/>
131                </xs:keyref>
132                <xs:keyref name="attachedDeviceRef" refer="devicePortNameKey">
133                    <xs:selector xpath="attachedDevices/item"/>
134                    <xs:field xpath="."/>
135                </xs:keyref>
136                <!-- The following 3 constraints try to make sure each sink port
137                     is reference in one an only one route. -->
138                <xs:key name="routeSinkKey">
139                    <!-- predicate [@type='sink'] does not work in xsd 1.0 -->
140                    <xs:selector xpath="devicePorts/devicePort|mixPorts/mixPort"/>
141                    <xs:field xpath="@tagName|@name"/>
142                </xs:key>
143                <xs:keyref name="routeSinkRef" refer="routeSinkKey">
144                    <xs:selector xpath="routes/route"/>
145                    <xs:field xpath="@sink"/>
146                </xs:keyref>
147                <xs:unique name="routeUniqueness">
148                    <xs:selector xpath="routes/route"/>
149                    <xs:field xpath="@sink"/>
150                </xs:unique>
151            </xs:element>
152        </xs:sequence>
153    </xs:complexType>
154    <xs:complexType name="attachedDevices">
155        <xs:sequence>
156            <xs:element name="item" type="xs:token" minOccurs="0" maxOccurs="unbounded"/>
157        </xs:sequence>
158    </xs:complexType>
159    <xs:simpleType name="audioInOutFlag">
160        <xs:annotation>
161            <xs:documentation xml:lang="en">
162              The flags indicate suggested stream attributes supported by the profile.
163            </xs:documentation>
164        </xs:annotation>
165        <xs:restriction base="xs:string">
166            <xs:enumeration value="AUDIO_OUTPUT_FLAG_DIRECT" />
167            <xs:enumeration value="AUDIO_OUTPUT_FLAG_PRIMARY" />
168            <xs:enumeration value="AUDIO_OUTPUT_FLAG_FAST" />
169            <xs:enumeration value="AUDIO_OUTPUT_FLAG_DEEP_BUFFER" />
170            <xs:enumeration value="AUDIO_OUTPUT_FLAG_COMPRESS_OFFLOAD" />
171            <xs:enumeration value="AUDIO_OUTPUT_FLAG_NON_BLOCKING" />
172            <xs:enumeration value="AUDIO_OUTPUT_FLAG_HW_AV_SYNC" />
173            <xs:enumeration value="AUDIO_OUTPUT_FLAG_TTS" />
174            <xs:enumeration value="AUDIO_OUTPUT_FLAG_RAW" />
175            <xs:enumeration value="AUDIO_OUTPUT_FLAG_SYNC" />
176            <xs:enumeration value="AUDIO_OUTPUT_FLAG_IEC958_NONAUDIO" />
177            <xs:enumeration value="AUDIO_OUTPUT_FLAG_DIRECT_PCM" />
178            <xs:enumeration value="AUDIO_OUTPUT_FLAG_MMAP_NOIRQ" />
179            <xs:enumeration value="AUDIO_OUTPUT_FLAG_VOIP_RX" />
180            <xs:enumeration value="AUDIO_OUTPUT_FLAG_INCALL_MUSIC" />
181            <xs:enumeration value="AUDIO_OUTPUT_FLAG_GAPLESS_OFFLOAD" />
182            <xs:enumeration value="AUDIO_OUTPUT_FLAG_SPATIALIZER" />
183            <xs:enumeration value="AUDIO_OUTPUT_FLAG_ULTRASOUND" />
184            <xs:enumeration value="AUDIO_OUTPUT_FLAG_BIT_PERFECT" />
185            <xs:enumeration value="AUDIO_INPUT_FLAG_FAST" />
186            <xs:enumeration value="AUDIO_INPUT_FLAG_HW_HOTWORD" />
187            <xs:enumeration value="AUDIO_INPUT_FLAG_RAW" />
188            <xs:enumeration value="AUDIO_INPUT_FLAG_SYNC" />
189            <xs:enumeration value="AUDIO_INPUT_FLAG_MMAP_NOIRQ" />
190            <xs:enumeration value="AUDIO_INPUT_FLAG_VOIP_TX" />
191            <xs:enumeration value="AUDIO_INPUT_FLAG_HW_AV_SYNC" />
192            <xs:enumeration value="AUDIO_INPUT_FLAG_DIRECT" />
193            <xs:enumeration value="AUDIO_INPUT_FLAG_ULTRASOUND" />
194            <xs:enumeration value="AUDIO_INPUT_FLAG_HOTWORD_TAP" />
195            <xs:enumeration value="AUDIO_INPUT_FLAG_HW_LOOKBACK" />
196        </xs:restriction>
197    </xs:simpleType>
198    <xs:simpleType name="audioInOutFlags">
199        <xs:list itemType="audioInOutFlag" />
200    </xs:simpleType>
201    <xs:simpleType name="role">
202        <xs:restriction base="xs:string">
203            <xs:enumeration value="sink"/>
204            <xs:enumeration value="source"/>
205        </xs:restriction>
206    </xs:simpleType>
207    <xs:complexType name="mixPorts">
208        <xs:sequence>
209            <xs:element name="mixPort" minOccurs="0" maxOccurs="unbounded">
210                <xs:complexType>
211                    <xs:sequence>
212                        <xs:element name="profile" type="profile" minOccurs="0" maxOccurs="unbounded"/>
213                        <xs:element name="gains" type="gains" minOccurs="0"/>
214                    </xs:sequence>
215                    <xs:attribute name="name" type="xs:token" use="required"/>
216                    <xs:attribute name="role" type="role" use="required"/>
217                    <xs:attribute name="flags" type="audioInOutFlags"/>
218                    <xs:attribute name="maxOpenCount" type="xs:unsignedInt"/>
219                    <xs:attribute name="maxActiveCount" type="xs:unsignedInt"/>
220                    <xs:attribute name="recommendedMuteDurationMs" type="xs:unsignedInt"/>
221                </xs:complexType>
222                <xs:unique name="mixPortProfileUniqueness">
223                    <xs:selector xpath="profile"/>
224                    <xs:field xpath="format"/>
225                    <xs:field xpath="samplingRate"/>
226                    <xs:field xpath="channelMasks"/>
227                </xs:unique>
228                <xs:unique name="mixPortGainUniqueness">
229                    <xs:selector xpath="gains/gain"/>
230                    <xs:field xpath="@name"/>
231                </xs:unique>
232            </xs:element>
233        </xs:sequence>
234    </xs:complexType>
235    <xs:simpleType name="audioDevice">
236        <xs:restriction base="xs:string">
237            <xs:enumeration value="AUDIO_DEVICE_NONE"/>
238
239            <xs:enumeration value="AUDIO_DEVICE_OUT_EARPIECE"/>
240            <xs:enumeration value="AUDIO_DEVICE_OUT_SPEAKER"/>
241            <xs:enumeration value="AUDIO_DEVICE_OUT_WIRED_HEADSET"/>
242            <xs:enumeration value="AUDIO_DEVICE_OUT_WIRED_HEADPHONE"/>
243            <xs:enumeration value="AUDIO_DEVICE_OUT_BLUETOOTH_SCO"/>
244            <xs:enumeration value="AUDIO_DEVICE_OUT_BLUETOOTH_SCO_HEADSET"/>
245            <xs:enumeration value="AUDIO_DEVICE_OUT_BLUETOOTH_SCO_CARKIT"/>
246            <xs:enumeration value="AUDIO_DEVICE_OUT_BLUETOOTH_A2DP"/>
247            <xs:enumeration value="AUDIO_DEVICE_OUT_BLUETOOTH_A2DP_HEADPHONES"/>
248            <xs:enumeration value="AUDIO_DEVICE_OUT_BLUETOOTH_A2DP_SPEAKER"/>
249            <xs:enumeration value="AUDIO_DEVICE_OUT_HDMI"/>
250            <xs:enumeration value="AUDIO_DEVICE_OUT_HDMI_EARC"/>
251            <xs:enumeration value="AUDIO_DEVICE_OUT_AUX_DIGITAL"/>
252            <xs:enumeration value="AUDIO_DEVICE_OUT_ANLG_DOCK_HEADSET"/>
253            <xs:enumeration value="AUDIO_DEVICE_OUT_DGTL_DOCK_HEADSET"/>
254            <xs:enumeration value="AUDIO_DEVICE_OUT_USB_ACCESSORY"/>
255            <xs:enumeration value="AUDIO_DEVICE_OUT_USB_DEVICE"/>
256            <xs:enumeration value="AUDIO_DEVICE_OUT_REMOTE_SUBMIX"/>
257            <xs:enumeration value="AUDIO_DEVICE_OUT_TELEPHONY_TX"/>
258            <xs:enumeration value="AUDIO_DEVICE_OUT_LINE"/>
259            <xs:enumeration value="AUDIO_DEVICE_OUT_HDMI_ARC"/>
260            <xs:enumeration value="AUDIO_DEVICE_OUT_SPDIF"/>
261            <xs:enumeration value="AUDIO_DEVICE_OUT_FM"/>
262            <xs:enumeration value="AUDIO_DEVICE_OUT_AUX_LINE"/>
263            <xs:enumeration value="AUDIO_DEVICE_OUT_SPEAKER_SAFE"/>
264            <xs:enumeration value="AUDIO_DEVICE_OUT_IP"/>
265            <xs:enumeration value="AUDIO_DEVICE_OUT_BUS"/>
266            <xs:enumeration value="AUDIO_DEVICE_OUT_PROXY"/>
267            <xs:enumeration value="AUDIO_DEVICE_OUT_USB_HEADSET"/>
268            <xs:enumeration value="AUDIO_DEVICE_OUT_HEARING_AID"/>
269            <xs:enumeration value="AUDIO_DEVICE_OUT_ECHO_CANCELLER"/>
270            <xs:enumeration value="AUDIO_DEVICE_OUT_BLE_HEADSET"/>
271            <xs:enumeration value="AUDIO_DEVICE_OUT_BLE_SPEAKER"/>
272            <xs:enumeration value="AUDIO_DEVICE_OUT_BLE_BROADCAST"/>
273            <xs:enumeration value="AUDIO_DEVICE_OUT_DEFAULT"/>
274            <xs:enumeration value="AUDIO_DEVICE_OUT_STUB"/>
275
276            <xs:enumeration value="AUDIO_DEVICE_IN_COMMUNICATION"/>
277            <xs:enumeration value="AUDIO_DEVICE_IN_AMBIENT"/>
278            <xs:enumeration value="AUDIO_DEVICE_IN_BUILTIN_MIC"/>
279            <xs:enumeration value="AUDIO_DEVICE_IN_BLUETOOTH_SCO_HEADSET"/>
280            <xs:enumeration value="AUDIO_DEVICE_IN_WIRED_HEADSET"/>
281            <xs:enumeration value="AUDIO_DEVICE_IN_HDMI"/>
282            <xs:enumeration value="AUDIO_DEVICE_IN_AUX_DIGITAL"/>
283            <xs:enumeration value="AUDIO_DEVICE_IN_VOICE_CALL"/>
284            <xs:enumeration value="AUDIO_DEVICE_IN_TELEPHONY_RX"/>
285            <xs:enumeration value="AUDIO_DEVICE_IN_BACK_MIC"/>
286            <xs:enumeration value="AUDIO_DEVICE_IN_REMOTE_SUBMIX"/>
287            <xs:enumeration value="AUDIO_DEVICE_IN_ANLG_DOCK_HEADSET"/>
288            <xs:enumeration value="AUDIO_DEVICE_IN_DGTL_DOCK_HEADSET"/>
289            <xs:enumeration value="AUDIO_DEVICE_IN_USB_ACCESSORY"/>
290            <xs:enumeration value="AUDIO_DEVICE_IN_USB_DEVICE"/>
291            <xs:enumeration value="AUDIO_DEVICE_IN_FM_TUNER"/>
292            <xs:enumeration value="AUDIO_DEVICE_IN_TV_TUNER"/>
293            <xs:enumeration value="AUDIO_DEVICE_IN_LINE"/>
294            <xs:enumeration value="AUDIO_DEVICE_IN_SPDIF"/>
295            <xs:enumeration value="AUDIO_DEVICE_IN_BLUETOOTH_A2DP"/>
296            <xs:enumeration value="AUDIO_DEVICE_IN_LOOPBACK"/>
297            <xs:enumeration value="AUDIO_DEVICE_IN_IP"/>
298            <xs:enumeration value="AUDIO_DEVICE_IN_BUS"/>
299            <xs:enumeration value="AUDIO_DEVICE_IN_PROXY"/>
300            <xs:enumeration value="AUDIO_DEVICE_IN_USB_HEADSET"/>
301            <xs:enumeration value="AUDIO_DEVICE_IN_BLUETOOTH_BLE"/>
302            <xs:enumeration value="AUDIO_DEVICE_IN_HDMI_ARC"/>
303            <xs:enumeration value="AUDIO_DEVICE_IN_HDMI_EARC"/>
304            <xs:enumeration value="AUDIO_DEVICE_IN_ECHO_REFERENCE"/>
305            <xs:enumeration value="AUDIO_DEVICE_IN_BLE_HEADSET"/>
306            <xs:enumeration value="AUDIO_DEVICE_IN_DEFAULT"/>
307            <xs:enumeration value="AUDIO_DEVICE_IN_STUB"/>
308        </xs:restriction>
309    </xs:simpleType>
310    <xs:simpleType name="vendorExtension">
311        <!-- Vendor extension names must be prefixed by "VX_" to distinguish them from
312             AOSP values. Vendors must namespace their names to avoid conflicts. The
313             namespace part must only use capital latin characters and decimal digits and
314             consist of at least 3 characters. The part of the extension name after the
315             namespace may in addition include underscores. Example for a hypothetical
316             Google virtual reality device:
317
318                 <devicePort tagName="VR" type="VX_GOOGLE_VR" role="sink" />
319        -->
320        <xs:restriction base="xs:string">
321            <xs:pattern value="VX_[A-Z0-9]{3,}_[_A-Z0-9]+"/>
322        </xs:restriction>
323    </xs:simpleType>
324    <xs:simpleType name="extendableAudioDevice">
325        <xs:union memberTypes="audioDevice vendorExtension"/>
326    </xs:simpleType>
327    <xs:simpleType name="audioFormat">
328        <xs:restriction base="xs:string">
329            <xs:enumeration value="AUDIO_FORMAT_DEFAULT" />
330            <xs:enumeration value="AUDIO_FORMAT_PCM_16_BIT" />
331            <xs:enumeration value="AUDIO_FORMAT_PCM_8_BIT"/>
332            <xs:enumeration value="AUDIO_FORMAT_PCM_32_BIT"/>
333            <xs:enumeration value="AUDIO_FORMAT_PCM_8_24_BIT"/>
334            <xs:enumeration value="AUDIO_FORMAT_PCM_FLOAT"/>
335            <xs:enumeration value="AUDIO_FORMAT_PCM_24_BIT_PACKED"/>
336            <xs:enumeration value="AUDIO_FORMAT_MP3"/>
337            <xs:enumeration value="AUDIO_FORMAT_AMR_NB"/>
338            <xs:enumeration value="AUDIO_FORMAT_AMR_WB"/>
339            <xs:enumeration value="AUDIO_FORMAT_AAC"/>
340            <xs:enumeration value="AUDIO_FORMAT_AAC_MAIN"/>
341            <xs:enumeration value="AUDIO_FORMAT_AAC_LC"/>
342            <xs:enumeration value="AUDIO_FORMAT_AAC_SSR"/>
343            <xs:enumeration value="AUDIO_FORMAT_AAC_LTP"/>
344            <xs:enumeration value="AUDIO_FORMAT_AAC_HE_V1"/>
345            <xs:enumeration value="AUDIO_FORMAT_AAC_SCALABLE"/>
346            <xs:enumeration value="AUDIO_FORMAT_AAC_ERLC"/>
347            <xs:enumeration value="AUDIO_FORMAT_AAC_LD"/>
348            <xs:enumeration value="AUDIO_FORMAT_AAC_HE_V2"/>
349            <xs:enumeration value="AUDIO_FORMAT_AAC_ELD"/>
350            <xs:enumeration value="AUDIO_FORMAT_AAC_XHE"/>
351            <xs:enumeration value="AUDIO_FORMAT_HE_AAC_V1"/>
352            <xs:enumeration value="AUDIO_FORMAT_HE_AAC_V2"/>
353            <xs:enumeration value="AUDIO_FORMAT_VORBIS"/>
354            <xs:enumeration value="AUDIO_FORMAT_OPUS"/>
355            <xs:enumeration value="AUDIO_FORMAT_AC3"/>
356            <xs:enumeration value="AUDIO_FORMAT_E_AC3"/>
357            <xs:enumeration value="AUDIO_FORMAT_E_AC3_JOC"/>
358            <xs:enumeration value="AUDIO_FORMAT_DTS"/>
359            <xs:enumeration value="AUDIO_FORMAT_DTS_HD"/>
360            <xs:enumeration value="AUDIO_FORMAT_IEC61937"/>
361            <xs:enumeration value="AUDIO_FORMAT_DOLBY_TRUEHD"/>
362            <xs:enumeration value="AUDIO_FORMAT_EVRC"/>
363            <xs:enumeration value="AUDIO_FORMAT_EVRCB"/>
364            <xs:enumeration value="AUDIO_FORMAT_EVRCWB"/>
365            <xs:enumeration value="AUDIO_FORMAT_EVRCNW"/>
366            <xs:enumeration value="AUDIO_FORMAT_AAC_ADIF"/>
367            <xs:enumeration value="AUDIO_FORMAT_WMA"/>
368            <xs:enumeration value="AUDIO_FORMAT_WMA_PRO"/>
369            <xs:enumeration value="AUDIO_FORMAT_AMR_WB_PLUS"/>
370            <xs:enumeration value="AUDIO_FORMAT_MP2"/>
371            <xs:enumeration value="AUDIO_FORMAT_QCELP"/>
372            <xs:enumeration value="AUDIO_FORMAT_DSD"/>
373            <xs:enumeration value="AUDIO_FORMAT_FLAC"/>
374            <xs:enumeration value="AUDIO_FORMAT_ALAC"/>
375            <xs:enumeration value="AUDIO_FORMAT_APE"/>
376            <xs:enumeration value="AUDIO_FORMAT_AAC_ADTS"/>
377            <xs:enumeration value="AUDIO_FORMAT_AAC_ADTS_MAIN"/>
378            <xs:enumeration value="AUDIO_FORMAT_AAC_ADTS_LC"/>
379            <xs:enumeration value="AUDIO_FORMAT_AAC_ADTS_SSR"/>
380            <xs:enumeration value="AUDIO_FORMAT_AAC_ADTS_LTP"/>
381            <xs:enumeration value="AUDIO_FORMAT_AAC_ADTS_HE_V1"/>
382            <xs:enumeration value="AUDIO_FORMAT_AAC_ADTS_SCALABLE"/>
383            <xs:enumeration value="AUDIO_FORMAT_AAC_ADTS_ERLC"/>
384            <xs:enumeration value="AUDIO_FORMAT_AAC_ADTS_LD"/>
385            <xs:enumeration value="AUDIO_FORMAT_AAC_ADTS_HE_V2"/>
386            <xs:enumeration value="AUDIO_FORMAT_AAC_ADTS_ELD"/>
387            <xs:enumeration value="AUDIO_FORMAT_AAC_ADTS_XHE"/>
388            <xs:enumeration value="AUDIO_FORMAT_SBC"/>
389            <xs:enumeration value="AUDIO_FORMAT_APTX"/>
390            <xs:enumeration value="AUDIO_FORMAT_APTX_HD"/>
391            <xs:enumeration value="AUDIO_FORMAT_AC4"/>
392            <xs:enumeration value="AUDIO_FORMAT_LDAC"/>
393            <xs:enumeration value="AUDIO_FORMAT_MAT"/>
394            <xs:enumeration value="AUDIO_FORMAT_MAT_1_0"/>
395            <xs:enumeration value="AUDIO_FORMAT_MAT_2_0"/>
396            <xs:enumeration value="AUDIO_FORMAT_MAT_2_1"/>
397            <xs:enumeration value="AUDIO_FORMAT_AAC_LATM"/>
398            <xs:enumeration value="AUDIO_FORMAT_AAC_LATM_LC"/>
399            <xs:enumeration value="AUDIO_FORMAT_AAC_LATM_HE_V1"/>
400            <xs:enumeration value="AUDIO_FORMAT_AAC_LATM_HE_V2"/>
401            <xs:enumeration value="AUDIO_FORMAT_CELT"/>
402            <xs:enumeration value="AUDIO_FORMAT_APTX_ADAPTIVE"/>
403            <xs:enumeration value="AUDIO_FORMAT_LHDC"/>
404            <xs:enumeration value="AUDIO_FORMAT_LHDC_LL"/>
405            <xs:enumeration value="AUDIO_FORMAT_APTX_TWSP"/>
406            <xs:enumeration value="AUDIO_FORMAT_LC3"/>
407            <xs:enumeration value="AUDIO_FORMAT_MPEGH_BL_L3"/>
408            <xs:enumeration value="AUDIO_FORMAT_MPEGH_BL_L4"/>
409            <xs:enumeration value="AUDIO_FORMAT_MPEGH_LC_L3"/>
410            <xs:enumeration value="AUDIO_FORMAT_MPEGH_LC_L4"/>
411            <xs:enumeration value="AUDIO_FORMAT_IEC60958"/>
412            <xs:enumeration value="AUDIO_FORMAT_DTS_UHD"/>
413            <xs:enumeration value="AUDIO_FORMAT_DRA"/>
414            <xs:enumeration value="AUDIO_FORMAT_APTX_ADAPTIVE_QLEA"/>
415            <xs:enumeration value="AUDIO_FORMAT_APTX_ADAPTIVE_R4"/>
416            <xs:enumeration value="AUDIO_FORMAT_DTS_HD_MA"/>
417            <xs:enumeration value="AUDIO_FORMAT_DTS_UHD_P2"/>
418        </xs:restriction>
419    </xs:simpleType>
420    <xs:simpleType name="extendableAudioFormat">
421        <xs:union memberTypes="audioFormat vendorExtension"/>
422    </xs:simpleType>
423    <xs:simpleType name="samplingRates">
424        <xs:list itemType="xs:nonNegativeInteger" />
425    </xs:simpleType>
426    <xs:simpleType name="audioChannelMask">
427        <xs:annotation>
428            <xs:documentation xml:lang="en">
429                Audio channel mask specifies presence of particular channels.
430                There are two representations:
431                - representation position (traditional discrete channel specification,
432                  e.g. "left", "right");
433                - indexed (this is similar to "tracks" in audio mixing, channels
434                  are represented using numbers).
435            </xs:documentation>
436        </xs:annotation>
437        <xs:restriction base="xs:string">
438            <xs:enumeration value="AUDIO_CHANNEL_NONE"/>
439            <xs:enumeration value="AUDIO_CHANNEL_OUT_MONO"/>
440            <xs:enumeration value="AUDIO_CHANNEL_OUT_STEREO"/>
441            <xs:enumeration value="AUDIO_CHANNEL_OUT_2POINT1"/>
442            <xs:enumeration value="AUDIO_CHANNEL_OUT_TRI"/>
443            <xs:enumeration value="AUDIO_CHANNEL_OUT_TRI_BACK"/>
444            <xs:enumeration value="AUDIO_CHANNEL_OUT_3POINT1"/>
445            <xs:enumeration value="AUDIO_CHANNEL_OUT_2POINT0POINT2"/>
446            <xs:enumeration value="AUDIO_CHANNEL_OUT_2POINT1POINT2"/>
447            <xs:enumeration value="AUDIO_CHANNEL_OUT_3POINT0POINT2"/>
448            <xs:enumeration value="AUDIO_CHANNEL_OUT_3POINT1POINT2"/>
449            <xs:enumeration value="AUDIO_CHANNEL_OUT_QUAD"/>
450            <xs:enumeration value="AUDIO_CHANNEL_OUT_QUAD_BACK"/>
451            <xs:enumeration value="AUDIO_CHANNEL_OUT_QUAD_SIDE"/>
452            <xs:enumeration value="AUDIO_CHANNEL_OUT_SURROUND"/>
453            <xs:enumeration value="AUDIO_CHANNEL_OUT_PENTA"/>
454            <xs:enumeration value="AUDIO_CHANNEL_OUT_5POINT1"/>
455            <xs:enumeration value="AUDIO_CHANNEL_OUT_5POINT1_BACK"/>
456            <xs:enumeration value="AUDIO_CHANNEL_OUT_5POINT1_SIDE"/>
457            <xs:enumeration value="AUDIO_CHANNEL_OUT_5POINT1POINT2"/>
458            <xs:enumeration value="AUDIO_CHANNEL_OUT_5POINT1POINT4"/>
459            <xs:enumeration value="AUDIO_CHANNEL_OUT_6POINT1"/>
460            <xs:enumeration value="AUDIO_CHANNEL_OUT_7POINT1"/>
461            <xs:enumeration value="AUDIO_CHANNEL_OUT_7POINT1POINT2"/>
462            <xs:enumeration value="AUDIO_CHANNEL_OUT_7POINT1POINT4"/>
463            <xs:enumeration value="AUDIO_CHANNEL_OUT_9POINT1POINT4"/>
464            <xs:enumeration value="AUDIO_CHANNEL_OUT_9POINT1POINT6"/>
465            <xs:enumeration value="AUDIO_CHANNEL_OUT_13POINT_360RA"/>
466            <xs:enumeration value="AUDIO_CHANNEL_OUT_22POINT2"/>
467            <xs:enumeration value="AUDIO_CHANNEL_OUT_MONO_HAPTIC_A"/>
468            <xs:enumeration value="AUDIO_CHANNEL_OUT_STEREO_HAPTIC_A"/>
469            <xs:enumeration value="AUDIO_CHANNEL_OUT_HAPTIC_AB"/>
470            <xs:enumeration value="AUDIO_CHANNEL_OUT_MONO_HAPTIC_AB"/>
471            <xs:enumeration value="AUDIO_CHANNEL_OUT_STEREO_HAPTIC_AB"/>
472            <xs:enumeration value="AUDIO_CHANNEL_IN_MONO"/>
473            <xs:enumeration value="AUDIO_CHANNEL_IN_STEREO"/>
474            <xs:enumeration value="AUDIO_CHANNEL_IN_2POINT1"/>
475            <xs:enumeration value="AUDIO_CHANNEL_IN_FRONT_BACK"/>
476            <xs:enumeration value="AUDIO_CHANNEL_IN_TRI"/>
477            <xs:enumeration value="AUDIO_CHANNEL_IN_3POINT1"/>
478            <xs:enumeration value="AUDIO_CHANNEL_IN_6"/>
479            <xs:enumeration value="AUDIO_CHANNEL_IN_2POINT0POINT2"/>
480            <xs:enumeration value="AUDIO_CHANNEL_IN_2POINT1POINT2"/>
481            <xs:enumeration value="AUDIO_CHANNEL_IN_3POINT0POINT2"/>
482            <xs:enumeration value="AUDIO_CHANNEL_IN_3POINT1POINT2"/>
483            <xs:enumeration value="AUDIO_CHANNEL_IN_QUAD"/>
484            <xs:enumeration value="AUDIO_CHANNEL_IN_PENTA"/>
485            <xs:enumeration value="AUDIO_CHANNEL_IN_5POINT1"/>
486            <xs:enumeration value="AUDIO_CHANNEL_IN_VOICE_UPLINK_MONO"/>
487            <xs:enumeration value="AUDIO_CHANNEL_IN_VOICE_DNLINK_MONO"/>
488            <xs:enumeration value="AUDIO_CHANNEL_IN_VOICE_CALL_MONO"/>
489            <xs:enumeration value="AUDIO_CHANNEL_INDEX_MASK_1"/>
490            <xs:enumeration value="AUDIO_CHANNEL_INDEX_MASK_2"/>
491            <xs:enumeration value="AUDIO_CHANNEL_INDEX_MASK_3"/>
492            <xs:enumeration value="AUDIO_CHANNEL_INDEX_MASK_4"/>
493            <xs:enumeration value="AUDIO_CHANNEL_INDEX_MASK_5"/>
494            <xs:enumeration value="AUDIO_CHANNEL_INDEX_MASK_6"/>
495            <xs:enumeration value="AUDIO_CHANNEL_INDEX_MASK_7"/>
496            <xs:enumeration value="AUDIO_CHANNEL_INDEX_MASK_8"/>
497            <xs:enumeration value="AUDIO_CHANNEL_INDEX_MASK_9"/>
498            <xs:enumeration value="AUDIO_CHANNEL_INDEX_MASK_10"/>
499            <xs:enumeration value="AUDIO_CHANNEL_INDEX_MASK_11"/>
500            <xs:enumeration value="AUDIO_CHANNEL_INDEX_MASK_12"/>
501            <xs:enumeration value="AUDIO_CHANNEL_INDEX_MASK_13"/>
502            <xs:enumeration value="AUDIO_CHANNEL_INDEX_MASK_14"/>
503            <xs:enumeration value="AUDIO_CHANNEL_INDEX_MASK_15"/>
504            <xs:enumeration value="AUDIO_CHANNEL_INDEX_MASK_16"/>
505            <xs:enumeration value="AUDIO_CHANNEL_INDEX_MASK_17"/>
506            <xs:enumeration value="AUDIO_CHANNEL_INDEX_MASK_18"/>
507            <xs:enumeration value="AUDIO_CHANNEL_INDEX_MASK_19"/>
508            <xs:enumeration value="AUDIO_CHANNEL_INDEX_MASK_20"/>
509            <xs:enumeration value="AUDIO_CHANNEL_INDEX_MASK_21"/>
510            <xs:enumeration value="AUDIO_CHANNEL_INDEX_MASK_22"/>
511            <xs:enumeration value="AUDIO_CHANNEL_INDEX_MASK_23"/>
512            <xs:enumeration value="AUDIO_CHANNEL_INDEX_MASK_24"/>
513        </xs:restriction>
514    </xs:simpleType>
515    <xs:simpleType name="channelMasks">
516        <xs:list itemType="audioChannelMask" />
517    </xs:simpleType>
518    <xs:complexType name="profile">
519        <xs:attribute name="format" type="extendableAudioFormat" use="optional"/>
520        <xs:attribute name="samplingRates" type="samplingRates" use="optional"/>
521        <xs:attribute name="channelMasks" type="channelMasks" use="optional"/>
522    </xs:complexType>
523    <xs:simpleType name="audioGainMode">
524        <xs:restriction base="xs:string">
525            <xs:enumeration value="AUDIO_GAIN_MODE_JOINT"/>
526            <xs:enumeration value="AUDIO_GAIN_MODE_CHANNELS"/>
527            <xs:enumeration value="AUDIO_GAIN_MODE_RAMP"/>
528        </xs:restriction>
529    </xs:simpleType>
530    <xs:simpleType name="audioGainModeMaskUnrestricted">
531        <xs:list itemType="audioGainMode" />
532    </xs:simpleType>
533    <xs:simpleType name='audioGainModeMask'>
534        <xs:restriction base='audioGainModeMaskUnrestricted'>
535            <xs:minLength value='1' />
536        </xs:restriction>
537    </xs:simpleType>
538    <xs:complexType name="gains">
539        <xs:sequence>
540            <xs:element name="gain" minOccurs="0" maxOccurs="unbounded">
541                <xs:complexType>
542                    <xs:attribute name="mode" type="audioGainModeMask" use="required"/>
543                    <xs:attribute name="channel_mask" type="audioChannelMask" use="optional"/>
544                    <xs:attribute name="minValueMB" type="xs:int" use="optional"/>
545                    <xs:attribute name="maxValueMB" type="xs:int" use="optional"/>
546                    <xs:attribute name="defaultValueMB" type="xs:int" use="optional"/>
547                    <xs:attribute name="stepValueMB" type="xs:int" use="optional"/>
548                    <xs:attribute name="minRampMs" type="xs:int" use="optional"/>
549                    <xs:attribute name="maxRampMs" type="xs:int" use="optional"/>
550                    <xs:attribute name="useForVolume" type="xs:boolean" use="optional"/>
551                </xs:complexType>
552            </xs:element>
553        </xs:sequence>
554    </xs:complexType>
555    <xs:complexType name="devicePorts">
556        <xs:sequence>
557            <xs:element name="devicePort" minOccurs="0" maxOccurs="unbounded">
558                <xs:complexType>
559                    <xs:sequence>
560                        <xs:element name="profile" type="profile" minOccurs="0" maxOccurs="unbounded"/>
561                        <xs:element name="gains" type="gains" minOccurs="0"/>
562                    </xs:sequence>
563                    <xs:attribute name="tagName" type="xs:token" use="required"/>
564                    <xs:attribute name="type" type="extendableAudioDevice" use="required"/>
565                    <xs:attribute name="role" type="role" use="required"/>
566                    <xs:attribute name="address" type="xs:string" use="optional" default=""/>
567                    <!-- Note that XSD 1.0 can not check that a type only has one default. -->
568                    <xs:attribute name="default" type="xs:boolean" use="optional">
569                        <xs:annotation>
570                            <xs:documentation xml:lang="en">
571                                The default device will be used if multiple have the same type
572                                and no explicit route request exists for a specific device of
573                                that type.
574                            </xs:documentation>
575                        </xs:annotation>
576                    </xs:attribute>
577                    <xs:attribute name="encodedFormats" type="audioFormatsList" use="optional"
578                                  default="" />
579                </xs:complexType>
580                <xs:unique name="devicePortProfileUniqueness">
581                    <xs:selector xpath="profile"/>
582                    <xs:field xpath="format"/>
583                    <xs:field xpath="samplingRate"/>
584                    <xs:field xpath="channelMasks"/>
585                </xs:unique>
586                <xs:unique name="devicePortGainUniqueness">
587                    <xs:selector xpath="gains/gain"/>
588                    <xs:field xpath="@name"/>
589                </xs:unique>
590            </xs:element>
591        </xs:sequence>
592    </xs:complexType>
593    <xs:simpleType name="mixType">
594        <xs:restriction base="xs:string">
595            <xs:enumeration value="mix"/>
596            <xs:enumeration value="mux"/>
597        </xs:restriction>
598    </xs:simpleType>
599    <xs:complexType name="routes">
600        <xs:sequence>
601            <xs:element name="route" minOccurs="0" maxOccurs="unbounded">
602                <xs:annotation>
603                    <xs:documentation xml:lang="en">
604                        List all available sources for a given sink.
605                    </xs:documentation>
606                </xs:annotation>
607                <xs:complexType>
608                    <xs:attribute name="type" type="mixType" use="required"/>
609                    <xs:attribute name="sink" type="xs:string" use="required"/>
610                    <xs:attribute name="sources" type="xs:string" use="required"/>
611                </xs:complexType>
612            </xs:element>
613        </xs:sequence>
614    </xs:complexType>
615    <xs:complexType name="volumes">
616        <xs:sequence>
617            <xs:element name="volume" type="volume" minOccurs="0" maxOccurs="unbounded"/>
618            <xs:element name="reference" type="reference" minOccurs="0" maxOccurs="unbounded">
619            </xs:element>
620        </xs:sequence>
621    </xs:complexType>
622    <!-- TODO: Always require a ref for better xsd validations.
623               Currently a volume could have no points nor ref
624               as it can not be forbidden by xsd 1.0.-->
625    <xs:simpleType name="volumePoint">
626        <xs:annotation>
627            <xs:documentation xml:lang="en">
628                Comma separated pair of number.
629                The fist one is the framework level (between 0 and 100).
630                The second one is the volume to send to the HAL.
631                The framework will interpolate volumes not specified.
632                Their MUST be at least 2 points specified.
633            </xs:documentation>
634        </xs:annotation>
635        <xs:restriction base="xs:string">
636            <xs:pattern value="([0-9]{1,2}|100),-?[0-9]+"/>
637        </xs:restriction>
638    </xs:simpleType>
639    <xs:simpleType name="audioStreamType">
640        <xs:annotation>
641            <xs:documentation xml:lang="en">
642                Audio stream type describing the intended use case of a stream.
643                Please consult frameworks/base/media/java/android/media/AudioSystem.java
644                for the description of each value.
645            </xs:documentation>
646        </xs:annotation>
647        <xs:restriction base="xs:string">
648            <xs:enumeration value="AUDIO_STREAM_VOICE_CALL"/>
649            <xs:enumeration value="AUDIO_STREAM_SYSTEM"/>
650            <xs:enumeration value="AUDIO_STREAM_RING"/>
651            <xs:enumeration value="AUDIO_STREAM_MUSIC"/>
652            <xs:enumeration value="AUDIO_STREAM_ALARM"/>
653            <xs:enumeration value="AUDIO_STREAM_NOTIFICATION"/>
654            <xs:enumeration value="AUDIO_STREAM_BLUETOOTH_SCO"/>
655            <xs:enumeration value="AUDIO_STREAM_ENFORCED_AUDIBLE"/>
656            <xs:enumeration value="AUDIO_STREAM_DTMF"/>
657            <xs:enumeration value="AUDIO_STREAM_TTS"/>
658            <xs:enumeration value="AUDIO_STREAM_ACCESSIBILITY"/>
659            <xs:enumeration value="AUDIO_STREAM_ASSISTANT"/>
660            <xs:enumeration value="AUDIO_STREAM_REROUTING"/>
661            <xs:enumeration value="AUDIO_STREAM_PATCH"/>
662            <xs:enumeration value="AUDIO_STREAM_CALL_ASSISTANT"/>
663        </xs:restriction>
664    </xs:simpleType>
665    <xs:simpleType name="audioSource">
666        <xs:annotation>
667            <xs:documentation xml:lang="en">
668                An audio source defines the intended use case for the sound being recorded.
669                Please consult frameworks/base/media/java/android/media/MediaRecorder.java
670                for the description of each value.
671            </xs:documentation>
672        </xs:annotation>
673        <xs:restriction base="xs:string">
674            <xs:enumeration value="AUDIO_SOURCE_DEFAULT"/>
675            <xs:enumeration value="AUDIO_SOURCE_MIC"/>
676            <xs:enumeration value="AUDIO_SOURCE_VOICE_UPLINK"/>
677            <xs:enumeration value="AUDIO_SOURCE_VOICE_DOWNLINK"/>
678            <xs:enumeration value="AUDIO_SOURCE_VOICE_CALL"/>
679            <xs:enumeration value="AUDIO_SOURCE_CAMCORDER"/>
680            <xs:enumeration value="AUDIO_SOURCE_VOICE_RECOGNITION"/>
681            <xs:enumeration value="AUDIO_SOURCE_VOICE_COMMUNICATION"/>
682            <xs:enumeration value="AUDIO_SOURCE_REMOTE_SUBMIX"/>
683            <xs:enumeration value="AUDIO_SOURCE_UNPROCESSED"/>
684            <xs:enumeration value="AUDIO_SOURCE_VOICE_PERFORMANCE"/>
685            <xs:enumeration value="AUDIO_SOURCE_ECHO_REFERENCE"/>
686            <xs:enumeration value="AUDIO_SOURCE_FM_TUNER"/>
687            <xs:enumeration value="AUDIO_SOURCE_HOTWORD"/>
688            <xs:enumeration value="AUDIO_SOURCE_ULTRASOUND"/>
689        </xs:restriction>
690    </xs:simpleType>
691    <!-- Enum values of device_category from Volume.h. -->
692    <xs:simpleType name="deviceCategory">
693        <xs:restriction base="xs:string">
694            <xs:enumeration value="DEVICE_CATEGORY_HEADSET"/>
695            <xs:enumeration value="DEVICE_CATEGORY_SPEAKER"/>
696            <xs:enumeration value="DEVICE_CATEGORY_EARPIECE"/>
697            <xs:enumeration value="DEVICE_CATEGORY_EXT_MEDIA"/>
698            <xs:enumeration value="DEVICE_CATEGORY_HEARING_AID"/>
699        </xs:restriction>
700    </xs:simpleType>
701    <xs:complexType name="volume">
702        <xs:annotation>
703            <xs:documentation xml:lang="en">
704                Volume section defines a volume curve for a given use case and device category.
705                It contains a list of points of this curve expressing the attenuation in Millibels
706                for a given volume index from 0 to 100.
707                <volume stream="AUDIO_STREAM_MUSIC" deviceCategory="DEVICE_CATEGORY_SPEAKER">
708                    <point>0,-9600</point>
709                    <point>100,0</point>
710                </volume>
711
712                It may also reference a reference/@name to avoid duplicating curves.
713                <volume stream="AUDIO_STREAM_MUSIC" deviceCategory="DEVICE_CATEGORY_SPEAKER"
714                        ref="DEFAULT_MEDIA_VOLUME_CURVE"/>
715                <reference name="DEFAULT_MEDIA_VOLUME_CURVE">
716                    <point>0,-9600</point>
717                    <point>100,0</point>
718                </reference>
719            </xs:documentation>
720        </xs:annotation>
721        <xs:sequence>
722            <xs:element name="point" type="volumePoint" minOccurs="0" maxOccurs="unbounded"/>
723        </xs:sequence>
724        <xs:attribute name="stream" type="audioStreamType"/>
725        <xs:attribute name="deviceCategory" type="deviceCategory"/>
726        <xs:attribute name="ref" type="xs:token" use="optional"/>
727    </xs:complexType>
728    <xs:complexType name="reference">
729        <xs:sequence>
730            <xs:element name="point" type="volumePoint" minOccurs="2" maxOccurs="unbounded"/>
731        </xs:sequence>
732        <xs:attribute name="name" type="xs:token" use="required"/>
733    </xs:complexType>
734    <xs:complexType name="surroundSound">
735        <xs:annotation>
736            <xs:documentation xml:lang="en">
737                Surround Sound section provides configuration related to handling of
738                multi-channel formats.
739            </xs:documentation>
740        </xs:annotation>
741        <xs:sequence>
742            <xs:element name="formats" type="surroundFormats"/>
743        </xs:sequence>
744    </xs:complexType>
745    <xs:simpleType name="audioFormatsList">
746        <xs:list itemType="extendableAudioFormat" />
747    </xs:simpleType>
748    <xs:complexType name="surroundFormats">
749        <xs:sequence>
750            <xs:element name="format" minOccurs="0" maxOccurs="unbounded">
751                <xs:complexType>
752                    <xs:attribute name="name" type="extendableAudioFormat" use="required"/>
753                    <xs:attribute name="subformats" type="audioFormatsList" />
754                </xs:complexType>
755            </xs:element>
756        </xs:sequence>
757    </xs:complexType>
758    <xs:simpleType name="engineSuffix">
759        <xs:restriction base="xs:string">
760            <xs:enumeration value="default"/>
761            <xs:enumeration value="configurable"/>
762        </xs:restriction>
763    </xs:simpleType>
764</xs:schema>
765