hal: apply TTY mode change for all voice use cases
Update devices for Voice2, VoLTE and QCHAT sessions
based on the TTY mode. This change is needed to support
enabling/disabling and switching TTY mode during
voice call.
Change-Id: I4f1fde8ce6b20fad0d24e0cd963e2c3709ff25d5
CRs-fixed: 608183
diff --git a/hal/audio_hw.c b/hal/audio_hw.c
index 69e9561..4787ab3 100644
--- a/hal/audio_hw.c
+++ b/hal/audio_hw.c
@@ -551,21 +551,6 @@
return ret;
}
-static void update_devices_for_all_voice_usecases(struct audio_device *adev)
-{
- struct listnode *node;
- struct audio_usecase *usecase;
-
- list_for_each(node, &adev->usecase_list) {
- usecase = node_to_item(node, struct audio_usecase, list);
- if (usecase->type == VOICE_CALL) {
- ALOGV("%s: updating device for usecase:%s", __func__,
- use_case_table[usecase->id]);
- select_devices(adev, usecase->id);
- }
- }
-}
-
static audio_usecase_t get_voice_usecase_id_from_list(struct audio_device *adev)
{
struct audio_usecase *usecase;
@@ -1467,7 +1452,7 @@
} else if ((adev->mode == AUDIO_MODE_IN_CALL) &&
voice_is_in_call(adev) &&
(out == adev->primary_output)) {
- update_devices_for_all_voice_usecases(adev);
+ voice_update_devices_for_all_voice_usecases(adev);
}
}
diff --git a/hal/voice.c b/hal/voice.c
index 1c3ab38..ac067a3 100644
--- a/hal/voice.c
+++ b/hal/voice.c
@@ -405,8 +405,7 @@
adev->voice.tty_mode = tty_mode;
adev->acdb_settings = (adev->acdb_settings & TTY_MODE_CLEAR) | tty_mode;
if (voice_is_in_call(adev))
- //todo: what about voice2, volte and qchat usecases?
- select_devices(adev, USECASE_VOICE_CALL);
+ voice_update_devices_for_all_voice_usecases(adev);
}
}
@@ -446,4 +445,19 @@
voice_extn_init(adev);
}
+void voice_update_devices_for_all_voice_usecases(struct audio_device *adev)
+{
+ struct listnode *node;
+ struct audio_usecase *usecase;
+
+ list_for_each(node, &adev->usecase_list) {
+ usecase = node_to_item(node, struct audio_usecase, list);
+ if (usecase->type == VOICE_CALL) {
+ ALOGV("%s: updating device for usecase:%s", __func__,
+ use_case_table[usecase->id]);
+ select_devices(adev, usecase->id);
+ }
+ }
+}
+
diff --git a/hal/voice.h b/hal/voice.h
index 5e4ce7f..d160569 100644
--- a/hal/voice.h
+++ b/hal/voice.h
@@ -86,4 +86,5 @@
struct stream_out *out);
int voice_check_and_stop_incall_rec_usecase(struct audio_device *adev,
struct stream_in *in);
+void voice_update_devices_for_all_voice_usecases(struct audio_device *adev);
#endif //VOICE_H