Merge "hal: suppress redundant warning messages"
diff --git a/hal/audio_extn/spkr_protection.c b/hal/audio_extn/spkr_protection.c
index 9c30bbe..8c6ff06 100644
--- a/hal/audio_extn/spkr_protection.c
+++ b/hal/audio_extn/spkr_protection.c
@@ -1824,6 +1824,30 @@
}
}
+static bool fbsp_parms_allowed(struct str_parms *parms)
+{
+ if (str_parms_has_key(parms, AUDIO_PARAMETER_KEY_FBSP_TRIGGER_SPKR_CAL))
+ return true;
+ if (str_parms_has_key(parms, AUDIO_PARAMETER_KEY_FBSP_APPLY_SPKR_CAL))
+ return true;
+ if (str_parms_has_key(parms, AUDIO_PARAMETER_KEY_FBSP_GET_SPKR_CAL))
+ return true;
+ if (str_parms_has_key(parms, AUDIO_PARAMETER_KEY_FBSP_CFG_WAIT_TIME))
+ return true;
+ if (str_parms_has_key(parms, AUDIO_PARAMETER_KEY_FBSP_CFG_FTM_TIME))
+ return true;
+ if (str_parms_has_key(parms, AUDIO_PARAMETER_KEY_FBSP_GET_FTM_PARAM))
+ return true;
+ if (str_parms_has_key(parms, AUDIO_PARAMETER_KEY_FBSP_TRIGGER_V_VALI))
+ return true;
+ if (str_parms_has_key(parms, AUDIO_PARAMETER_KEY_FBSP_V_VALI_WAIT_TIME))
+ return true;
+ if (str_parms_has_key(parms, AUDIO_PARAMETER_KEY_FBSP_V_VALI_VALI_TIME))
+ return true;
+
+ return false;
+}
+
int fbsp_set_parameters(struct str_parms *parms)
{
int ret= 0 , err;
@@ -1841,9 +1865,14 @@
}
ALOGV_IF(kv_pairs != NULL, "%s: enter: %s", __func__, kv_pairs);
+ if (!fbsp_parms_allowed(parms)) {
+ ret = -EINVAL;
+ goto done;
+ }
+
len = strlen(kv_pairs);
value = (char*)calloc(len, sizeof(char));
- if(value == NULL) {
+ if (value == NULL) {
ret = -ENOMEM;
ALOGE("[%s] failed to allocate memory",__func__);
goto done;
diff --git a/hal/voice_extn/voice_extn.c b/hal/voice_extn/voice_extn.c
index 1f45a64..f08c73c 100644
--- a/hal/voice_extn/voice_extn.c
+++ b/hal/voice_extn/voice_extn.c
@@ -664,8 +664,6 @@
}
if(voice_extn_compress_voip_enabled)
voice_extn_compress_voip_get_parameters(query, reply);
- else
- ALOGE("%s: COMPRESS_VOIP feature is not enabled", __func__);
str = str_parms_to_str(reply);
ALOGV_IF(str != NULL, "%s: exit: returns \"%s\"", __func__, str);
@@ -678,8 +676,6 @@
{
if(voice_extn_compress_voip_enabled)
voice_extn_compress_voip_out_get_parameters(out, query, reply);
- else
- ALOGE("%s: COMPRESS_VOIP feature is not enabled", __func__);
}
void voice_extn_in_get_parameters(struct stream_in *in,
@@ -688,9 +684,6 @@
{
if(voice_extn_compress_voip_enabled)
voice_extn_compress_voip_in_get_parameters(in, query, reply);
- else
- ALOGE("%s: COMPRESS_VOIP feature is not enabled", __func__);
-
}
@@ -717,8 +710,6 @@
int ret = -ENOSYS;
if(voice_extn_compress_voip_enabled)
ret = compress_voip_set_parameters(adev, parms);
- else
- ALOGE("%s: COMPRESS_VOIP feature is not enabled", __func__);
return ret;
}
@@ -727,8 +718,6 @@
{
if(voice_extn_compress_voip_enabled)
compress_voip_get_parameters(query, reply);
- else
- ALOGE("%s: COMPRESS_VOIP feature is not enabled", __func__);
}
@@ -738,8 +727,6 @@
{
if(voice_extn_compress_voip_enabled)
compress_voip_out_get_parameters(out, query, reply);
- else
- ALOGE("%s: COMPRESS_VOIP feature is not enabled", __func__);
}
void voice_extn_compress_voip_in_get_parameters(struct stream_in *in,
@@ -748,8 +735,6 @@
{
if(voice_extn_compress_voip_enabled)
compress_voip_in_get_parameters(in, query, reply);
- else
- ALOGE("%s: COMPRESS_VOIP feature is not enabled", __func__);
}
int voice_extn_compress_voip_out_get_buffer_size(struct stream_out *out)
@@ -757,8 +742,6 @@
int ret = -1;
if(voice_extn_compress_voip_enabled)
ret = compress_voip_out_get_buffer_size(out);
- else
- ALOGE("%s: COMPRESS_VOIP feature is not enabled", __func__);
return ret;
}
@@ -767,8 +750,6 @@
int ret = -1;
if(voice_extn_compress_voip_enabled)
ret = compress_voip_in_get_buffer_size(in);
- else
- ALOGE("%s: COMPRESS_VOIP feature is not enabled", __func__);
return ret;
}
@@ -778,8 +759,6 @@
int ret = -1;
if(voice_extn_compress_voip_enabled)
ret = compress_voip_start_output_stream(out);
- else
- ALOGE("%s: COMPRESS_VOIP feature is not enabled", __func__);
return ret;
}
@@ -789,8 +768,6 @@
int ret = -1;
if(voice_extn_compress_voip_enabled)
ret = compress_voip_start_input_stream(in);
- else
- ALOGE("%s: COMPRESS_VOIP feature is not enabled", __func__);
return ret;
}
@@ -799,8 +776,6 @@
int ret = -1;
if(voice_extn_compress_voip_enabled)
ret = compress_voip_close_output_stream(stream);
- else
- ALOGE("%s: COMPRESS_VOIP feature is not enabled", __func__);
return ret;
}
@@ -810,8 +785,6 @@
int ret = -1;
if(voice_extn_compress_voip_enabled)
ret = compress_voip_close_input_stream(stream);
- else
- ALOGE("%s: COMPRESS_VOIP feature is not enabled", __func__);
return ret;
}
@@ -820,8 +793,6 @@
int ret = -1;
if(voice_extn_compress_voip_enabled)
ret = compress_voip_open_output_stream(out);
- else
- ALOGE("%s: COMPRESS_VOIP feature is not enabled", __func__);
return ret;
}
@@ -831,8 +802,6 @@
int ret = -1;
if(voice_extn_compress_voip_enabled)
ret = compress_voip_open_input_stream(in);
- else
- ALOGE("%s: COMPRESS_VOIP feature is not enabled", __func__);
return ret;
}
@@ -841,8 +810,6 @@
int ret = -1;
if(voice_extn_compress_voip_enabled)
ret = compress_voip_set_volume(adev, volume);
- else
- ALOGE("%s: COMPRESS_VOIP feature is not enabled", __func__);
return ret;
}
@@ -851,8 +818,6 @@
int ret = -1;
if(voice_extn_compress_voip_enabled)
ret = compress_voip_set_mic_mute(adev, state);
- else
- ALOGE("%s: COMPRESS_VOIP feature is not enabled", __func__);
return ret;
}
@@ -861,8 +826,6 @@
bool ret = false;
if(voice_extn_compress_voip_enabled)
ret = compress_voip_pcm_prop_check();
- else
- ALOGE("%s: COMPRESS_VOIP feature is not enabled", __func__);
return ret;
}
@@ -871,8 +834,6 @@
bool ret = false;
if(voice_extn_compress_voip_enabled)
ret = compress_voip_is_active(adev);
- else
- ALOGE("%s: COMPRESS_VOIP feature is not enabled", __func__);
return ret;
}
@@ -881,8 +842,6 @@
bool ret = false;
if(voice_extn_compress_voip_enabled)
ret = compress_voip_is_format_supported(format);
- else
- ALOGE("%s: COMPRESS_VOIP feature is not enabled", __func__);
return ret;
}
@@ -891,8 +850,6 @@
bool ret = false;
if(voice_extn_compress_voip_enabled)
ret = compress_voip_is_config_supported(config);
- else
- ALOGE("%s: COMPRESS_VOIP feature is not enabled", __func__);
return ret;
}
@@ -901,8 +858,6 @@
bool ret = false;
if(voice_extn_compress_voip_enabled)
ret = compress_voip_is_started(adev);
- else
- ALOGE("%s: COMPRESS_VOIP feature is not enabled", __func__);
return ret;
}
diff --git a/post_proc/asphere.c b/post_proc/asphere.c
index 65e8034..7b35a77 100644
--- a/post_proc/asphere.c
+++ b/post_proc/asphere.c
@@ -197,6 +197,18 @@
return asphere.init_status;
}
+static bool asphere_parms_allowed(struct str_parms *parms)
+{
+ if (str_parms_has_key(parms, AUDIO_PARAMETER_KEY_ASPHERE_ENABLE))
+ return true;
+ if (str_parms_has_key(parms, AUDIO_PARAMETER_KEY_ASPHERE_STRENGTH))
+ return true;
+ if (str_parms_has_key(parms, AUDIO_PARAMETER_KEY_ASPHERE_STATUS))
+ return true;
+
+ return false;
+}
+
void asphere_set_parameters(struct str_parms *parms)
{
int ret = 0;
@@ -205,6 +217,10 @@
char value[32] = {0};
bool set_enable = false, set_strength = false;
+ if (!asphere_parms_allowed(parms)) {
+ return;
+ }
+
if (asphere_init() != 1) {
ALOGW("%s: init check failed!!!", __func__);
return;