No need to reopen output when the active media devices is empty.
The active media devices will be used to reopen outputs to use the best
profile. When the active media devices is empty, there is no need to
reopen the outputs.
Bug: 183980515
Test: connect/disconnect BT device
Change-Id: I483bb001d6e196bf448d039230cc36a5b4cdbdfe
diff --git a/services/audiopolicy/managerdefault/AudioPolicyManager.cpp b/services/audiopolicy/managerdefault/AudioPolicyManager.cpp
index 2b9f8d7..94e8d30 100644
--- a/services/audiopolicy/managerdefault/AudioPolicyManager.cpp
+++ b/services/audiopolicy/managerdefault/AudioPolicyManager.cpp
@@ -284,7 +284,7 @@
setOutputDevices(desc, newDevices, force, 0);
}
if (!desc->isDuplicated() && desc->mProfile->hasDynamicAudioProfile() &&
- desc->devices() != activeMediaDevices &&
+ !activeMediaDevices.empty() && desc->devices() != activeMediaDevices &&
desc->supportsDevicesForPlayback(activeMediaDevices)) {
// Reopen the output to query the dynamic profiles when there is not active
// clients or all active clients will be rerouted. Otherwise, set the flag