Android Automotive OS (AAOS) uses flags and configurations to enable different features, starting with dynamic routing to more generic feature flags, such as volume control from the car service. Current AAOS configuration flags for audio management are described here.
Flag | Purpose |
---|---|
audioUseDynamicRouting | Defined in the car service config file to Enable AAOS routing. The config must be set to true . When false , routing and much of CarAudioService , are disabled and the OS falls back to the default behavior described in Configuring audio policies. |
audioUseCarVolumeGroupMuting | Defined in car service config file to enable the muting of individual volume groups. When set to false (the default value), muting of individual volume groups is disabled. Instead, muting toggles master mute. When set to true , car volume group muting is enabled and each individual volume group can be muted separately. When true , volume group muting must be implemented at the Audio Control HAL. |
audioUseHalDuckingSignals | Defined in the car service config file to enable the IAudioControl#onDevicesToDuckChange API to inform HAL when to duck. When true (default value), the API receives signals indicating which output devices to duck and what usages hold focus. When false , the API is not called. The API isn't called unless the Audio Control HAL implements ducking. |
config_oemCarService | Defined in the car service config file, this is the component name for the OEM customization service. OEMs can opt to implement this service to customize car service actions for different policies. If OEMs opt to implement this component, they must implement a service to extend OemCarService exposed by car-lib, and then implement the required component services. For car audio service specifically, OEMs can implement any of the audio sub services to manage audio action. For details, see Car Audio Plugin Service. If the component name is invalid, CarService wouldn't connect to any OEM service. The component name can't be a third party package. It must be pre-installed. |
audioVolumeAdjustmentContextsVersion | Defined in the car service config file, configuration to select the version of volume adjustment context priority list. Version 1 includes all audio contexts, in this order:
Version 2 is limited to the following contexts, in this order. The default version is
|
audioPersistMasterMuteState | Defined in car service config file, configuration to persist global mute state. When true (the default value) Android restores the global mute state on boot. When audioUseCarVolumeGroupMuting is true , this has no impact on persisting mute changes as mute changes are based on individual volume groups. The default value is set to true and must be overwritten when master mute shouldn't be persisted for a device. |
audioVolumeKeyEventTimeoutMs | Defined in the car service config file, configuration to indicate the timeout in milliseconds while a car volume group is considered active for volume control changes during volume key events. The configuration is used as follows:
The default value is |
audioUseCarVolumeGroupEvent | Defined in the car service config file, configuration to enable callback events to volume groups. When true , clients receive callback through ICarVolumeGroupEvent to events that impact volume groups. When enabled:
The default value is |
config_useFixedVolume | Defined in frameworks/base/core/res/res/values/config.xml . Must be set to true to allow for car audio service to manage volume control. When the config_useFixedVolume flag is not set, or is set to false (the default value), apps can call the AudioManager volume management APIs and change the volume by stream type in the software mixer. This may be undesirable because of the potential effect on other apps and the fact that volume attenuation in the software mixer can result in fewer significant bits available in the signal when received at the hardware amplifier. New devices that have not been configured and that are set to true receive volume changes through the AudioManager volume and mute APIs. |
config_handleVolumeKeysInWindowManager | Defined in frameworks/base/core/res/res/values/config.xml , must be set to true to allow for car audio service to intercept volume key events. If set to false (the default value) volume key events can be forwarded to the foreground app and can lead to adverse results from volume key event management outside the car audio service. |
audioUseMinMaxActivationVolume | Defined in the car service config file to enable minimum and maximum activation volume. When true , the volume gain index can be adjusted due to minimum and maximum activation volume management. When false (default value), minimum and maximum activation volume doesn't take effect. |
audioUseFadeManagerConfiguration | Defined in the car service config file to enable system-enforced audio focus loss behavior. When true , car audio framework parses the car audio fade config definitions and applies the respective FadeManagerConfiguration when dising audio focus loss. When false (default value), the system doesn't enforce fade behavior when an app loses audio focus. |
Car audio service configs
Before Android 13, car service configs were overwritten with a product configuration overlay (to learn more, see Customizing the build with resource overlays) for the packages/services/Car/service/res/values/config.xml
file.
PRODUCT_PACKAGE_OVERLAYS := <path_to_overlay>
The location of the config file from <path_to_overlay>
to the actual location should include packages/services/Car/service/res/values/
.
Car service RROs
Since Android 13, AAOS supports Runtime resource overlays. Use an RRO to change the value of the car audio configuration. For example, see the RROs for the automotive cuttlefish
reference in device/google/cuttlefish/shared/auto/rro_overlay/
. The audioUseDynamicRouting
config is overridden in device/google/cuttlefish/shared/auto/rro_overlay/CarServiceOverlay/res/values/config.xml
.
<resources>
<bool name="audioUseDynamicRouting">true</bool>
...
The resource overlay map is contained in device/google/cuttlefish/shared/auto/rro_overlay/CarServiceOverlay/res/xml/overlays.xml
:
<overlay>
...
<item target="bool/audioUseDynamicRouting"
value="@bool/audioUseDynamicRouting" />
...
</overlay>
The resource overlay manifest defined in device/google/cuttlefish/shared/auto/rro_overlay/CarServiceOverlay/AndroidManifest.xml
contains the targetPackage
set as com.android.car.updatable
.
See these resources for more information:
Feature-enabled API
The method returns true
if the feature is enabled on the device, otherwise false
. In the CarAudioManager#isAudioFeatureEnabled
API, the parameter passed in must be one of:
AUDIO_FEATURE_DYNAMIC_ROUTING
AUDIO_FEATURE_VOLUME_GROUP_MUTING
AUDIO_FEATURE_OEM_AUDIO_SERVICE
AUDIO_FEATURE_VOLUME_GROUP_EVENTS
AUDIO_FEATURE_AUDIO_MIRRORING