<?xml version="1.0" encoding="utf-8"?>
<!-- Copyright (C) 2025 The Android Open Source Project

     Licensed under the Apache License, Version 2.0 (the "License");
     you may not use this file except in compliance with the License.
     You may obtain a copy of the License at

          http://www.apache.org/licenses/LICENSE-2.0

     Unless required by applicable law or agreed to in writing, software
     distributed under the License is distributed on an "AS IS" BASIS,
     WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
     See the License for the specific language governing permissions and
     limitations under the License.
-->

<!--
  Defines the audio configuration in a car, including
    - Audio zones
    - Zone configurations (in each audio zone)
    - Volume groups (in each zone configuration)
    - Context to audio bus mappings (in each volume group)
  in the car environment.
-->
<carAudioConfiguration version="4">
    <deviceConfigurations>
        <deviceConfiguration name="useHalDuckingSignals" value="false" />
        <deviceConfiguration name="useCoreAudioRouting" value="true" />
        <deviceConfiguration name="useCoreAudioVolume" value="true" />
        <deviceConfiguration name="useCarVolumeGroupMuting" value="true" />
    </deviceConfigurations>
    <activationVolumeConfigs>
        <activationVolumeConfig name="activation_volume_on_boot_config">
            <activationVolumeConfigEntry minActivationVolumePercentage="20"
                maxActivationVolumePercentage="90" invocationType="onPlaybackChanged" />
        </activationVolumeConfig>
        <activationVolumeConfig name="activation_volume_on_source_changed_config">
            <activationVolumeConfigEntry minActivationVolumePercentage="20"
                maxActivationVolumePercentage="80" invocationType="onSourceChanged" />
        </activationVolumeConfig>
        <activationVolumeConfig name="activation_volume_on_playback_changed_config">
            <activationVolumeConfigEntry minActivationVolumePercentage="20"
                maxActivationVolumePercentage="80" />
        </activationVolumeConfig>
    </activationVolumeConfigs>
    <oemContexts>
        <oemContext name="oem_traffic_announcement">
            <audioAttributes>
                <usage value="AUDIO_USAGE_ANNOUNCEMENT" />
                <audioAttribute usage="AUDIO_USAGE_ASSISTANCE_NAVIGATION_GUIDANCE"
                    tags="VX_OEM_TA" />
            </audioAttributes>
        </oemContext>
        <oemContext name="oem_ipa">
            <audioAttributes>
                <usage value="AUDIO_USAGE_SAFETY" />
                <usage value="AUDIO_USAGE_VEHICLE_STATUS" />
                <audioAttribute usage="AUDIO_USAGE_ASSISTANCE_NAVIGATION_GUIDANCE"
                    tags="VX_OEM_IPA" />
            </audioAttributes>
        </oemContext>
        <oemContext name="oem_xcall">
            <audioAttributes>
                <audioAttribute usage="AUDIO_USAGE_VOICE_COMMUNICATION"
                    tags="VX_OEM_XCALL" />
                <usage value="AUDIO_USAGE_EMERGENCY" />
            </audioAttributes>
        </oemContext>
        <oemContext name="third_party_alternate">
            <audioAttributes>
                <audioAttribute usage="AUDIO_USAGE_ASSISTANCE_NAVIGATION_GUIDANCE"
                    tags="VX_OEM_ALTERNATE" />
            </audioAttributes>
        </oemContext>
        <oemContext name="third_party_auxiliary">
            <audioAttributes>
                <audioAttribute usage="AUDIO_USAGE_ASSISTANCE_NAVIGATION_GUIDANCE"
                    tags="VX_OEM_AUXILIARY"/>
                <audioAttribute usage="AUDIO_USAGE_ASSISTANT"
                    tags="VX_OEM_AUXILIARY"/>
            </audioAttributes>
        </oemContext>
        <oemContext name="third_party_alert">
            <audioAttributes>
                <audioAttribute usage="AUDIO_USAGE_ALARM"
                    tags="VX_OEM_ALERT" />
                <audioAttribute usage="AUDIO_USAGE_NOTIFICATION_TELEPHONY_RINGTONE"
                    tags="VX_OEM_ALERT" />
            </audioAttributes>
        </oemContext>
        <oemContext name="voice_command">
            <audioAttributes>
                <usage value="AUDIO_USAGE_ASSISTANT"/>
                <usage value="AUDIO_USAGE_ASSISTANCE_ACCESSIBILITY"/>
            </audioAttributes>
        </oemContext>
        <oemContext name="music">
            <audioAttributes>
                <usage value="AUDIO_USAGE_MEDIA" />
                <usage value="AUDIO_USAGE_GAME" />
                <usage value="AUDIO_USAGE_UNKNOWN"/>
            </audioAttributes>
        </oemContext>
        <oemContext name="nav_guidance">
            <audioAttributes>
                <usage value="AUDIO_USAGE_ASSISTANCE_NAVIGATION_GUIDANCE" />
            </audioAttributes>
        </oemContext>
        <oemContext name="ring">
            <audioAttributes>
                <usage value="AUDIO_USAGE_NOTIFICATION_TELEPHONY_RINGTONE"/>
            </audioAttributes>
        </oemContext>
        <oemContext name="notification">
            <audioAttributes>
                <usage value="AUDIO_USAGE_NOTIFICATION" />
                <usage value="AUDIO_USAGE_NOTIFICATION_EVENT" />
            </audioAttributes>
        </oemContext>
        <oemContext name="system">
            <audioAttributes>
                <usage value="AUDIO_USAGE_ASSISTANCE_SONIFICATION" />
            </audioAttributes>
        </oemContext>
        <oemContext name="alarm">
            <audioAttributes>
                <usage value="AUDIO_USAGE_ALARM" />
            </audioAttributes>
        </oemContext>
        <oemContext name="voice_call">
            <audioAttributes>
                <usage value="AUDIO_USAGE_VOICE_COMMUNICATION" />
                <usage value="AUDIO_USAGE_VOICE_COMMUNICATION_SIGNALLING" />
                <usage value="AUDIO_USAGE_CALL_ASSISTANT" />
            </audioAttributes>
        </oemContext>
       </oemContexts>
    <zones>
        <zone isPrimary="true" name="primary zone" audioZoneId="0" occupantZoneId="0">
            <zoneConfigs>
                <zoneConfig  name="primary zone config 1" isDefault="true">
                    <volumeGroups>
                        <group name="entertainment" activationConfig="activation_volume_on_boot_config">
                            <device address="BUS00_MEDIA_CARD_0_DEV_0">
                                <context context="music"/>
                            </device>
                        </group>
                        <group name="navvol" activationConfig="activation_volume_on_source_changed_config">
                            <device address="BUS01_NAV_GUIDANCE_CARD_0_DEV_1">
                                <context context="nav_guidance"/>
                                <context context="oem_ipa"/>
                                <context context="oem_traffic_announcement"/>
                            </device>
                            <device address="BUS02_NOTIFICATION_CARD_0_DEV_2">
                                <context context="third_party_alternate"/>
                            </device>
                        </group>
                        <group name="sdsvol" activationConfig="activation_volume_on_playback_changed_config">
                            <device address="BUS04_ASSISTANT_CARD_0_DEV_4">
                                <context context="voice_command"/>
                                <context context="third_party_auxiliary"/>
                            </device>
                        </group>
                        <group name="system" activationConfig="activation_volume_on_source_changed_config">
                            <device address="BUS05_SYSTEM_CARD_0_DEV_5">
                                <context context="system"/>
                                <context context="notification"/>
                            </device>
                        </group>
                        <group name="telringvol" activationConfig="activation_volume_on_playback_changed_config">
                            <device address="BUS03_PHONE_CARD_0_DEV_3">
                                <context context="voice_call"/>
                                <context context="oem_xcall"/>
                                <context context="ring"/>
                                <context context="alarm"/>
                                <context context="third_party_alert"/>
                            </device>
                        </group>
                    </volumeGroups>
                </zoneConfig>
            </zoneConfigs>
        </zone>
    </zones>
</carAudioConfiguration>
