exynos: audiohal_comv1: Adapt call usages
Change-Id: I44446c6e60a0dc92a8b4577f1dbe77b83f459cdd
Signed-off-by: Francescodario Cuzzocrea <bosconovic@gmail.com>
diff --git a/include/libaudio/audiohal_comv1/audio_tables.h b/include/libaudio/audiohal_comv1/audio_tables.h
index 3177897..aaf4a6b 100644
--- a/include/libaudio/audiohal_comv1/audio_tables.h
+++ b/include/libaudio/audiohal_comv1/audio_tables.h
@@ -56,14 +56,24 @@
[AUSAGE_RECORDING] = "recording",
[AUSAGE_CAMCORDER] = "camcorder",
- [AUSAGE_VOICE_CALL] = "incall",
- [AUSAGE_VOICE_CALL_HAC] = "incall_hac",
+ [AUSAGE_VOICE_CALL_NB] = "voice_call_nb",
+ [AUSAGE_VOICE_CALL_NB_HAC] = "voice_call_nb_hac",
+ [AUSAGE_VOICE_CALL_WB] = "voice_call_wb",
+ [AUSAGE_VOICE_CALL_WB_HAC] = "voice_call_wb_hac",
+ [AUSAGE_VOLTE_CALL_NB] = "volte_call_nb",
+ [AUSAGE_VOLTE_CALL_WB] = "volte_call_wb",
+ [AUSAGE_VOLTE_CALL_SWB] = "volte_vt_call_swb",
+ [AUSAGE_VOLTE_VT_CALL_NB] = "volte_vt_call_nb",
+ [AUSAGE_VOLTE_VT_CALL_WB] = "volte_vt_call_wb",
+ [AUSAGE_VOLTE_VT_CALL_SWB] = "volte_call_swb",
[AUSAGE_TTY] = "tty_mode",
[AUSAGE_INCALL_MUSIC] = "incall_music",
[AUSAGE_CALL_FORWARDING_PRIMARY] = "call_forwarding_primary",
[AUSAGE_SPECTRO] = "call_spectro",
- [AUSAGE_WIFI_CALL] = "wificall",
+ [AUSAGE_WIFI_CALL_NB] = "vowifi_call_nb",
+ [AUSAGE_WIFI_CALL_WB] = "vowifi_call_wb",
+ [AUSAGE_WIFI_CALL_SWB] = "vowifi_call_swb",
[AUSAGE_VIDEO_CALL] = "video_call",
[AUSAGE_VOIP_CALL] = "voip_call",
[AUSAGE_COMMUNICATION] = "communication",
@@ -102,14 +112,24 @@
[AUSAGE_RECORDING] = "recording",
[AUSAGE_CAMCORDER] = "camcorder",
- [AUSAGE_VOICE_CALL] = "incall",
- [AUSAGE_VOICE_CALL_HAC] = "incall_hac",
+ [AUSAGE_VOICE_CALL_NB] = "incall_nb",
+ [AUSAGE_VOICE_CALL_NB_HAC] = "incall_nb_hac",
+ [AUSAGE_VOICE_CALL_WB] = "incall_wb",
+ [AUSAGE_VOICE_CALL_WB_HAC] = "incall_wb_hac",
+ [AUSAGE_VOLTE_CALL_NB] = "incall_nb",
+ [AUSAGE_VOLTE_CALL_WB] = "incall_nb",
+ [AUSAGE_VOLTE_CALL_SWB] = "incall_nb",
+ [AUSAGE_VOLTE_VT_CALL_NB] = "incall_nb",
+ [AUSAGE_VOLTE_VT_CALL_WB] = "incall_nb",
+ [AUSAGE_VOLTE_VT_CALL_SWB] = "incall_nb",
[AUSAGE_TTY] = "tty_mode",
[AUSAGE_INCALL_MUSIC] = "incall_music",
[AUSAGE_CALL_FORWARDING_PRIMARY] = "call_forwarding_primary",
[AUSAGE_SPECTRO] = "call_spectro",
- [AUSAGE_WIFI_CALL] = "wificall",
+ [AUSAGE_WIFI_CALL_NB] = "wificall_nb",
+ [AUSAGE_WIFI_CALL_WB] = "wificall_wb",
+ [AUSAGE_WIFI_CALL_SWB] = "wificall_evs",
[AUSAGE_VIDEO_CALL] = "video_call",
[AUSAGE_VOIP_CALL] = "voip_call",
[AUSAGE_COMMUNICATION] = "communication",
diff --git a/include/libaudio/audiohal_comv1/audio_usages.h b/include/libaudio/audiohal_comv1/audio_usages.h
index ecf38a2..d0a6c09 100644
--- a/include/libaudio/audiohal_comv1/audio_usages.h
+++ b/include/libaudio/audiohal_comv1/audio_usages.h
@@ -37,8 +37,16 @@
// Call Usages
// These audio usages are defined from Audio Mode and Voice Status
AUSAGE_CPCALL_MIN,
- AUSAGE_VOICE_CALL = AUSAGE_CPCALL_MIN,
- AUSAGE_VOICE_CALL_HAC,
+ AUSAGE_VOICE_CALL_NB = AUSAGE_CPCALL_MIN,
+ AUSAGE_VOICE_CALL_NB_HAC,
+ AUSAGE_VOICE_CALL_WB,
+ AUSAGE_VOICE_CALL_WB_HAC,
+ AUSAGE_VOLTE_CALL_NB,
+ AUSAGE_VOLTE_CALL_WB,
+ AUSAGE_VOLTE_CALL_SWB,
+ AUSAGE_VOLTE_VT_CALL_NB,
+ AUSAGE_VOLTE_VT_CALL_WB,
+ AUSAGE_VOLTE_VT_CALL_SWB,
AUSAGE_TTY,
AUSAGE_INCALL_MUSIC, //Music playback during CP call, sent to other device as CP Tx
AUSAGE_CALL_FORWARDING_PRIMARY,
@@ -46,7 +54,9 @@
AUSAGE_CPCALL_MAX = AUSAGE_SPECTRO,
AUSAGE_APCALL_MIN,
- AUSAGE_WIFI_CALL = AUSAGE_APCALL_MIN,
+ AUSAGE_WIFI_CALL_NB = AUSAGE_APCALL_MIN,
+ AUSAGE_WIFI_CALL_WB,
+ AUSAGE_WIFI_CALL_SWB,
AUSAGE_VIDEO_CALL,
AUSAGE_VOIP_CALL,
AUSAGE_COMMUNICATION,
diff --git a/libaudio/audiohal_comv1/common_audiohal/audio_hw.c b/libaudio/audiohal_comv1/common_audiohal/audio_hw.c
index a6c1e6c..968f296 100644
--- a/libaudio/audiohal_comv1/common_audiohal/audio_hw.c
+++ b/libaudio/audiohal_comv1/common_audiohal/audio_hw.c
@@ -310,6 +310,55 @@
return ausage;
}
+// VoLTE Call Usage
+static audio_usage adev_get_ausage_for_volte(struct audio_device *adev)
+{
+ volte_status_t volte_status = VOLTE_OFF;
+ int samplingrate = VOICE_SR_NB;
+ audio_usage ausage = AUSAGE_NONE;
+
+ if (adev->voice) {
+ volte_status = voice_get_volte_status(adev->voice);
+ if (volte_status == VOLTE_VOICE) {
+ /* VoLTE Voice Call Usage */
+ samplingrate = voice_get_samplingrate(adev->voice);
+ switch (samplingrate) {
+ case VOICE_SR_SWB:
+ ausage = AUSAGE_VOLTE_CALL_SWB;
+ break;
+
+ case VOICE_SR_WB:
+ ausage = AUSAGE_VOLTE_CALL_WB;
+ break;
+
+ case VOICE_SR_NB:
+ default:
+ ausage = AUSAGE_VOLTE_CALL_NB;
+ break;
+ }
+ } else if (volte_status == VOLTE_VIDEO) {
+ /* VoLTE Video Call Usage */
+ samplingrate = voice_get_samplingrate(adev->voice);
+ switch (samplingrate) {
+ case VOICE_SR_SWB:
+ ausage = AUSAGE_VOLTE_VT_CALL_SWB;
+ break;
+
+ case VOICE_SR_WB:
+ ausage = AUSAGE_VOLTE_VT_CALL_WB;
+ break;
+
+ case VOICE_SR_NB:
+ default:
+ ausage = AUSAGE_VOLTE_VT_CALL_NB;
+ break;
+ }
+ }
+ }
+
+ return ausage;
+}
+
// Voice Call or VoLTE Call Usage
static audio_usage adev_get_ausage_for_call(struct audio_device *adev)
{
@@ -322,10 +371,29 @@
} else if (adev->incallmusic_on) {
ausage = AUSAGE_INCALL_MUSIC;
ALOGI("%s: incallmusic_on (%d)", __func__, adev->incallmusic_on);
- } else if (adev->voice->hac_mode == HAC_MODE_ON) {
- ausage = AUSAGE_VOICE_CALL_HAC;
- } else {
- ausage = AUSAGE_VOICE_CALL; // Voice Call or VoLTE Call
+ }
+
+ /* Check Normal Call Usage(Voice Call or VoLTE Call) */
+ if (voice_get_volte_status(adev->voice) != VOLTE_OFF)
+ ausage = adev_get_ausage_for_volte(adev);
+ else {
+ int samplingrate = voice_get_samplingrate(adev->voice);
+ switch (samplingrate) {
+ case VOICE_SR_WB:
+ if (adev->voice->hac_mode == HAC_MODE_ON)
+ ausage = AUSAGE_VOICE_CALL_WB_HAC;
+ else
+ ausage = AUSAGE_VOICE_CALL_WB;
+ break;
+
+ case VOICE_SR_NB:
+ default:
+ if (adev->voice->hac_mode == HAC_MODE_ON)
+ ausage = AUSAGE_VOICE_CALL_NB_HAC;
+ else
+ ausage = AUSAGE_VOICE_CALL_NB;
+ break;
+ }
}
}
@@ -342,10 +410,37 @@
if (adev->voice && adev->voice->csvtcall) {
ausage = AUSAGE_VIDEO_CALL;
} else if (adev->voice && adev->voice->voip_wificalling) {
- if (adev->voice->tty_mode != TTY_MODE_OFF)
+ if (adev->voice->tty_mode != TTY_MODE_OFF) {
ausage = AUSAGE_AP_TTY;
- else
- ausage = AUSAGE_WIFI_CALL;
+ } else {
+ if (adev->primary_output->common.requested_devices & AUDIO_DEVICE_OUT_ALL_SCO) {
+ if (adev->voice->bluetooth_samplerate == WB_SAMPLING_RATE)
+ ausage = AUSAGE_WIFI_CALL_WB;
+ else
+ ausage = AUSAGE_WIFI_CALL_NB;
+ } else {
+ int vowifi_band = voice_get_vowifi_band(adev->voice);
+ switch (vowifi_band) {
+ case VOICE_SR_SWB:
+ ausage = AUSAGE_WIFI_CALL_SWB;
+ break;
+
+ case VOICE_SR_WB:
+ ausage = AUSAGE_WIFI_CALL_WB;
+ break;
+
+ case VOICE_SR_NB:
+ default:
+ ausage = AUSAGE_WIFI_CALL_NB;
+ break;
+ }
+ }
+ }
+ } else {
+ if (adev->active_input) {
+ if (adev->active_input->requested_source == AUDIO_SOURCE_MIC)
+ ausage = AUSAGE_VOIP_CALL;
+ }
}
return ausage;