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
diff --git a/policy_hal/AudioPolicyManager.cpp b/policy_hal/AudioPolicyManager.cpp
index 147c03c..cb22dc7 100644
--- a/policy_hal/AudioPolicyManager.cpp
+++ b/policy_hal/AudioPolicyManager.cpp
@@ -1593,6 +1593,7 @@
// 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 @@
}
}
}
+ //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