hal: suppress redundant warning messages
set_parameters() is a hotspot that is invoked most frequently, and
xxx_set_paramters() from various modules will be enumerated regardless
of parameters. Hence, warning mesasge should not be added in the path
to avoid message storm.
Change-Id: Ied41ce8990c8653275c66f3e379497667f13764f
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 aaed913..1457ad6 100644
--- a/hal/voice_extn/voice_extn.c
+++ b/hal/voice_extn/voice_extn.c
@@ -651,8 +651,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);
@@ -665,8 +663,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,
@@ -675,9 +671,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__);
-
}
#ifdef INCALL_MUSIC_ENABLED
@@ -702,8 +695,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;
}
@@ -712,8 +703,6 @@
{
if(voice_extn_compress_voip_enabled)
compress_voip_get_parameters(query, reply);
- else
- ALOGE("%s: COMPRESS_VOIP feature is not enabled", __func__);
}
@@ -723,8 +712,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,
@@ -733,8 +720,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)
@@ -742,8 +727,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;
}
@@ -752,8 +735,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;
}
@@ -763,8 +744,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;
}
@@ -774,8 +753,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;
}
@@ -784,8 +761,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;
}
@@ -795,8 +770,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;
}
@@ -805,8 +778,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;
}
@@ -816,8 +787,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;
}
@@ -826,8 +795,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;
}
@@ -836,8 +803,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;
}
@@ -846,8 +811,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;
}
@@ -856,8 +819,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;
}
@@ -866,8 +827,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;
}
@@ -876,8 +835,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;
}
@@ -886,8 +843,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;