summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDhananjay Kumar <dhakumar@codeaurora.org>2015-12-01 16:24:09 +0530
committerSteve Kondik <steve@cyngn.com>2016-04-30 20:40:09 -0700
commit4f1d6d3c3c8c2b77c4f560e170a34e0d69718352 (patch)
tree4324588c9688d3b18aebe151b46053186748ddf9
parent211004f06e472cefcbcd2e3e31bfff2d3eb332da (diff)
downloadhardware_qcom_audio-4f1d6d3c3c8c2b77c4f560e170a34e0d69718352.tar.gz
hardware_qcom_audio-4f1d6d3c3c8c2b77c4f560e170a34e0d69718352.tar.bz2
hardware_qcom_audio-4f1d6d3c3c8c2b77c4f560e170a34e0d69718352.zip
policy_hal: fix improper voice-playback concurrency handling
- setPhoneState checks call-state in audio hal to filter out unworthy usage of this API. - With M upgrade, change to update call-state with audio hal is removed, instead permission checks are introduced to prevent random usage of such APIs. But setPhoneState is still checking for this call-state causing improper concurrency handling. - Fix the issue by removing state check from setPhoneState. - Remove set and get for parameter "in_call" from voice_extn. Change-Id: I92fe10c617d6158976a0e07eed3275acb0aadd15
-rw-r--r--hal/voice.c2
-rw-r--r--hal/voice.h1
-rw-r--r--hal/voice_extn/voice_extn.c19
-rw-r--r--policy_hal/AudioPolicyManager.cpp14
4 files changed, 2 insertions, 34 deletions
diff --git a/hal/voice.c b/hal/voice.c
index e12d24f3..40aa8fbc 100644
--- a/hal/voice.c
+++ b/hal/voice.c
@@ -131,8 +131,6 @@ int voice_stop_usecase(struct audio_device *adev, audio_usecase_t usecase_id)
}
session->state.current = CALL_INACTIVE;
- if (adev->mode == AUDIO_MODE_NORMAL)
- adev->voice.is_in_call = false;
/* Disable sidetone only when no calls are active */
if (!voice_is_call_state_active(adev))
diff --git a/hal/voice.h b/hal/voice.h
index ec5418af..f0b8ac14 100644
--- a/hal/voice.h
+++ b/hal/voice.h
@@ -62,7 +62,6 @@ struct voice {
int tty_mode;
bool mic_mute;
float volume;
- bool is_in_call;
bool in_call;
};
diff --git a/hal/voice_extn/voice_extn.c b/hal/voice_extn/voice_extn.c
index 9bbd0f83..08c1efd3 100644
--- a/hal/voice_extn/voice_extn.c
+++ b/hal/voice_extn/voice_extn.c
@@ -41,7 +41,6 @@
#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
@@ -482,15 +481,6 @@ int voice_extn_set_parameters(struct audio_device *adev,
}
}
- 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);
@@ -522,19 +512,10 @@ void voice_extn_get_parameters(const struct audio_device *adev,
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) {
diff --git a/policy_hal/AudioPolicyManager.cpp b/policy_hal/AudioPolicyManager.cpp
index 408b90da..0986bbfc 100644
--- a/policy_hal/AudioPolicyManager.cpp
+++ b/policy_hal/AudioPolicyManager.cpp
@@ -680,7 +680,6 @@ void AudioPolicyManagerCustom::setPhoneState(audio_mode_t state)
sp<SwAudioOutputDescriptor> hwOutputDesc = mPrimaryOutput;
#ifdef VOICE_CONCURRENCY
- int voice_call_state = 0;
char propValue[PROPERTY_VALUE_MAX];
bool prop_playback_enabled = false, prop_rec_enabled=false, prop_voip_enabled = false;
@@ -696,19 +695,10 @@ void AudioPolicyManagerCustom::setPhoneState(audio_mode_t state)
prop_voip_enabled = atoi(propValue) || !strncmp("true", propValue, 4);
}
- bool mode_in_call = (AUDIO_MODE_IN_CALL != oldState) && (AUDIO_MODE_IN_CALL == state);
- //query if it is a actual voice call initiated by telephony
- if (mode_in_call) {
- String8 valueStr = mpClientInterface->getParameters((audio_io_handle_t)0, String8("in_call"));
- AudioParameter result = AudioParameter(valueStr);
- if (result.getInt(String8("in_call"), voice_call_state) == NO_ERROR)
- ALOGD("voice_conc:SetPhoneState: Voice call state = %d", voice_call_state);
- }
-
- if (mode_in_call && voice_call_state && !mvoice_call_state) {
+ if ((AUDIO_MODE_IN_CALL != oldState) && (AUDIO_MODE_IN_CALL == state)) {
ALOGD("voice_conc:Entering to call mode oldState :: %d state::%d ",
oldState, state);
- mvoice_call_state = voice_call_state;
+ mvoice_call_state = state;
if (prop_rec_enabled) {
//Close all active inputs
audio_io_handle_t activeInput = mInputs.getActiveInput();