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

Commit af6d36f2 authored by Eric Laurent's avatar Eric Laurent
Browse files

audio policy: do not consider telephony TX device as a local device

Exclude playback over AUDIO_DEVICE_OUT_TELEPHONY_TX when evaluating
local playback activity on a HW module as this is a virtual device
injecting audio to telephony TX path and as such not interfering
with local playback.

Bug: 159480161
Test: repro steps in bug
Change-Id: I8cd27acc0033725fa66f95c7661c58b38d31532a
parent f00b91b9
Loading
Loading
Loading
Loading
+8 −2
Original line number Diff line number Diff line
@@ -690,7 +690,9 @@ bool SwAudioOutputCollection::isActiveLocally(VolumeSource volumeSource, uint32_
        const sp<SwAudioOutputDescriptor> outputDesc = this->valueAt(i);
        if (outputDesc->isActive(volumeSource, inPastMs, sysTime)
                && (!(outputDesc->devices()
                        .containsDeviceAmongTypes(getAllOutRemoteDevices())))) {
                        .containsDeviceAmongTypes(getAllOutRemoteDevices())
                        || outputDesc->devices()
                            .onlyContainsDevicesWithType(AUDIO_DEVICE_OUT_TELEPHONY_TX)))) {
            return true;
        }
    }
@@ -722,9 +724,13 @@ bool SwAudioOutputCollection::isStrategyActiveOnSameModule(product_strategy_t ps
        const sp<SwAudioOutputDescriptor> otherDesc = valueAt(i);
        if (desc->sharesHwModuleWith(otherDesc) &&
                otherDesc->isStrategyActive(ps, inPastMs, sysTime)) {
            if (desc == otherDesc
                    || !otherDesc->devices()
                            .onlyContainsDevicesWithType(AUDIO_DEVICE_OUT_TELEPHONY_TX)) {
                return true;
            }
        }
    }
    return false;
}