Merge "hal: add support for all_call_states key"

This commit is contained in:
Linux Build Service Account 2014-01-09 15:54:56 -08:00 committed by Gerrit - the friendly Code Review server
commit 7954540556
4 changed files with 53 additions and 10 deletions

View File

@ -2008,7 +2008,7 @@ static int adev_open_output_stream(struct audio_hw_device *dev,
{
struct audio_device *adev = (struct audio_device *)dev;
struct stream_out *out;
int i, ret;
int i, ret = 0;
ALOGV("%s: enter: sample_rate(%d) channel_mask(%#x) devices(%#x) flags(%#x)",
__func__, config->sample_rate, config->channel_mask, devices, flags);
@ -2332,7 +2332,7 @@ static char* adev_get_parameters(const struct audio_hw_device *dev,
pthread_mutex_lock(&adev->lock);
audio_extn_get_parameters(adev, query, reply);
voice_extn_get_parameters(adev, query, reply);
voice_get_parameters(adev, query, reply);
platform_get_parameters(adev->platform, query, reply);
str = str_parms_to_str(reply);
str_parms_destroy(query);

View File

@ -351,6 +351,13 @@ int voice_stop_call(struct audio_device *adev)
return ret;
}
void voice_get_parameters(struct audio_device *adev,
struct str_parms *query,
struct str_parms *reply)
{
voice_extn_get_parameters(adev, query, reply);
}
int voice_set_parameters(struct audio_device *adev, struct str_parms *parms)
{
char *str;

View File

@ -72,6 +72,8 @@ enum {
int voice_start_call(struct audio_device *adev);
int voice_stop_call(struct audio_device *adev);
int voice_set_parameters(struct audio_device *adev, struct str_parms *parms);
void voice_get_parameters(struct audio_device *adev, struct str_parms *query,
struct str_parms *reply);
void voice_init(struct audio_device *adev);
bool voice_is_in_call(struct audio_device *adev);
int voice_set_mic_mute(struct audio_device *dev, bool state);

View File

@ -18,7 +18,7 @@
*/
#define LOG_TAG "voice_extn"
/*#define LOG_NDEBUG 0*/
#define LOG_NDEBUG 0
#define LOG_NDDEBUG 0
#include <errno.h>
@ -34,8 +34,12 @@
#include "platform_api.h"
#include "voice_extn.h"
#define AUDIO_PARAMETER_KEY_VSID "vsid"
#define AUDIO_PARAMETER_KEY_CALL_STATE "call_state"
#define AUDIO_PARAMETER_KEY_VSID "vsid"
#define AUDIO_PARAMETER_KEY_CALL_STATE "call_state"
#define AUDIO_PARAMETER_KEY_AUDIO_MODE "audio_mode"
#define AUDIO_PARAMETER_KEY_ALL_CALL_STATES "all_call_states"
#define VOICE_EXTN_PARAMETER_VALUE_MAX_LEN 256
#define VOICE2_VSID 0x10DC1000
#define VOLTE_VSID 0x10C02000
@ -432,7 +436,7 @@ int voice_extn_set_parameters(struct audio_device *adev,
goto done;
}
} else {
ALOGD("%s: Not handled here", __func__);
ALOGV("%s: Not handled here", __func__);
}
done:
@ -440,21 +444,51 @@ done:
return ret;
}
int get_all_call_states_str(const struct audio_device *adev,
char *value)
{
int ret = 0;
char *cur_ptr = value;
int i, len=0;
for (i = 0; i < MAX_VOICE_SESSIONS; i++) {
snprintf(cur_ptr, VOICE_EXTN_PARAMETER_VALUE_MAX_LEN - len,
"%d:%d,",adev->voice.session[i].vsid,
adev->voice.session[i].state.current);
len = strlen(cur_ptr);
cur_ptr = cur_ptr + len;
}
ALOGV("%s:value=%s", __func__, value);
return ret;
}
void voice_extn_get_parameters(const struct audio_device *adev,
struct str_parms *query,
struct str_parms *reply)
{
int ret;
char value[32]={0};
char value[VOICE_EXTN_PARAMETER_VALUE_MAX_LEN] = {0};
char *str = NULL;
ret = str_parms_get_str(query, "audio_mode", value,
ALOGV("%s: enter %s", __func__, str_parms_to_str(query));
ret = str_parms_get_str(query, AUDIO_PARAMETER_KEY_AUDIO_MODE, value,
sizeof(value));
if (ret >= 0) {
str_parms_add_int(reply, "audio_mode", adev->mode);
str_parms_add_int(reply, AUDIO_PARAMETER_KEY_AUDIO_MODE, adev->mode);
}
ALOGV("%s: returns %s", __func__, str_parms_to_str(reply));
ret = str_parms_get_str(query, AUDIO_PARAMETER_KEY_ALL_CALL_STATES,
value, sizeof(value));
if (ret >= 0) {
ret = get_all_call_states_str(adev, value);
if (ret) {
ALOGE("%s: Error fetching call states, err:%d", __func__, ret);
return;
}
str_parms_add_str(reply, AUDIO_PARAMETER_KEY_ALL_CALL_STATES, value);
}
ALOGV("%s: exit: returns \"%s\"", __func__, str_parms_to_str(reply));
}
void voice_extn_out_get_parameters(struct stream_out *out,