audio policy: engine configurable: fix support of multiple devices of same type
The configurable policy is using criteria for the available devices based on
the type. If multiple devices of the same type (as remote submix) are removed
and added, the bit associated to this type within the criterion shall be set
as far as at least one device of this type is connected.
It was not the case, this patch is fixing this issue.
Change-Id: Id6a83b753907a9b0f07bf8552e50ee28e990a83e
Signed-off-by: François Gaffie <francois.gaffie@intel.com>
diff --git a/services/audiopolicy/engineconfigurable/src/Engine.cpp b/services/audiopolicy/engineconfigurable/src/Engine.cpp
index 32341ec..074af50 100755
--- a/services/audiopolicy/engineconfigurable/src/Engine.cpp
+++ b/services/audiopolicy/engineconfigurable/src/Engine.cpp
@@ -246,10 +246,17 @@
return mPolicyParameterMgr->getForceUse(usage);
}
-status_t Engine::setDeviceConnectionState(audio_devices_t devices, audio_policy_dev_state_t state,
- const char *deviceAddress)
+status_t Engine::setDeviceConnectionState(const sp<DeviceDescriptor> devDesc,
+ audio_policy_dev_state_t /*state*/)
{
- return mPolicyParameterMgr->setDeviceConnectionState(devices, state, deviceAddress);
+ if (audio_is_output_device(devDesc->type())) {
+ return mPolicyParameterMgr->setAvailableOutputDevices(
+ mApmObserver->getAvailableOutputDevices().types());
+ } else if (audio_is_input_device(devDesc->type())) {
+ return mPolicyParameterMgr->setAvailableInputDevices(
+ mApmObserver->getAvailableInputDevices().types());
+ }
+ return BAD_TYPE;
}
template <>