hal: Enhance voice concurrency support for 8916
- All VoIP, compress, deep buffer, record usecases need to close
before voice call setup and don't allow these usecases during
voice call on 8916.
- setMode(IN_CALL) itself is not sufficient to know if we are
in actual voice call.
- Add keyvalue parameters support to know if we are in voice call
and policy hal can query the same and make decissions based on it.
CRs-Fixed: 662804
Change-Id: I20d660fadd07c4d227a7e3dfe356fc39806ca167
diff --git a/hal/voice.c b/hal/voice.c
index bad9255..449c0c2 100644
--- a/hal/voice.c
+++ b/hal/voice.c
@@ -67,6 +67,8 @@
session = (struct voice_session *)voice_get_session_from_use_case(adev, usecase_id);
session->state.current = CALL_INACTIVE;
+ if (adev->mode == AUDIO_MODE_NORMAL)
+ adev->voice.is_in_call = false;
ret = platform_stop_voice_call(adev->platform, session->vsid);
diff --git a/hal/voice.h b/hal/voice.h
index 0098f94..4df2d6a 100644
--- a/hal/voice.h
+++ b/hal/voice.h
@@ -61,6 +61,7 @@
bool mic_mute;
float volume;
bool voice_device_set;
+ bool is_in_call;
};
enum {
diff --git a/hal/voice_extn/voice_extn.c b/hal/voice_extn/voice_extn.c
index d42cc53..ea25a4b 100644
--- a/hal/voice_extn/voice_extn.c
+++ b/hal/voice_extn/voice_extn.c
@@ -40,6 +40,7 @@
#define AUDIO_PARAMETER_KEY_ALL_CALL_STATES "all_call_states"
#define AUDIO_PARAMETER_KEY_DEVICE_MUTE "device_mute"
#define AUDIO_PARAMETER_KEY_DIRECTION "direction"
+#define AUDIO_PARAMETER_KEY_IN_CALL "in_call"
#define VOICE_EXTN_PARAMETER_VALUE_MAX_LEN 256
@@ -505,6 +506,15 @@
}
}
+ err = str_parms_get_str(parms, AUDIO_PARAMETER_KEY_IN_CALL, str_value,
+ sizeof(str_value));
+ if (err >= 0) {
+ str_parms_del(parms, AUDIO_PARAMETER_KEY_IN_CALL);
+ if (!strncmp("true", str_value, sizeof("true"))) {
+ adev->voice.is_in_call = true;
+ }
+ }
+
done:
ALOGV("%s: exit with code(%d)", __func__, ret);
free(kv_pairs);
@@ -536,10 +546,19 @@
int ret;
char value[VOICE_EXTN_PARAMETER_VALUE_MAX_LEN] = {0};
char *str = str_parms_to_str(query);
+ int val = 0;
ALOGV_IF(str != NULL, "%s: enter %s", __func__, str);
free(str);
+ ret = str_parms_get_str(query, AUDIO_PARAMETER_KEY_IN_CALL, value,
+ sizeof(value));
+ if (ret >=0) {
+ if (adev->voice.is_in_call)
+ val = 1;
+ str_parms_add_int(reply, AUDIO_PARAMETER_KEY_IN_CALL, val);
+ }
+
ret = str_parms_get_str(query, AUDIO_PARAMETER_KEY_AUDIO_MODE, value,
sizeof(value));
if (ret >= 0) {