Audio policy: fix areAllDevicesSupported()
Fix areAllDevicesSupported() where HwModules.getDeviceDescriptor()
must be called with matchAddress == true: if the caller does not want to
distinguish on address it can leave the address field empty in the
AudioDeviceTypeAddr passed which has the same effect as using
matchAddress == false.
Also fix places where device_distinguishes_on_address() was improperly
used in place of audio_is_remote_submix_device().
Bug: 155224229
Test: build and launch car emulator
Test: AudioHostTest
Test: AudioServiceHostTest
Test: audiopolicy_tests
Test: manual mirroring and car projection tests
Change-Id: I74295de95bcd82e7fa439c396ae32749b9c70c05
diff --git a/services/audiopolicy/managerdefault/AudioPolicyManager.cpp b/services/audiopolicy/managerdefault/AudioPolicyManager.cpp
index 5683e69..13e2093 100644
--- a/services/audiopolicy/managerdefault/AudioPolicyManager.cpp
+++ b/services/audiopolicy/managerdefault/AudioPolicyManager.cpp
@@ -3072,7 +3072,7 @@
for (size_t i = 0; i < devices.size(); i++) {
sp<DeviceDescriptor> devDesc = mHwModules.getDeviceDescriptor(
devices[i].mType, devices[i].mAddress.c_str(), String8(),
- AUDIO_FORMAT_DEFAULT, false /*allowToCreate*/, false /*matchAddress*/);
+ AUDIO_FORMAT_DEFAULT, false /*allowToCreate*/, true /*matchAddress*/);
if (devDesc == nullptr || (predicate != nullptr && !predicate(devices[i].mType))) {
ALOGE("%s: device type %#x address %s not supported or not an output device",
context, devices[i].mType, devices[i].mAddress.c_str());
@@ -4837,7 +4837,7 @@
if (output != AUDIO_IO_HANDLE_NONE) {
addOutput(output, desc);
- if (device_distinguishes_on_address(deviceType) && address != "0") {
+ if (audio_is_remote_submix_device(deviceType) && address != "0") {
sp<AudioPolicyMix> policyMix;
if (mPolicyMixes.getAudioPolicyMix(deviceType, address, policyMix)
== NO_ERROR) {