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

Commit 329ddab0 authored by Abhijith Shastry's avatar Abhijith Shastry
Browse files

Do not cap volume for ring stream when voice stream has been programatically

muted.

Test: Manual
Bug: 131171138
Change-Id: Iea9aaa618cfef60cae592a8a21026d59212c0740
parent 34a740d5
Loading
Loading
Loading
Loading
+10 −1
Original line number Original line Diff line number Diff line
@@ -5685,7 +5685,16 @@ float AudioPolicyManager::computeVolume(IVolumeCurves &curves,
        const float maxVoiceVolDb =
        const float maxVoiceVolDb =
                computeVolume(voiceCurves, callVolumeSrc, voiceVolumeIndex, device)
                computeVolume(voiceCurves, callVolumeSrc, voiceVolumeIndex, device)
                + IN_CALL_EARPIECE_HEADROOM_DB;
                + IN_CALL_EARPIECE_HEADROOM_DB;
        if (volumeDb > maxVoiceVolDb) {
        // FIXME: Workaround for call screening applications until a proper audio mode is defined
        // to support this scenario : Exempt the RING stream from the audio cap if the audio was
        // programmatically muted.
        // VOICE_CALL stream has minVolumeIndex > 0 : Users cannot set the volume of voice calls to
        // 0. We don't want to cap volume when the system has programmatically muted the voice call
        // stream. See setVolumeCurveIndex() for more information.
        bool exemptFromCapping = (volumeSource == ringVolumeSrc) && (voiceVolumeIndex == 0);
        ALOGV_IF(exemptFromCapping, "%s volume source %d at vol=%f not capped", __func__,
                 volumeSource, volumeDb);
        if ((volumeDb > maxVoiceVolDb) && !exemptFromCapping) {
            ALOGV("%s volume source %d at vol=%f overriden by volume group %d at vol=%f", __func__,
            ALOGV("%s volume source %d at vol=%f overriden by volume group %d at vol=%f", __func__,
                  volumeSource, volumeDb, callVolumeSrc, maxVoiceVolDb);
                  volumeSource, volumeDb, callVolumeSrc, maxVoiceVolDb);
            volumeDb = maxVoiceVolDb;
            volumeDb = maxVoiceVolDb;