Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 0e26e3f9 authored by Eric Laurent's avatar Eric Laurent
Browse files

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
parent ec660f18
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -320,7 +320,7 @@ sp<DeviceDescriptor> HwModuleCollection::getDeviceDescriptor(const audio_devices
{
    String8 devAddress = (address == nullptr || !matchAddress) ? String8("") : String8(address);
    // handle legacy remote submix case where the address was not always specified
    if (device_distinguishes_on_address(deviceType) && (devAddress.length() == 0)) {
    if (audio_is_remote_submix_device(deviceType) && (devAddress.length() == 0)) {
        devAddress = String8("0");
    }

+2 −2
Original line number Diff line number Diff line
@@ -3072,7 +3072,7 @@ bool AudioPolicyManager::areAllDevicesSupported(
    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 @@ status_t AudioPolicyManager::checkOutputsForDevice(const sp<DeviceDescriptor>& d

                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) {