summaryrefslogtreecommitdiffstats
path: root/hal
diff options
context:
space:
mode:
authorKunlei Zhang <kunleiz@codeaurora.org>2019-08-27 16:33:29 +0800
committerKunlei Zhang <kunleiz@codeaurora.org>2019-10-30 10:25:16 +0800
commit136e6745f9eb0b65e3b5fb50d88328125bdc907d (patch)
tree09b5425d97ecd375a133a18afb4e31ea0e941d02 /hal
parent5171705a38e73290c2b14b7ed778917ea29add15 (diff)
downloadandroid_hardware_qcom_audio-136e6745f9eb0b65e3b5fb50d88328125bdc907d.tar.gz
android_hardware_qcom_audio-136e6745f9eb0b65e3b5fb50d88328125bdc907d.tar.bz2
android_hardware_qcom_audio-136e6745f9eb0b65e3b5fb50d88328125bdc907d.zip
hal: fix bt sco and a2dp concurrency issues
When sco mic device is already active and A2dpsuspened=false is received, then route is switched to A2dp, but sco mic can still keep active which means the BE is already active, causing the slimbus configuration of feedback path for A2dp to be ignored. To fix this, tear down the input stream to disable bt sco mic before enabling a2dp path. Change-Id: I67f1e1ef03febb0bd3736509500195808dc1e53b
Diffstat (limited to 'hal')
-rw-r--r--hal/audio_hw.c22
1 files changed, 15 insertions, 7 deletions
diff --git a/hal/audio_hw.c b/hal/audio_hw.c
index 38e57a82..67708d95 100644
--- a/hal/audio_hw.c
+++ b/hal/audio_hw.c
@@ -8132,7 +8132,6 @@ static int adev_set_parameters(struct audio_hw_device *dev, const char *kvpairs)
int status = 0;
bool a2dp_reconfig = false;
struct listnode *node;
- struct audio_usecase *usecase = NULL;
ALOGD("%s: enter: %s", __func__, kvpairs);
parms = str_parms_create_str(kvpairs);
@@ -8164,17 +8163,26 @@ static int adev_set_parameters(struct audio_hw_device *dev, const char *kvpairs)
if (strcmp(value, AUDIO_PARAMETER_VALUE_ON) == 0){
adev->bt_sco_on = true;
} else {
- ALOGD("sco is off, reset sco and route device to handset mic");
adev->bt_sco_on = false;
audio_extn_sco_reset_configuration();
+ }
+ }
+
+ ret = str_parms_get_str(parms, "A2dpSuspended", value, sizeof(value));
+ if (ret>=0) {
+ if (!strncmp(value, "false", 5) &&
+ audio_extn_a2dp_source_is_suspended()) {
+ struct audio_usecase *usecase;
+ struct listnode *node;
list_for_each(node, &adev->usecase_list) {
usecase = node_to_item(node, struct audio_usecase, list);
- if ((usecase->type == PCM_CAPTURE) && usecase->stream.in &&
- (usecase->stream.in->device & AUDIO_DEVICE_IN_ALL_SCO))
+ if (usecase->stream.in && (usecase->type == PCM_CAPTURE) &&
+ ((usecase->stream.in->device & ~AUDIO_DEVICE_BIT_IN) &
+ AUDIO_DEVICE_IN_ALL_SCO)) {
+ ALOGD("a2dp resumed, switch bt sco mic to handset mic");
usecase->stream.in->device = AUDIO_DEVICE_IN_BUILTIN_MIC;
- else
- continue;
- select_devices(adev, usecase->id);
+ select_devices(adev, usecase->id);
+ }
}
}
}