Merge "AudioPolicyManager: fix closure of output supporting more than on device" am: b1b4ddf70c am: 8e799747de am: dac9e956f0 am: 94af2ae592 am: f687acb5cb

Original change: https://android-review.googlesource.com/c/platform/frameworks/av/+/1863726

Change-Id: Iac028910bc949f61caf5e8537fa6f7f71dd07092
diff --git a/services/audiopolicy/managerdefault/AudioPolicyManager.cpp b/services/audiopolicy/managerdefault/AudioPolicyManager.cpp
index a46da41..6221c05 100644
--- a/services/audiopolicy/managerdefault/AudioPolicyManager.cpp
+++ b/services/audiopolicy/managerdefault/AudioPolicyManager.cpp
@@ -5457,7 +5457,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",