Home | History | Annotate | Download | only in config
      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:key name="devicePortNameGlobalKey">
     53             <xs:selector xpath="modules/module/devicePorts/devicePort"/>
     54             <xs:field xpath="@tagName"/>
     55         </xs:key>
     56         <xs:unique name="volumeTargetUniqueness">
     57             <xs:selector xpath="volumes/volume"/>
     58             <xs:field xpath="@stream"/>
     59             <xs:field xpath="@deviceCategory"/>
     60         </xs:unique>
     61         <xs:key name="volumeCurveNameKey">
     62             <xs:selector xpath="volumes/reference"/>
     63             <xs:field xpath="@name"/>
     64         </xs:key>
     65         <xs:keyref name="volumeCurveRef" refer="volumeCurveNameKey">
     66             <xs:selector xpath="volumes/volume"/>
     67             <xs:field xpath="@ref"/>
     68         </xs:keyref>
     69     </xs:element>
     70     <xs:complexType name="globalConfiguration">
     71         <xs:attribute name="speaker_drc_enabled" type="xs:boolean" use="required"/>
     72     </xs:complexType>
     73     <!-- Enum values of IDevicesFactory::Device
     74          TODO: generate from hidl to avoid manual sync. -->
     75     <xs:simpleType name="halName">
     76         <xs:restriction base="xs:string">
     77             <xs:enumeration value="primary"/>
     78             <xs:enumeration value="a2dp"/>
     79             <xs:enumeration value="usb"/>
     80             <xs:enumeration value="r_submix"/>
     81             <xs:enumeration value="codec_offload"/>
     82             <xs:enumeration value="stub"/>
     83         </xs:restriction>
     84     </xs:simpleType>
     85     <xs:complexType name="modules">
     86         <xs:annotation>
     87             <xs:documentation xml:lang="en">
     88                 There should be one section per audio HW module present on the platform.
     89                 Each <module/> contains two mandatory tags: halVersion and name.
     90                 The module "name" is the same as in previous .conf file.
     91                 Each module must contain the following sections:
     92                  - <devicePorts/>: a list of device descriptors for all
     93                    input and output devices accessible via this module.
     94                    This contains both permanently attached devices and removable devices.
     95                  - <mixPorts/>: listing all output and input streams exposed by the audio HAL
     96                  - <routes/>: list of possible connections between input
     97                    and output devices or between stream and devices.
     98                    A <route/> is defined by a set of 3 attributes:
     99                         -"type": mux|mix means all sources are mutual exclusive (mux) or can be mixed (mix)
    100                         -"sink": the sink involved in this route
    101                         -"sources": all the sources than can be connected to the sink via this route
    102                  - <attachedDevices/>: permanently attached devices.
    103                    The attachedDevices section is a list of devices names.
    104                    Their names correspond to device names defined in "devicePorts" section.
    105                  - <defaultOutputDevice/> is the device to be used when no policy rule applies
    106             </xs:documentation>
    107         </xs:annotation>
    108         <xs:sequence>
    109             <xs:element name="module" maxOccurs="unbounded">
    110                 <xs:complexType>
    111                     <xs:sequence>
    112                         <xs:element name="attachedDevices" type="attachedDevices" minOccurs="0">
    113                             <xs:unique name="attachedDevicesUniqueness">
    114                                 <xs:selector xpath="item"/>
    115                                 <xs:field xpath="."/>
    116                             </xs:unique>
    117                         </xs:element>
    118                         <xs:element name="defaultOutputDevice" type="xs:token" minOccurs="0"/>
    119                         <xs:element name="mixPorts" type="mixPorts" minOccurs="0"/>
    120                         <xs:element name="devicePorts" type="devicePorts" minOccurs="0"/>
    121                         <xs:element name="routes" type="routes" minOccurs="0"/>
    122                     </xs:sequence>
    123                     <xs:attribute name="name" type="halName" use="required"/>
    124                     <xs:attribute name="halVersion" type="halVersion" use="required"/>
    125                 </xs:complexType>
    126                 <xs:unique name="mixPortNameUniqueness">
    127                     <xs:selector xpath="mixPorts/mixPort"/>
    128                     <xs:field xpath="@name"/>
    129                 </xs:unique>
    130                 <!-- Although this key constraint is redundant with devicePortNameGlobalKey,
    131                      the set is used to constraint defaultOutputDevice and attachedDevice
    132                      to reference a devicePort of the same module. -->
    133                 <xs:key name="devicePortNameKey">
    134                     <xs:selector xpath="devicePorts/devicePort"/>
    135                     <xs:field xpath="@tagName"/>
    136                 </xs:key>
    137                 <xs:keyref name="defaultOutputDeviceRef" refer="devicePortNameKey">
    138                     <xs:selector xpath="defaultOutputDevice"/>
    139                     <xs:field xpath="."/>
    140                 </xs:keyref>
    141                 <xs:keyref name="attachedDeviceRef" refer="devicePortNameKey">
    142                     <xs:selector xpath="attachedDevices/item"/>
    143                     <xs:field xpath="."/>
    144                 </xs:keyref>
    145                 <!-- The following 3 constraints try to make sure each sink port
    146                      is reference in one an only one route. -->
    147                 <xs:key name="routeSinkKey">
    148                     <!-- predicate [@type='sink'] does not work in xsd 1.0 -->
    149                     <xs:selector xpath="devicePorts/devicePort|mixPorts/mixPort"/>
    150                     <xs:field xpath="@tagName|@name"/>
    151                 </xs:key>
    152                 <xs:keyref name="routeSinkRef" refer="routeSinkKey">
    153                     <xs:selector xpath="routes/route"/>
    154                     <xs:field xpath="@sink"/>
    155                 </xs:keyref>
    156                 <xs:unique name="routeUniqueness">
    157                     <xs:selector xpath="routes/route"/>
    158                     <xs:field xpath="@sink"/>
    159                 </xs:unique>
    160             </xs:element>
    161         </xs:sequence>
    162     </xs:complexType>
    163     <xs:complexType name="attachedDevices">
    164         <xs:sequence>
    165             <xs:element name="item" type="xs:token" minOccurs="0" maxOccurs="unbounded"/>
    166         </xs:sequence>
    167     </xs:complexType>
    168     <!-- TODO: separate values by space for better xsd validations. -->
    169     <xs:simpleType name="audioInOutFlags">
    170         <xs:annotation>
    171             <xs:documentation xml:lang="en">
    172                 "|" separated list of audio_output_flags_t or audio_input_flags_t.
    173             </xs:documentation>
    174         </xs:annotation>
    175         <xs:restriction base="xs:string">
    176             <xs:pattern value="|[_A-Z]+(\|[_A-Z]+)*"/>
    177         </xs:restriction>
    178     </xs:simpleType>
    179     <xs:simpleType name="role">
    180         <xs:restriction base="xs:string">
    181             <xs:enumeration value="sink"/>
    182             <xs:enumeration value="source"/>
    183         </xs:restriction>
    184     </xs:simpleType>
    185     <xs:complexType name="mixPorts">
    186         <xs:sequence>
    187             <xs:element name="mixPort" minOccurs="0" maxOccurs="unbounded">
    188                 <xs:complexType>
    189                     <xs:sequence>
    190                         <xs:element name="profile" type="profile" minOccurs="0" maxOccurs="unbounded"/>
    191                         <xs:element name="gains" type="gains" minOccurs="0"/>
    192                     </xs:sequence>
    193                     <xs:attribute name="name" type="xs:token" use="required"/>
    194                     <xs:attribute name="role" type="role" use="required"/>
    195                     <xs:attribute name="flags" type="audioInOutFlags"/>
    196                 </xs:complexType>
    197                 <xs:unique name="mixPortProfileUniqueness">
    198                     <xs:selector xpath="profile"/>
    199                     <xs:field xpath="format"/>
    200                     <xs:field xpath="samplingRate"/>
    201                     <xs:field xpath="channelMasks"/>
    202                 </xs:unique>
    203                 <xs:unique name="mixPortGainUniqueness">
    204                     <xs:selector xpath="gains/gain"/>
    205                     <xs:field xpath="@name"/>
    206                 </xs:unique>
    207             </xs:element>
    208         </xs:sequence>
    209     </xs:complexType>
    210     <!-- Enum values of audio_device_t in audio.h
    211          TODO: generate from hidl to avoid manual sync.
    212          TODO: separate source and sink in the xml for better xsd validations. -->
    213     <xs:simpleType name="audioDevice">
    214         <xs:restriction base="xs:string">
    215             <xs:enumeration value="AUDIO_DEVICE_NONE"/>
    216 
    217             <xs:enumeration value="AUDIO_DEVICE_OUT_EARPIECE"/>
    218             <xs:enumeration value="AUDIO_DEVICE_OUT_SPEAKER"/>
    219             <xs:enumeration value="AUDIO_DEVICE_OUT_SPEAKER_SAFE"/>
    220             <xs:enumeration value="AUDIO_DEVICE_OUT_WIRED_HEADSET"/>
    221             <xs:enumeration value="AUDIO_DEVICE_OUT_WIRED_HEADPHONE"/>
    222             <xs:enumeration value="AUDIO_DEVICE_OUT_BLUETOOTH_SCO"/>
    223             <xs:enumeration value="AUDIO_DEVICE_OUT_BLUETOOTH_SCO_HEADSET"/>
    224             <xs:enumeration value="AUDIO_DEVICE_OUT_BLUETOOTH_SCO_CARKIT"/>
    225             <xs:enumeration value="AUDIO_DEVICE_OUT_ALL_SCO"/>
    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_ALL_A2DP"/>
    230             <xs:enumeration value="AUDIO_DEVICE_OUT_AUX_DIGITAL"/>
    231             <xs:enumeration value="AUDIO_DEVICE_OUT_HDMI"/>
    232             <xs:enumeration value="AUDIO_DEVICE_OUT_ANLG_DOCK_HEADSET"/>
    233             <xs:enumeration value="AUDIO_DEVICE_OUT_DGTL_DOCK_HEADSET"/>
    234             <xs:enumeration value="AUDIO_DEVICE_OUT_USB_ACCESSORY"/>
    235             <xs:enumeration value="AUDIO_DEVICE_OUT_USB_DEVICE"/>
    236             <xs:enumeration value="AUDIO_DEVICE_OUT_ALL_USB"/>
    237             <xs:enumeration value="AUDIO_DEVICE_OUT_REMOTE_SUBMIX"/>
    238             <xs:enumeration value="AUDIO_DEVICE_OUT_TELEPHONY_TX"/>
    239             <xs:enumeration value="AUDIO_DEVICE_OUT_LINE"/>
    240             <xs:enumeration value="AUDIO_DEVICE_OUT_HDMI_ARC"/>
    241             <xs:enumeration value="AUDIO_DEVICE_OUT_SPDIF"/>
    242             <xs:enumeration value="AUDIO_DEVICE_OUT_FM"/>
    243             <xs:enumeration value="AUDIO_DEVICE_OUT_AUX_LINE"/>
    244             <xs:enumeration value="AUDIO_DEVICE_OUT_IP"/>
    245             <xs:enumeration value="AUDIO_DEVICE_OUT_BUS"/>
    246             <xs:enumeration value="AUDIO_DEVICE_OUT_PROXY"/>
    247             <xs:enumeration value="AUDIO_DEVICE_OUT_USB_HEADSET"/>
    248             <xs:enumeration value="AUDIO_DEVICE_OUT_DEFAULT"/>
    249             <xs:enumeration value="AUDIO_DEVICE_OUT_STUB"/>
    250 
    251             <!-- Due to the xml format, IN types can not be a separated from OUT types -->
    252             <xs:enumeration value="AUDIO_DEVICE_IN_COMMUNICATION"/>
    253             <xs:enumeration value="AUDIO_DEVICE_IN_AMBIENT"/>
    254             <xs:enumeration value="AUDIO_DEVICE_IN_BUILTIN_MIC"/>
    255             <xs:enumeration value="AUDIO_DEVICE_IN_BLUETOOTH_SCO_HEADSET"/>
    256             <xs:enumeration value="AUDIO_DEVICE_IN_ALL_SCO"/>
    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_TELEPHONY_RX"/>
    261             <xs:enumeration value="AUDIO_DEVICE_IN_VOICE_CALL"/>
    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_ALL_USB"/>
    269             <xs:enumeration value="AUDIO_DEVICE_IN_FM_TUNER"/>
    270             <xs:enumeration value="AUDIO_DEVICE_IN_TV_TUNER"/>
    271             <xs:enumeration value="AUDIO_DEVICE_IN_LINE"/>
    272             <xs:enumeration value="AUDIO_DEVICE_IN_SPDIF"/>
    273             <xs:enumeration value="AUDIO_DEVICE_IN_BLUETOOTH_A2DP"/>
    274             <xs:enumeration value="AUDIO_DEVICE_IN_LOOPBACK"/>
    275             <xs:enumeration value="AUDIO_DEVICE_IN_IP"/>
    276             <xs:enumeration value="AUDIO_DEVICE_IN_BUS"/>
    277             <xs:enumeration value="AUDIO_DEVICE_IN_PROXY"/>
    278             <xs:enumeration value="AUDIO_DEVICE_IN_USB_HEADSET"/>
    279             <xs:enumeration value="AUDIO_DEVICE_IN_DEFAULT"/>
    280             <xs:enumeration value="AUDIO_DEVICE_IN_STUB"/>
    281         </xs:restriction>
    282     </xs:simpleType>
    283     <!-- Enum values of audio_format_t in audio.h
    284          TODO: generate from hidl to avoid manual sync. -->
    285     <xs:simpleType name="audioFormat">
    286         <xs:restriction base="xs:string">
    287             <xs:enumeration value="AUDIO_FORMAT_PCM_16_BIT" />
    288             <xs:enumeration value="AUDIO_FORMAT_PCM_8_BIT"/>
    289             <xs:enumeration value="AUDIO_FORMAT_PCM_32_BIT"/>
    290             <xs:enumeration value="AUDIO_FORMAT_PCM_8_24_BIT"/>
    291             <xs:enumeration value="AUDIO_FORMAT_PCM_FLOAT"/>
    292             <xs:enumeration value="AUDIO_FORMAT_PCM_24_BIT_PACKED"/>
    293             <xs:enumeration value="AUDIO_FORMAT_MP3"/>
    294             <xs:enumeration value="AUDIO_FORMAT_AMR_NB"/>
    295             <xs:enumeration value="AUDIO_FORMAT_AMR_WB"/>
    296             <xs:enumeration value="AUDIO_FORMAT_AAC"/>
    297             <xs:enumeration value="AUDIO_FORMAT_AAC_MAIN"/>
    298             <xs:enumeration value="AUDIO_FORMAT_AAC_LC"/>
    299             <xs:enumeration value="AUDIO_FORMAT_AAC_SSR"/>
    300             <xs:enumeration value="AUDIO_FORMAT_AAC_LTP"/>
    301             <xs:enumeration value="AUDIO_FORMAT_AAC_HE_V1"/>
    302             <xs:enumeration value="AUDIO_FORMAT_AAC_SCALABLE"/>
    303             <xs:enumeration value="AUDIO_FORMAT_AAC_ERLC"/>
    304             <xs:enumeration value="AUDIO_FORMAT_AAC_LD"/>
    305             <xs:enumeration value="AUDIO_FORMAT_AAC_HE_V2"/>
    306             <xs:enumeration value="AUDIO_FORMAT_AAC_ELD"/>
    307             <xs:enumeration value="AUDIO_FORMAT_AAC_ADTS_MAIN"/>
    308             <xs:enumeration value="AUDIO_FORMAT_AAC_ADTS_LC"/>
    309             <xs:enumeration value="AUDIO_FORMAT_AAC_ADTS_SSR"/>
    310             <xs:enumeration value="AUDIO_FORMAT_AAC_ADTS_LTP"/>
    311             <xs:enumeration value="AUDIO_FORMAT_AAC_ADTS_HE_V1"/>
    312             <xs:enumeration value="AUDIO_FORMAT_AAC_ADTS_SCALABLE"/>
    313             <xs:enumeration value="AUDIO_FORMAT_AAC_ADTS_ERLC"/>
    314             <xs:enumeration value="AUDIO_FORMAT_AAC_ADTS_LD"/>
    315             <xs:enumeration value="AUDIO_FORMAT_AAC_ADTS_HE_V2"/>
    316             <xs:enumeration value="AUDIO_FORMAT_AAC_ADTS_ELD"/>
    317             <xs:enumeration value="AUDIO_FORMAT_VORBIS"/>
    318             <xs:enumeration value="AUDIO_FORMAT_HE_AAC_V1"/>
    319             <xs:enumeration value="AUDIO_FORMAT_HE_AAC_V2"/>
    320             <xs:enumeration value="AUDIO_FORMAT_OPUS"/>
    321             <xs:enumeration value="AUDIO_FORMAT_AC3"/>
    322             <xs:enumeration value="AUDIO_FORMAT_E_AC3"/>
    323             <xs:enumeration value="AUDIO_FORMAT_DTS"/>
    324             <xs:enumeration value="AUDIO_FORMAT_DTS_HD"/>
    325             <xs:enumeration value="AUDIO_FORMAT_IEC61937"/>
    326             <xs:enumeration value="AUDIO_FORMAT_DOLBY_TRUEHD"/>
    327             <xs:enumeration value="AUDIO_FORMAT_EVRC"/>
    328             <xs:enumeration value="AUDIO_FORMAT_EVRCB"/>
    329             <xs:enumeration value="AUDIO_FORMAT_EVRCWB"/>
    330             <xs:enumeration value="AUDIO_FORMAT_EVRCNW"/>
    331             <xs:enumeration value="AUDIO_FORMAT_AAC_ADIF"/>
    332             <xs:enumeration value="AUDIO_FORMAT_WMA"/>
    333             <xs:enumeration value="AUDIO_FORMAT_WMA_PRO"/>
    334             <xs:enumeration value="AUDIO_FORMAT_AMR_WB_PLUS"/>
    335             <xs:enumeration value="AUDIO_FORMAT_MP2"/>
    336             <xs:enumeration value="AUDIO_FORMAT_QCELP"/>
    337             <xs:enumeration value="AUDIO_FORMAT_DSD"/>
    338             <xs:enumeration value="AUDIO_FORMAT_FLAC"/>
    339             <xs:enumeration value="AUDIO_FORMAT_ALAC"/>
    340             <xs:enumeration value="AUDIO_FORMAT_APE"/>
    341             <xs:enumeration value="AUDIO_FORMAT_AAC_ADTS"/>
    342             <xs:enumeration value="AUDIO_FORMAT_SBC"/>
    343             <xs:enumeration value="AUDIO_FORMAT_APTX"/>
    344             <xs:enumeration value="AUDIO_FORMAT_APTX_HD"/>
    345             <xs:enumeration value="AUDIO_FORMAT_AC4"/>
    346             <xs:enumeration value="AUDIO_FORMAT_LDAC"/>
    347         </xs:restriction>
    348     </xs:simpleType>
    349     <!-- TODO: Change to a space separated list to xsd enforce correctness. -->
    350     <xs:simpleType name="samplingRates">
    351         <xs:restriction base="xs:string">
    352             <xs:pattern value="[0-9]+(,[0-9]+)*"/>
    353         </xs:restriction>
    354     </xs:simpleType>
    355     <!-- TODO: Change to a space separated list to xsd enforce correctness. -->
    356     <xs:simpleType name="channelMask">
    357         <xs:annotation>
    358             <xs:documentation xml:lang="en">
    359                 Comma (",") separated list of channel flags
    360                 from audio_channel_mask_t.
    361             </xs:documentation>
    362         </xs:annotation>
    363         <xs:restriction base="xs:string">
    364             <xs:pattern value="[_A-Z][_A-Z0-9]*(,[_A-Z][_A-Z0-9]*)*"/>
    365         </xs:restriction>
    366     </xs:simpleType>
    367     <xs:complexType name="profile">
    368         <xs:attribute name="name" type="xs:token" use="optional"/>
    369         <xs:attribute name="format" type="audioFormat" use="optional"/>
    370         <xs:attribute name="samplingRates" type="samplingRates" use="optional"/>
    371         <xs:attribute name="channelMasks" type="channelMask" use="optional"/>
    372     </xs:complexType>
    373     <xs:simpleType name="gainMode">
    374         <xs:restriction base="xs:string">
    375             <xs:enumeration value="AUDIO_GAIN_MODE_JOINT"/>
    376             <xs:enumeration value="AUDIO_GAIN_MODE_CHANNELS"/>
    377             <xs:enumeration value="AUDIO_GAIN_MODE_RAMP"/>
    378         </xs:restriction>
    379     </xs:simpleType>
    380     <xs:complexType name="gains">
    381         <xs:sequence>
    382             <xs:element name="gain" minOccurs="0" maxOccurs="unbounded">
    383                 <xs:complexType>
    384                     <xs:attribute name="name" type="xs:token" use="required"/>
    385                     <xs:attribute name="mode" type="gainMode" use="required"/>
    386                     <xs:attribute name="channel_mask" type="channelMask" use="optional"/>
    387                     <xs:attribute name="minValueMB" type="xs:int" use="optional"/>
    388                     <xs:attribute name="maxValueMB" type="xs:int" use="optional"/>
    389                     <xs:attribute name="defaultValueMB" type="xs:int" use="optional"/>
    390                     <xs:attribute name="stepValueMB" type="xs:int" use="optional"/>
    391                     <xs:attribute name="minRampMs" type="xs:int" use="optional"/>
    392                     <xs:attribute name="maxRampMs" type="xs:int" use="optional"/>
    393                 </xs:complexType>
    394             </xs:element>
    395         </xs:sequence>
    396     </xs:complexType>
    397     <xs:complexType name="devicePorts">
    398         <xs:sequence>
    399             <xs:element name="devicePort" minOccurs="0" maxOccurs="unbounded">
    400                 <xs:complexType>
    401                     <xs:sequence>
    402                         <xs:element name="profile" type="profile" minOccurs="0" maxOccurs="unbounded"/>
    403                         <xs:element name="gains" type="gains" minOccurs="0"/>
    404                     </xs:sequence>
    405                     <xs:attribute name="tagName" type="xs:token" use="required"/>
    406                     <xs:attribute name="type" type="audioDevice" use="required"/>
    407                     <xs:attribute name="role" type="role" use="required"/>
    408                     <xs:attribute name="address" type="xs:string" use="optional"/>
    409                 </xs:complexType>
    410                 <xs:unique name="devicePortProfileUniqueness">
    411                     <xs:selector xpath="profile"/>
    412                     <xs:field xpath="format"/>
    413                     <xs:field xpath="samplingRate"/>
    414                     <xs:field xpath="channelMasks"/>
    415                 </xs:unique>
    416                 <xs:unique name="devicePortGainUniqueness">
    417                     <xs:selector xpath="gains/gain"/>
    418                     <xs:field xpath="@name"/>
    419                 </xs:unique>
    420             </xs:element>
    421         </xs:sequence>
    422     </xs:complexType>
    423     <xs:simpleType name="mixType">
    424         <xs:restriction base="xs:string">
    425             <xs:enumeration value="mix"/>
    426             <xs:enumeration value="mux"/>
    427         </xs:restriction>
    428     </xs:simpleType>
    429     <xs:complexType name="routes">
    430         <xs:sequence>
    431             <xs:element name="route" minOccurs="0" maxOccurs="unbounded">
    432                 <xs:annotation>
    433                     <xs:documentation xml:lang="en">
    434                         List all available sources for a given sink.
    435                     </xs:documentation>
    436                 </xs:annotation>
    437                 <xs:complexType>
    438                     <xs:attribute name="type" type="mixType" use="required"/>
    439                     <xs:attribute name="sink" type="xs:string" use="required"/>
    440                     <xs:attribute name="sources" type="xs:string" use="required"/>
    441                 </xs:complexType>
    442             </xs:element>
    443         </xs:sequence>
    444     </xs:complexType>
    445     <xs:complexType name="volumes">
    446         <xs:sequence>
    447             <xs:element name="volume" type="volume" minOccurs="0" maxOccurs="unbounded"/>
    448             <xs:element name="reference" type="reference" minOccurs="0" maxOccurs="unbounded">
    449             </xs:element>
    450         </xs:sequence>
    451     </xs:complexType>
    452     <!-- TODO: Always require a ref for better xsd validations.
    453                Currently a volume could have no points nor ref
    454                as it can not be forbidden by xsd 1.0.-->
    455     <xs:simpleType name="volumePoint">
    456         <xs:annotation>
    457             <xs:documentation xml:lang="en">
    458                 Comma separated pair of number.
    459                 The fist one is the framework level (between 0 and 100).
    460                 The second one is the volume to send to the HAL.
    461                 The framework will interpolate volumes not specified.
    462                 Their MUST be at least 2 points specified.
    463             </xs:documentation>
    464         </xs:annotation>
    465         <xs:restriction base="xs:string">
    466             <xs:pattern value="([0-9]{1,2}|100),-?[0-9]+"/>
    467         </xs:restriction>
    468     </xs:simpleType>
    469     <!-- Enum values of audio_stream_type_t in audio-base.h
    470          TODO: generate from hidl to avoid manual sync. -->
    471     <xs:simpleType name="stream">
    472         <xs:restriction base="xs:string">
    473             <xs:enumeration value="AUDIO_STREAM_VOICE_CALL"/>
    474             <xs:enumeration value="AUDIO_STREAM_SYSTEM"/>
    475             <xs:enumeration value="AUDIO_STREAM_RING"/>
    476             <xs:enumeration value="AUDIO_STREAM_MUSIC"/>
    477             <xs:enumeration value="AUDIO_STREAM_ALARM"/>
    478             <xs:enumeration value="AUDIO_STREAM_NOTIFICATION"/>
    479             <xs:enumeration value="AUDIO_STREAM_BLUETOOTH_SCO"/>
    480             <xs:enumeration value="AUDIO_STREAM_ENFORCED_AUDIBLE"/>
    481             <xs:enumeration value="AUDIO_STREAM_DTMF"/>
    482             <xs:enumeration value="AUDIO_STREAM_TTS"/>
    483             <xs:enumeration value="AUDIO_STREAM_ACCESSIBILITY"/>
    484             <xs:enumeration value="AUDIO_STREAM_REROUTING"/>
    485             <xs:enumeration value="AUDIO_STREAM_PATCH"/>
    486         </xs:restriction>
    487     </xs:simpleType>
    488     <!-- Enum values of device_category from Volume.h.
    489          TODO: generate from hidl to avoid manual sync. -->
    490     <xs:simpleType name="deviceCategory">
    491         <xs:restriction base="xs:string">
    492             <xs:enumeration value="DEVICE_CATEGORY_HEADSET"/>
    493             <xs:enumeration value="DEVICE_CATEGORY_SPEAKER"/>
    494             <xs:enumeration value="DEVICE_CATEGORY_EARPIECE"/>
    495             <xs:enumeration value="DEVICE_CATEGORY_EXT_MEDIA"/>
    496         </xs:restriction>
    497     </xs:simpleType>
    498     <xs:complexType name="volume">
    499         <xs:annotation>
    500             <xs:documentation xml:lang="en">
    501                 Volume section defines a volume curve for a given use case and device category.
    502                 It contains a list of points of this curve expressing the attenuation in Millibels
    503                 for a given volume index from 0 to 100.
    504                 <volume stream="AUDIO_STREAM_MUSIC" deviceCategory="DEVICE_CATEGORY_SPEAKER">
    505                     <point>0,-9600</point>
    506                     <point>100,0</point>
    507                 </volume>
    508 
    509                 It may also reference a reference/@name to avoid duplicating curves.
    510                 <volume stream="AUDIO_STREAM_MUSIC" deviceCategory="DEVICE_CATEGORY_SPEAKER"
    511                         ref="DEFAULT_MEDIA_VOLUME_CURVE"/>
    512                 <reference name="DEFAULT_MEDIA_VOLUME_CURVE">
    513                     <point>0,-9600</point>
    514                     <point>100,0</point>
    515                 </reference>
    516             </xs:documentation>
    517         </xs:annotation>
    518         <xs:sequence>
    519             <xs:element name="point" type="volumePoint" minOccurs="0" maxOccurs="unbounded"/>
    520         </xs:sequence>
    521         <xs:attribute name="stream" type="stream"/>
    522         <xs:attribute name="deviceCategory" type="deviceCategory"/>
    523         <xs:attribute name="ref" type="xs:token" use="optional"/>
    524     </xs:complexType>
    525     <xs:complexType name="reference">
    526         <xs:sequence>
    527             <xs:element name="point" type="volumePoint" minOccurs="2" maxOccurs="unbounded"/>
    528         </xs:sequence>
    529         <xs:attribute name="name" type="xs:token" use="required"/>
    530     </xs:complexType>
    531 </xs:schema>
    532