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