audio-hal: Changes to support multiple custom configs

To have support for multiple custom configs, send semicolon
seperated configs to pal

Change-Id: Ic4178adebe2346a45081d78918ce37db1cd43b7c
diff --git a/hal/AudioStream.cpp b/hal/AudioStream.cpp
index 3d13f61..854b053 100644
--- a/hal/AudioStream.cpp
+++ b/hal/AudioStream.cpp
@@ -89,20 +89,20 @@
     bool orientationInverted = adevice->inverted;
 
     if (orientationLandscape && !orientationInverted) {
-        strlcpy(palInDevice->custom_config.custom_key,
-            "unprocessed-hdr-mic-landscape",
+        strlcat(palInDevice->custom_config.custom_key,
+            "unprocessed-hdr-mic-landscape;",
             sizeof(palInDevice->custom_config.custom_key));
     } else if (!orientationLandscape && !orientationInverted) {
-        strlcpy(palInDevice->custom_config.custom_key,
-            "unprocessed-hdr-mic-portrait",
+        strlcat(palInDevice->custom_config.custom_key,
+            "unprocessed-hdr-mic-portrait;",
             sizeof(palInDevice->custom_config.custom_key));
     } else if (orientationLandscape && orientationInverted) {
-        strlcpy(palInDevice->custom_config.custom_key,
-            "unprocessed-hdr-mic-inverted-landscape",
+        strlcat(palInDevice->custom_config.custom_key,
+            "unprocessed-hdr-mic-inverted-landscape;",
             sizeof(palInDevice->custom_config.custom_key));
     } else if (!orientationLandscape && orientationInverted) {
-        strlcpy(palInDevice->custom_config.custom_key,
-            "unprocessed-hdr-mic-inverted-portrait",
+        strlcat(palInDevice->custom_config.custom_key,
+            "unprocessed-hdr-mic-inverted-portrait;",
             sizeof(palInDevice->custom_config.custom_key));
     }
     AHAL_INFO("Setting custom key as %s",
@@ -2218,7 +2218,7 @@
 
             if ((AudioExtn::audio_devices_cmp(mAndroidOutDevices, AUDIO_DEVICE_OUT_SPEAKER_SAFE)) &&
                                    (mPalOutDeviceIds[i] == PAL_DEVICE_OUT_SPEAKER)) {
-                strlcpy(mPalOutDevice[i].custom_config.custom_key, "speaker-safe",
+                strlcat(mPalOutDevice[i].custom_config.custom_key, "speaker-safe;",
                         sizeof(mPalOutDevice[i].custom_config.custom_key));
                 AHAL_INFO("Setting custom key as %s", mPalOutDevice[i].custom_config.custom_key);
             }
@@ -2230,8 +2230,8 @@
 
                 AHAL_DBG("hifi-filter custom key sent to PAL (only applicable to certain streams)\n");
 
-                strlcpy(mPalOutDevice[i].custom_config.custom_key,
-                       "hifi-filter_custom_key",
+                strlcat(mPalOutDevice[i].custom_config.custom_key,
+                       "hifi-filter_custom_key;",
                        sizeof(mPalOutDevice[i].custom_config.custom_key));
             }
 
@@ -2243,16 +2243,16 @@
                   (mPalOutDevice[i].id == PAL_DEVICE_OUT_WIRED_HEADPHONE) ||
                   (mPalOutDevice[i].id == PAL_DEVICE_OUT_WIRED_HEADSET))) {
                 if (config_.sample_rate == 8000) {
-                    strlcpy(mPalOutDevice[i].custom_config.custom_key, "8K",
+                    strlcat(mPalOutDevice[i].custom_config.custom_key, "8K;",
                     sizeof(mPalOutDevice[i].custom_config.custom_key));
                 } else if (config_.sample_rate == 16000) {
-                     strlcpy(mPalOutDevice[i].custom_config.custom_key, "16K",
+                     strlcat(mPalOutDevice[i].custom_config.custom_key, "16K;",
                      sizeof(mPalOutDevice[i].custom_config.custom_key));
                 } else if (config_.sample_rate == 32000) {
-                    strlcpy(mPalOutDevice[i].custom_config.custom_key, "32K",
+                    strlcat(mPalOutDevice[i].custom_config.custom_key, "32K;",
                     sizeof(mPalOutDevice[i].custom_config.custom_key));
                 } else if (config_.sample_rate == 48000) {
-                    strlcpy(mPalOutDevice[i].custom_config.custom_key, "48K",
+                    strlcat(mPalOutDevice[i].custom_config.custom_key, "48K;",
                     sizeof(mPalOutDevice[i].custom_config.custom_key));
                 } else {
                     AHAL_DBG("No custom config to set for usecase %d for sr %d",
@@ -2266,7 +2266,7 @@
 
         std::shared_ptr<AudioDevice> adevice = AudioDevice::GetInstance();
         if (adevice->hac_voip && (mPalOutDevice->id == PAL_DEVICE_OUT_HANDSET)) {
-            strlcpy(mPalOutDevice->custom_config.custom_key, "HAC",
+            strlcat(mPalOutDevice->custom_config.custom_key, "HAC;",
                    sizeof(mPalOutDevice->custom_config.custom_key));
         }
 
@@ -2726,8 +2726,8 @@
 
         AHAL_DBG("hifi-filter custom key sent to PAL (only applicable to certain streams)\n");
 
-        strlcpy(mPalOutDevice->custom_config.custom_key,
-                "hifi-filter_custom_key",
+        strlcat(mPalOutDevice->custom_config.custom_key,
+                "hifi-filter_custom_key;",
                 sizeof(mPalOutDevice->custom_config.custom_key));
     }
 
@@ -2752,7 +2752,7 @@
     }
 
     if (adevice->hac_voip && (mPalOutDevice->id == PAL_DEVICE_OUT_HANDSET)) {
-        strlcpy(mPalOutDevice->custom_config.custom_key, "HAC",
+        strlcat(mPalOutDevice->custom_config.custom_key, "HAC;",
                 sizeof(mPalOutDevice->custom_config.custom_key));
     }
 
@@ -3527,7 +3527,7 @@
 
         if ((AudioExtn::audio_devices_cmp(mAndroidOutDevices, AUDIO_DEVICE_OUT_SPEAKER_SAFE)) &&
                                    (mPalOutDeviceIds[i] == PAL_DEVICE_OUT_SPEAKER)) {
-            strlcpy(mPalOutDevice[i].custom_config.custom_key, "speaker-safe",
+            strlcat(mPalOutDevice[i].custom_config.custom_key, "speaker-safe;",
                      sizeof(mPalOutDevice[i].custom_config.custom_key));
             AHAL_INFO("Setting custom key as %s", mPalOutDevice[i].custom_config.custom_key);
         }
@@ -3540,16 +3540,16 @@
               (mPalOutDevice[i].id == PAL_DEVICE_OUT_WIRED_HEADPHONE) ||
               (mPalOutDevice[i].id == PAL_DEVICE_OUT_WIRED_HEADSET))) {
             if (config_.sample_rate == 8000) {
-                strlcpy(mPalOutDevice[i].custom_config.custom_key, "8K",
+                strlcat(mPalOutDevice[i].custom_config.custom_key, "8K;",
                 sizeof(mPalOutDevice[i].custom_config.custom_key));
             } else if (config_.sample_rate == 16000) {
-                 strlcpy(mPalOutDevice[i].custom_config.custom_key, "16K",
+                 strlcat(mPalOutDevice[i].custom_config.custom_key, "16K;",
                  sizeof(mPalOutDevice[i].custom_config.custom_key));
             } else if (config_.sample_rate == 32000) {
-                strlcpy(mPalOutDevice[i].custom_config.custom_key, "32K",
+                strlcat(mPalOutDevice[i].custom_config.custom_key, "32K;",
                 sizeof(mPalOutDevice[i].custom_config.custom_key));
             } else if (config_.sample_rate == 48000) {
-                strlcpy(mPalOutDevice[i].custom_config.custom_key, "48K",
+                strlcat(mPalOutDevice[i].custom_config.custom_key, "48K;",
                 sizeof(mPalOutDevice[i].custom_config.custom_key));
             } else {
                 AHAL_DBG("No custom config to set for usecase %d for sr %d",
@@ -4037,7 +4037,7 @@
                 setup_hdr_usecase(&mPalInDevice[i]);
 
             if (source_ == AUDIO_SOURCE_CAMCORDER && adevice->cameraOrientation == CAMERA_DEFAULT) {
-                strlcpy(mPalInDevice[i].custom_config.custom_key, "camcorder_landscape",
+                strlcat(mPalInDevice[i].custom_config.custom_key, "camcorder_landscape;",
                         sizeof(mPalInDevice[i].custom_config.custom_key));
                 AHAL_INFO("Setting custom key as %s", mPalInDevice[i].custom_config.custom_key);
             }
@@ -4048,16 +4048,16 @@
                  (mPalInDevice[i].id == PAL_DEVICE_IN_SPEAKER_MIC) ||
                  (mPalInDevice[i].id == PAL_DEVICE_IN_WIRED_HEADSET))) {
                 if (config_.sample_rate == 8000) {
-                    strlcpy(mPalInDevice[i].custom_config.custom_key, "8K",
+                    strlcat(mPalInDevice[i].custom_config.custom_key, "8K;",
                     sizeof(mPalInDevice[i].custom_config.custom_key));
                 } else if (config_.sample_rate == 16000) {
-                     strlcpy(mPalInDevice[i].custom_config.custom_key, "16K",
+                     strlcat(mPalInDevice[i].custom_config.custom_key, "16K;",
                      sizeof(mPalInDevice[i].custom_config.custom_key));
                 } else if (config_.sample_rate == 32000) {
-                    strlcpy(mPalInDevice[i].custom_config.custom_key, "32K",
+                    strlcat(mPalInDevice[i].custom_config.custom_key, "32K;",
                     sizeof(mPalInDevice[i].custom_config.custom_key));
                 } else if (config_.sample_rate == 48000) {
-                    strlcpy(mPalInDevice[i].custom_config.custom_key, "48K",
+                    strlcat(mPalInDevice[i].custom_config.custom_key, "48K;",
                     sizeof(mPalInDevice[i].custom_config.custom_key));
                 } else {
                     AHAL_DBG("No custom config to set for usecase %d for sr %d",
@@ -4873,7 +4873,7 @@
                 sizeof(mPalInDevice[i].custom_config.custom_key));
 
         if (source_ == AUDIO_SOURCE_CAMCORDER && adevice->cameraOrientation == CAMERA_DEFAULT) {
-            strlcpy(mPalInDevice[i].custom_config.custom_key, "camcorder_landscape",
+            strlcat(mPalInDevice[i].custom_config.custom_key, "camcorder_landscape;",
                     sizeof(mPalInDevice[i].custom_config.custom_key));
             AHAL_INFO("Setting custom key as %s", mPalInDevice[i].custom_config.custom_key);
         }
@@ -4884,16 +4884,16 @@
              (mPalInDevice[i].id == PAL_DEVICE_IN_SPEAKER_MIC) ||
              (mPalInDevice[i].id == PAL_DEVICE_IN_WIRED_HEADSET))) {
             if (config_.sample_rate == 8000) {
-                strlcpy(mPalInDevice[i].custom_config.custom_key, "8K",
+                strlcat(mPalInDevice[i].custom_config.custom_key, "8K;",
                 sizeof(mPalInDevice[i].custom_config.custom_key));
             } else if (config_.sample_rate == 16000) {
-                 strlcpy(mPalInDevice[i].custom_config.custom_key, "16K",
+                 strlcat(mPalInDevice[i].custom_config.custom_key, "16K;",
                  sizeof(mPalInDevice[i].custom_config.custom_key));
             } else if (config_.sample_rate == 32000) {
-                strlcpy(mPalInDevice[i].custom_config.custom_key, "32K",
+                strlcat(mPalInDevice[i].custom_config.custom_key, "32K;",
                 sizeof(mPalInDevice[i].custom_config.custom_key));
             } else if (config_.sample_rate == 48000) {
-                strlcpy(mPalInDevice[i].custom_config.custom_key, "48K",
+                strlcat(mPalInDevice[i].custom_config.custom_key, "48K;",
                 sizeof(mPalInDevice[i].custom_config.custom_key));
             } else {
                 AHAL_DBG("No custom config to set for usecase %d for sr %d",
diff --git a/hal/AudioVoice.cpp b/hal/AudioVoice.cpp
index 15a8169..fdd9f9d 100644
--- a/hal/AudioVoice.cpp
+++ b/hal/AudioVoice.cpp
@@ -1,6 +1,6 @@
 /*
  * Copyright (c) 2019-2021, The Linux Foundation. All rights reserved.
- * Copyright (c) 2022 Qualcomm Innovation Center, Inc. All rights reserved.
+ * Copyright (c) 2022, 2024, Qualcomm Innovation Center, Inc. All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions are
@@ -679,9 +679,9 @@
     /*set custom key for hac mode*/
     if (session && session->hac && palDevices[1].id == 
         PAL_DEVICE_OUT_HANDSET) {
-        strlcpy(palDevices[0].custom_config.custom_key, "HAC",
+        strlcat(palDevices[0].custom_config.custom_key, "HAC;",
                     sizeof(palDevices[0].custom_config.custom_key));
-        strlcpy(palDevices[1].custom_config.custom_key, "HAC",
+        strlcat(palDevices[1].custom_config.custom_key, "HAC;",
                     sizeof(palDevices[1].custom_config.custom_key));
         AHAL_INFO("Setting custom key as %s", palDevices[0].custom_config.custom_key);
     }
@@ -945,9 +945,9 @@
     /*set or remove custom key for hac mode*/
     if (session && session->hac && palDevices[1].id == 
         PAL_DEVICE_OUT_HANDSET) {
-        strlcpy(palDevices[0].custom_config.custom_key, "HAC",
+        strlcat(palDevices[0].custom_config.custom_key, "HAC;",
                     sizeof(palDevices[0].custom_config.custom_key));
-        strlcpy(palDevices[1].custom_config.custom_key, "HAC",
+        strlcat(palDevices[1].custom_config.custom_key, "HAC;",
                     sizeof(palDevices[1].custom_config.custom_key));
             AHAL_INFO("Setting custom key as %s", palDevices[0].custom_config.custom_key);
     } else {