• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1<?xml version="1.0" encoding="UTF-8"?>
2<!-- Copyright (C) 2017 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<!-- TODO: define a targetNamespace. Note that it will break retrocompatibility -->
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. -->
22    <xs:simpleType name="version">
23        <xs:restriction base="xs:decimal">
24            <xs:enumeration value="1.0"/>
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.
31            </xs:documentation>
32        </xs:annotation>
33        <xs:restriction base="xs:decimal">
34            <!-- List of HAL versions supported by the framework. -->
35            <xs:enumeration value="2.0"/>
36            <xs:enumeration value="3.0"/>
37        </xs:restriction>
38    </xs:simpleType>
39    <xs:element name="audioPolicyConfiguration">
40        <xs:complexType>
41            <xs:sequence>
42                <xs:element name="globalConfiguration" type="globalConfiguration"/>
43                <xs:element name="modules" type="modules" maxOccurs="unbounded"/>
44                <xs:element name="volumes" type="volumes" maxOccurs="unbounded"/>
45            </xs:sequence>
46            <xs:attribute name="version" type="version"/>
47        </xs:complexType>
48        <xs:key name="moduleNameKey">
49            <xs:selector xpath="modules/module"/>
50            <xs:field xpath="@name"/>
51        </xs:key>
52        <xs:unique name="volumeTargetUniqueness">
53            <xs:selector xpath="volumes/volume"/>
54            <xs:field xpath="@stream"/>
55            <xs:field xpath="@deviceCategory"/>
56        </xs:unique>
57        <xs:key name="volumeCurveNameKey">
58            <xs:selector xpath="volumes/reference"/>
59            <xs:field xpath="@name"/>
60        </xs:key>
61        <xs:keyref name="volumeCurveRef" refer="volumeCurveNameKey">
62            <xs:selector xpath="volumes/volume"/>
63            <xs:field xpath="@ref"/>
64        </xs:keyref>
65    </xs:element>
66    <xs:complexType name="globalConfiguration">
67        <xs:attribute name="speaker_drc_enabled" type="xs:boolean" use="required"/>
68    </xs:complexType>
69    <xs:complexType name="modules">
70        <xs:annotation>
71            <xs:documentation xml:lang="en">
72                There should be one section per audio HW module present on the platform.
73                Each <module/> contains two mandatory tags: “halVersion” and “name”.
74                The module "name" is the same as in previous .conf file.
75                Each module must contain the following sections:
76                 - <devicePorts/>: a list of device descriptors for all
77                   input and output devices accessible via this module.
78                   This contains both permanently attached devices and removable devices.
79                 - <mixPorts/>: listing all output and input streams exposed by the audio HAL
80                 - <routes/>: list of possible connections between input
81                   and output devices or between stream and devices.
82                   A <route/> is defined by a set of 3 attributes:
83                        -"type": mux|mix means all sources are mutual exclusive (mux) or can be mixed (mix)
84                        -"sink": the sink involved in this route
85                        -"sources": all the sources than can be connected to the sink via this route
86                 - <attachedDevices/>: permanently attached devices.
87                   The attachedDevices section is a list of devices names.
88                   Their names correspond to device names defined in "devicePorts" section.
89                 - <defaultOutputDevice/> is the device to be used when no policy rule applies
90            </xs:documentation>
91        </xs:annotation>
92        <xs:sequence>
93            <xs:element name="module" maxOccurs="unbounded">
94                <xs:complexType>
95                    <xs:sequence>
96                        <xs:element name="attachedDevices" type="attachedDevices" minOccurs="0">
97                            <xs:unique name="attachedDevicesUniqueness">
98                                <xs:selector xpath="item"/>
99                                <xs:field xpath="."/>
100                            </xs:unique>
101                        </xs:element>
102                        <xs:element name="defaultOutputDevice" type="xs:token" minOccurs="0"/>
103                        <xs:element name="mixPorts" type="mixPorts" minOccurs="0"/>
104                        <xs:element name="devicePorts" type="devicePorts" minOccurs="0"/>
105                        <xs:element name="routes" type="routes" minOccurs="0"/>
106                    </xs:sequence>
107                    <xs:attribute name="name" type="xs:string" use="required"/>
108                    <xs:attribute name="halVersion" type="halVersion" use="required"/>
109                </xs:complexType>
110                <xs:unique name="mixPortNameUniqueness">
111                    <xs:selector xpath="mixPorts/mixPort"/>
112                    <xs:field xpath="@name"/>
113                </xs:unique>
114                <xs:key name="devicePortNameKey">
115                    <xs:selector xpath="devicePorts/devicePort"/>
116                    <xs:field xpath="@tagName"/>
117                </xs:key>
118                <xs:unique name="devicePortUniqueness">
119                    <xs:selector xpath="devicePorts/devicePort"/>
120                    <xs:field xpath="@type"/>
121                    <xs:field xpath="@address"/>
122                </xs:unique>
123                <xs:keyref name="defaultOutputDeviceRef" refer="devicePortNameKey">
124                    <xs:selector xpath="defaultOutputDevice"/>
125                    <xs:field xpath="."/>
126                </xs:keyref>
127                <xs:keyref name="attachedDeviceRef" refer="devicePortNameKey">
128                    <xs:selector xpath="attachedDevices/item"/>
129                    <xs:field xpath="."/>
130                </xs:keyref>
131                <!-- The following 3 constraints try to make sure each sink port
132                     is reference in one an only one route. -->
133                <xs:key name="routeSinkKey">
134                    <!-- predicate [@type='sink'] does not work in xsd 1.0 -->
135                    <xs:selector xpath="devicePorts/devicePort|mixPorts/mixPort"/>
136                    <xs:field xpath="@tagName|@name"/>
137                </xs:key>
138                <xs:keyref name="routeSinkRef" refer="routeSinkKey">
139                    <xs:selector xpath="routes/route"/>
140                    <xs:field xpath="@sink"/>
141                </xs:keyref>
142                <xs:unique name="routeUniqueness">
143                    <xs:selector xpath="routes/route"/>
144                    <xs:field xpath="@sink"/>
145                </xs:unique>
146            </xs:element>
147        </xs:sequence>
148    </xs:complexType>
149    <xs:complexType name="attachedDevices">
150        <xs:sequence>
151            <xs:element name="item" type="xs:token" minOccurs="0" maxOccurs="unbounded"/>
152        </xs:sequence>
153    </xs:complexType>
154    <!-- TODO: separate values by space for better xsd validations. -->
155    <xs:simpleType name="audioInOutFlags">
156        <xs:annotation>
157            <xs:documentation xml:lang="en">
158                "|" separated list of audio_output_flags_t or audio_input_flags_t.
159            </xs:documentation>
160        </xs:annotation>
161        <xs:restriction base="xs:string">
162            <xs:pattern value="|[_A-Z]+(\|[_A-Z]+)*"/>
163        </xs:restriction>
164    </xs:simpleType>
165    <xs:simpleType name="role">
166        <xs:restriction base="xs:string">
167            <xs:enumeration value="sink"/>
168            <xs:enumeration value="source"/>
169        </xs:restriction>
170    </xs:simpleType>
171    <xs:complexType name="mixPorts">
172        <xs:sequence>
173            <xs:element name="mixPort" minOccurs="0" maxOccurs="unbounded">
174                <xs:complexType>
175                    <xs:sequence>
176                        <xs:element name="profile" type="profile" minOccurs="0" maxOccurs="unbounded"/>
177                        <xs:element name="gains" type="gains" minOccurs="0"/>
178                    </xs:sequence>
179                    <xs:attribute name="name" type="xs:token" use="required"/>
180                    <xs:attribute name="role" type="role" use="required"/>
181                    <xs:attribute name="flags" type="audioInOutFlags"/>
182                    <xs:attribute name="maxOpenCount" type="xs:unsignedInt"/>
183                    <xs:attribute name="maxActiveCount" type="xs:unsignedInt"/>
184                    <xs:attribute name="preferredUsage" type="audioUsageList">
185                        <xs:annotation>
186                            <xs:documentation xml:lang="en">
187                                When choosing the mixPort of an audio track, the audioPolicy
188                                first considers the mixPorts with a preferredUsage including
189                                the track AudioUsage preferred .
190                                If non support the track format, the other mixPorts are considered.
191                                Eg: a <mixPort preferredUsage="AUDIO_USAGE_MEDIA" /> will receive
192                                    the audio of all apps playing with a MEDIA usage.
193                                    It may receive audio from ALARM if there are no audio compatible
194                                    <mixPort preferredUsage="AUDIO_USAGE_ALARM" />.
195                             </xs:documentation>
196                        </xs:annotation>
197                    </xs:attribute>
198                </xs:complexType>
199                <xs:unique name="mixPortProfileUniqueness">
200                    <xs:selector xpath="profile"/>
201                    <xs:field xpath="format"/>
202                    <xs:field xpath="samplingRate"/>
203                    <xs:field xpath="channelMasks"/>
204                </xs:unique>
205                <xs:unique name="mixPortGainUniqueness">
206                    <xs:selector xpath="gains/gain"/>
207                    <xs:field xpath="@name"/>
208                </xs:unique>
209            </xs:element>
210        </xs:sequence>
211    </xs:complexType>
212    <!-- Enum values of audio_device_t in audio.h
213         TODO: generate from hidl to avoid manual sync.
214         TODO: separate source and sink in the xml for better xsd validations. -->
215    <xs:simpleType name="audioDevice">
216        <xs:restriction base="xs:string">
217            <xs:enumeration value="AUDIO_DEVICE_NONE"/>
218
219            <xs:enumeration value="AUDIO_DEVICE_OUT_EARPIECE"/>
220            <xs:enumeration value="AUDIO_DEVICE_OUT_SPEAKER"/>
221            <xs:enumeration value="AUDIO_DEVICE_OUT_WIRED_HEADSET"/>
222            <xs:enumeration value="AUDIO_DEVICE_OUT_WIRED_HEADPHONE"/>
223            <xs:enumeration value="AUDIO_DEVICE_OUT_BLUETOOTH_SCO"/>
224            <xs:enumeration value="AUDIO_DEVICE_OUT_BLUETOOTH_SCO_HEADSET"/>
225            <xs:enumeration value="AUDIO_DEVICE_OUT_BLUETOOTH_SCO_CARKIT"/>
226            <xs:enumeration value="AUDIO_DEVICE_OUT_BLUETOOTH_A2DP"/>
227            <xs:enumeration value="AUDIO_DEVICE_OUT_BLUETOOTH_A2DP_HEADPHONES"/>
228            <xs:enumeration value="AUDIO_DEVICE_OUT_BLUETOOTH_A2DP_SPEAKER"/>
229            <xs:enumeration value="AUDIO_DEVICE_OUT_AUX_DIGITAL"/>
230            <xs:enumeration value="AUDIO_DEVICE_OUT_HDMI"/>
231            <xs:enumeration value="AUDIO_DEVICE_OUT_ANLG_DOCK_HEADSET"/>
232            <xs:enumeration value="AUDIO_DEVICE_OUT_DGTL_DOCK_HEADSET"/>
233            <xs:enumeration value="AUDIO_DEVICE_OUT_USB_ACCESSORY"/>
234            <xs:enumeration value="AUDIO_DEVICE_OUT_USB_DEVICE"/>
235            <xs:enumeration value="AUDIO_DEVICE_OUT_REMOTE_SUBMIX"/>
236            <xs:enumeration value="AUDIO_DEVICE_OUT_TELEPHONY_TX"/>
237            <xs:enumeration value="AUDIO_DEVICE_OUT_LINE"/>
238            <xs:enumeration value="AUDIO_DEVICE_OUT_HDMI_ARC"/>
239            <xs:enumeration value="AUDIO_DEVICE_OUT_SPDIF"/>
240            <xs:enumeration value="AUDIO_DEVICE_OUT_FM"/>
241            <xs:enumeration value="AUDIO_DEVICE_OUT_AUX_LINE"/>
242            <xs:enumeration value="AUDIO_DEVICE_OUT_SPEAKER_SAFE"/>
243            <xs:enumeration value="AUDIO_DEVICE_OUT_IP"/>
244            <xs:enumeration value="AUDIO_DEVICE_OUT_BUS"/>
245            <xs:enumeration value="AUDIO_DEVICE_OUT_PROXY"/>
246            <xs:enumeration value="AUDIO_DEVICE_OUT_USB_HEADSET"/>
247            <xs:enumeration value="AUDIO_DEVICE_OUT_HEARING_AID"/>
248            <xs:enumeration value="AUDIO_DEVICE_OUT_ECHO_CANCELLER"/>
249            <xs:enumeration value="AUDIO_DEVICE_OUT_DEFAULT"/>
250            <xs:enumeration value="AUDIO_DEVICE_OUT_STUB"/>
251
252            <!-- Due to the xml format, IN types can not be a separated from OUT types -->
253            <xs:enumeration value="AUDIO_DEVICE_IN_COMMUNICATION"/>
254            <xs:enumeration value="AUDIO_DEVICE_IN_AMBIENT"/>
255            <xs:enumeration value="AUDIO_DEVICE_IN_BUILTIN_MIC"/>
256            <xs:enumeration value="AUDIO_DEVICE_IN_BLUETOOTH_SCO_HEADSET"/>
257            <xs:enumeration value="AUDIO_DEVICE_IN_WIRED_HEADSET"/>
258            <xs:enumeration value="AUDIO_DEVICE_IN_AUX_DIGITAL"/>
259            <xs:enumeration value="AUDIO_DEVICE_IN_HDMI"/>
260            <xs:enumeration value="AUDIO_DEVICE_IN_VOICE_CALL"/>
261            <xs:enumeration value="AUDIO_DEVICE_IN_TELEPHONY_RX"/>
262            <xs:enumeration value="AUDIO_DEVICE_IN_BACK_MIC"/>
263            <xs:enumeration value="AUDIO_DEVICE_IN_REMOTE_SUBMIX"/>
264            <xs:enumeration value="AUDIO_DEVICE_IN_ANLG_DOCK_HEADSET"/>
265            <xs:enumeration value="AUDIO_DEVICE_IN_DGTL_DOCK_HEADSET"/>
266            <xs:enumeration value="AUDIO_DEVICE_IN_USB_ACCESSORY"/>
267            <xs:enumeration value="AUDIO_DEVICE_IN_USB_DEVICE"/>
268            <xs:enumeration value="AUDIO_DEVICE_IN_FM_TUNER"/>
269            <xs:enumeration value="AUDIO_DEVICE_IN_TV_TUNER"/>
270            <xs:enumeration value="AUDIO_DEVICE_IN_LINE"/>
271            <xs:enumeration value="AUDIO_DEVICE_IN_SPDIF"/>
272            <xs:enumeration value="AUDIO_DEVICE_IN_BLUETOOTH_A2DP"/>
273            <xs:enumeration value="AUDIO_DEVICE_IN_LOOPBACK"/>
274            <xs:enumeration value="AUDIO_DEVICE_IN_IP"/>
275            <xs:enumeration value="AUDIO_DEVICE_IN_BUS"/>
276            <xs:enumeration value="AUDIO_DEVICE_IN_PROXY"/>
277            <xs:enumeration value="AUDIO_DEVICE_IN_USB_HEADSET"/>
278            <xs:enumeration value="AUDIO_DEVICE_IN_BLUETOOTH_BLE"/>
279            <xs:enumeration value="AUDIO_DEVICE_IN_DEFAULT"/>
280            <xs:enumeration value="AUDIO_DEVICE_IN_STUB"/>
281        </xs:restriction>
282    </xs:simpleType>
283    <xs:simpleType name="vendorExtension">
284        <!-- Vendor extension names must be prefixed by "VX_" to distinguish them from AOSP values.
285             Vendor are encouraged to namespace their module names to avoid conflicts.
286             Example for an hypothetical Google virtual reality device:
287                <devicePort tagName="VR" type="VX_GOOGLE_VR" role="sink">
288        -->
289        <xs:restriction base="xs:string">
290            <xs:pattern value="VX_[_a-zA-Z0-9]+"/>
291        </xs:restriction>
292    </xs:simpleType>
293    <xs:simpleType name="extendableAudioDevice">
294        <xs:union memberTypes="audioDevice vendorExtension"/>
295    </xs:simpleType>
296    <!-- Enum values of audio_format_t in audio.h
297         TODO: generate from hidl to avoid manual sync. -->
298    <xs:simpleType name="audioFormat">
299        <xs:restriction base="xs:string">
300            <xs:enumeration value="AUDIO_FORMAT_PCM_16_BIT" />
301            <xs:enumeration value="AUDIO_FORMAT_PCM_8_BIT"/>
302            <xs:enumeration value="AUDIO_FORMAT_PCM_32_BIT"/>
303            <xs:enumeration value="AUDIO_FORMAT_PCM_8_24_BIT"/>
304            <xs:enumeration value="AUDIO_FORMAT_PCM_FLOAT"/>
305            <xs:enumeration value="AUDIO_FORMAT_PCM_24_BIT_PACKED"/>
306            <xs:enumeration value="AUDIO_FORMAT_MP3"/>
307            <xs:enumeration value="AUDIO_FORMAT_AMR_NB"/>
308            <xs:enumeration value="AUDIO_FORMAT_AMR_WB"/>
309            <xs:enumeration value="AUDIO_FORMAT_AAC"/>
310            <xs:enumeration value="AUDIO_FORMAT_AAC_MAIN"/>
311            <xs:enumeration value="AUDIO_FORMAT_AAC_LC"/>
312            <xs:enumeration value="AUDIO_FORMAT_AAC_SSR"/>
313            <xs:enumeration value="AUDIO_FORMAT_AAC_LTP"/>
314            <xs:enumeration value="AUDIO_FORMAT_AAC_HE_V1"/>
315            <xs:enumeration value="AUDIO_FORMAT_AAC_SCALABLE"/>
316            <xs:enumeration value="AUDIO_FORMAT_AAC_ERLC"/>
317            <xs:enumeration value="AUDIO_FORMAT_AAC_LD"/>
318            <xs:enumeration value="AUDIO_FORMAT_AAC_HE_V2"/>
319            <xs:enumeration value="AUDIO_FORMAT_AAC_ELD"/>
320            <xs:enumeration value="AUDIO_FORMAT_AAC_ADTS_MAIN"/>
321            <xs:enumeration value="AUDIO_FORMAT_AAC_ADTS_LC"/>
322            <xs:enumeration value="AUDIO_FORMAT_AAC_ADTS_SSR"/>
323            <xs:enumeration value="AUDIO_FORMAT_AAC_ADTS_LTP"/>
324            <xs:enumeration value="AUDIO_FORMAT_AAC_ADTS_HE_V1"/>
325            <xs:enumeration value="AUDIO_FORMAT_AAC_ADTS_SCALABLE"/>
326            <xs:enumeration value="AUDIO_FORMAT_AAC_ADTS_ERLC"/>
327            <xs:enumeration value="AUDIO_FORMAT_AAC_ADTS_LD"/>
328            <xs:enumeration value="AUDIO_FORMAT_AAC_ADTS_HE_V2"/>
329            <xs:enumeration value="AUDIO_FORMAT_AAC_ADTS_ELD"/>
330            <xs:enumeration value="AUDIO_FORMAT_VORBIS"/>
331            <xs:enumeration value="AUDIO_FORMAT_HE_AAC_V1"/>
332            <xs:enumeration value="AUDIO_FORMAT_HE_AAC_V2"/>
333            <xs:enumeration value="AUDIO_FORMAT_OPUS"/>
334            <xs:enumeration value="AUDIO_FORMAT_AC3"/>
335            <xs:enumeration value="AUDIO_FORMAT_E_AC3"/>
336            <xs:enumeration value="AUDIO_FORMAT_DTS"/>
337            <xs:enumeration value="AUDIO_FORMAT_DTS_HD"/>
338            <xs:enumeration value="AUDIO_FORMAT_IEC61937"/>
339            <xs:enumeration value="AUDIO_FORMAT_DOLBY_TRUEHD"/>
340            <xs:enumeration value="AUDIO_FORMAT_EVRC"/>
341            <xs:enumeration value="AUDIO_FORMAT_EVRCB"/>
342            <xs:enumeration value="AUDIO_FORMAT_EVRCWB"/>
343            <xs:enumeration value="AUDIO_FORMAT_EVRCNW"/>
344            <xs:enumeration value="AUDIO_FORMAT_AAC_ADIF"/>
345            <xs:enumeration value="AUDIO_FORMAT_WMA"/>
346            <xs:enumeration value="AUDIO_FORMAT_WMA_PRO"/>
347            <xs:enumeration value="AUDIO_FORMAT_AMR_WB_PLUS"/>
348            <xs:enumeration value="AUDIO_FORMAT_MP2"/>
349            <xs:enumeration value="AUDIO_FORMAT_QCELP"/>
350            <xs:enumeration value="AUDIO_FORMAT_DSD"/>
351            <xs:enumeration value="AUDIO_FORMAT_FLAC"/>
352            <xs:enumeration value="AUDIO_FORMAT_ALAC"/>
353            <xs:enumeration value="AUDIO_FORMAT_APE"/>
354            <xs:enumeration value="AUDIO_FORMAT_AAC_ADTS"/>
355            <xs:enumeration value="AUDIO_FORMAT_SBC"/>
356            <xs:enumeration value="AUDIO_FORMAT_APTX"/>
357            <xs:enumeration value="AUDIO_FORMAT_APTX_HD"/>
358            <xs:enumeration value="AUDIO_FORMAT_AC4"/>
359            <xs:enumeration value="AUDIO_FORMAT_LDAC"/>
360        </xs:restriction>
361    </xs:simpleType>
362    <xs:simpleType name="extendableAudioFormat">
363        <xs:union memberTypes="audioFormat vendorExtension"/>
364    </xs:simpleType>
365    <!-- Enum values of audio::common::4_0::AudioUsage
366         TODO: generate from HIDL to avoid manual sync. -->
367    <xs:simpleType name="audioUsage">
368        <xs:restriction base="xs:string">
369            <xs:enumeration value="AUDIO_USAGE_UNKNOWN" />
370            <xs:enumeration value="AUDIO_USAGE_MEDIA" />
371            <xs:enumeration value="AUDIO_USAGE_VOICE_COMMUNICATION" />
372            <xs:enumeration value="AUDIO_USAGE_VOICE_COMMUNICATION_SIGNALLING" />
373            <xs:enumeration value="AUDIO_USAGE_ALARM" />
374            <xs:enumeration value="AUDIO_USAGE_NOTIFICATION" />
375            <xs:enumeration value="AUDIO_USAGE_NOTIFICATION_TELEPHONY_RINGTONE" />
376            <xs:enumeration value="AUDIO_USAGE_ASSISTANCE_ACCESSIBILITY" />
377            <xs:enumeration value="AUDIO_USAGE_ASSISTANCE_NAVIGATION_GUIDANCE" />
378            <xs:enumeration value="AUDIO_USAGE_ASSISTANCE_SONIFICATION" />
379            <xs:enumeration value="AUDIO_USAGE_GAME" />
380            <xs:enumeration value="AUDIO_USAGE_VIRTUAL_SOURCE" />
381            <xs:enumeration value="AUDIO_USAGE_ASSISTANT" />
382        </xs:restriction>
383    </xs:simpleType>
384    <xs:simpleType name="audioUsageList">
385        <xs:list itemType="audioUsage"/>
386    </xs:simpleType>
387    <!-- TODO: Change to a space separated list to xsd enforce correctness. -->
388    <xs:simpleType name="samplingRates">
389        <xs:restriction base="xs:string">
390            <xs:pattern value="[0-9]+(,[0-9]+)*"/>
391        </xs:restriction>
392    </xs:simpleType>
393    <!-- TODO: Change to a space separated list to xsd enforce correctness. -->
394    <xs:simpleType name="channelMask">
395        <xs:annotation>
396            <xs:documentation xml:lang="en">
397                Comma (",") separated list of channel flags
398                from audio_channel_mask_t.
399            </xs:documentation>
400        </xs:annotation>
401        <xs:restriction base="xs:string">
402            <xs:pattern value="[_A-Z][_A-Z0-9]*(,[_A-Z][_A-Z0-9]*)*"/>
403        </xs:restriction>
404    </xs:simpleType>
405    <xs:complexType name="profile">
406        <xs:attribute name="name" type="xs:token" use="optional"/>
407        <xs:attribute name="format" type="extendableAudioFormat" use="optional"/>
408        <xs:attribute name="samplingRates" type="samplingRates" use="optional"/>
409        <xs:attribute name="channelMasks" type="channelMask" use="optional"/>
410    </xs:complexType>
411    <xs:simpleType name="gainMode">
412        <xs:restriction base="xs:string">
413            <xs:enumeration value="AUDIO_GAIN_MODE_JOINT"/>
414            <xs:enumeration value="AUDIO_GAIN_MODE_CHANNELS"/>
415            <xs:enumeration value="AUDIO_GAIN_MODE_RAMP"/>
416        </xs:restriction>
417    </xs:simpleType>
418    <xs:complexType name="gains">
419        <xs:sequence>
420            <xs:element name="gain" minOccurs="0" maxOccurs="unbounded">
421                <xs:complexType>
422                    <xs:attribute name="name" type="xs:token" use="required"/>
423                    <xs:attribute name="mode" type="gainMode" use="required"/>
424                    <xs:attribute name="channel_mask" type="channelMask" use="optional"/>
425                    <xs:attribute name="minValueMB" type="xs:int" use="optional"/>
426                    <xs:attribute name="maxValueMB" type="xs:int" use="optional"/>
427                    <xs:attribute name="defaultValueMB" type="xs:int" use="optional"/>
428                    <xs:attribute name="stepValueMB" type="xs:int" use="optional"/>
429                    <xs:attribute name="minRampMs" type="xs:int" use="optional"/>
430                    <xs:attribute name="maxRampMs" type="xs:int" use="optional"/>
431                </xs:complexType>
432            </xs:element>
433        </xs:sequence>
434    </xs:complexType>
435    <xs:complexType name="devicePorts">
436        <xs:sequence>
437            <xs:element name="devicePort" minOccurs="0" maxOccurs="unbounded">
438                <xs:complexType>
439                    <xs:sequence>
440                        <xs:element name="profile" type="profile" minOccurs="0" maxOccurs="unbounded"/>
441                        <xs:element name="gains" type="gains" minOccurs="0"/>
442                    </xs:sequence>
443                    <xs:attribute name="tagName" type="xs:token" use="required"/>
444                    <xs:attribute name="type" type="extendableAudioDevice" use="required"/>
445                    <xs:attribute name="role" type="role" use="required"/>
446                    <xs:attribute name="address" type="xs:string" use="optional" default=""/>
447                    <!-- Note that XSD 1.0 can not check that a type only has one default. -->
448                    <xs:attribute name="default" type="xs:boolean" use="optional">
449                        <xs:annotation>
450                            <xs:documentation xml:lang="en">
451                                The default device will be used if multiple have the same type
452                                and no explicit route request exists for a specific device of
453                                that type.
454                            </xs:documentation>
455                        </xs:annotation>
456                    </xs:attribute>
457                </xs:complexType>
458                <xs:unique name="devicePortProfileUniqueness">
459                    <xs:selector xpath="profile"/>
460                    <xs:field xpath="format"/>
461                    <xs:field xpath="samplingRate"/>
462                    <xs:field xpath="channelMasks"/>
463                </xs:unique>
464                <xs:unique name="devicePortGainUniqueness">
465                    <xs:selector xpath="gains/gain"/>
466                    <xs:field xpath="@name"/>
467                </xs:unique>
468            </xs:element>
469        </xs:sequence>
470    </xs:complexType>
471    <xs:simpleType name="mixType">
472        <xs:restriction base="xs:string">
473            <xs:enumeration value="mix"/>
474            <xs:enumeration value="mux"/>
475        </xs:restriction>
476    </xs:simpleType>
477    <xs:complexType name="routes">
478        <xs:sequence>
479            <xs:element name="route" minOccurs="0" maxOccurs="unbounded">
480                <xs:annotation>
481                    <xs:documentation xml:lang="en">
482                        List all available sources for a given sink.
483                    </xs:documentation>
484                </xs:annotation>
485                <xs:complexType>
486                    <xs:attribute name="type" type="mixType" use="required"/>
487                    <xs:attribute name="sink" type="xs:string" use="required"/>
488                    <xs:attribute name="sources" type="xs:string" use="required"/>
489                </xs:complexType>
490            </xs:element>
491        </xs:sequence>
492    </xs:complexType>
493    <xs:complexType name="volumes">
494        <xs:sequence>
495            <xs:element name="volume" type="volume" minOccurs="0" maxOccurs="unbounded"/>
496            <xs:element name="reference" type="reference" minOccurs="0" maxOccurs="unbounded">
497            </xs:element>
498        </xs:sequence>
499    </xs:complexType>
500    <!-- TODO: Always require a ref for better xsd validations.
501               Currently a volume could have no points nor ref
502               as it can not be forbidden by xsd 1.0.-->
503    <xs:simpleType name="volumePoint">
504        <xs:annotation>
505            <xs:documentation xml:lang="en">
506                Comma separated pair of number.
507                The fist one is the framework level (between 0 and 100).
508                The second one is the volume to send to the HAL.
509                The framework will interpolate volumes not specified.
510                Their MUST be at least 2 points specified.
511            </xs:documentation>
512        </xs:annotation>
513        <xs:restriction base="xs:string">
514            <xs:pattern value="([0-9]{1,2}|100),-?[0-9]+"/>
515        </xs:restriction>
516    </xs:simpleType>
517    <!-- Enum values of audio_stream_type_t in audio-base.h
518         TODO: generate from hidl to avoid manual sync. -->
519    <xs:simpleType name="stream">
520        <xs:restriction base="xs:string">
521            <xs:enumeration value="AUDIO_STREAM_VOICE_CALL"/>
522            <xs:enumeration value="AUDIO_STREAM_SYSTEM"/>
523            <xs:enumeration value="AUDIO_STREAM_RING"/>
524            <xs:enumeration value="AUDIO_STREAM_MUSIC"/>
525            <xs:enumeration value="AUDIO_STREAM_ALARM"/>
526            <xs:enumeration value="AUDIO_STREAM_NOTIFICATION"/>
527            <xs:enumeration value="AUDIO_STREAM_BLUETOOTH_SCO"/>
528            <xs:enumeration value="AUDIO_STREAM_ENFORCED_AUDIBLE"/>
529            <xs:enumeration value="AUDIO_STREAM_DTMF"/>
530            <xs:enumeration value="AUDIO_STREAM_TTS"/>
531            <xs:enumeration value="AUDIO_STREAM_ACCESSIBILITY"/>
532            <xs:enumeration value="AUDIO_STREAM_REROUTING"/>
533            <xs:enumeration value="AUDIO_STREAM_PATCH"/>
534        </xs:restriction>
535    </xs:simpleType>
536    <!-- Enum values of device_category from Volume.h.
537         TODO: generate from hidl to avoid manual sync. -->
538    <xs:simpleType name="deviceCategory">
539        <xs:restriction base="xs:string">
540            <xs:enumeration value="DEVICE_CATEGORY_HEADSET"/>
541            <xs:enumeration value="DEVICE_CATEGORY_SPEAKER"/>
542            <xs:enumeration value="DEVICE_CATEGORY_EARPIECE"/>
543            <xs:enumeration value="DEVICE_CATEGORY_EXT_MEDIA"/>
544            <xs:enumeration value="DEVICE_CATEGORY_HEARING_AID"/>
545        </xs:restriction>
546    </xs:simpleType>
547    <xs:complexType name="volume">
548        <xs:annotation>
549            <xs:documentation xml:lang="en">
550                Volume section defines a volume curve for a given use case and device category.
551                It contains a list of points of this curve expressing the attenuation in Millibels
552                for a given volume index from 0 to 100.
553                <volume stream="AUDIO_STREAM_MUSIC" deviceCategory="DEVICE_CATEGORY_SPEAKER">
554                    <point>0,-9600</point>
555                    <point>100,0</point>
556                </volume>
557
558                It may also reference a reference/@name to avoid duplicating curves.
559                <volume stream="AUDIO_STREAM_MUSIC" deviceCategory="DEVICE_CATEGORY_SPEAKER"
560                        ref="DEFAULT_MEDIA_VOLUME_CURVE"/>
561                <reference name="DEFAULT_MEDIA_VOLUME_CURVE">
562                    <point>0,-9600</point>
563                    <point>100,0</point>
564                </reference>
565            </xs:documentation>
566        </xs:annotation>
567        <xs:sequence>
568            <xs:element name="point" type="volumePoint" minOccurs="0" maxOccurs="unbounded"/>
569        </xs:sequence>
570        <xs:attribute name="stream" type="stream"/>
571        <xs:attribute name="deviceCategory" type="deviceCategory"/>
572        <xs:attribute name="ref" type="xs:token" use="optional"/>
573    </xs:complexType>
574    <xs:complexType name="reference">
575        <xs:sequence>
576            <xs:element name="point" type="volumePoint" minOccurs="2" maxOccurs="unbounded"/>
577        </xs:sequence>
578        <xs:attribute name="name" type="xs:token" use="required"/>
579    </xs:complexType>
580</xs:schema>
581