sonyxperiadev / device-sony-common

70 stars 139 forks source link

[T] Remove reliance on deprecated a2dp/hearing_aid system audio modules #899

Closed MarijnS95 closed 1 year ago

MarijnS95 commented 1 year ago

Android finally cut down on vendor access to the system-only audio.a2dp.default and audio.hearing_aid.default libhardware modules, which have already been deprecated and replaced with the much more modern HIDL+fqm audio.bluetooth.default vendor libhardware module. The modules reside on /system where they can't be loaded anyway when VNDK is enabled:

E DevicesFactoryHAL: loadAudioInterface couldn't load audio hw module audio.a2dp (No such file or directory)
W DevicesFactoryHalHidl: The specified device name is not recognized: "a2dp"
E AudioFlinger: loadHwModule() error -22 loading module a2dp
W APM_AudioPolicyManager: could not open HW module a2dp

This policy isn't reachable anyway unless the new Bluetooth Audio HAL is explicitly disabled by setting persist.bluetooth.bluetooth_audio_hal.disabled to true.

Besides removing this request for libraries that are only installed to /system - which isn't compatible with GSI! - delete/exclude any fallback policy files that are pointing to this a2dp/hearing_aid module (which were previously introduced/retained only to have an easy-out if the Bluetooth Audio HAL acted up, but have fortunately never been used 🎉).

Only AUDIO_DEVICE_IN_BLUETOOTH_A2DP is now unsupported, but phones never function as an a2dp sink anyway (this is typically reserved for infotainment systems) and call microphone audio still travels over good-old 8kHz/16kHz HFP SCO via AUDIO_DEVICE_IN_BLUETOOTH_SCO_HEADSET (and hopefully LC3 through Bluetooth LE Audio when we enable that soon).


Note that this is WIP until the matching platform PRs are submitted, and properly tested on-device - on at least T some services fail to start properly, rendering A2DP to not work at all.