hal: Add support for fluence in HFP call
Add changes to support for fluence in HFP call
CRs-Fixed: 2021778
Change-Id: I5e5452de3886f19a7f5b3d0482080f0cb188708a
diff --git a/hal/msm8916/platform.c b/hal/msm8916/platform.c
index a8b4d93..dfb896c 100644
--- a/hal/msm8916/platform.c
+++ b/hal/msm8916/platform.c
@@ -261,6 +261,7 @@
bool fluence_in_voice_call;
bool fluence_in_voice_rec;
bool fluence_in_audio_rec;
+ bool fluence_in_hfp_call;
bool external_spk_1;
bool external_spk_2;
bool external_mic;
@@ -2126,6 +2127,7 @@
my_data->fluence_in_voice_call = false;
my_data->fluence_in_voice_rec = false;
my_data->fluence_in_audio_rec = false;
+ my_data->fluence_in_hfp_call = false;
my_data->external_spk_1 = false;
my_data->external_spk_2 = false;
my_data->external_mic = false;
@@ -2175,6 +2177,11 @@
if (!strncmp("broadside", value, sizeof("broadside"))) {
my_data->fluence_mode = FLUENCE_BROADSIDE;
}
+
+ property_get("persist.audio.fluence.hfpcall",value,"");
+ if (!strncmp("true", value, sizeof("true"))) {
+ my_data->fluence_in_hfp_call = true;
+ }
}
if (check_and_get_wsa_info((char *)snd_card_name, &wsaCount, &is_wsa_combo_supported)) {
@@ -2362,10 +2369,10 @@
/* obtain source mic type from max mic count*/
get_source_mic_type(my_data);
ALOGD("%s: Fluence_Type(%d) max_mic_count(%d) mic_type(0x%x) fluence_in_voice_call(%d)"
- " fluence_in_voice_rec(%d) fluence_in_spkr_mode(%d) ",
+ " fluence_in_voice_rec(%d) fluence_in_spkr_mode(%d) fluence_in_hfp_call(%d) ",
__func__, my_data->fluence_type, my_data->max_mic_count, my_data->source_mic_type,
my_data->fluence_in_voice_call, my_data->fluence_in_voice_rec,
- my_data->fluence_in_spkr_mode);
+ my_data->fluence_in_spkr_mode, my_data->fluence_in_hfp_call);
/* init usb */
audio_extn_usb_init(adev);
@@ -3946,7 +3953,8 @@
snd_device = SND_DEVICE_IN_AANC_HANDSET_MIC;
adev->acdb_settings |= ANC_FLAG;
} else if (my_data->fluence_type == FLUENCE_NONE ||
- my_data->fluence_in_voice_call == false) {
+ my_data->fluence_in_voice_call == false ||
+ my_data->fluence_in_hfp_call == false) {
snd_device = SND_DEVICE_IN_HANDSET_MIC;
if (audio_extn_hfp_is_active(adev))
platform_set_echo_reference(adev, true, out_device);
@@ -3972,7 +3980,8 @@
}
} else if (out_device & AUDIO_DEVICE_OUT_SPEAKER) {
if (my_data->fluence_type != FLUENCE_NONE &&
- my_data->fluence_in_voice_call &&
+ (my_data->fluence_in_voice_call ||
+ my_data->fluence_in_hfp_call) &&
my_data->fluence_in_spkr_mode) {
if((my_data->fluence_type & FLUENCE_QUAD_MIC) &&
(my_data->source_mic_type & SOURCE_QUAD_MIC)) {
diff --git a/hal/msm8974/platform.c b/hal/msm8974/platform.c
index b40f472..0094c0c 100644
--- a/hal/msm8974/platform.c
+++ b/hal/msm8974/platform.c
@@ -233,6 +233,7 @@
bool fluence_in_voice_call;
bool fluence_in_voice_rec;
bool fluence_in_audio_rec;
+ bool fluence_in_hfp_call;
bool external_spk_1;
bool external_spk_2;
bool external_mic;
@@ -1859,6 +1860,7 @@
my_data->fluence_in_voice_call = false;
my_data->fluence_in_voice_rec = false;
my_data->fluence_in_audio_rec = false;
+ my_data->fluence_in_hfp_call = false;
my_data->external_spk_1 = false;
my_data->external_spk_2 = false;
my_data->external_mic = false;
@@ -1907,6 +1909,11 @@
if (!strncmp("broadside", value, sizeof("broadside"))) {
my_data->fluence_mode = FLUENCE_BROADSIDE;
}
+
+ property_get("persist.audio.fluence.hfpcall",value,"");
+ if (!strncmp("true", value, sizeof("true"))) {
+ my_data->fluence_in_hfp_call = true;
+ }
}
/* Check if Vbat speaker enabled property is set, this should be done before acdb init */
@@ -2068,10 +2075,10 @@
/* obtain source mic type from max mic count*/
get_source_mic_type(my_data);
ALOGD("%s: Fluence_Type(%d) max_mic_count(%d) mic_type(0x%x) fluence_in_voice_call(%d)"
- " fluence_in_voice_rec(%d) fluence_in_spkr_mode(%d) ",
+ " fluence_in_voice_rec(%d) fluence_in_spkr_mode(%d) fluence_in_hfp_call(%d) ",
__func__, my_data->fluence_type, my_data->max_mic_count, my_data->source_mic_type,
my_data->fluence_in_voice_call, my_data->fluence_in_voice_rec,
- my_data->fluence_in_spkr_mode);
+ my_data->fluence_in_spkr_mode, my_data->fluence_in_hfp_call);
/* init usb */
audio_extn_usb_init(adev);
@@ -3554,7 +3561,8 @@
}
adev->acdb_settings |= ANC_FLAG;
} else if (my_data->fluence_type == FLUENCE_NONE ||
- my_data->fluence_in_voice_call == false) {
+ my_data->fluence_in_voice_call == false ||
+ my_data->fluence_in_hfp_call == false) {
snd_device = SND_DEVICE_IN_HANDSET_MIC;
if (audio_extn_hfp_is_active(adev))
platform_set_echo_reference(adev, true, out_device);
@@ -3579,7 +3587,8 @@
}
} else if (out_device & AUDIO_DEVICE_OUT_SPEAKER) {
if (my_data->fluence_type != FLUENCE_NONE &&
- my_data->fluence_in_voice_call &&
+ (my_data->fluence_in_voice_call ||
+ my_data->fluence_in_hfp_call) &&
my_data->fluence_in_spkr_mode) {
if((my_data->fluence_type & FLUENCE_QUAD_MIC) &&
(my_data->source_mic_type & SOURCE_QUAD_MIC)) {