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

Commit 6272e444 authored by Abhijith Shastry's avatar Abhijith Shastry Committed by android-build-merger
Browse files

Merge "Do not cap volume for ring stream when voice stream has been...

Merge "Do not cap volume for ring stream when voice stream has been programatically muted." into qt-dev
am: e905b6b1

Change-Id: Ie2a7c6e54ee3b6239074b9ee28748821dc9ffa0a
parents 90383f07 e905b6b1
Loading
Loading
Loading
Loading
+10 −1
Original line number Diff line number Diff line
@@ -5685,7 +5685,16 @@ float AudioPolicyManager::computeVolume(IVolumeCurves &curves,
        const float maxVoiceVolDb =
                computeVolume(voiceCurves, callVolumeSrc, voiceVolumeIndex, device)
                + 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__,
                  volumeSource, volumeDb, callVolumeSrc, maxVoiceVolDb);
            volumeDb = maxVoiceVolDb;