Merge "configs: add mmap-record path in msmnile"
diff --git a/configs/msmnile_au/msmnile_au.mk b/configs/msmnile_au/msmnile_au.mk
index c7f2db5..68343e9 100644
--- a/configs/msmnile_au/msmnile_au.mk
+++ b/configs/msmnile_au/msmnile_au.mk
@@ -137,7 +137,7 @@
 endif
 AUDIO_FEATURE_ENABLED_FM_TUNER_EXT := true
 AUDIO_FEATURE_ENABLED_ICC := true
-ifneq ( ,$(filter S 12, $(PLATFORM_VERSION)))
+ifneq ( ,$(filter S 12 T 13, $(PLATFORM_VERSION)))
 AUDIO_FEATURE_ENABLED_POWER_POLICY := true
 endif
 ifneq ( ,$(filter msmnile_gvmq msmnile_au, $(TARGET_BOARD_PLATFORM)$(TARGET_BOARD_SUFFIX)))
@@ -366,9 +366,9 @@
 #Enable AAudio MMAP/NOIRQ data path
 #1 is AAUDIO_POLICY_NEVER so it will not try MMAP
 #2 is AAUDIO_POLICY_AUTO so it will try MMAP then fallback to Legacy path
-PRODUCT_PROPERTY_OVERRIDES += aaudio.mmap_policy=1
+PRODUCT_PROPERTY_OVERRIDES += aaudio.mmap_policy=2
 #Allow EXCLUSIVE then fall back to SHARED.
-PRODUCT_PROPERTY_OVERRIDES += aaudio.mmap_exclusive_policy=1
+PRODUCT_PROPERTY_OVERRIDES += aaudio.mmap_exclusive_policy=2
 PRODUCT_PROPERTY_OVERRIDES += aaudio.hw_burst_min_usec=2000
 
 #enable mirror-link feature
diff --git a/hal/audio_extn/keep_alive.c b/hal/audio_extn/keep_alive.c
index 386bfc1..a969412 100644
--- a/hal/audio_extn/keep_alive.c
+++ b/hal/audio_extn/keep_alive.c
@@ -25,6 +25,11 @@
 * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
 * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
 * IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+*
+* Changes from Qualcomm Innovation Center are provided under the following license:
+*
+* Copyright (c) 2022 Qualcomm Innovation Center, Inc. All rights reserved.
+* SPDX-License-Identifier: BSD-3-Clause-Clear
 */
 
 #define LOG_TAG "keep_alive"
@@ -198,13 +203,14 @@
     struct listnode out_devices;
 
     pthread_mutex_lock(&ka.lock);
+    list_init(&out_devices);
+
     ALOGV("%s: mode %x", __func__, ka_mode);
     if ((ka.state == STATE_DISABLED)||(ka.state == STATE_DEINIT)) {
         ALOGE(" %s : Unexpected state %x",__func__, ka.state);
         goto exit;
     }
 
-    list_init(&out_devices);
     get_device_id_from_mode(ka_mode, &out_devices);
     if (compare_devices(&out_devices, &ka.active_devices) &&
             (ka.state == STATE_ACTIVE)) {
diff --git a/hal/audio_extn/power_policy_launcher.cpp b/hal/audio_extn/power_policy_launcher.cpp
index ac846cd..b655e37 100644
--- a/hal/audio_extn/power_policy_launcher.cpp
+++ b/hal/audio_extn/power_policy_launcher.cpp
@@ -36,7 +36,7 @@
 
     int launchPowerPolicyClient(power_policy_init_config_t init_config) {
         ALOGD("%s: power policy launcher called", __func__);
-        ABinderProcess_setThreadPoolMaxThreadCount(0);
+        ABinderProcess_setThreadPoolMaxThreadCount(1);
         std::shared_ptr<PowerPolicyClient> powerPolicyClient =
                 ::ndk::SharedRefBase::make<PowerPolicyClient>(init_config);
         ALOGD("%s:Instantiating power policy client from launcher", __func__);
diff --git a/hal/msm8974/platform.c b/hal/msm8974/platform.c
index 674601c..0736daf 100644
--- a/hal/msm8974/platform.c
+++ b/hal/msm8974/platform.c
@@ -5764,6 +5764,7 @@
         path = acdb_dev_type-1;
         fe_id = platform_get_fe_id(usecase->id, path);
 
+#ifdef PLATFORM_AUTO
         if (my_data->acdb_send_audio_cal_v6 && (fe_id != -1) ) {
             my_data->acdb_send_audio_cal_v6(acdb_dev_id, acdb_dev_type,
                                             app_type, sample_rate, fe_id,
@@ -5779,6 +5780,19 @@
             my_data->acdb_send_audio_cal(acdb_dev_id, acdb_dev_type, app_type,
                                          sample_rate);
         }
+#else
+        if (my_data->acdb_send_audio_cal_v4) {
+            my_data->acdb_send_audio_cal_v4(acdb_dev_id, acdb_dev_type,
+                                            app_type, sample_rate, i,
+                                            backend_cfg.sample_rate);
+        } else if (my_data->acdb_send_audio_cal_v3) {
+            my_data->acdb_send_audio_cal_v3(acdb_dev_id, acdb_dev_type,
+                                            app_type, sample_rate, i);
+        } else if (my_data->acdb_send_audio_cal) {
+            my_data->acdb_send_audio_cal(acdb_dev_id, acdb_dev_type, app_type,
+                                         sample_rate);
+        }
+#endif
     }
 
     /* send haptics audio calibration */
diff --git a/hal/platform_info.c b/hal/platform_info.c
index d9aabbf..0dd7c8c 100644
--- a/hal/platform_info.c
+++ b/hal/platform_info.c
@@ -391,6 +391,7 @@
 
     int pcm_id = atoi((char *)attr[5]);
 
+#ifdef PLATFORM_AUTO
     if (strcmp(attr[6], "fe") != 0) {
         ALOGE("%s: fe id not mentioned", __func__);
         goto done;
@@ -403,6 +404,15 @@
               __func__, attr[1], type, pcm_id, fe_id);
         goto done;
     }
+#else
+    int fe_id = -1;
+
+    if (platform_set_usecase_pcm_id(index, type, pcm_id, fe_id) < 0) {
+        ALOGE("%s: usecase %s type %d pcm_id %d fe_id %d was not set!",
+              __func__, attr[1], type, pcm_id, fe_id);
+        goto done;
+    }
+#endif
 
 done:
     return;