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

Commit 84c05cdc authored by Eric Laurent's avatar Eric Laurent
Browse files

audio policy: limit voice call index to max index

Workaround for issue 111194621: limit voice call volume
index to max value before computing voice volume.

Bug: 111194621
Test: repro steps in bug.
Change-Id: Id965a3cc9d0d20900c910f43f41d998917e6040d
parent 93cef54d
Loading
Loading
Loading
Loading
+8 −1
Original line number Diff line number Diff line
@@ -5541,7 +5541,14 @@ status_t AudioPolicyManager::checkAndSetVolume(audio_stream_type_t stream,
        float voiceVolume;
        // Force voice volume to max for bluetooth SCO as volume is managed by the headset
        if (stream == AUDIO_STREAM_VOICE_CALL) {
            voiceVolume = (float)index/(float)mVolumeCurves->getVolumeIndexMax(stream);
            // FIXME: issue 111194621: this should not happen
            int maxIndex = mVolumeCurves->getVolumeIndexMax(stream);
            if (index > maxIndex) {
                ALOGW("%s limiting voice call index %d to max index %d",
                      __FUNCTION__, index, maxIndex);
                index = maxIndex;
            }
            voiceVolume = (float)index/(float)maxIndex;
        } else {
            voiceVolume = 1.0;
        }