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

Commit 9323d8bb authored by Alexy Joseph's avatar Alexy Joseph
Browse files

policy_hal: Support vr audio concurrency

Add support for falling back of VOIP using
FAST + RAW flags to primary output when VR
is going on. This is used to prevent
VOIP from having reverb enabled on it.
Other apps using FAST + RAW are expected
to honor focus

CRs-Fixed: 1099039
Change-Id: Idb2f0d4981b60b1cf8cc0836cb84d38803308ab4
parent 140f558c
Loading
Loading
Loading
Loading
+20 −0
Original line number Diff line number Diff line
@@ -1593,6 +1593,7 @@ audio_io_handle_t AudioPolicyManagerCustom::getOutputForDevice(
        // requested sample rate matches with that of voip input stream (if opened already)
        int value = 0;
        uint32_t mode = 0, voipOutCount = 1, voipSampleRate = 1;
        bool is_vr_mode_on = false;
        String8 valueStr = mpClientInterface->getParameters((audio_io_handle_t)0,
                                                           String8("audio_mode"));
        AudioParameter result = AudioParameter(valueStr);
@@ -1627,6 +1628,25 @@ audio_io_handle_t AudioPolicyManagerCustom::getOutputForDevice(
                }
            }
        }
        //IF VOIP is going to be started at the same time as when
        //vr is enabled, get VOIP to fallback to low latency
        String8 vr_value;
        valueStr =  mpClientInterface->getParameters((audio_io_handle_t)0,
                                              String8("vr_audio_mode_on"));
        result = AudioParameter(valueStr);
        if (result.get(String8("vr_audio_mode_on"), vr_value) == NO_ERROR) {
            is_vr_mode_on = vr_value.contains("true");
            ALOGI("VR mode is %d, switch to primary output if request is for fast|raw",
                is_vr_mode_on);
        }

        if (is_vr_mode_on) {
             //check the flags being requested for, and clear FAST|RAW
            flags = (audio_output_flags_t)(flags &
                (~(AUDIO_OUTPUT_FLAG_FAST|AUDIO_OUTPUT_FLAG_RAW)));

        }

    }

#ifdef VOICE_CONCURRENCY