audiopolicy: apm: connectAudioSource: use Sw brigding according to hal support
Even if the implementation is not ready, this patch updates the conditions
of audio patch creation delegation to audio hal not only if HAL
is at least supporting 3.0 routing API but also has declared within
policy configuration file that a route between Device port is supported.
If the route is not declared in configuration file, Audio HAL is not able
to do the connexion, let AudioFlinger do the the Sw Bridging.
Test: Audio smoke tests.
Test: CTS tests for AudioRecord, AudioTrack and AudioEffect
Change-Id: I6ed11be04473be2edfcf16e922d1c6864184b6cd
Signed-off-by: François Gaffie <francois.gaffie@renault.com>
diff --git a/services/audiopolicy/managerdefault/AudioPolicyManager.cpp b/services/audiopolicy/managerdefault/AudioPolicyManager.cpp
index d13253d..ec1b9ea 100644
--- a/services/audiopolicy/managerdefault/AudioPolicyManager.cpp
+++ b/services/audiopolicy/managerdefault/AudioPolicyManager.cpp
@@ -3430,14 +3430,14 @@
audio_patch_handle_t afPatchHandle = AUDIO_PATCH_HANDLE_NONE;
- if (srcDeviceDesc->getAudioPort()->mModule->getHandle() ==
- sinkDeviceDesc->getAudioPort()->mModule->getHandle() &&
+ if (srcDeviceDesc->hasSameHwModuleAs(sinkDeviceDesc) &&
srcDeviceDesc->getAudioPort()->mModule->getHalVersionMajor() >= 3 &&
+ sinkDeviceDesc->mModule->supportsPatch(srcDeviceDesc, sinkDeviceDesc) &&
srcDeviceDesc->getAudioPort()->mGains.size() > 0) {
- ALOGV("%s AUDIO_DEVICE_API_VERSION_3_0", __FUNCTION__);
+ ALOGV("%s Device to Device route supported by >=3.0 HAL", __FUNCTION__);
// TODO: may explicitly specify whether we should use HW or SW patch
- // create patch between src device and output device
- // create Hwoutput and add to mHwOutputs
+ // create patch between src device and output device
+ // create Hwoutput and add to mHwOutputs
} else {
audio_attributes_t resultAttr;
audio_io_handle_t output = AUDIO_IO_HANDLE_NONE;