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

Commit 6015dfc9 authored by James E. Blair's avatar James E. Blair Committed by Jean-Baptiste Queru
Browse files

Fix issue #1324: No audible call-waiting indication when in-call volume

is low

http://code.google.com/p/android/issues/detail?id=1324
Re-base the internally generated in-call audio volume so that it is
never muted, which is already the case for the hardware routed in-call
audio.
parent 007452f7
Loading
Loading
Loading
Loading
+14 −1
Original line number Diff line number Diff line
@@ -800,13 +800,21 @@ status_t AudioFlinger::setStreamVolume(int stream, float value)
        return BAD_VALUE;
    }

    mStreamTypes[stream].volume = value;
    status_t ret = NO_ERROR;
    if (stream == AudioTrack::VOICE_CALL) {
        AutoMutex lock(mHardwareLock);
        mHardwareStatus = AUDIO_SET_VOICE_VOLUME;
        ret = mAudioHardware->setVoiceVolume(value);
        mHardwareStatus = AUDIO_HW_IDLE;
        // FIXME: This is a temporary fix to re-base the internally
        // generated in-call audio so that it is never muted, which is
        // already the case for the hardware routed in-call audio.
        // When audio stream handling is reworked, this should be
        // addressed more cleanly.  Fixes #1324; see discussion at
        // http://review.source.android.com/8224
        mStreamTypes[stream].volume = value * (1.0 - 1.0 / 6.0) + (1.0 / 6.0);
    } else {
        mStreamTypes[stream].volume = value;
    }
    return ret;
}
@@ -830,6 +838,11 @@ float AudioFlinger::streamVolume(int stream) const
    if (uint32_t(stream) >= AudioTrack::NUM_STREAM_TYPES) {
        return 0.0f;
    }
    if (stream == AudioTrack::VOICE_CALL) {
        // FIXME: Re-base internally generated in-call audio,
        // reverse of above in setStreamVolume.
        return (mStreamTypes[stream].volume - (1.0 / 6.0)) / (1.0 - 1.0 / 6.0);
    }
    return mStreamTypes[stream].volume;
}