audio: build apex hal
* Update audio policy configuration based on cuttlefish [1] & [2]. * Update product package and copy file definitions to build the new APEX HAL instead of the legacy HAL. * Update to system properties used in the new AIDL HAL. * Use stub to simulate input as Raspberry Pi doesn't have any built-in hardware for audio input. It's still required to have primary input defined in audio policy config for many applications to function. [1]: https://android.googlesource.com/device/google/cuttlefish/+/refs/tags/android-16.0.0_r1/shared/config/audio/policy/audio_policy_configuration.xml [2]: https://android.googlesource.com/device/google/cuttlefish/+/refs/tags/android-16.0.0_r1/shared/config/audio/policy/primary_audio_policy_configuration.xml
This commit is contained in:
@@ -1,18 +1,28 @@
|
||||
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
|
||||
<!-- Copyright (C) 2015 The Android Open Source Project
|
||||
<!-- Copyright (C) 2024 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.
|
||||
-->
|
||||
|
||||
<audioPolicyConfiguration version="7.0" xmlns:xi="http://www.w3.org/2001/XInclude">
|
||||
<!-- version section contains a “version” tag in the form “major.minor” e.g. version=”1.0” -->
|
||||
|
||||
<!-- Global configuration Decalaration -->
|
||||
<globalConfiguration speaker_drc_enabled="false"/>
|
||||
|
||||
<modules>
|
||||
<module name="primary" halVersion="2.0">
|
||||
<!-- Primary Audio HAL -->
|
||||
<module name="primary" halVersion="3.0">
|
||||
<attachedDevices>
|
||||
<item>Speaker</item>
|
||||
<item>Built-In Mic</item>
|
||||
@@ -26,7 +36,7 @@
|
||||
</mixPort>
|
||||
<mixPort name="primary input" role="sink">
|
||||
<profile name="" format="AUDIO_FORMAT_PCM_16_BIT"
|
||||
samplingRates="8000 11025 12000 16000 22050 24000 32000 44100 48000"
|
||||
samplingRates="8000 11025 16000 32000 44100 48000"
|
||||
channelMasks="AUDIO_CHANNEL_IN_MONO AUDIO_CHANNEL_IN_STEREO"/>
|
||||
</mixPort>
|
||||
</mixPorts>
|
||||
@@ -36,71 +46,40 @@
|
||||
samplingRates="48000"
|
||||
channelMasks="AUDIO_CHANNEL_OUT_STEREO"/>
|
||||
</devicePort>
|
||||
<devicePort tagName="Wired Headset" type="AUDIO_DEVICE_OUT_WIRED_HEADSET" role="sink">
|
||||
<profile name="" format="AUDIO_FORMAT_PCM_16_BIT"
|
||||
samplingRates="48000"
|
||||
channelMasks="AUDIO_CHANNEL_OUT_STEREO"/>
|
||||
</devicePort>
|
||||
<devicePort tagName="Wired Headphones" type="AUDIO_DEVICE_OUT_WIRED_HEADPHONE" role="sink">
|
||||
<profile name="" format="AUDIO_FORMAT_PCM_16_BIT"
|
||||
samplingRates="48000"
|
||||
channelMasks="AUDIO_CHANNEL_OUT_STEREO"/>
|
||||
</devicePort>
|
||||
<devicePort tagName="BT SCO" type="AUDIO_DEVICE_OUT_BLUETOOTH_SCO" role="sink">
|
||||
<profile name="" format="AUDIO_FORMAT_PCM_16_BIT"
|
||||
samplingRates="8000 16000"
|
||||
channelMasks="AUDIO_CHANNEL_OUT_MONO"/>
|
||||
</devicePort>
|
||||
<devicePort tagName="BT SCO Headset" type="AUDIO_DEVICE_OUT_BLUETOOTH_SCO_HEADSET" role="sink">
|
||||
<profile name="" format="AUDIO_FORMAT_PCM_16_BIT"
|
||||
samplingRates="8000 16000"
|
||||
channelMasks="AUDIO_CHANNEL_OUT_MONO"/>
|
||||
</devicePort>
|
||||
<devicePort tagName="BT SCO Car Kit" type="AUDIO_DEVICE_OUT_BLUETOOTH_SCO_CARKIT" role="sink">
|
||||
<profile name="" format="AUDIO_FORMAT_PCM_16_BIT"
|
||||
samplingRates="8000 16000"
|
||||
channelMasks="AUDIO_CHANNEL_OUT_MONO"/>
|
||||
</devicePort>
|
||||
<devicePort tagName="Built-In Mic" type="AUDIO_DEVICE_IN_BUILTIN_MIC" role="source">
|
||||
<profile name="" format="AUDIO_FORMAT_PCM_16_BIT"
|
||||
samplingRates="8000 11025 12000 16000 22050 24000 32000 44100 48000"
|
||||
samplingRates="8000 11025 16000 32000 44100 48000"
|
||||
channelMasks="AUDIO_CHANNEL_IN_MONO AUDIO_CHANNEL_IN_STEREO"/>
|
||||
</devicePort>
|
||||
<devicePort tagName="Wired Headset Mic" type="AUDIO_DEVICE_IN_WIRED_HEADSET" role="source">
|
||||
<profile name="" format="AUDIO_FORMAT_PCM_16_BIT"
|
||||
samplingRates="8000 11025 12000 16000 22050 24000 32000 44100 48000"
|
||||
channelMasks="AUDIO_CHANNEL_IN_MONO AUDIO_CHANNEL_IN_STEREO"/>
|
||||
</devicePort>
|
||||
<devicePort tagName="BT SCO Headset Mic" type="AUDIO_DEVICE_IN_BLUETOOTH_SCO_HEADSET" role="source">
|
||||
<profile name="" format="AUDIO_FORMAT_PCM_16_BIT"
|
||||
samplingRates="8000 16000"
|
||||
channelMasks="AUDIO_CHANNEL_IN_MONO"/>
|
||||
</devicePort>
|
||||
</devicePorts>
|
||||
<routes>
|
||||
<route type="mix" sink="Speaker"
|
||||
sources="primary output"/>
|
||||
<route type="mix" sink="Wired Headset"
|
||||
sources="primary output"/>
|
||||
<route type="mix" sink="Wired Headphones"
|
||||
sources="primary output"/>
|
||||
<route type="mix" sink="BT SCO"
|
||||
sources="primary output"/>
|
||||
<route type="mix" sink="BT SCO Headset"
|
||||
sources="primary output"/>
|
||||
<route type="mix" sink="BT SCO Car Kit"
|
||||
sources="primary output"/>
|
||||
<route type="mix" sink="primary input"
|
||||
sources="Built-In Mic,Wired Headset Mic,BT SCO Headset Mic"/>
|
||||
sources="Built-In Mic"/>
|
||||
</routes>
|
||||
</module>
|
||||
|
||||
<xi:include href="a2dp_in_audio_policy_configuration_7_0.xml"/>
|
||||
<!-- USB Audio HAL -->
|
||||
<xi:include href="usb_audio_policy_configuration.xml"/>
|
||||
|
||||
<!-- Remote Submix Audio HAL -->
|
||||
<xi:include href="r_submix_audio_policy_configuration.xml"/>
|
||||
|
||||
<!-- Bluetooth Audio HAL -->
|
||||
<xi:include href="bluetooth_audio_policy_configuration_7_0.xml"/>
|
||||
</modules>
|
||||
<!-- End of Modules section -->
|
||||
|
||||
<!-- Volume section:
|
||||
IMPORTANT NOTE: Volume tables have been moved to engine configuration.
|
||||
Keep it here for legacy.
|
||||
Engine will fallback on these files if none are provided by engine.
|
||||
-->
|
||||
|
||||
<xi:include href="audio_policy_volumes.xml"/>
|
||||
<xi:include href="default_volume_tables.xml"/>
|
||||
|
||||
<!-- End of Volume section -->
|
||||
|
||||
</audioPolicyConfiguration>
|
||||
|
||||
23
device.mk
23
device.mk
@@ -18,21 +18,16 @@ PRODUCT_SHIPPING_API_LEVEL := 36
|
||||
|
||||
# Audio
|
||||
PRODUCT_PACKAGES += \
|
||||
android.hardware.audio.service \
|
||||
android.hardware.audio@7.1-impl \
|
||||
android.hardware.audio.effect@7.0-impl \
|
||||
audio.primary.rpi \
|
||||
audio.primary.rpi_hdmi \
|
||||
audio.r_submix.default \
|
||||
audio.usb.default
|
||||
com.android.hardware.audio.rpi5
|
||||
|
||||
PRODUCT_COPY_FILES += \
|
||||
$(DEVICE_PATH)/audio/audio_effects_config.xml:$(TARGET_COPY_OUT_VENDOR)/etc/audio_effects_config.xml \
|
||||
$(DEVICE_PATH)/audio/audio_policy_configuration.xml:$(TARGET_COPY_OUT_VENDOR)/etc/audio_policy_configuration.xml \
|
||||
frameworks/av/media/libeffects/data/audio_effects.xml:$(TARGET_COPY_OUT_VENDOR)/etc/audio_effects.xml \
|
||||
$(DEVICE_PATH)/audio/usb_audio_policy_configuration.xml:$(TARGET_COPY_OUT_VENDOR)/etc/usb_audio_policy_configuration.xml \
|
||||
frameworks/av/services/audiopolicy/config/audio_policy_volumes.xml:$(TARGET_COPY_OUT_VENDOR)/etc/audio_policy_volumes.xml \
|
||||
frameworks/av/services/audiopolicy/config/bluetooth_audio_policy_configuration_7_0.xml:$(TARGET_COPY_OUT_VENDOR)/etc/bluetooth_audio_policy_configuration_7_0.xml \
|
||||
frameworks/av/services/audiopolicy/config/default_volume_tables.xml:$(TARGET_COPY_OUT_VENDOR)/etc/default_volume_tables.xml \
|
||||
frameworks/av/services/audiopolicy/config/r_submix_audio_policy_configuration.xml:$(TARGET_COPY_OUT_VENDOR)/etc/r_submix_audio_policy_configuration.xml \
|
||||
frameworks/av/services/audiopolicy/config/usb_audio_policy_configuration.xml:$(TARGET_COPY_OUT_VENDOR)/etc/usb_audio_policy_configuration.xml
|
||||
frameworks/av/services/audiopolicy/config/r_submix_audio_policy_configuration.xml:$(TARGET_COPY_OUT_VENDOR)/etc/r_submix_audio_policy_configuration.xml
|
||||
|
||||
# Bluetooth
|
||||
PRODUCT_PACKAGES += \
|
||||
@@ -42,14 +37,6 @@ PRODUCT_COPY_FILES += \
|
||||
frameworks/native/data/etc/android.hardware.bluetooth.xml:$(TARGET_COPY_OUT_VENDOR)/etc/permissions/android.hardware.bluetooth.xml \
|
||||
frameworks/native/data/etc/android.hardware.bluetooth_le.xml:$(TARGET_COPY_OUT_VENDOR)/etc/permissions/android.hardware.bluetooth_le.xml
|
||||
|
||||
PRODUCT_PACKAGES += \
|
||||
android.hardware.bluetooth.audio-impl \
|
||||
audio.bluetooth.default
|
||||
|
||||
PRODUCT_COPY_FILES += \
|
||||
frameworks/av/services/audiopolicy/config/a2dp_in_audio_policy_configuration_7_0.xml:$(TARGET_COPY_OUT_VENDOR)/etc/a2dp_in_audio_policy_configuration_7_0.xml \
|
||||
frameworks/av/services/audiopolicy/config/bluetooth_audio_policy_configuration_7_0.xml:$(TARGET_COPY_OUT_VENDOR)/etc/bluetooth_audio_policy_configuration_7_0.xml
|
||||
|
||||
# Camera
|
||||
PRODUCT_PACKAGES += \
|
||||
com.android.hardware.camera.external.rpi5
|
||||
|
||||
@@ -1,22 +1,4 @@
|
||||
<compatibility-matrix version="1.0" type="framework" level="202504">
|
||||
<hal format="hidl">
|
||||
<name>android.hardware.audio</name>
|
||||
<transport>hwbinder</transport>
|
||||
<version>7.1</version>
|
||||
<interface>
|
||||
<name>IDevicesFactory</name>
|
||||
<instance>default</instance>
|
||||
</interface>
|
||||
</hal>
|
||||
<hal format="hidl">
|
||||
<name>android.hardware.audio.effect</name>
|
||||
<transport>hwbinder</transport>
|
||||
<version>7.0</version>
|
||||
<interface>
|
||||
<name>IEffectsFactory</name>
|
||||
<instance>default</instance>
|
||||
</interface>
|
||||
</hal>
|
||||
<hal format="aidl">
|
||||
<name>android.hardware.media.c2</name>
|
||||
<version>1</version>
|
||||
|
||||
21
manifest.xml
21
manifest.xml
@@ -1,20 +1 @@
|
||||
<manifest version="1.0" type="device" target-level="202504">
|
||||
<hal format="hidl">
|
||||
<name>android.hardware.audio</name>
|
||||
<transport>hwbinder</transport>
|
||||
<version>7.1</version>
|
||||
<interface>
|
||||
<name>IDevicesFactory</name>
|
||||
<instance>default</instance>
|
||||
</interface>
|
||||
</hal>
|
||||
<hal format="hidl">
|
||||
<name>android.hardware.audio.effect</name>
|
||||
<transport>hwbinder</transport>
|
||||
<version>7.0</version>
|
||||
<interface>
|
||||
<name>IEffectsFactory</name>
|
||||
<instance>default</instance>
|
||||
</interface>
|
||||
</hal>
|
||||
</manifest>
|
||||
<manifest version="1.0" type="device" target-level="202504" />
|
||||
|
||||
@@ -1,9 +1,6 @@
|
||||
# Audio
|
||||
persist.vendor.audio.device u:object_r:vendor_audio_config_prop:s0
|
||||
persist.vendor.audio.hdmi.device u:object_r:vendor_audio_config_prop:s0
|
||||
persist.vendor.audio.pcm.card.auto u:object_r:vendor_audio_config_prop:s0
|
||||
persist.vendor.audio.pcm.card u:object_r:vendor_audio_config_prop:s0
|
||||
persist.vendor.audio.pcm.device u:object_r:vendor_audio_config_prop:s0
|
||||
persist.vendor.audio.device u:object_r:vendor_audio_config_prop:s0
|
||||
persist.vendor.audio.pcm.card u:object_r:vendor_audio_config_prop:s0
|
||||
|
||||
# CEC
|
||||
persist.vendor.hdmi.cec_device u:object_r:vendor_hdmi_config_prop:s0
|
||||
|
||||
@@ -1,10 +1,8 @@
|
||||
# Audio
|
||||
persist.vendor.audio.device=dac
|
||||
persist.vendor.audio.hdmi.device=vc4hdmi0
|
||||
persist.vendor.audio.pcm.card.auto=true
|
||||
persist.vendor.audio.device=hdmi0
|
||||
ro.boot.audio.tinyalsa.simulate_input=true
|
||||
ro.config.media_vol_default=20
|
||||
ro.config.media_vol_steps=25
|
||||
ro.hardware.audio.primary=rpi_hdmi
|
||||
|
||||
# Bluetooth
|
||||
bluetooth.device.class_of_device?=90,2,12
|
||||
|
||||
Reference in New Issue
Block a user