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

Commit 7731b5ad authored by Eric Laurent's avatar Eric Laurent
Browse files

audio policy: fix notification + voicemail routing

Consider an active VOICE_CALL stream as an indication
that notification routing and volume should match voice call routing.

Also limit notification volume to match current VOICE_CALL volume index,
not just VOICE_CALL volume curve with notification volume index.

Bug: 74019016
Test: manual: receive notification while listening to voicemail and
check volume and routing.

Change-Id: Ia9309bdb10b42f6a4fa8745daf3129c90d44f0b8
parent 79d1ed9b
Loading
Loading
Loading
Loading
+2 −2
Original line number Diff line number Diff line
@@ -266,7 +266,7 @@ audio_devices_t Engine::getDeviceForStrategyInt(routing_strategy strategy,
        break;

    case STRATEGY_SONIFICATION_RESPECTFUL:
        if (isInCall()) {
        if (isInCall() || outputs.isStreamActiveLocally(AUDIO_STREAM_VOICE_CALL)) {
            device = getDeviceForStrategyInt(
                    STRATEGY_SONIFICATION, availableOutputDevices, availableInputDevices, outputs,
                    outputDeviceTypesToIgnore);
@@ -409,7 +409,7 @@ audio_devices_t Engine::getDeviceForStrategyInt(routing_strategy strategy,

        // If incall, just select the STRATEGY_PHONE device: The rest of the behavior is handled by
        // handleIncallSonification().
        if (isInCall()) {
        if (isInCall() || outputs.isStreamActiveLocally(AUDIO_STREAM_VOICE_CALL)) {
            device = getDeviceForStrategyInt(
                    STRATEGY_PHONE, availableOutputDevices, availableInputDevices, outputs,
                    outputDeviceTypesToIgnore);
+7 −3
Original line number Diff line number Diff line
@@ -5116,7 +5116,8 @@ float AudioPolicyManager::computeVolume(audio_stream_type_t stream,
    }

    // in-call: always cap earpiece volume by voice volume + some low headroom
    if ((stream != AUDIO_STREAM_VOICE_CALL) && (device & AUDIO_DEVICE_OUT_EARPIECE) && isInCall()) {
    if ((stream != AUDIO_STREAM_VOICE_CALL) && (device & AUDIO_DEVICE_OUT_EARPIECE) &&
            (isInCall() || mOutputs.isStreamActiveLocally(AUDIO_STREAM_VOICE_CALL))) {
        switch (stream) {
        case AUDIO_STREAM_SYSTEM:
        case AUDIO_STREAM_RING:
@@ -5126,7 +5127,10 @@ float AudioPolicyManager::computeVolume(audio_stream_type_t stream,
        case AUDIO_STREAM_ENFORCED_AUDIBLE:
        case AUDIO_STREAM_DTMF:
        case AUDIO_STREAM_ACCESSIBILITY: {
            const float maxVoiceVolDb = computeVolume(AUDIO_STREAM_VOICE_CALL, index, device)
            int voiceVolumeIndex =
                mVolumeCurves->getVolumeIndex(AUDIO_STREAM_VOICE_CALL, AUDIO_DEVICE_OUT_EARPIECE);
            const float maxVoiceVolDb =
                computeVolume(AUDIO_STREAM_VOICE_CALL, voiceVolumeIndex, AUDIO_DEVICE_OUT_EARPIECE)
                + IN_CALL_EARPIECE_HEADROOM_DB;
            if (volumeDB > maxVoiceVolDb) {
                ALOGV("computeVolume() stream %d at vol=%f overriden by stream %d at vol=%f",