hal: Fixes for dynamic audio HAL feature enable

- Update audio and voice feature init sequence
- Update API names for querying whether feature is enabled
- Fix A2DP audio_extn APIs
- Fix compress VOIP set parameter default return val issue that
  was causing no other set param to be processed
- Fix dynamic primary usecase check

Change-Id: I08fa3bc369ec197932347b01491588d42655797c
This commit is contained in:
Aalique Grahame 2019-01-31 16:18:17 -08:00 committed by Gerrit - the friendly Code Review server
parent 2efca04176
commit 6e7637151a
7 changed files with 19 additions and 15 deletions

View File

@ -2655,7 +2655,7 @@ bool a2dp_source_is_suspended()
}
void a2dp_init(void *adev,
a2dp_offload_init_config_t *init_config)
a2dp_offload_init_config_t init_config)
{
a2dp.adev = (struct audio_device*)adev;
a2dp.bt_lib_source_handle = NULL;
@ -2676,8 +2676,8 @@ void a2dp_init(void *adev,
// init function pointers
fp_platform_get_pcm_device_id =
init_config->fp_platform_get_pcm_device_id;
fp_check_a2dp_restore = init_config->fp_check_a2dp_restore;
init_config.fp_platform_get_pcm_device_id;
fp_check_a2dp_restore = init_config.fp_check_a2dp_restore;
reset_a2dp_enc_config_params();
reset_a2dp_source_dec_config_params();
@ -2687,7 +2687,8 @@ void a2dp_init(void *adev,
a2dp.a2dp_sink_started = false;
a2dp.bt_state_sink = A2DP_STATE_DISCONNECTED;
a2dp.a2dp_sink_total_active_session_requests = 0;
open_a2dp_sink();
if (isRunningWithVendorEnhancedFramework())
open_a2dp_sink();
a2dp.is_a2dp_offload_supported = false;
update_offload_codec_capabilities();

View File

@ -2330,7 +2330,6 @@ void audio_extn_init(struct audio_device *adev)
{
//fix-me: check running on vendor enhanced build
//is_running_on_stock_version = !isRunningWithVendorEnhancedFramework();
audio_extn_feature_init();
aextnmod.anc_enabled = 0;
aextnmod.aanc_enabled = 0;
aextnmod.custom_stereo_enabled = 0;
@ -3478,7 +3477,7 @@ exit:
static void *a2dp_lib_handle = NULL;
typedef void (*a2dp_init_t)(void *, a2dp_offload_init_config_t *);
typedef void (*a2dp_init_t)(void *, a2dp_offload_init_config_t);
static a2dp_init_t a2dp_init;
typedef int (*a2dp_start_playback_t)();
@ -3609,9 +3608,9 @@ feature_disabled:
void audio_extn_a2dp_init(void *adev)
{
if (a2dp_init) {
a2dp_offload_init_config_t *a2dp_init_config = NULL;
a2dp_init_config->fp_platform_get_pcm_device_id = platform_get_pcm_device_id;
a2dp_init_config->fp_check_a2dp_restore = check_a2dp_restore;
a2dp_offload_init_config_t a2dp_init_config;
a2dp_init_config.fp_platform_get_pcm_device_id = platform_get_pcm_device_id;
a2dp_init_config.fp_check_a2dp_restore = check_a2dp_restore;
a2dp_init(adev, a2dp_init_config);
}

View File

@ -37,6 +37,9 @@
#include <log/log.h>
#include <unistd.h>
#include <vndfwk-detect.h>
#include "audio_hw.h"
#include "audio_extn.h"
#include "voice_extn.h"
#include "audio_feature_manager.h"
extern AHalValues* confValues;
@ -47,6 +50,8 @@ void audio_feature_manager_init()
audio_extn_ahal_config_helper_init(
isRunningWithVendorEnhancedFramework());
confValues = audio_extn_get_feature_values();
audio_extn_feature_init();
voice_extn_feature_init();
}
bool audio_feature_manager_is_feature_enabled(audio_ext_feature feature)

View File

@ -6303,7 +6303,7 @@ int adev_open_output_stream(struct audio_hw_device *dev,
(devices != AUDIO_DEVICE_OUT_USB_ACCESSORY);
bool direct_dev = is_hdmi || is_usb_dev;
bool use_db_as_primary =
audio_feature_manager_is_feature_enabled(USE_DEEP_BUFFER_AS_PRIMARY_OUTPUT);
audio_feature_manager_is_feature_enabled(USE_DEEP_BUFFER_AS_PRIMARY_OUTPUT);
if (is_usb_dev && (!audio_extn_usb_connected(NULL))) {
is_usb_dev = false;
@ -6932,7 +6932,7 @@ int adev_open_output_stream(struct audio_hw_device *dev,
devices, out->flags, out->hal_op_format, out->sample_rate,
out->bit_width, out->channel_mask, out->profile,
&out->app_type_cfg);
if ((out->usecase == GET_USECASE_AUDIO_PLAYBACK_PRIMARY(use_db_as_primary)) ||
if ((out->usecase == (audio_usecase_t)(GET_USECASE_AUDIO_PLAYBACK_PRIMARY(use_db_as_primary))) ||
(flags & AUDIO_OUTPUT_FLAG_PRIMARY)) {
/* Ensure the default output is not selected twice */
if(adev->primary_output == NULL)

View File

@ -429,7 +429,6 @@ void voice_extn_init(struct audio_device *adev)
adev->voice.session[VOWLAN_SESS_IDX].vsid = VOWLAN_VSID;
adev->voice.session[MMODE1_SESS_IDX].vsid = VOICEMMODE1_VSID;
adev->voice.session[MMODE2_SESS_IDX].vsid = VOICEMMODE2_VSID;
voice_extn_feature_init();
}
void compr_voip_feature_init(bool is_feature_enabled)
@ -698,7 +697,7 @@ int voice_extn_check_and_set_incall_music_usecase(struct audio_device *adev,
int voice_extn_compress_voip_set_parameters(struct audio_device *adev,
struct str_parms *parms)
{
int ret = -1;
int ret = -ENOSYS;
if(voice_extn_compress_voip_enabled)
ret = compress_voip_set_parameters(adev, parms);
else

View File

@ -175,7 +175,7 @@ static void asphere_init_once() {
if (hal_lib_pointer == NULL)
ALOGE("%s: DLOPEN failed for %s", __func__, PRIMARY_HAL_PATH);
else if ((is_feature_enabled = (bool (*)(audio_ext_feature))dlsym(hal_lib_pointer,
"audio_feature_manager_is_feature_enable")) != NULL) {
"audio_feature_manager_is_feature_enabled")) != NULL) {
if (is_feature_enabled(AUDIOSPHERE)) {
asphere.init_status = 1;
asphere_get_values_from_mixer();

View File

@ -489,7 +489,7 @@ int virtualizer_init(effect_context_t *context)
else {
is_feature_enabled =
(bool (*)(audio_ext_feature))dlsym(hal_lib_pointer,
"audio_feature_manager_is_feature_enable");
"audio_feature_manager_is_feature_enabled");
if (is_feature_enabled == NULL)
ALOGE("%s: dlsym failed", __func__);
}