audiopolicy: Fix sofware bridge creation for AudioHAL supporting routing APIs
AudioPolicy roughly checks if HAL supports routing APIs 3.0 to enable or
not software bridge in case of device to device patch requests.
However, Audio HAL declares in XML file routes supported. AudioPolicy
shall refine its decision upon information available in the policy configuration
file.
Test: Audio smoke tests.
Test: CTS tests for AudioRecord, AudioTrack and AudioEffect
Change-Id: Idc2e1ccd7d9fb6385f9a05ee002bec045e608232
Signed-off-by: Francois Gaffie <francois.gaffie@renault.com>
diff --git a/services/audiopolicy/managerdefault/AudioPolicyManager.cpp b/services/audiopolicy/managerdefault/AudioPolicyManager.cpp
index 02f6f5a..d13253d 100644
--- a/services/audiopolicy/managerdefault/AudioPolicyManager.cpp
+++ b/services/audiopolicy/managerdefault/AudioPolicyManager.cpp
@@ -3083,8 +3083,10 @@
// create a software bridge in PatchPanel if:
// - source and sink devices are on different HW modules OR
// - audio HAL version is < 3.0
+ // - audio HAL version is >= 3.0 but no route has been declared between devices
if (!srcDeviceDesc->hasSameHwModuleAs(sinkDeviceDesc) ||
- (srcDeviceDesc->mModule->getHalVersionMajor() < 3)) {
+ (srcDeviceDesc->mModule->getHalVersionMajor() < 3) ||
+ !srcDeviceDesc->mModule->supportsPatch(srcDeviceDesc, sinkDeviceDesc)) {
// support only one sink device for now to simplify output selection logic
if (patch->num_sinks > 1) {
return INVALID_OPERATION;