1<?xml version="1.0" encoding="UTF-8"?>
2<!-- Copyright (C) 2024 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" elementFormDefault="qualified" xmlns:xs="http://www.w3.org/2001/XMLSchema">
17    <xs:element name="carAudioConfiguration" type="CarAudioConfigurationType" minOccurs="1" maxOccurs="1" />
18    <xs:complexType name="CarAudioConfigurationType">
19        <xs:attribute name="version" type="xs:string" use="required" />
20        <xs:sequence>
21            <xs:element name="mirroringDevices" type="MirroringDevicesType" minOccurs="0" />
22            <xs:element name="deviceConfigurations" type="DeviceConfigurationsType" minOccurs="0" />
23            <xs:element name="oemContexts" type="OemContextsType" />
24            <xs:element name="activationVolumeConfigs" type="ActivationVolumeConfigsType" minOccurs="0" />
25            <xs:element name="zones" type="ZonesType" />
26        </xs:sequence>
27    </xs:complexType>
28    <xs:complexType name="ZonesType">
29        <xs:element name="zone" type="ZoneType" minOccurs="1" maxOccurs="unbounded" />
30    </xs:complexType>
31    <xs:complexType name="ActivationVolumeConfigsType">
32        <xs:element name="activationVolumeConfig" type="ActivationVolumeConfigType" maxOccurs="unbounded" />
33    </xs:complexType>
34    <xs:complexType name="OemContextsType">
35        <xs:element name="oemContext" type="OemContextType" minOccurs="1" maxOccurs="unbounded" />
36    </xs:complexType>
37    <xs:complexType name="DeviceConfigurationsType">
38        <xs:element name="deviceConfiguration" type="DeviceConfigurationType" minOccurs="0" maxOccurs="unbounded" />
39    </xs:complexType>
40    <xs:complexType name="ZoneType">
41        <xs:attribute name="name" type="xs:string" />
42        <xs:attribute name="audioZoneId" type="xs:string" use="required" />
43        <xs:attribute name="isPrimary" type="xs:boolean" />
44        <xs:attribute name="occupantZoneId" type="xs:string" />
45        <xs:element name="inputDevices" type="InputDevicesType" />
46        <xs:element name="zoneConfigs" type="ZoneConfigsType" />
47    </xs:complexType>
48    <xs:complexType name="ZoneConfigsType">
49        <xs:element name="zoneConfig" type="ZoneConfigType"/>
50    </xs:complexType>
51    <xs:complexType name="ZoneConfigType">
52        <xs:attribute name="name" type="xs:string" />
53        <xs:attribute name="isDefault" type="xs:boolean" />
54        <xs:element name="volumeGroups" type="VolumeGroupsType" />
55        <xs:element name="applyFadeConfigs" type="ApplyFadeConfigsType" />
56    </xs:complexType>
57    <xs:complexType name="ApplyFadeConfigsType">
58        <xs:element name="fadeConfig" type="ApplyFadeConfigType" minOccurs="0" maxOccurs="unbounded" />
59    </xs:complexType>
60    <xs:complexType name="ApplyFadeConfigType">
61        <xs:attribute name="name" type="xs:string" />
62        <xs:attribute name="isDefault" type="xs:boolean" />
63        <xs:element name="audioAttributes" type="AudioAttributeUsagesType" minOccurs="0" maxOccurs="unbounded" />
64    </xs:complexType>
65    <xs:complexType name="AudioAttributeUsagesType">
66        <xs:element name="usage" type="UsageType" maxOccurs="unbounded" />
67    </xs:complexType>
68    <xs:complexType name="VolumeGroupsType">
69        <xs:element name="group"  type="VolumeGroupType" minOccurs="1" maxOccurs="unbounded" />
70    </xs:complexType>
71    <xs:complexType name="VolumeGroupType">
72        <xs:attribute name="name" type="xs:string" />
73        <xs:attribute name="activationConfig" type="xs:string" />
74        <xs:element name="device" type="DeviceRoutesType" minOccurts="1" maxOccurs="unbounded" />
75    </xs:complexType>
76    <xs:complexType name="DeviceRoutesType" >
77        <xs:attribute name="address" type="xs:string" />
78        <xs:attribute name="type" type="OutDeviceType" />
79        <xs:element name="context" type="ContextNameType" mixOccurs="1" maxOccurs="unbounded" />
80    </xs:complexType>
81    <xs:complexType name="ContextNameType">
82        <xs:attribute name="context" type="xs:string"/>
83    </xs:complexType>
84    <xs:complexType name="OemContextType">
85        <xs:attribute name="name" type="xs:string" />
86        <xs:attribute name="id" type="xs:string" />
87        <xs:element name="audioAttributes" type="AudioAttributesUsagesType" minOccurs="1" maxOccurs="1" />
88    </xs:complexType>
89    <xs:complexType name="AudioAttributesUsagesType" >
90        <xs:choice minOccurs="0" maxOccurs="unbounded" >
91            <xs:element name="audioAttribute" type="AttributesType" />
92            <xs:element name="usage" type="UsageType" />
93        </xs:choice>
94    </xs:complexType>
95    <xs:complexType name="AttributesType">
96        <xs:attribute name="contentType" type="contentTypeEnum" />
97        <xs:attribute name="usage" type="usageEnumType" />
98        <xs:attribute name="tags" type="xs:string" />
99    </xs:complexType>
100    <xs:complexType name="DeviceConfigurationType">
101        <xs:attribute name="name" type="xs:string" />
102        <xs:attribute name="value" type="xs:string" />
103    </xs:complexType>
104    <xs:complexType name="ContentType" >
105        <xs:attribute name="value" type="contentTypeEnum" use="required" />
106    </xs:complexType>
107    <xs:complexType name="UsageType">
108        <xs:attribute name="value" type="usageEnumType" use="required" />
109    </xs:complexType>
110    <xs:simpleType name="contentTypeEnum">
111        <xs:restriction base="xs:string">
112            <xs:enumeration value="AUDIO_CONTENT_TYPE_UNKNOWN"/>
113            <xs:enumeration value="AUDIO_CONTENT_TYPE_SPEECH"/>
114            <xs:enumeration value="AUDIO_CONTENT_TYPE_MUSIC"/>
115            <xs:enumeration value="AUDIO_CONTENT_TYPE_MOVIE"/>
116            <xs:enumeration value="AUDIO_CONTENT_TYPE_SONIFICATION"/>
117        </xs:restriction>
118    </xs:simpleType>
119    <xs:simpleType name="usageEnumType">
120      <xs:restriction base="xs:string">
121          <xs:enumeration value="AUDIO_USAGE_UNKNOWN"/>
122          <xs:enumeration value="AUDIO_USAGE_MEDIA"/>
123          <xs:enumeration value="AUDIO_USAGE_VOICE_COMMUNICATION"/>
124          <xs:enumeration value="AUDIO_USAGE_VOICE_COMMUNICATION_SIGNALLING"/>
125          <xs:enumeration value="AUDIO_USAGE_ALARM"/>
126          <xs:enumeration value="AUDIO_USAGE_NOTIFICATION"/>
127          <xs:enumeration value="AUDIO_USAGE_NOTIFICATION_TELEPHONY_RINGTONE"/>
128          <!-- Note: the following 3 values were deprecated in Android T (13) SDK -->
129          <xs:enumeration value="AUDIO_USAGE_NOTIFICATION_COMMUNICATION_REQUEST"/>
130          <xs:enumeration value="AUDIO_USAGE_NOTIFICATION_COMMUNICATION_INSTANT"/>
131          <xs:enumeration value="AUDIO_USAGE_NOTIFICATION_COMMUNICATION_DELAYED"/>
132          <xs:enumeration value="AUDIO_USAGE_NOTIFICATION_EVENT"/>
133          <xs:enumeration value="AUDIO_USAGE_ASSISTANCE_ACCESSIBILITY"/>
134          <xs:enumeration value="AUDIO_USAGE_ASSISTANCE_NAVIGATION_GUIDANCE"/>
135          <xs:enumeration value="AUDIO_USAGE_ASSISTANCE_SONIFICATION"/>
136          <xs:enumeration value="AUDIO_USAGE_GAME"/>
137          <xs:enumeration value="AUDIO_USAGE_VIRTUAL_SOURCE"/>
138          <xs:enumeration value="AUDIO_USAGE_ASSISTANT"/>
139          <xs:enumeration value="AUDIO_USAGE_CALL_ASSISTANT"/>
140          <xs:enumeration value="AUDIO_USAGE_EMERGENCY" />
141          <xs:enumeration value="AUDIO_USAGE_SAFETY" />
142          <xs:enumeration value="AUDIO_USAGE_VEHICLE_STATUS" />
143          <xs:enumeration value="AUDIO_USAGE_ANNOUNCEMENT" />
144      </xs:restriction>
145    </xs:simpleType>
146    <xs:complexType name="ActivationVolumeConfigType">
147        <xs:attribute name="name" type="xs:string" />
148        <xs:element name="activationVolumeConfigEntry" type="ActivationVolumeConfigEntryType" maxOccurs="unbounded" />
149    </xs:complexType>
150    <xs:complexType name="ActivationVolumeConfigEntryType">
151          <xs:attribute name="maxActivationVolumePercentage" type="xs:string" />
152          <xs:attribute name="minActivationVolumePercentage" type="xs:string" />
153          <xs:attribute name="invocationType" type="ActivationType" />
154    </xs:complexType>
155    <xs:simpleType name="ActivationType">
156        <xs:restriction base="xs:string">
157            <xs:enumeration value="onBoot"/>
158            <xs:enumeration value="onSourceChanged"/>
159            <xs:enumeration value="onPlaybackChanged"/>
160        </xs:restriction>
161    </xs:simpleType>
162    <xs:simpleType name="OutDeviceType">
163        <xs:restriction base="xs:string">
164            <xs:enumeration value="AUDIO_DEVICE_OUT_SPEAKER"/>
165            <xs:enumeration value="AUDIO_DEVICE_OUT_WIRED_HEADSET"/>
166            <xs:enumeration value="AUDIO_DEVICE_OUT_WIRED_HEADPHONE"/>
167            <xs:enumeration value="AUDIO_DEVICE_OUT_BLUETOOTH_A2DP"/>
168            <xs:enumeration value="AUDIO_DEVICE_OUT_BLUETOOTH_A2DP_HEADPHONES"/>
169            <xs:enumeration value="AUDIO_DEVICE_OUT_BLUETOOTH_A2DP_SPEAKER"/>
170            <xs:enumeration value="AUDIO_DEVICE_OUT_HDMI"/>
171            <xs:enumeration value="AUDIO_DEVICE_OUT_HDMI_EARC"/>
172            <xs:enumeration value="AUDIO_DEVICE_OUT_AUX_DIGITAL"/>
173            <xs:enumeration value="AUDIO_DEVICE_OUT_USB_ACCESSORY"/>
174            <xs:enumeration value="AUDIO_DEVICE_OUT_USB_DEVICE"/>
175            <xs:enumeration value="AUDIO_DEVICE_OUT_LINE"/>
176            <xs:enumeration value="AUDIO_DEVICE_OUT_HDMI_ARC"/>
177            <xs:enumeration value="AUDIO_DEVICE_OUT_AUX_LINE"/>
178            <xs:enumeration value="AUDIO_DEVICE_OUT_SPEAKER_SAFE"/>
179            <xs:enumeration value="AUDIO_DEVICE_OUT_BUS"/>
180            <xs:enumeration value="AUDIO_DEVICE_OUT_USB_HEADSET"/>
181            <xs:enumeration value="AUDIO_DEVICE_OUT_BLE_HEADSET"/>
182            <xs:enumeration value="AUDIO_DEVICE_OUT_BLE_SPEAKER"/>
183            <xs:enumeration value="AUDIO_DEVICE_OUT_BLE_BROADCAST"/>
184            <xs:enumeration value="AUDIO_DEVICE_OUT_DEFAULT"/>
185            <!-- Added to support legacy files -->
186            <xs:enumeration value="TYPE_BUILTIN_SPEAKER"/>
187            <xs:enumeration value="TYPE_WIRED_HEADSET"/>
188            <xs:enumeration value="TYPE_WIRED_HEADPHONES"/>
189            <xs:enumeration value="TYPE_BLUETOOTH_A2DP"/>
190            <xs:enumeration value="TYPE_HDMI"/>
191            <xs:enumeration value="TYPE_USB_ACCESSORY"/>
192            <xs:enumeration value="TYPE_USB_DEVICE"/>
193            <xs:enumeration value="TYPE_USB_HEADSET"/>
194            <xs:enumeration value="TYPE_AUX_LINE"/>
195            <xs:enumeration value="TYPE_BUS"/>
196            <xs:enumeration value="TYPE_BLE_HEADSET"/>
197            <xs:enumeration value="TYPE_BLE_SPEAKER"/>
198            <xs:enumeration value="TYPE_BLE_BROADCAST"/>
199        </xs:restriction>
200    </xs:simpleType>
201    <xs:complexType name="MirroringDevicesType">
202        <xs:element name="mirroringDevice" type="MirroringDevice" maxOccurs="unbounded" />
203    </xs:complexType>
204    <xs:complexType name="MirroringDevice">
205        <xs:attribute name="address" type="xs:string" />
206    </xs:complexType>
207    <xs:complexType name="InputDevicesType">
208        <xs:element name="inputDevice" type="InputDeviceType" maxOccurs="unbounded" />
209    </xs:complexType>
210    <xs:complexType name="InputDeviceType">
211        <xs:attribute name="address" type="xs:string" />
212        <xs:attribute name="type" type="InDeviceType" />
213    </xs:complexType>
214    <xs:simpleType name="InDeviceType">
215        <xs:restriction base="xs:string">
216            <xs:enumeration value="AUDIO_DEVICE_IN_COMMUNICATION"/>
217            <xs:enumeration value="AUDIO_DEVICE_IN_AMBIENT"/>
218            <xs:enumeration value="AUDIO_DEVICE_IN_BUILTIN_MIC"/>
219            <xs:enumeration value="AUDIO_DEVICE_IN_BLUETOOTH_SCO_HEADSET"/>
220            <xs:enumeration value="AUDIO_DEVICE_IN_WIRED_HEADSET"/>
221            <xs:enumeration value="AUDIO_DEVICE_IN_AUX_DIGITAL"/>
222            <xs:enumeration value="AUDIO_DEVICE_IN_HDMI"/>
223            <xs:enumeration value="AUDIO_DEVICE_IN_VOICE_CALL"/>
224            <xs:enumeration value="AUDIO_DEVICE_IN_TELEPHONY_RX"/>
225            <xs:enumeration value="AUDIO_DEVICE_IN_BACK_MIC"/>
226            <xs:enumeration value="AUDIO_DEVICE_IN_REMOTE_SUBMIX"/>
227            <xs:enumeration value="AUDIO_DEVICE_IN_ANLG_DOCK_HEADSET"/>
228            <xs:enumeration value="AUDIO_DEVICE_IN_DGTL_DOCK_HEADSET"/>
229            <xs:enumeration value="AUDIO_DEVICE_IN_USB_ACCESSORY"/>
230            <xs:enumeration value="AUDIO_DEVICE_IN_USB_DEVICE"/>
231            <xs:enumeration value="AUDIO_DEVICE_IN_FM_TUNER"/>
232            <xs:enumeration value="AUDIO_DEVICE_IN_TV_TUNER"/>
233            <xs:enumeration value="AUDIO_DEVICE_IN_LINE"/>
234            <xs:enumeration value="AUDIO_DEVICE_IN_SPDIF"/>
235            <xs:enumeration value="AUDIO_DEVICE_IN_BLUETOOTH_A2DP"/>
236            <xs:enumeration value="AUDIO_DEVICE_IN_LOOPBACK"/>
237            <xs:enumeration value="AUDIO_DEVICE_IN_IP"/>
238            <xs:enumeration value="AUDIO_DEVICE_IN_BUS"/>
239            <xs:enumeration value="AUDIO_DEVICE_IN_PROXY"/>
240            <xs:enumeration value="AUDIO_DEVICE_IN_USB_HEADSET"/>
241            <xs:enumeration value="AUDIO_DEVICE_IN_BLUETOOTH_BLE"/>
242            <xs:enumeration value="AUDIO_DEVICE_IN_HDMI_ARC"/>
243            <xs:enumeration value="AUDIO_DEVICE_IN_ECHO_REFERENCE"/>
244            <xs:enumeration value="AUDIO_DEVICE_IN_DEFAULT"/>
245            <xs:enumeration value="AUDIO_DEVICE_IN_STUB"/>
246        </xs:restriction>
247    </xs:simpleType>
248</xs:schema>
249