AudioPolicyManager: fix closure of output supporting more than on device
When an output supports more than one device which is considered
as "distinguished on address", if one of these devices is closed,
the output is closed.
This CL fixes this behavior by adding a guard on no more available
device is supported by the given sw output.
Signed-off-by: Francois Gaffie <francois.gaffie@renault.com>
Change-Id: Ibc6da5a8b0f82c0f3f4ce33f781bfd84e597ac0f
diff --git a/services/audiopolicy/managerdefault/AudioPolicyManager.cpp b/services/audiopolicy/managerdefault/AudioPolicyManager.cpp
index cc2d8e8..6e943d8 100644
--- a/services/audiopolicy/managerdefault/AudioPolicyManager.cpp
+++ b/services/audiopolicy/managerdefault/AudioPolicyManager.cpp
@@ -5219,7 +5219,8 @@
if (!desc->isDuplicated()) {
// exact match on device
if (device_distinguishes_on_address(deviceType) && desc->supportsDevice(device)
- && desc->containsSingleDeviceSupportingEncodedFormats(device)) {
+ && desc->containsSingleDeviceSupportingEncodedFormats(device)
+ && !mAvailableOutputDevices.containsAtLeastOne(desc->supportedDevices())) {
outputs.add(mOutputs.keyAt(i));
} else if (!mAvailableOutputDevices.containsAtLeastOne(desc->supportedDevices())) {
ALOGV("checkOutputsForDevice(): disconnecting adding output %d",