Merge tag 'AUDIO.LA.8.0.r1-10200-KAILUA.0' into staging/lineage-21.0_merge-AUDIO.LA.8.0.r1-10200-KAILUA.0

AUDIO.LA.8.0.r1-10200-KAILUA.0

# By Anand Mohan (1) and yangma (1)
# Via Gerrit - the friendly Code Review server (2) and others
* tag 'AUDIO.LA.8.0.r1-10200-KAILUA.0':
  hal: pass is_in_call flag to suspended setparam for A2DP device
  hal: add support for kalama aim

Change-Id: I251d46e4a62557a74bf213f1da5145c035ff4f35
diff --git a/configs/kalama/audio-modules.mk b/configs/kalama/audio-modules.mk
index 73e4eef..1c11240 100644
--- a/configs/kalama/audio-modules.mk
+++ b/configs/kalama/audio-modules.mk
@@ -89,6 +89,8 @@
     AUDIO_MODULES += RB5_GEN2_DVT_acdb_cal.acdb
     AUDIO_MODULES += RB5_GEN2_DVT_workspaceFileXml.qwsp
     AUDIO_MODULES += ffv__5.0.2_0.1__eai_2.10_enpu.pmd
+    AUDIO_MODULES += AIM_acdb_cal.acdb
+    AUDIO_MODULES += AIM_workspaceFileXml.qwsp
 endif
 ifeq ($(call is-board-platform-in-list,crow),true)
     AUDIO_MODULES += audio.primary.crow
diff --git a/configs/kalama/kalama.mk b/configs/kalama/kalama.mk
index f508b82..d9770cc 100644
--- a/configs/kalama/kalama.mk
+++ b/configs/kalama/kalama.mk
@@ -131,6 +131,7 @@
     $(CONFIG_HAL_SRC_DIR)/microphone_characteristics.xml:$(TARGET_COPY_OUT_VENDOR)/etc/microphone_characteristics.xml \
     $(CONFIG_PAL_SRC_DIR)/card-defs.xml:$(TARGET_COPY_OUT_VENDOR)/etc/card-defs.xml \
     $(CONFIG_PAL_SRC_DIR)/mixer_paths_kalama_qrd.xml:$(CONFIG_SKU_OUT_DIR)/mixer_paths_kalama_qrd.xml \
+    $(CONFIG_PAL_SRC_DIR)/mixer_paths_kalama_aim.xml:$(CONFIG_SKU_OUT_DIR)/mixer_paths_kalama_aim.xml \
     $(CONFIG_PAL_SRC_DIR)/mixer_paths_kalama_mtp.xml:$(CONFIG_SKU_OUT_DIR)/mixer_paths_kalama_mtp.xml \
     $(CONFIG_PAL_SRC_DIR)/mixer_paths_kalama_mtp_apq.xml:$(CONFIG_SKU_OUT_DIR)/mixer_paths_kalama_mtp_apq.xml \
     $(CONFIG_PAL_SRC_DIR)/mixer_paths_kalama_cdp.xml:$(CONFIG_SKU_OUT_DIR)/mixer_paths_kalama_cdp.xml \
@@ -139,6 +140,7 @@
     $(CONFIG_PAL_SRC_DIR)/mixer_paths_kalama_grd.xml:$(CONFIG_SKU_OUT_DIR)/mixer_paths_kalama_grd.xml \
     $(CONFIG_PAL_SRC_DIR)/mixer_paths_kalama_rb5_gen2_dvt.xml:$(CONFIG_SKU_OUT_DIR)/mixer_paths_kalama_rb5_gen2_dvt.xml \
     $(CONFIG_PAL_SRC_DIR)/resourcemanager_kalama_qrd.xml:$(CONFIG_SKU_OUT_DIR)/resourcemanager_kalama_qrd.xml \
+    $(CONFIG_PAL_SRC_DIR)/resourcemanager_kalama_aim.xml:$(CONFIG_SKU_OUT_DIR)/resourcemanager_kalama_aim.xml \
     $(CONFIG_PAL_SRC_DIR)/resourcemanager_kalama_mtp.xml:$(CONFIG_SKU_OUT_DIR)/resourcemanager_kalama_mtp.xml \
     $(CONFIG_PAL_SRC_DIR)/resourcemanager_kalama_mtp_apq.xml:$(CONFIG_SKU_OUT_DIR)/resourcemanager_kalama_mtp_apq.xml \
     $(CONFIG_PAL_SRC_DIR)/resourcemanager_kalama_cdp.xml:$(CONFIG_SKU_OUT_DIR)/resourcemanager_kalama_cdp.xml \
diff --git a/hal/AudioDevice.cpp b/hal/AudioDevice.cpp
index 0283d5c..1ea826f 100644
--- a/hal/AudioDevice.cpp
+++ b/hal/AudioDevice.cpp
@@ -1798,6 +1798,7 @@
 
     ret = str_parms_get_str(parms, "A2dpSuspended" , value, sizeof(value));
     if (ret >= 0) {
+        audio_mode_t mode = AUDIO_MODE_NORMAL;
         pal_param_bta2dp_t param_bt_a2dp;
 
         if (strncmp(value, "true", 4) == 0)
@@ -1807,6 +1808,10 @@
 
         param_bt_a2dp.dev_id = PAL_DEVICE_OUT_BLUETOOTH_A2DP;
 
+        if (voice_)
+            voice_->get_voice_call_state(&mode);
+        param_bt_a2dp.is_in_call = (mode != AUDIO_MODE_NORMAL);
+
         AHAL_INFO("BT A2DP Suspended = %s, command received", value);
         ret = pal_set_param(PAL_PARAM_ID_BT_A2DP_SUSPENDED, (void *)&param_bt_a2dp,
                             sizeof(pal_param_bta2dp_t));
@@ -2007,6 +2012,7 @@
 
     ret = str_parms_get_str(parms, "A2dpCaptureSuspend", value, sizeof(value));
     if (ret >= 0) {
+        audio_mode_t mode = AUDIO_MODE_NORMAL;
         pal_param_bta2dp_t param_bt_a2dp;
 
         if (strncmp(value, "true", 4) == 0)
@@ -2016,6 +2022,10 @@
 
         param_bt_a2dp.dev_id = PAL_DEVICE_IN_BLUETOOTH_A2DP;
 
+        if (voice_)
+            voice_->get_voice_call_state(&mode);
+        param_bt_a2dp.is_in_call = (mode != AUDIO_MODE_NORMAL);
+
         AHAL_INFO("BT A2DP Capture Suspended = %s, command received", value);
         ret = pal_set_param(PAL_PARAM_ID_BT_A2DP_CAPTURE_SUSPENDED, (void*)&param_bt_a2dp,
             sizeof(pal_param_bta2dp_t));