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

Commit 695b76b3 authored by Vlad Popa's avatar Vlad Popa
Browse files

Adjust code for stream bt sco replacement

When replaceStreamBtSco is active do not block volume command when voice
volume stream is requested together with active sco device

Flag: com.android.media.audio.replace_stream_bt_sco
Test: atest + manual tests
Bug: 345024266
Change-Id: I45c6424aa7c0043e695eba8ca1e93abfdb8ce981
parent d623175b
Loading
Loading
Loading
Loading
+10 −2
Original line number Diff line number Diff line
@@ -8473,11 +8473,19 @@ bool AudioPolicyManager::isVolumeConsistentForCalls(VolumeSource volumeSource,
                                                   bool& isBtScoVolSrc,
                                                   const char* caller) {
    const VolumeSource callVolSrc = toVolumeSource(AUDIO_STREAM_VOICE_CALL, false);
    const VolumeSource btScoVolSrc = toVolumeSource(AUDIO_STREAM_BLUETOOTH_SCO, false);
    isVoiceVolSrc = (volumeSource != VOLUME_SOURCE_NONE) && (callVolSrc == volumeSource);

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

    isVoiceVolSrc = (volumeSource != VOLUME_SOURCE_NONE) && (callVolSrc == volumeSource);
    if (com_android_media_audio_replace_stream_bt_sco()) {
        ALOGV("%s stream bt sco is replaced, no volume consistency check for calls", __func__);
        isBtScoVolSrc = (volumeSource != VOLUME_SOURCE_NONE) && (callVolSrc == volumeSource) &&
                        (isScoRequested || isHAUsed);
        return true;
    }

    const VolumeSource btScoVolSrc = toVolumeSource(AUDIO_STREAM_BLUETOOTH_SCO, false);
    isBtScoVolSrc = (volumeSource != VOLUME_SOURCE_NONE) && (btScoVolSrc == volumeSource);

    if ((callVolSrc != btScoVolSrc) &&