summaryrefslogtreecommitdiffstats
path: root/hal/audio_hw.c
diff options
context:
space:
mode:
authorHW Lee <hwlee@google.com>2019-03-18 17:27:18 +0800
committerHW Lee <hwlee@google.com>2019-03-21 12:27:26 +0000
commitf88584d64bdf41850cb721483e51eaf849771f80 (patch)
treed65b4213c0465f2b930e43d56dfb6710fad6f700 /hal/audio_hw.c
parent2a70cb736f2e5916964498547207608a3e8d78fe (diff)
downloadandroid_hardware_qcom_audio-f88584d64bdf41850cb721483e51eaf849771f80.tar.gz
android_hardware_qcom_audio-f88584d64bdf41850cb721483e51eaf849771f80.tar.bz2
android_hardware_qcom_audio-f88584d64bdf41850cb721483e51eaf849771f80.zip
hal: re-select input device after dropping call
Bug: 124841974 Test: repro steps described in the bug Change-Id: I5d7dfe402bb98893ebefad92edcdf2ffa8ff2661 Signed-off-by: HW Lee <hwlee@google.com>
Diffstat (limited to 'hal/audio_hw.c')
-rw-r--r--hal/audio_hw.c26
1 files changed, 23 insertions, 3 deletions
diff --git a/hal/audio_hw.c b/hal/audio_hw.c
index 4b85b213..a11a4377 100644
--- a/hal/audio_hw.c
+++ b/hal/audio_hw.c
@@ -1492,8 +1492,9 @@ struct stream_in *get_voice_communication_input(const struct audio_device *adev)
return NULL;
}
-int select_devices(struct audio_device *adev,
- audio_usecase_t uc_id)
+int select_devices_with_force_switch(struct audio_device *adev,
+ audio_usecase_t uc_id,
+ bool force_switch)
{
snd_device_t out_snd_device = SND_DEVICE_NONE;
snd_device_t in_snd_device = SND_DEVICE_NONE;
@@ -1598,7 +1599,7 @@ int select_devices(struct audio_device *adev,
if (out_snd_device == usecase->out_snd_device &&
in_snd_device == usecase->in_snd_device) {
- if (!force_device_switch(usecase))
+ if (!force_device_switch(usecase) && !force_switch)
return 0;
}
@@ -1742,6 +1743,12 @@ int select_devices(struct audio_device *adev,
return status;
}
+int select_devices(struct audio_device *adev,
+ audio_usecase_t uc_id)
+{
+ return select_devices_with_force_switch(adev, uc_id, false);
+}
+
static int stop_input_stream(struct stream_in *in)
{
int i, ret = 0;
@@ -5478,6 +5485,19 @@ static int adev_set_mode(struct audio_hw_device *dev, audio_mode_t mode)
voice_is_in_call(adev)) {
voice_stop_call(adev);
adev->current_call_output = NULL;
+
+ /*
+ * After stopping the call, it must check if any active capture
+ * activity device needs to be re-selected.
+ */
+ 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 != NULL) {
+ select_devices_with_force_switch(adev, usecase->id, true);
+ }
+ }
}
}
pthread_mutex_unlock(&adev->lock);