Merge "hal: open proxy record2 only when hearing aid is connected"
diff --git a/hal/audio_hw.c b/hal/audio_hw.c
index d822863..b8acffe 100644
--- a/hal/audio_hw.c
+++ b/hal/audio_hw.c
@@ -2908,10 +2908,8 @@
usecase->stream.in->enable_ec_port = false;
- bool is_ha_usecase = adev->ha_proxy_enable ?
- usecase->id == USECASE_AUDIO_RECORD_AFE_PROXY2 :
- usecase->id == USECASE_AUDIO_RECORD_AFE_PROXY;
- if (is_ha_usecase) {
+ if (usecase->id == USECASE_AUDIO_RECORD_AFE_PROXY ||
+ usecase->id == USECASE_AUDIO_RECORD_AFE_PROXY2) {
reassign_device_list(&out_devices, AUDIO_DEVICE_OUT_TELEPHONY_TX, "");
} else if (voip_usecase) {
assign_devices(&out_devices, &voip_usecase->stream.out->device_list);
@@ -7770,7 +7768,6 @@
struct stream_in *in = (struct stream_in *)stream;
struct audio_device *adev = in->dev;
struct listnode devices;
- bool is_ha_usecase = false;
list_init(&devices);
@@ -7781,11 +7778,10 @@
pthread_mutex_lock(&adev->lock);
ALOGV("%s: in->usecase: %d, device: %x", __func__, in->usecase, get_device_types(&devices));
- is_ha_usecase = adev->ha_proxy_enable ?
- in->usecase == USECASE_AUDIO_RECORD_AFE_PROXY2 :
- in->usecase == USECASE_AUDIO_RECORD_AFE_PROXY;
- if (is_ha_usecase && !list_empty(&devices)
- && adev->voice_tx_output != NULL) {
+ if ((in->usecase == USECASE_AUDIO_RECORD_AFE_PROXY ||
+ in->usecase == USECASE_AUDIO_RECORD_AFE_PROXY2) &&
+ !list_empty(&devices) &&
+ adev->voice_tx_output != NULL) {
/* Use the rx device from afe-proxy record to route voice call because
there is no routing if tx device is on primary hal and rx device
is on other hal during voice call. */
@@ -8994,6 +8990,9 @@
ALOGV("detected USB connect .. disable proxy");
adev->allow_afe_proxy_usage = false;
}
+ } else if (audio_is_hearing_aid_out_device(device) &&
+ property_get_bool("persist.vendor.audio.ha_proxy.enabled", false)) {
+ adev->ha_proxy_enable = true;
}
}
@@ -9016,6 +9015,8 @@
ALOGV("detected USB disconnect .. enable proxy");
adev->allow_afe_proxy_usage = true;
}
+ } else if (audio_is_hearing_aid_out_device(device)) {
+ adev->ha_proxy_enable = false;
}
}
@@ -10709,6 +10710,7 @@
adev->use_old_pspd_mix_ctrl = false;
adev->adm_routing_changed = false;
adev->a2dp_started = false;
+ adev->ha_proxy_enable = false;
audio_extn_perf_lock_init();
@@ -10883,7 +10885,6 @@
audio_extn_qdsp_init(adev->platform);
adev->multi_offload_enable = property_get_bool("vendor.audio.offload.multiple.enabled", false);
- adev->ha_proxy_enable = property_get_bool("persist.vendor.audio.ha_proxy.enabled", false);
pthread_mutex_unlock(&adev_init_lock);
if (adev->adm_init)