Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 785f153c authored by Weiyin Jiang's avatar Weiyin Jiang
Browse files

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
parent 091fa39d
Loading
Loading
Loading
Loading
+30 −1
Original line number Diff line number Diff line
@@ -1824,6 +1824,30 @@ static void spkr_v_vali_thread_create()
    }
}

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,6 +1865,11 @@ int fbsp_set_parameters(struct str_parms *parms)
    }
    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) {
+0 −45
Original line number Diff line number Diff line
@@ -651,8 +651,6 @@ void voice_extn_get_parameters(const struct audio_device *adev,
    }
    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 @@ void voice_extn_out_get_parameters(struct stream_out *out,
{
    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 @@ void voice_extn_in_get_parameters(struct stream_in *in,
{
    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 voice_extn_compress_voip_set_parameters(struct audio_device *adev,
    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 @@ void voice_extn_compress_voip_get_parameters(struct str_parms *query,
{
    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 @@ void voice_extn_compress_voip_out_get_parameters(struct stream_out *out,
{
    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 @@ void voice_extn_compress_voip_in_get_parameters(struct stream_in *in,
{
    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 voice_extn_compress_voip_out_get_buffer_size(struct stream_out *out)
    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 voice_extn_compress_voip_in_get_buffer_size(struct stream_in *in)
    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 voice_extn_compress_voip_start_output_stream(struct stream_out *out)
    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 voice_extn_compress_voip_start_input_stream(struct stream_in *in)
    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 voice_extn_compress_voip_close_output_stream(struct audio_stream *stream)
    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 voice_extn_compress_voip_close_input_stream(struct audio_stream *stream)
    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 voice_extn_compress_voip_open_output_stream(struct stream_out *out)
    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 voice_extn_compress_voip_open_input_stream(struct stream_in *in)
    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 voice_extn_compress_voip_set_volume(struct audio_device *adev, float volume)
    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 voice_extn_compress_voip_set_mic_mute(struct audio_device *adev, bool state)
    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 voice_extn_compress_voip_pcm_prop_check()
    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 voice_extn_compress_voip_is_active(const struct audio_device *adev)
    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 voice_extn_compress_voip_is_format_supported(audio_format_t format)
    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 voice_extn_compress_voip_is_config_supported(struct audio_config *config)
    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 voice_extn_compress_voip_is_started(struct audio_device *adev)
    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;
}
+16 −0
Original line number Diff line number Diff line
@@ -197,6 +197,18 @@ static int asphere_init() {
    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 @@ void asphere_set_parameters(struct str_parms *parms)
    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;