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

Commit 9ed657a2 authored by Eric Laurent's avatar Eric Laurent Committed by Automerger Merge Worker
Browse files

Merge "audio policy: workaround for call signalling tones with hearing aids"...

Merge "audio policy: workaround for call signalling tones with hearing aids" into tm-dev am: 267bdb6f

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



Change-Id: I5bf8b3ec7f6228f96beafb096de2b5d82f6151d9
Signed-off-by: default avatarAutomerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
parents 73746060 267bdb6f
Loading
Loading
Loading
Loading
+17 −2
Original line number Diff line number Diff line
@@ -5539,6 +5539,7 @@ status_t AudioPolicyManager::initialize() {
        return status;
    }

    mEngine->updateDeviceSelectionCache();
    mCommunnicationStrategy = mEngine->getProductStrategyForAttributes(
        mEngine->getAttributesForStreamType(AUDIO_STREAM_VOICE_CALL));

@@ -6432,6 +6433,18 @@ bool AudioPolicyManager::isScoRequestedForComm() const {
    return false;
}

bool AudioPolicyManager::isHearingAidUsedForComm() const {
    DeviceVector devices = mEngine->getOutputDevicesForStream(AUDIO_STREAM_VOICE_CALL,
                                                       true /*fromCache*/);
    for (const auto &device : devices) {
        if (device->type() == AUDIO_DEVICE_OUT_HEARING_AID) {
            return true;
        }
    }
    return false;
}


void AudioPolicyManager::checkA2dpSuspend()
{
    audio_io_handle_t a2dpOutput = mOutputs.getA2dpOutput();
@@ -7229,11 +7242,13 @@ status_t AudioPolicyManager::checkAndSetVolume(IVolumeCurves &curves,
    bool isBtScoVolSrc = (volumeSource != VOLUME_SOURCE_NONE) && (btScoVolSrc == volumeSource);

    bool isScoRequested = isScoRequestedForComm();
    bool isHAUsed = isHearingAidUsedForComm();

    // do not change in call volume if bluetooth is connected and vice versa
    // if sco and call follow same curves, bypass forceUseForComm
    if ((callVolSrc != btScoVolSrc) &&
            ((isVoiceVolSrc && isScoRequested) ||
             (isBtScoVolSrc && !isScoRequested))) {
             (isBtScoVolSrc && !(isScoRequested || isHAUsed)))) {
        ALOGV("%s cannot set volume group %d volume when is%srequested for comm", __func__,
             volumeSource, isScoRequested ? " " : " not ");
        // Do not return an error here as AudioService will always set both voice call
+2 −0
Original line number Diff line number Diff line
@@ -1189,6 +1189,8 @@ private:

        bool isScoRequestedForComm() const;

        bool isHearingAidUsedForComm() const;

        bool areAllActiveTracksRerouted(const sp<SwAudioOutputDescriptor>& output);

        /**