Override vendor's usb_audio_policy_configuration

Android 8.1 added the support for new type of USB Audio devices
(USB_HEADSET, instead of old USB_DEVICE)
Some older USB devices got converted to this USB_HEADSET while still
using the old protocol.
There is no driver change needed, but the audio policy needs to be
changed.
Since vendors are simply using AOSP usb_audio_policy_configuration
Override it by ourself.
This commit is contained in:
Pierre-Hugues Husson 2018-04-01 00:21:03 +02:00
parent 0dcd4589e9
commit 1e27cc1157
4 changed files with 10 additions and 1 deletions

View File

@ -33,6 +33,9 @@ PRODUCT_COPY_FILES += \
device/phh/treble/ld.config.26.txt:system/etc/ld.config.26.txt \
device/phh/treble/ld.config.27.txt:system/etc/ld.config.27.txt \
#USB Audio
PRODUCT_COPY_FILES += \
frameworks/av/services/audiopolicy/config/usb_audio_policy_configuration.xml:system/etc/usb_audio_policy_configuration.xml
# NFC:
# Provide default libnfc-nci.conf file for devices that does not have one in

View File

@ -1,2 +1,3 @@
/system/bin/phh-su u:object_r:phhsu_exec:s0
/system/bin/vndk-detect u:object_r:vndk_detect_exec:s0
/system/etc/usb_audio_policy_configuration.xml u:object_r:vendor_configs_file:s0

View File

@ -11,6 +11,10 @@ allow vndk_detect toolbox_exec:file rx_file_perms;
allow vndk_detect system_file:file rx_file_perms;
#mount -o bind /system/bin/adbd /sbin/adbd
allow vndk_detect adbd_exec:file { getattr };
allow vndk_detect adbd_exec:file { getattr read };
allow vndk_detect rootfs:file { mounton getattr };
allow vndk_detect self:capability { sys_admin };
#mount -o bind /system/etc/usb_audio_policy_configuration.xml /vendor/etc/usb_audio_policy_configuration.xml
allow init vendor_configs_file:file { getattr mounton };

View File

@ -1,3 +1,4 @@
on post-fs
exec - root -- /system/bin/vndk-detect
mount none /system/etc/usb_audio_policy_configuration.xml /vendor/etc/usb_audio_policy_configuration.xml bind
export LD_CONFIG_FILE /system/etc/ld.config.${persist.sys.vndk}.txt