Merge tag 'LA.VENDOR.1.0.r1-25300-WAIPIO.QSSI15.0' into staging/lineage-21.0_merge-LA.VENDOR.1.0.r1-25300-WAIPIO.QSSI15.0

"LA.VENDOR.1.0.r1-25300-WAIPIO.QSSI15.0"

# By Trinath Thammishetty (5) and others
# Via Gerrit - the friendly Code Review server (12) and others
* tag 'LA.VENDOR.1.0.r1-25300-WAIPIO.QSSI15.0':
  pal: make initial volume take effect instantly before pcm/compress start
  PAL: For more than one voice recorgnition record session use pcm record
  pal: Update paused status at the end of pause_l
  Pal: Move setting volume to 0 after finishing pause
  pal:  Change volumeRamp parameters during pause/resume.
  PAL: support additonal SR custom key for USB_RX
  PAL: add additional CKVs for devicePP
  pal: Add support for dynamic sr feature
  PAL: configure ec mfc for record usecase
  pal: Support for multiple custom configs
  PAL: send sample rate custom key for voice recognition
  PAL: Configure ec ref mfc during device switch
  PAL: add 8k,16k,32k rate support for headphone
  pal: Update sample rate for VI feedback device
  PAL: Send sample rate CKVs for devicePP
  PAL: Send sample rate CKVs for devicePP
  Pal : add support to set and fire voice_num_channel ckv

Change-Id: I8e6b1fb1e27c4ff7435f794b9b268019dc473051
diff --git a/.gitupstream b/.gitupstream
new file mode 100644
index 0000000..3fee311
--- /dev/null
+++ b/.gitupstream
@@ -0,0 +1 @@
+https://git.codelinaro.org/clo/la/platform/vendor/qcom/opensource/arpal-lx
diff --git a/Android.mk b/Android.mk
index c7670ca..ce55f80 100644
--- a/Android.mk
+++ b/Android.mk
@@ -6,6 +6,24 @@
 
 include $(CLEAR_VARS)
 
+LOCAL_MODULE                := libarpal_headers
+LOCAL_VENDOR_MODULE         := true
+LOCAL_EXPORT_C_INCLUDE_DIRS := \
+    $(LOCAL_PATH) \
+    $(LOCAL_PATH)/stream/inc \
+    $(LOCAL_PATH)/device/inc \
+    $(LOCAL_PATH)/session/inc \
+    $(LOCAL_PATH)/resource_manager/inc \
+    $(LOCAL_PATH)/context_manager/inc \
+    $(LOCAL_PATH)/utils/inc \
+    $(LOCAL_PATH)/plugins/codecs
+
+include $(BUILD_HEADER_LIBRARY)
+
+ifneq ($(QCPATH),)
+
+include $(CLEAR_VARS)
+
 LOCAL_MODULE        := libar-pal
 LOCAL_MODULE_OWNER  := qti
 LOCAL_MODULE_TAGS   := optional
@@ -21,13 +39,6 @@
 LOCAL_CPPFLAGS      += -fexceptions -frtti
 
 LOCAL_C_INCLUDES := \
-    $(LOCAL_PATH)/stream/inc \
-    $(LOCAL_PATH)/device/inc \
-    $(LOCAL_PATH)/session/inc \
-    $(LOCAL_PATH)/resource_manager/inc \
-    $(LOCAL_PATH)/context_manager/inc \
-    $(LOCAL_PATH)/utils/inc \
-    $(LOCAL_PATH)/plugins/codecs \
     $(TOP)/system/media/audio_route/include \
     $(TOP)/system/media/audio/include
 
@@ -122,7 +133,7 @@
     libcapiv2_headers \
     libagm_headers \
     libacdb_headers \
-    liblisten_headers
+    libpal_headers
 
 LOCAL_SHARED_LIBRARIES := \
     libar-gsl\
@@ -146,6 +157,8 @@
 
 include $(BUILD_SHARED_LIBRARY)
 
+endif
+
 #-------------------------------------------
 #            Build CHARGER_LISTENER LIB
 #-------------------------------------------
@@ -169,7 +182,7 @@
 include $(CLEAR_VARS)
 LOCAL_USE_VNDK := true
 
-LOCAL_C_INCLUDES     := $(TOP)/vendor/qcom/opensource/pal
+LOCAL_C_INCLUDES     := $(call project-path-for,qcom-audio)/pal
 
 LOCAL_CFLAGS += -Wno-tautological-compare
 LOCAL_CFLAGS += -Wno-macro-redefined
diff --git a/Makefile.am b/Makefile.am
index ce0e358..0e5a582 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -24,6 +24,7 @@
             ./device/inc/UltrasoundDevice.h \
             ./session/inc/Session.h \
             ./session/inc/PayloadBuilder.h \
+            ./session/inc/kvh2xml.h \
             ./session/inc/SessionGsl.h \
             ./session/inc/SessionAlsaUtils.h \
             ./session/inc/SessionAlsaPcm.h \
@@ -101,6 +102,7 @@
             ${top_srcdir}/session/inc/ACDEngine.h \
             ${top_srcdir}/session/inc/Session.h \
             ${top_srcdir}/session/inc/PayloadBuilder.h \
+            $(top_srcdir)/session/inc/kvh2xml.h \
             ${top_srcdir}/session/inc/SessionGsl.h \
             ${top_srcdir}/session/inc/SessionAlsaPcm.h \
             ${top_srcdir}/session/inc/SessionAlsaCompress.h \
@@ -139,6 +141,7 @@
 AM_CPPFLAGS += -Wno-sign-compare -Wno-unused-result
 AM_CPPFLAGS += -D__unused=__attribute__\(\(__unused__\)\) -DLINUX_ENABLED
 AM_CPPFLAGS += -DSND_AUDIOCODEC_ALAC=0x00000020 -DSND_AUDIOCODEC_APE=0x00000021
+AM_CPPFLAGS += $(GECKO_CFLAGS)
 AM_CPPFLAGS += -DCONFIG_GSL
 
 pal_sources = ${top_srcdir}/stream/src/Stream.cpp \
diff --git a/configure.ac b/configure.ac
index fc073f0..8a1ed36 100644
--- a/configure.ac
+++ b/configure.ac
@@ -55,15 +55,6 @@
 
 AC_SUBST(SPF_CFLAGS)
 
-AC_ARG_WITH([acdbdata],
-      AC_HELP_STRING([--with-acdbdata],
-         [enable acdbdata, Build against acdbdata. Use this when building for HLOS systems which use acdbdata]))
-
-ACDBDATA_CFLAGS=
-AS_IF([test "x$with_acdbdata" != "xno"], [ACDBDATA_CFLAGS="-I$with_acdbdata"])
-
-AC_SUBST(ACDBDATA_CFLAGS)
-
 AC_ARG_WITH([compress],
     AS_HELP_STRING([compile compress (default is no)]),
     [with_compress=$withval],
diff --git a/context_manager/inc/ContextManager.h b/context_manager/inc/ContextManager.h
index a417e40..f25fde7 100644
--- a/context_manager/inc/ContextManager.h
+++ b/context_manager/inc/ContextManager.h
@@ -37,7 +37,6 @@
 #include <PalApi.h>
 #include "ACDPlatformInfo.h"
 #include <PalCommon.h>
-#include "kvh2xml.h"
 
 enum PCM_DATA_EFFECT {
     PCM_DATA_EFFECT_RAW = 1,
diff --git a/device/src/Bluetooth.cpp b/device/src/Bluetooth.cpp
index b6b2cbb..a95322d 100644
--- a/device/src/Bluetooth.cpp
+++ b/device/src/Bluetooth.cpp
@@ -35,7 +35,6 @@
 #include "Session.h"
 #include "SessionAlsaUtils.h"
 #include "Device.h"
-#include "kvh2xml.h"
 #include <dlfcn.h>
 #include <unistd.h>
 #include <cutils/properties.h>
diff --git a/device/src/DisplayPort.cpp b/device/src/DisplayPort.cpp
index cf2b599..62d07c6 100644
--- a/device/src/DisplayPort.cpp
+++ b/device/src/DisplayPort.cpp
@@ -38,7 +38,6 @@
 #include "ResourceManager.h"
 #include "PayloadBuilder.h"
 #include "Device.h"
-#include "kvh2xml.h"
 
 enum {
     EXT_DISPLAY_TYPE_NONE,
diff --git a/device/src/ExtEC.cpp b/device/src/ExtEC.cpp
index 5f7c121..27abc9d 100644
--- a/device/src/ExtEC.cpp
+++ b/device/src/ExtEC.cpp
@@ -31,7 +31,6 @@
 #include "ExtEC.h"
 #include "ResourceManager.h"
 #include "Device.h"
-#include "kvh2xml.h"
 
 std::shared_ptr<Device> ExtEC::obj = nullptr;
 
@@ -117,4 +116,4 @@
             break;
     }
     return rc;
-}
\ No newline at end of file
+}
diff --git a/device/src/FMDevice.cpp b/device/src/FMDevice.cpp
index 499dd7a..f84e071 100644
--- a/device/src/FMDevice.cpp
+++ b/device/src/FMDevice.cpp
@@ -31,7 +31,6 @@
 #include "ResourceManager.h"
 #include "FMDevice.h"
 #include "Device.h"
-#include "kvh2xml.h"
 
 std::shared_ptr<Device> FMDevice::obj = nullptr;
 
diff --git a/device/src/Handset.cpp b/device/src/Handset.cpp
index 7c46eb7..2bbbbd5 100644
--- a/device/src/Handset.cpp
+++ b/device/src/Handset.cpp
@@ -32,7 +32,6 @@
 #include "Handset.h"
 #include "ResourceManager.h"
 #include "Device.h"
-#include "kvh2xml.h"
 #include "SpeakerProtection.h"
 
 std::shared_ptr<Device> Handset::obj = nullptr;
diff --git a/device/src/HandsetMic.cpp b/device/src/HandsetMic.cpp
index 115a615..02188d3 100644
--- a/device/src/HandsetMic.cpp
+++ b/device/src/HandsetMic.cpp
@@ -34,7 +34,6 @@
 #include "PalAudioRoute.h"
 #include "ResourceManager.h"
 #include "Device.h"
-#include "kvh2xml.h"
 
 std::shared_ptr<Device> HandsetMic::obj = nullptr;
 
diff --git a/device/src/HandsetVaMic.cpp b/device/src/HandsetVaMic.cpp
index 7eea10e..2a8ce37 100644
--- a/device/src/HandsetVaMic.cpp
+++ b/device/src/HandsetVaMic.cpp
@@ -34,7 +34,6 @@
 #include "PalAudioRoute.h"
 #include "ResourceManager.h"
 #include "Device.h"
-#include "kvh2xml.h"
 
 std::shared_ptr<Device> HandsetVaMic::obj = nullptr;
 
diff --git a/device/src/HapticsDev.cpp b/device/src/HapticsDev.cpp
index 114adf4..efc998a 100644
--- a/device/src/HapticsDev.cpp
+++ b/device/src/HapticsDev.cpp
@@ -31,7 +31,6 @@
 #include "HapticsDev.h"
 #include "ResourceManager.h"
 #include "Device.h"
-#include "kvh2xml.h"
 
 std::shared_ptr<Device> HapticsDev::obj = nullptr;
 
diff --git a/device/src/Headphone.cpp b/device/src/Headphone.cpp
index 7c5a64f..fdceedf 100644
--- a/device/src/Headphone.cpp
+++ b/device/src/Headphone.cpp
@@ -35,7 +35,6 @@
 #include "Headphone.h"
 #include "ResourceManager.h"
 #include "Device.h"
-#include "kvh2xml.h"
 
 std::shared_ptr<Device> Headphone::obj = nullptr;
 
diff --git a/device/src/HeadsetMic.cpp b/device/src/HeadsetMic.cpp
index 30b532f..a188068 100644
--- a/device/src/HeadsetMic.cpp
+++ b/device/src/HeadsetMic.cpp
@@ -38,7 +38,6 @@
 #include "PalAudioRoute.h"
 #include "ResourceManager.h"
 #include "Device.h"
-#include "kvh2xml.h"
 
 std::shared_ptr<Device> HeadsetMic::obj = nullptr;
 
diff --git a/device/src/HeadsetVaMic.cpp b/device/src/HeadsetVaMic.cpp
index 4818643..205e706 100644
--- a/device/src/HeadsetVaMic.cpp
+++ b/device/src/HeadsetVaMic.cpp
@@ -34,7 +34,6 @@
 #include "PalAudioRoute.h"
 #include "ResourceManager.h"
 #include "Device.h"
-#include "kvh2xml.h"
 
 std::shared_ptr<Device> HeadsetVaMic::obj = nullptr;
 
diff --git a/device/src/RTProxy.cpp b/device/src/RTProxy.cpp
index f1ff2c3..6f92348 100644
--- a/device/src/RTProxy.cpp
+++ b/device/src/RTProxy.cpp
@@ -32,7 +32,6 @@
 #include "RTProxy.h"
 #include "ResourceManager.h"
 #include "Device.h"
-#include "kvh2xml.h"
 
 #include "PayloadBuilder.h"
 #include "Stream.h"
diff --git a/device/src/Speaker.cpp b/device/src/Speaker.cpp
index 5fa6bff..79db874 100644
--- a/device/src/Speaker.cpp
+++ b/device/src/Speaker.cpp
@@ -32,7 +32,6 @@
 #include "ResourceManager.h"
 #include "SpeakerProtection.h"
 #include "Device.h"
-#include "kvh2xml.h"
 
 std::shared_ptr<Device> Speaker::obj = nullptr;
 
diff --git a/device/src/SpeakerMic.cpp b/device/src/SpeakerMic.cpp
index 696377e..4fc78ae 100644
--- a/device/src/SpeakerMic.cpp
+++ b/device/src/SpeakerMic.cpp
@@ -34,7 +34,6 @@
 #include "PalAudioRoute.h"
 #include "ResourceManager.h"
 #include "Device.h"
-#include "kvh2xml.h"
 
 std::shared_ptr<Device> SpeakerMic::obj = nullptr;
 
diff --git a/device/src/SpeakerProtection.cpp b/device/src/SpeakerProtection.cpp
index 0aa0838..86511e5 100644
--- a/device/src/SpeakerProtection.cpp
+++ b/device/src/SpeakerProtection.cpp
@@ -35,7 +35,6 @@
 #include "PalAudioRoute.h"
 #include "ResourceManager.h"
 #include "SessionAlsaUtils.h"
-#include "kvh2xml.h"
 #include <agm/agm_api.h>
 
 #include<fstream>
diff --git a/device/src/USBAudio.cpp b/device/src/USBAudio.cpp
index 020e653..3507e1f 100644
--- a/device/src/USBAudio.cpp
+++ b/device/src/USBAudio.cpp
@@ -37,7 +37,6 @@
 #include "ResourceManager.h"
 #include "PayloadBuilder.h"
 #include "Device.h"
-#include "kvh2xml.h"
 #include <unistd.h>
 
 std::shared_ptr<Device> USB::objRx = nullptr;
diff --git a/device/src/UltrasoundDevice.cpp b/device/src/UltrasoundDevice.cpp
index e424d74..6a60959 100644
--- a/device/src/UltrasoundDevice.cpp
+++ b/device/src/UltrasoundDevice.cpp
@@ -31,7 +31,6 @@
 #include "UltrasoundDevice.h"
 #include "ResourceManager.h"
 #include "Device.h"
-#include "kvh2xml.h"
 
 std::shared_ptr<Device> UltrasoundDevice::objRx = nullptr;
 std::shared_ptr<Device> UltrasoundDevice::objTx = nullptr;
diff --git a/ipc/HwBinders/interfaces/Android.bp b/ipc/HwBinders/interfaces/Android.bp
index e4d713f..a35cad4 100644
--- a/ipc/HwBinders/interfaces/Android.bp
+++ b/ipc/HwBinders/interfaces/Android.bp
@@ -3,5 +3,5 @@
 ]
 hidl_package_root {
      name: "vendor.qti.hardware.pal",
-     path: "vendor/qcom/opensource/pal/ipc/HwBinders/interfaces/pal",
+     path: "hardware/qcom-caf/sm8450/audio/pal/ipc/HwBinders/interfaces/pal",
 }
diff --git a/ipc/HwBinders/pal_ipc_client/Android.mk b/ipc/HwBinders/pal_ipc_client/Android.mk
index ab83293..be82f7c 100644
--- a/ipc/HwBinders/pal_ipc_client/Android.mk
+++ b/ipc/HwBinders/pal_ipc_client/Android.mk
@@ -2,10 +2,11 @@
 
 include $(CLEAR_VARS)
 
-LOCAL_C_INCLUDES += vendor/qcom/opensource/pal
+LOCAL_C_INCLUDES += $(call project-path-for,qcom-audio)/pal
 LOCAL_MODULE := libpalclient
 LOCAL_MODULE_OWNER := qti
 LOCAL_VENDOR_MODULE := true
+LOCAL_CFLAGS += -Wno-unused-parameter -Wno-unused-variable -Wno-format
 LOCAL_SRC_FILES := \
     src/pal_client_wrapper.cpp
 
diff --git a/ipc/HwBinders/pal_ipc_server/Android.mk b/ipc/HwBinders/pal_ipc_server/Android.mk
index 4760afc..2030b5a 100644
--- a/ipc/HwBinders/pal_ipc_server/Android.mk
+++ b/ipc/HwBinders/pal_ipc_server/Android.mk
@@ -5,11 +5,23 @@
 LOCAL_MODULE_OWNER := qti
 LOCAL_VENDOR_MODULE := true
 LOCAL_CFLAGS += -v
+LOCAL_CFLAGS += \
+    -Wno-unused-parameter \
+    -Wno-unused-variable \
+    -Wno-format \
+    -Wno-missing-field-initializers \
+    -Wno-unused-function
+
 LOCAL_SRC_FILES := \
     src/pal_server_wrapper.cpp
 
 LOCAL_EXPORT_C_INCLUDE_DIRS := $(LOCAL_PATH)/inc
 
+ifeq ($(QCPATH),)
+LOCAL_C_INCLUDES := \
+    $(LOCAL_PATH)/../../..
+endif
+
 LOCAL_SHARED_LIBRARIES := \
     libhidlbase \
     libhidltransport \
diff --git a/ipc/HwBinders/pal_ipc_server/inc/pal_server_wrapper.h b/ipc/HwBinders/pal_ipc_server/inc/pal_server_wrapper.h
index 214e312..c17abc4 100644
--- a/ipc/HwBinders/pal_ipc_server/inc/pal_server_wrapper.h
+++ b/ipc/HwBinders/pal_ipc_server/inc/pal_server_wrapper.h
@@ -111,7 +111,6 @@
 
 struct PAL : public IPAL /*, public android::hardware::hidl_death_recipient*/{
     public:
-    std::mutex mClientLock;
     PAL()
     {
         sInstance = this;
@@ -203,7 +202,6 @@
     static PAL* sInstance;
     int find_dup_fd_from_input_fd(const uint64_t streamHandle, int input_fd, int *dup_fd);
     void add_input_and_dup_fd(const uint64_t streamHandle, int input_fd, int dup_fd);
-    bool isValidstreamHandle(const uint64_t streamHandle);
 };
 
 class PalClientDeathRecipient : public android::hardware::hidl_death_recipient
diff --git a/ipc/HwBinders/pal_ipc_server/src/pal_server_wrapper.cpp b/ipc/HwBinders/pal_ipc_server/src/pal_server_wrapper.cpp
index d9db67e..5e2497b 100644
--- a/ipc/HwBinders/pal_ipc_server/src/pal_server_wrapper.cpp
+++ b/ipc/HwBinders/pal_ipc_server/src/pal_server_wrapper.cpp
@@ -57,7 +57,6 @@
     std::lock_guard<std::mutex> guard(mLock);
     ALOGD("%s : client died pid : %d", __func__, cookie);
     int pid = (int) cookie;
-    std::lock_guard<std::mutex> lock(mPalInstance->mClientLock);
     auto &clients = mPalInstance->mPalClients;
     for (auto itr = clients.begin(); itr != clients.end(); itr++) {
         auto client = *itr;
@@ -89,7 +88,6 @@
 void PAL::add_input_and_dup_fd(const uint64_t streamHandle, int input_fd, int dup_fd)
 {
     std::vector<std::pair<int, int>>::iterator it;
-    std::lock_guard<std::mutex> guard(mClientLock);
     for (auto& s: mPalClients) {
         std::lock_guard<std::mutex> lock(s->mActiveSessionsLock);
         for (int i = 0; i < s->mActiveSessions.size(); i++) {
@@ -133,7 +131,6 @@
            ALOGE("%s: No PAL instance running", __func__);
            return false;
         }
-        std::lock_guard<std::mutex> guard(PAL::getInstance()->mClientLock);
         for (auto& s: PAL::getInstance()->mPalClients) {
             std::lock_guard<std::mutex> lock(s->mActiveSessionsLock);
             for (int idx = 0; idx < s->mActiveSessions.size(); idx++) {
@@ -173,7 +170,6 @@
          * Find the original fd that was passed by client based on what
          * input and dup fd list and send that back.
          */
-        PAL::getInstance()->mClientLock.lock();
         for (auto& s: PAL::getInstance()->mPalClients) {
             std::lock_guard<std::mutex> lock(s->mActiveSessionsLock);
             for (int idx = 0; idx < s->mActiveSessions.size(); idx++) {
@@ -196,7 +192,6 @@
                 }
             }
         }
-        PAL::getInstance()->mClientLock.unlock();
 
         rwDonePayloadHidl.resize(sizeof(struct pal_event_read_write_done_payload));
         rwDonePayload =(PalEventReadWriteDonePayload *)rwDonePayloadHidl.data();
@@ -316,32 +311,6 @@
    print_media_config(&attr->out_media_config);
 }
 
-bool PAL::isValidstreamHandle(const uint64_t streamHandle) {
-    int pid = ::android::hardware::IPCThreadState::self()->getCallingPid();
-
-    std::lock_guard<std::mutex> guard(mClientLock);
-    for (auto itr = mPalClients.begin(); itr != mPalClients.end(); ) {
-        auto client = *itr;
-        if (client->pid == pid) {
-            std::lock_guard<std::mutex> lock(client->mActiveSessionsLock);
-            auto sItr = client->mActiveSessions.begin();
-            for (; sItr != client->mActiveSessions.end(); sItr++) {
-                if (sItr->session_handle == streamHandle) {
-                    return true;
-                }
-            }
-            ALOGE("%s: streamHandle: %pK for pid %d not found",
-                    __func__, streamHandle, pid);
-            return false;
-        }
-        itr++;
-    }
-
-    ALOGE("%s: client info for pid %d not found",
-            __func__, pid);
-    return false;
-}
-
 Return<void> PAL::ipc_pal_stream_open(const hidl_vec<PalStreamAttributes>& attr_hidl,
                             uint32_t noOfDevices,
                             const hidl_vec<PalDevice>& devs_hidl,
@@ -445,7 +414,6 @@
                           callback, (uint64_t)sr_clbk_data.get(), &stream_handle);
 
     if (!ret) {
-        std::lock_guard<std::mutex> guard(mClientLock);
         for(auto& client: mPalClients) {
             if (client->pid == pid) {
                 /*Another session from the same client*/
@@ -501,13 +469,8 @@
 Return<int32_t> PAL::ipc_pal_stream_close(const uint64_t streamHandle)
 {
     int pid = ::android::hardware::IPCThreadState::self()->getCallingPid();
+    Return<int32_t> status = pal_stream_close((pal_stream_handle_t *)streamHandle);
 
-    if (!isValidstreamHandle(streamHandle)) {
-        ALOGE("%s: Invalid streamHandle: %pK", __func__, streamHandle);
-        return -EINVAL;
-    }
-
-    mClientLock.lock();
     for (auto itr = mPalClients.begin(); itr != mPalClients.end(); ) {
         auto client = *itr;
         if (client->pid == pid) {
@@ -540,77 +503,38 @@
             break;
         }
     }
-    mClientLock.unlock();
-
-    Return<int32_t> status = pal_stream_close((pal_stream_handle_t *)streamHandle);
-
     return status;
 }
 
 Return<int32_t> PAL::ipc_pal_stream_start(const uint64_t streamHandle) {
-    if (!isValidstreamHandle(streamHandle)) {
-        ALOGE("%s: Invalid streamHandle: %pK", __func__, streamHandle);
-        return -EINVAL;
-    }
 
     return pal_stream_start((pal_stream_handle_t *)streamHandle);
 }
 
 Return<int32_t> PAL::ipc_pal_stream_stop(const uint64_t streamHandle) {
-    if (!isValidstreamHandle(streamHandle)) {
-        ALOGE("%s: Invalid streamHandle: %pK", __func__, streamHandle);
-        return -EINVAL;
-    }
-
     return pal_stream_stop((pal_stream_handle_t *)streamHandle);
 }
 
 Return<int32_t> PAL::ipc_pal_stream_pause(const uint64_t streamHandle) {
-    if (!isValidstreamHandle(streamHandle)) {
-        ALOGE("%s: Invalid streamHandle: %pK", __func__, streamHandle);
-        return -EINVAL;
-    }
-
     return pal_stream_pause((pal_stream_handle_t *)streamHandle);
 }
 
 Return<int32_t> PAL::ipc_pal_stream_drain(uint64_t streamHandle, PalDrainType type)
 {
     pal_drain_type_t drain_type = (pal_drain_type_t) type;
-
-    if (!isValidstreamHandle(streamHandle)) {
-        ALOGE("%s: Invalid streamHandle: %pK", __func__, streamHandle);
-        return -EINVAL;
-    }
-
     return pal_stream_drain((pal_stream_handle_t *)streamHandle,
                              drain_type);
 }
 
 Return<int32_t> PAL::ipc_pal_stream_flush(const uint64_t streamHandle) {
-    if (!isValidstreamHandle(streamHandle)) {
-        ALOGE("%s: Invalid streamHandle: %pK", __func__, streamHandle);
-        return -EINVAL;
-    }
-
     return pal_stream_flush((pal_stream_handle_t *)streamHandle);
 }
 
 Return<int32_t> PAL::ipc_pal_stream_suspend(const uint64_t streamHandle) {
-    if (!isValidstreamHandle(streamHandle)) {
-        ALOGE("%s: Invalid streamHandle: %pK", __func__, streamHandle);
-        return -EINVAL;
-    }
-
     return pal_stream_suspend((pal_stream_handle_t *)streamHandle);
 }
 
 Return<int32_t> PAL::ipc_pal_stream_resume(const uint64_t streamHandle) {
-    if (!isValidstreamHandle(streamHandle)) {
-        ALOGE("%s: Invalid streamHandle: %pK", __func__, streamHandle);
-        return -EINVAL;
-    }
-
     return pal_stream_resume((pal_stream_handle_t *)streamHandle);
 }
 
@@ -623,11 +547,6 @@
     pal_buffer_config_t out_buf_cfg, in_buf_cfg;
     PalBufferConfig in_buff_config_ret, out_buff_config_ret;
 
-    if (!isValidstreamHandle(streamHandle)) {
-        ALOGE("%s: Invalid streamHandle: %pK", __func__, streamHandle);
-        return Void();
-    }
-
     in_buf_cfg.buf_count = in_buff_config.buf_count;
     in_buf_cfg.buf_size = in_buff_config.buf_size;
     in_buf_cfg.max_metadata_size =  in_buff_config.max_metadata_size;
@@ -674,12 +593,6 @@
     struct pal_buffer buf = {0};
     uint32_t bufSize;
     const native_handle *allochandle = nullptr;
-
-    if (!isValidstreamHandle(streamHandle)) {
-        ALOGE("%s: Invalid streamHandle: %pK", __func__, streamHandle);
-        return -EINVAL;
-    }
-
     bufSize = buff_hidl.data()->size;
     if (buff_hidl.data()->buffer.size() == bufSize)
         buf.buffer = (uint8_t *)calloc(1, bufSize);
@@ -746,10 +659,6 @@
         goto exit;
     }
 
-    if (!isValidstreamHandle(streamHandle)) {
-        ALOGE("%s: Invalid streamHandle: %pK", __func__, streamHandle);
-        return Void();
-    }
 
     allochandle = inBuff_hidl.data()->alloc_info.alloc_handle.handle();
 
@@ -800,12 +709,6 @@
         ALOGE("Invalid payload size");
         return -EINVAL;
     }
-
-    if (!isValidstreamHandle(streamHandle)) {
-        ALOGE("%s: Invalid streamHandle: %pK", __func__, streamHandle);
-        return -EINVAL;
-    }
-
     param_payload = (pal_param_payload *)calloc (1,
                                     sizeof(pal_param_payload) + paramPayload.data()->size);
     if (!param_payload) {
@@ -827,12 +730,6 @@
     int32_t ret = 0;
     pal_param_payload *param_payload;
     hidl_vec<PalParamPayload> paramPayload;
-
-    if (!isValidstreamHandle(streamHandle)) {
-        ALOGE("%s: Invalid streamHandle: %pK", __func__, streamHandle);
-        return Void();
-    }
-
     ret = pal_stream_get_param((pal_stream_handle_t *)streamHandle, paramId, &param_payload);
     if (ret == 0) {
         paramPayload.resize(sizeof(PalParamPayload));
@@ -860,17 +757,10 @@
     struct pal_device *devices = NULL;
     int cnt = 0;
     int32_t ret = -ENOMEM;
-
-    if (!isValidstreamHandle(streamHandle)) {
-        ALOGE("%s: Invalid streamHandle: %pK", __func__, streamHandle);
-        return -EINVAL;
-    }
-
     if (noOfDevices > devs_hidl.size()) {
         ALOGE("Invalid noOfDevices");
         return -EINVAL;
     }
-
     if (devs_hidl.size()) {
         PalDevice *dev_hidl = NULL;
         devices = (struct pal_device *)calloc (1,
@@ -921,12 +811,6 @@
         ALOGE("Invalid vol vector size");
         return -EINVAL;
     }
-
-    if (!isValidstreamHandle(streamHandle)) {
-        ALOGE("%s: Invalid streamHandle: %pK", __func__, streamHandle);
-        return -EINVAL;
-    }
-
     volume = (struct pal_volume_data *) calloc(1,
                                         sizeof(struct pal_volume_data) +
                                         noOfVolPairs * sizeof(pal_channel_vol_kv));
@@ -959,11 +843,6 @@
 Return<int32_t> PAL::ipc_pal_stream_set_mute(const uint64_t streamHandle,
                                     bool state)
 {
-    if (!isValidstreamHandle(streamHandle)) {
-        ALOGE("%s: Invalid streamHandle: %pK", __func__, streamHandle);
-        return -EINVAL;
-    }
-
     return pal_stream_set_mute((pal_stream_handle_t *)streamHandle, state);
 }
 
@@ -982,12 +861,6 @@
 {
     struct pal_session_time stime;
     int32_t ret = 0;
-
-    if (!isValidstreamHandle(streamHandle)) {
-        ALOGE("%s: Invalid streamHandle: %pK", __func__, streamHandle);
-        return Void();
-    }
-
     hidl_vec<PalSessionTime> sessTime_hidl;
     sessTime_hidl.resize(sizeof(struct pal_session_time));
     ret = pal_get_timestamp((pal_stream_handle_t *)streamHandle, &stime);
@@ -1000,11 +873,6 @@
                                           const PalAudioEffect effect,
                                           bool enable)
 {
-    if (!isValidstreamHandle(streamHandle)) {
-        ALOGE("%s: Invalid streamHandle: %pK", __func__, streamHandle);
-        return -EINVAL;
-    }
-
     return pal_add_remove_effect((pal_stream_handle_t *)streamHandle,
                                    (pal_audio_effect_t) effect, enable);
 }
@@ -1064,12 +932,6 @@
     int32_t ret = 0;
     struct pal_mmap_buffer info;
     hidl_vec<PalMmapBuffer> mMapBuffer_hidl;
-
-    if (!isValidstreamHandle(streamHandle)) {
-        ALOGE("%s: Invalid streamHandle: %pK", __func__, streamHandle);
-        return Void();
-    }
-
     mMapBuffer_hidl.resize(sizeof(struct pal_mmap_buffer));
     ret = pal_stream_create_mmap_buffer((pal_stream_handle_t *)streamHandle, min_size_frames, &info);
     mMapBuffer_hidl.data()->buffer = (uint64_t)info.buffer;
@@ -1087,12 +949,6 @@
     int32_t ret = 0;
     struct pal_mmap_position mmap_position;
     hidl_vec<PalMmapPosition> mmap_position_hidl;
-
-    if (!isValidstreamHandle(streamHandle)) {
-        ALOGE("%s: Invalid streamHandle: %pK", __func__, streamHandle);
-        return Void();
-    }
-
     mmap_position_hidl.resize(sizeof(struct pal_mmap_position));
     ret = pal_stream_get_mmap_position((pal_stream_handle_t *)streamHandle, &mmap_position);
     memcpy(mmap_position_hidl.data(), &mmap_position, sizeof(struct pal_mmap_position));
@@ -1121,11 +977,6 @@
     size_t sz = size;
     hidl_vec<uint8_t> payloadRet;
 
-    if (!isValidstreamHandle(streamHandle)) {
-        ALOGE("%s: Invalid streamHandle: %pK", __func__, streamHandle);
-        return Void();
-    }
-
     if (size > 0) {
         payload = (uint8_t *)calloc(1, size);
         if (!payload) {
diff --git a/plugins/Android.mk b/plugins/Android.mk
index c455f97..4ea07b6 100644
--- a/plugins/Android.mk
+++ b/plugins/Android.mk
@@ -1,3 +1,5 @@
 LOCAL_PATH := $(call my-dir)
 
+ifneq ($(QCPATH),)
 include $(call all-subdir-makefiles)
+endif
diff --git a/resource_manager/src/ResourceManager.cpp b/resource_manager/src/ResourceManager.cpp
index 239591b..4b4493d 100644
--- a/resource_manager/src/ResourceManager.cpp
+++ b/resource_manager/src/ResourceManager.cpp
@@ -93,7 +93,6 @@
 #include <unistd.h>
 #include <dlfcn.h>
 #include <mutex>
-#include "kvh2xml.h"
 #include <sys/ioctl.h>
 #ifdef EC_REF_CAPTURE_ENABLED
 #include "ECRefDevice.h"
diff --git a/session/inc/PayloadBuilder.h b/session/inc/PayloadBuilder.h
index 4d62194..97c82a0 100644
--- a/session/inc/PayloadBuilder.h
+++ b/session/inc/PayloadBuilder.h
@@ -36,7 +36,6 @@
 
 #include "PalDefs.h"
 #include "gsl_intf.h"
-#include "kvh2xml.h"
 #include "PalCommon.h"
 #include <vector>
 #include <set>
diff --git a/session/inc/kvh2xml.h b/session/inc/kvh2xml.h
new file mode 100644
index 0000000..1266035
--- /dev/null
+++ b/session/inc/kvh2xml.h
@@ -0,0 +1,408 @@
+/*
+ * Copyright (c) 2019, The Linux Foundation. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are
+ * met:
+ *     * Redistributions of source code must retain the above copyright
+ *       notice, this list of conditions and the following disclaimer.
+ *     * Redistributions in binary form must reproduce the above
+ *       copyright notice, this list of conditions and the following
+ *       disclaimer in the documentation and/or other materials provided
+ *       with the distribution.
+ *     * Neither the name of The Linux Foundation nor the names of its
+ *       contributors may be used to endorse or promote products derived
+ *       from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESS OR IMPLIED
+ * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT
+ * ARE DISCLAIMED.  IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
+ * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+ * 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.
+ */
+
+typedef enum {
+	PLATFORM_LA = 1, 	/**< @h2xmle_name {LA} */
+	PLATFORM_LE = 2,	/**< @h2xmle_name {LE} */
+}platforms;
+/**
+  	@h2xml_platforms{PLATFORM_LA,PLATFORM_LE}
+*/
+
+enum AllKeyIds{
+	STREAMRX = 0xA1000000,       /**< @h2xmle_name{StreamRX} */
+	DEVICERX = 0xA2000000,       /**< @h2xmle_name{DeviceRX} */
+	DEVICETX = 0xA3000000,       /**< @h2xmle_name{DeviceTX} */
+	VOLUME = 0xA4000000,         /**< @h2xmle_name{Volume} */
+	SAMPLINGRATE = 0xA5000000,   /**< @h2xmle_name{SamplingRate} */
+	BITWIDTH = 0xA6000000,       /**< @h2xmle_name{BitWidth} */
+	PAUSE = 0xA7000000,          /**< @h2xmle_name{Pause} */
+	MUTE = 0xA8000000,           /**< @h2xmle_name{Mute} */
+	CHANNELS = 0xA9000000,       /**< @h2xmle_name{Channels} */
+	ECNS = 0xAA000000,           /**< @h2xmle_name{ECNS} */
+	INSTANCE = 0xAB000000,       /**< @h2xmle_name{Instance} */
+	DEVICEPP_RX = 0xAC000000,    /**< @h2xmle_name{DevicePP_Rx} */
+	DEVICEPP_TX = 0xAD000000,    /**< @h2xmle_name{DevicePP_Tx} */
+	MEDIAFMTID = 0xae000000,
+	STREAMTX = 0xb1000000,
+	EQUALIZER_SWITCH = 0xb2000000,
+	VIRTUALIZER_SWITCH = 0xb9000000,
+	REVERB_SWITCH = 0xb8000000,
+	PBE_SWITCH = 0xb6000000,
+	BASS_BOOST_SWITCH = 0xb7000000,
+	STREAM_SLOWTALK = 0xbb000000,
+	STREAM_CONFIG = 0xbc000000,
+	STREAM_MUXDEMUX = 0xbd000000,
+	TAG_KEY_SLOT_MASK = 0xe0000000
+};
+
+/**
+	@h2xmlk_key {STREAMRX}
+	@h2xmlk_description {Type of Rx Stream}
+*/
+enum Key_StreamRX {
+	PCM_LL_PLAYBACK = 0xA1000001, /**< @h2xmle_name {PCM_LL_Playback}*/
+	PCM_RECORD = 0xA1000002,      /**< @h2xmle_name {PCM_Record}*/
+	PCM_LOOPBACK = 0xA1000003,    /**< @h2xmle_name {PCM_Loopback}*/
+	VOICE_UI = 0xA1000004,        /**< @h2xmle_name {Voice_UI}*/
+	VOIP_RX_PLAYBACK = 0xA1000005,/**< @h2xmle_name {Voip_Rx}*/
+	VOIP_TX_RECORD = 0xA1000006,   /**< @h2xmle_name {Voip_Tx}*/
+	VOICE_UI_EC_REF_PATH = 0xA1000007,/**< @h2xmle_name {Voice_UI_EC_Ref_Path}*/
+	VOIP_TX_EC_REF_PATH = 0xA1000008,   /**< @h2xmle_name {Voip_Tx_EC_Ref_Path}*/
+	PCM_RECORD_EC_REF_PATH = 0xA1000009,/**< @h2xmle_name {PCM_Record_EC_Ref_Path}*/
+	COMPRESSED_OFFLOAD_PLAYBACK = 0xa100000a,
+	HAPTICS_PLAYBACK = 0xa1000015,
+};
+
+
+/**
+	@h2xmlk_key {INSTANCE}
+	@h2xmlk_description {Stream Instance Id}
+*/
+enum Key_Instance {
+	INSTANCE_1 = 1, /**< @h2xmle_name {Instance_1}*/
+	INSTANCE_2 = 2, /**< @h2xmle_name {Instance_2}*/
+	INSTANCE_3 = 3, /**< @h2xmle_name {Instance_3}*/
+};
+
+/**
+	@h2xmlk_key {DEVICERX}
+	@h2xmlk_description {Rx Device}
+*/
+enum Key_DeviceRX {
+	SPEAKER = 0xA2000001, /**< @h2xmle_name {Speaker}*/
+	HANDSET = 0xa2000004,
+	HAPTICS_DEVICE = 0xa2000009,
+};
+/**
+	@h2xmlk_key {DEVICETX}
+	@h2xmlk_description {Tx Device}
+*/
+enum Key_DeviceTX {
+	HANDSETMIC = 0xA3000004, /**< @h2xmle_name {HandsetMic}*/
+	HANDSETMIC_VA = 0xa3000006
+};
+
+/**
+	@h2xmlk_key {DEVICEPP_RX}
+	@h2xmlk_description {Rx Device Post/Pre Processing Chain}
+*/
+enum Key_DevicePP_RX {
+	DEVICEPP_RX_DEFAULT = 0xAC000001, /**< @h2xmle_name {Audio_LL_Default_PP} @h2xmlk_description {Low Latency Default Playback}*/
+	DEVICEPP_RX_AUDIO_MBDRC = 0xac000002,
+};
+/**
+	@h2xmlk_key {DEVICEPP_TX}
+	@h2xmlk_description {Tx Device Post/Pre Processing Chain}
+*/
+enum Key_DevicePP_TX {
+	DEVICEPP_TX_FLUENCE_FFECNS        = 0xAD000001, /**< @h2xmle_name {Voice_Fluence_FFECNS} @h2xmlk_description {Used in Voice UI use-cases}*/
+	DEVICEPP_TX_AUDIO_FLUENCE_SMECNS  = 0xAD000002, /**< @h2xmle_name {Audio_Fluence_SMECNS} @h2xmlk_description {Single Mic ECNS }*/
+	DEVICEPP_TX_AUDIO_FLUENCE_ENDFIRE = 0xAD000003, /**< @h2xmle_name {Audio_Fluence_Endfire} @h2xmlk_description {EndFire_ECNS - Typically used for dual mic capture scenarios}*/
+	DEVICEPP_TX_AUDIO_FLUENCE_PRO     = 0xAD000004, /**< @h2xmle_name {Audio_Fluence_Pro} @h2xmlk_description {Multi MIC scenarios ; at least 3 or more Micss}*/
+};
+
+
+enum Key_StreamConfig {
+	STREAM_CFG_VUI_SVA = 0xbc000001,
+};
+
+/**
+	@h2xmlk_key {VOLUME}
+	@h2xmlk_description {Volume}
+*/
+enum Key_Volume {
+	LEVEL_0 = 0, /**< @h2xmle_name {Level_0}*/
+	LEVEL_1 = 1, /**< @h2xmle_name {Level_1}*/
+	LEVEL_2 = 2, /**< @h2xmle_name {Level_2}*/
+	LEVEL_3 = 3, /**< @h2xmle_name {Level_3}*/
+	LEVEL_4 = 4, /**< @h2xmle_name {Level_4}*/
+	LEVEL_5 = 5, /**< @h2xmle_name {Level_5}*/
+	LEVEL_6 = 6, /**< @h2xmle_name {Level_6}*/
+	LEVEL_7 = 7, /**< @h2xmle_name {Level_7}*/
+	LEVEL_8 = 8, /**< @h2xmle_name {Level_8}*/
+	LEVEL_9 = 9, /**< @h2xmle_name {Level_9}*/
+	LEVEL_10 = 10, /**< @h2xmle_name {Level_10}*/
+	LEVEL_11 = 11, /**< @h2xmle_name {Level_11}*/
+	LEVEL_12 = 12, /**< @h2xmle_name {Level_12}*/
+	LEVEL_13 = 13, /**< @h2xmle_name {Level_13}*/
+	LEVEL_14 = 14, /**< @h2xmle_name {Level_14}*/
+	LEVEL_15 = 15, /**< @h2xmle_name {Level_15}*/
+};
+/**
+	@h2xmlk_key {SAMPLINGRATE}
+	@h2xmlk_sampleRate
+	@h2xmlk_description {Sampling Rate}
+*/
+enum Key_SamplingRate {
+	SAMPLINGRATE_8K = 8000,   /**< @h2xmle_sampleRate{8000} @h2xmle_name {SR_8K}*/
+	SAMPLINGRATE_16K = 16000, /**< @h2xmle_sampleRate{16000} @h2xmle_name {SR_16K}*/
+	SAMPLINGRATE_32K = 32000, /**< @h2xmle_sampleRate{32000} @h2xmle_name {SR_32K}*/
+	SAMPLINGRATE_44K = 44100, /**< @h2xmle_sampleRate{44100} @h2xmle_name {SR_44.1K}*/
+	SAMPLINGRATE_48K = 48000, /**< @h2xmle_sampleRate{48000} @h2xmle_name {SR_48K}*/
+	SAMPLINGRATE_96K = 96000, /**< @h2xmle_sampleRate{96000} @h2xmle_name {SR_96K}*/
+	SAMPLINGRATE_192K = 192000, /**< @h2xmle_sampleRate{192000} @h2xmle_name {SR_192K}*/
+	SAMPLINGRATE_384K = 384000, /**< @h2xmle_sampleRate{384000} @h2xmle_name {SR_384K}*/
+};
+/**
+	@h2xmlk_key {BITWIDTH}
+	@h2xmlk_description {Bit Width}
+*/
+enum Key_BitWidth {
+	BITWIDTH_16 = 16, /**< @h2xmle_name {BW_16}*/
+	BITWIDTH_24 = 24, /**< @h2xmle_name {BW_24}*/
+	BITWIDTH_32 = 32, /**< @h2xmle_name {BW_32}*/
+};
+/**
+	@h2xmlk_key {PAUSE}
+	@h2xmlk_description {Pause}
+*/
+enum Key_Pause {
+	OFF = 0, /**< @h2xmle_name {Off}*/
+	ON = 1, /**< @h2xmle_name {On}*/
+};
+/**
+	@h2xmlk_key {MUTE}
+	@h2xmlk_description {Mute}
+*/
+enum Key_Mute {
+	MUTE_OFF = 0, /**< @h2xmle_name {Off}*/
+	MUTE_ON = 1, /**< @h2xmle_name {On}*/
+};
+/**
+	@h2xmlk_key {CHANNELS}
+	@h2xmlk_description {Channels}
+*/
+enum Key_Channels {
+	CHANNELS_1 = 1, /**< @h2xmle_name {CHS_1}*/
+	CHANNELS_2 = 2, /**< @h2xmle_name {CHS_2}*/
+        CHANNELS_3 = 3, /**< @h2xmle_name {CHS_3}*/
+	CHANNELS_4 = 4, /**< @h2xmle_name {CHS_4}*/
+        CHANNELS_5 = 5, /**< @h2xmle_name {CHS_5}*/
+        CHANNELS_5_1 = 6, /**< @h2xmle_name {CHS_6}*/
+	CHANNELS_7 = 7, /**< @h2xmle_name {CHS_7}*/
+	CHANNELS_8 = 8, /**< @h2xmle_name {CHS_8}*/
+};
+
+/**
+	@h2xmlk_key {ECNS}
+	@h2xmlk_description {ECNS}
+*/
+enum Key_ECNS {
+	ECNS_OFF = 0, /**< @h2xmle_name {ECNS_Off}*/
+	ECNS_ON = 1, /**< @h2xmle_name {ECNS_On}*/
+	EC_ON = 2,
+	NS_ON = 3,
+};
+
+/**
+	@h2xmlk_gkeys
+	@h2xmlk_description {Graph Keys}
+*/
+enum Graph_Keys {
+	gk_StreamRX = STREAMRX,
+	gk_DeviceRX = DEVICERX,
+	gk_DeviceTX = DEVICETX,
+	gk_DevicePP_RX = DEVICEPP_RX,
+	gk_DevicePP_TX = DEVICEPP_TX,
+	gk_Instance = INSTANCE,
+	gk_StreamTX = STREAMTX,
+};
+/**
+	@h2xmlk_ckeys
+	@h2xmlk_description {Calibration Keys}
+*/
+enum Cal_Keys {
+	ck_volume = VOLUME,
+};
+
+#define DEVICE_HW_ENDPOINT_RX        0xC0000004
+/**
+        @h2xmlk_modTag {"device_hw_ep_rx",DEVICE_HW_ENDPOINT_RX}
+	@h2xmlk_description {Hw EP Rx}
+*/
+enum HW_ENDPOINT_RX_Keys {
+	tk1_hweprx = DEVICERX,
+	tk2_hweprx = SAMPLINGRATE,
+	tk3_hweprx = BITWIDTH,
+	tk4_hweprx = CHANNELS,
+};
+#define DEVICE_HW_ENDPOINT_TX        0xC0000005
+/**
+        @h2xmlk_modTag {"device_hw_ep_tx",DEVICE_HW_ENDPOINT_TX}
+	@h2xmlk_description {Hw EP Tx}
+*/
+enum HW_ENDPOINT_TX_Keys {
+	tk1_hweptx = DEVICETX,
+	tk2_hweptx = SAMPLINGRATE,
+	tk3_hweptx = BITWIDTH,
+	tk4_hweptx = CHANNELS,
+};
+#define TAG_PAUSE       0xC0000006
+/**
+	@h2xmlk_modTag {"stream_pause", TAG_PAUSE}
+	@h2xmlk_description {Stream Pause}
+*/
+enum TAG_PAUSE_Keys {
+	tk1_Pause = PAUSE,
+};
+#define TAG_MUTE        0xC0000007
+/**
+	@h2xmlk_modTag {"stream_mute", TAG_MUTE}
+	@h2xmlk_description {Stream Mute}
+*/
+enum TAG_MUTE_Keys {
+	tk1_Mute = MUTE,
+};
+
+#define TAG_ECNS  0xC000000A
+/**
+	@h2xmlk_modTag {"device_ecns", TAG_ECNS}
+	@h2xmlk_description {Ecns On/Off}
+*/
+enum TAG_ECNS_Keys {
+	tk1_Ecns = ECNS,
+};
+
+#define TAG_STREAM_VOLUME  0xC000000D
+/**
+	@h2xmlk_modTag {"stream_volume", TAG_STREAM_VOLUME}
+	@h2xmlk_description {Stream Volume}
+*/
+enum TAG_STREAM_VOLUME_Keys {
+	tk1_Volume = VOLUME,
+};
+
+#define TAG_DEVICE_PP_MFC  0xC0000011
+/**
+	@h2xmlk_modTag {"device_pp_mfc", TAG_DEVICE_PP_MFC}
+	@h2xmlk_description {Device PP MFC}
+*/
+enum TAG_DEVICE_PP_MFC_Keys {
+	tk1_SamplingRate = SAMPLINGRATE,
+	tk2_BitWidth     = BITWIDTH,
+	tk3_Channels     = CHANNELS,
+};
+
+#define TAG_STREAM_MFC  0xc000000b
+
+// Same enum names as TAG_DEVICE_PP_MFC_Keys
+/*enum TAG_STREAM_MFC_Keys {
+	tk1_SamplingRate = SAMPLINGRATE,
+	tk2_BitWidth     = BITWIDTH,
+	tk3_Channels     = CHANNELS,
+};*/
+
+
+#define TAG_STREAM_PLACEHOLDER_DECODER  0xc0000012
+
+enum TAG_STREAM_PLACEHOLDER_DECODER_Keys {
+	tk1_MediaFmtID = MEDIAFMTID,
+};
+
+#define TAG_STREAM_EQUALIZER  0xc0000014
+
+enum TAG_STREAM_EQUALIZER_Keys {
+	tk1_Equalizer = EQUALIZER_SWITCH,
+};
+
+#define TAG_STREAM_VIRTUALIZER  0xc0000015
+
+enum TAG_STREAM_VIRTUALIZER_Keys {
+	tk1_Virtualizer_Switch = VIRTUALIZER_SWITCH,
+};
+
+#define TAG_STREAM_REVERB  0xc0000016
+
+enum TAG_STREAM_REVERB_Keys {
+	tk1_Reverb_Switch = REVERB_SWITCH,
+};
+
+#define TAG_STREAM_PBE  0xc0000017
+
+enum TAG_STREAM_PBE_Keys {
+	tk1_PBE_Switch = PBE_SWITCH,
+};
+
+#define TAG_STREAM_BASS_BOOST  0xc0000018
+
+enum TAG_STREAM_BASS_BOOST_Keys {
+	tk1_BASS_BOOST_Switch = BASS_BOOST_SWITCH,
+};
+
+#define PER_STREAM_PER_DEVICE_MFC  0xc0000019
+
+// Same enum names as TAG_DEVICE_PP_MFC_Keys
+/*enum TAG_PSPD_MFC_Keys {
+	tk1_SamplingRate = SAMPLINGRATE,
+	tk2_BitWidth     = BITWIDTH,
+	tk3_Channels     = CHANNELS,
+};*/
+
+#define TAG_STREAM_SLOWTALK  0xc0000025
+
+enum TAG_STREAM_SLOWTALK_Keys {
+	tk1_Stream_SlowTalk = STREAM_SLOWTALK,
+};
+
+#define TAG_MODULE_CHANNELS  0xc0000026
+
+enum TAG_MODULE_CHANNELS_Keys {
+	tk1_Channels = CHANNELS,
+};
+
+#define TAG_STREAM_MUXDEMUX  0xc0000027
+
+enum TAG_STREAM_MUXDEMUX_Keys {
+	tk1_Stream_MuxDemux= STREAM_MUXDEMUX,
+};
+
+#define TAG_DEVICE_MUX  0xc0000040
+
+enum TAG_DEVICE_MUX_Keys {
+	tk1_SlotMask= TAG_KEY_SLOT_MASK,
+};
+
+/**
+	@h2xmlk_modTagList
+*/
+enum TAGS_DEFINITIONS {
+        SHMEM_ENDPOINT              = 0xC0000001, /**< @h2xmle_name {"sh_ep"} */
+        STREAM_INPUT_MEDIA_FORMAT   = 0xC0000002, /**< @h2xmle_name {"stream_input_media_format" } */
+        STREAM_OUTPUT_MEDIA_FORMAT  = 0xC0000003, /**< @h2xmle_name {"stream_output_media_format" } */
+        DEVICE_SVA                  = 0xC0000008, /**< @h2xmle_name {"device_sva"} */
+        DEVICE_ADAM                 = 0xC0000009, /**< @h2xmle_name {"device_adam"} */
+        STREAM_MFC                  = 0xC000000B, /**< @h2xmle_name {"stream_mfc"} */
+        DEVICE_MFC                  = 0xC000000C, /**< @h2xmle_name {"device_mfc"} */
+        STREAM_PCM_DECODER          = 0xC000000E, /**< @h2xmle_name {"stream_pcm_decoder"} */
+        STREAM_PCM_ENCODER          = 0xC000000F, /**< @h2xmle_name {"stream_pcm_encoder"} */
+        STREAM_PCM_CONVERTER        = 0xC0000010, /**< @h2xmle_name {"stream_pcm_converter"} */
+};
+typedef enum TAGS_DEFINITIONS TAGS_DEFINITIONS;
+
diff --git a/session/src/ACDEngine.cpp b/session/src/ACDEngine.cpp
index d4d7b37..e6a3464 100644
--- a/session/src/ACDEngine.cpp
+++ b/session/src/ACDEngine.cpp
@@ -38,7 +38,6 @@
 #include "Stream.h"
 #include "StreamACD.h"
 #include "ResourceManager.h"
-#include "kvh2xml.h"
 #include "acd_api.h"
 
 #define FILENAME_LEN 128
diff --git a/session/src/SoundTriggerEngineGsl.cpp b/session/src/SoundTriggerEngineGsl.cpp
index 39cbf35..7428dd8 100644
--- a/session/src/SoundTriggerEngineGsl.cpp
+++ b/session/src/SoundTriggerEngineGsl.cpp
@@ -39,7 +39,6 @@
 #include "Stream.h"
 #include "StreamSoundTrigger.h"
 #include "ResourceManager.h"
-#include "kvh2xml.h"
 #include "SoundTriggerPlatformInfo.h"
 
 // TODO: find another way to print debug logs by default
diff --git a/stream/src/StreamACD.cpp b/stream/src/StreamACD.cpp
index 447af76..3e5fd2d 100644
--- a/stream/src/StreamACD.cpp
+++ b/stream/src/StreamACD.cpp
@@ -34,7 +34,6 @@
 #include <unistd.h>
 #include "ResourceManager.h"
 #include "Device.h"
-#include "kvh2xml.h"
 
 StreamACD::StreamACD(struct pal_stream_attributes *sattr,
                                        struct pal_device *dattr,
diff --git a/stream/src/StreamCommon.cpp b/stream/src/StreamCommon.cpp
index 2f5dff4..0fdede8 100644
--- a/stream/src/StreamCommon.cpp
+++ b/stream/src/StreamCommon.cpp
@@ -35,7 +35,6 @@
 
 #include "StreamCommon.h"
 #include "Session.h"
-#include "kvh2xml.h"
 #include "SessionAlsaPcm.h"
 #include "ResourceManager.h"
 #include "Device.h"
diff --git a/stream/src/StreamInCall.cpp b/stream/src/StreamInCall.cpp
index d6da953..f35cb6b 100644
--- a/stream/src/StreamInCall.cpp
+++ b/stream/src/StreamInCall.cpp
@@ -32,7 +32,6 @@
 
 #include "StreamInCall.h"
 #include "Session.h"
-#include "kvh2xml.h"
 #include "SessionGsl.h"
 #include "SessionAlsaPcm.h"
 #include "ResourceManager.h"
diff --git a/stream/src/StreamNonTunnel.cpp b/stream/src/StreamNonTunnel.cpp
index 45c5eb1..1116e20 100644
--- a/stream/src/StreamNonTunnel.cpp
+++ b/stream/src/StreamNonTunnel.cpp
@@ -30,7 +30,6 @@
 #define LOG_TAG "StreamNonTunnel"
 
 #include "Session.h"
-#include "kvh2xml.h"
 #include "SessionGsl.h"
 #include "ResourceManager.h"
 #include <unistd.h>
diff --git a/stream/src/StreamPCM.cpp b/stream/src/StreamPCM.cpp
index b259c12..2d13642 100644
--- a/stream/src/StreamPCM.cpp
+++ b/stream/src/StreamPCM.cpp
@@ -33,7 +33,6 @@
 
 #include "StreamPCM.h"
 #include "Session.h"
-#include "kvh2xml.h"
 #include "SessionAlsaPcm.h"
 #include "ResourceManager.h"
 #include "Device.h"
@@ -108,8 +107,6 @@
         throw std::runtime_error("failed to malloc for stream attributes");
     }
 
-    ar_mem_cpy(mStreamAttr, sizeof(pal_stream_attributes), sattr, sizeof(pal_stream_attributes));
-
     if (mStreamAttr->in_media_config.ch_info.channels > PAL_MAX_CHANNELS_SUPPORTED) {
         PAL_ERR(LOG_TAG,"in_channels is invalid %d", in_channels);
         mStreamAttr->in_media_config.ch_info.channels = PAL_MAX_CHANNELS_SUPPORTED;
diff --git a/stream/src/StreamSensorPCMData.cpp b/stream/src/StreamSensorPCMData.cpp
index 277c1e1..f9181ab 100644
--- a/stream/src/StreamSensorPCMData.cpp
+++ b/stream/src/StreamSensorPCMData.cpp
@@ -35,7 +35,6 @@
 
 #include "StreamSensorPCMData.h"
 #include "Session.h"
-#include "kvh2xml.h"
 #include "SessionAlsaPcm.h"
 #include "ResourceManager.h"
 #include "Device.h"
diff --git a/stream/src/StreamSoundTrigger.cpp b/stream/src/StreamSoundTrigger.cpp
index c4bd72c..a37375a 100644
--- a/stream/src/StreamSoundTrigger.cpp
+++ b/stream/src/StreamSoundTrigger.cpp
@@ -70,7 +70,6 @@
 #include "SessionAlsaPcm.h"
 #include "ResourceManager.h"
 #include "Device.h"
-#include "kvh2xml.h"
 
 // TODO: find another way to print debug logs by default
 #define ST_DBG_LOGS
diff --git a/stream/src/StreamUltraSound.cpp b/stream/src/StreamUltraSound.cpp
index 2df53a1..53d2d81 100644
--- a/stream/src/StreamUltraSound.cpp
+++ b/stream/src/StreamUltraSound.cpp
@@ -38,7 +38,6 @@
 #include "SessionAlsaPcm.h"
 #include "ResourceManager.h"
 #include "Device.h"
-#include "us_detect_api.h"
 #include <unistd.h>
 
 StreamUltraSound::StreamUltraSound(const struct pal_stream_attributes *sattr __unused, struct pal_device *dattr __unused,
diff --git a/utils/inc/ListenSoundModelLib.h b/utils/inc/ListenSoundModelLib.h
new file mode 100644
index 0000000..46103fa
--- /dev/null
+++ b/utils/inc/ListenSoundModelLib.h
@@ -0,0 +1,919 @@
+/*
+ * ListenSoundModelLib.h
+ *
+ * This is the interface file of sound model library which provides
+ * the APIs to get sound model information and merge, delete functionality
+ * which will be used by STHAL.
+ *
+ * Copyright (c) 2019-2020, The Linux Foundation. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are
+ * met:
+ *     * Redistributions of source code must retain the above copyright
+ *       notice, this list of conditions and the following disclaimer.
+ *     * Redistributions in binary form must reproduce the above
+ *       copyright notice, this list of conditions and the following
+ *       disclaimer in the documentation and/or other materials provided
+ *       with the distribution.
+ *     * Neither the name of The Linux Foundation nor the names of its
+ *       contributors may be used to endorse or promote products derived
+ *       from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESS OR IMPLIED
+ * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT
+ * ARE DISCLAIMED.  IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
+ * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+ * 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.
+ */
+
+/*======================================================================
+DESCRIPTION : ListenSoundModelLibrary Version 3
+====================================================================*/
+
+#ifndef __LISTEN_SOUND_MODEL_LIB_V3_H__
+#define __LISTEN_SOUND_MODEL_LIB_V3_H__
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include <stdint.h>
+
+#if defined(_SML_NO_DLL)
+#define DllFunc
+#define CDECLARE
+#elif defined(_MSC_VER) && defined(_EXPORT)
+#define DllFunc   __declspec( dllexport )
+#define CDECLARE    __cdecl
+#elif defined(_MSC_VER)
+#define DllFunc   __declspec( dllimport )
+#define CDECLARE    __cdecl
+#else   // For other compiler like gcc
+#define DllFunc
+#define CDECLARE
+#endif
+
+#define LSMLIB_VERSION 2 // %%% some unique number that changes when API changes
+                         // %%% could be == SoundModel version supported for SVA 2.0
+
+#define MAX_STRING_LEN (100 * 2)  // maximum byte size of string representing Unicode character string
+// %%% NOTE: "MAX_STRING_LEN" replaces old constant "MAX_KEYWORD"
+
+
+// SVA 2.0
+// Keyword & User Identifier as zero terminated strings
+typedef char * keywordId_t;
+typedef char * userId_t;
+
+
+typedef struct {
+    //state machine parameters
+    float minSnrOnset;                  // The minimum snr of frame that speech segment starts
+    float minSnrLeave;                  // The minimum snr of frame that speech segment ends
+    float snrFloor;                     // The minimum snr value assumed in the end point detector
+    float snrThresholds;                // The minimum snr value of speech to verify
+    float forgettingFactorNoise;        // The forgetting factor used for noise estimation
+    int numFrameTransientFrame;         // the number of frames in the beginning that are used for noise estimate(valid only for online mode)
+    float minEnergyFrameRatio;          // the number of frame are used for noise estimation = minenergyFrameRatio * #frames of input(valid only for batch mode)
+
+    //post processing parameters
+    //Note:
+    int numMinFramesInPhrase;           // the minimum nubmer of samples for a speech phrase (targetted speech)
+    int numMinFramesInSpeech;           //the minimum number of samples for a speech intereval
+    int numMaxFrameInSpeechGap;         //the maximum allowable number of samples for a speech gap
+    int numFramesInHead;                //the speech head
+    int numFramesInTail;                //the speech tail
+} listen_epd_params;
+
+typedef struct {
+    int16_t *data;              /* Audio samples ( in Raw PCM format: 16kHz, 16bit, mono ) */
+    uint32_t n_samples;         /* number of audio samples */
+} listen_user_recording;
+
+typedef struct {
+    uint8_t *data;              /* block of memory containing Model data */
+    uint32_t size;              /* size of memory allocated for Model data */
+} listen_language_model_type;
+
+typedef struct {
+    uint8_t *data;              /* block of memory containing Model data */
+    uint32_t size;              /* size of memory allocated for Model data */
+} listen_model_type;
+
+// kwihyuk - comments will update
+// %%% the numbering - names are up to you, as long as type + version is unique between SVA 1.0 and 2.0 SMs
+typedef enum {
+    kKeywordModel = 1,           /* Keyword model */
+    kUserKeywordModel = 2,    /* Userkeyword model */
+    kTargetSoundModel = 3,
+    kMultiUserKeywordModel = 4, /* Multiple Keyword models */
+    kKeywordModelWithVop = 5,   //kwihyuk
+    kSecondStageKeywordModel = 6,   //kwihyuk
+    kSecondStageKeywordModelWithVop = 7,    //kwihyuk
+} listen_model_enum;
+
+typedef enum {
+    kSuccess = 0,
+    kFailure = 1
+} listen_detection_status_enum;
+
+typedef struct {
+    listen_model_enum type;     /* model type: Keyword, User, TargetSound */
+    uint32_t          version;  /* model version */
+    uint32_t          size;     /* total size of the model: header + payload size */
+} listen_sound_model_info;
+
+
+typedef struct {
+    listen_detection_status_enum status; // SUCCESS or FAILURE
+    uint32_t size;               // size in bytes of payload data
+                                                 // just contains result confidence level values
+    uint8_t *data;             // block of memory containing data payload
+} listen_event_payload;
+
+// SVA 2.0
+typedef struct {
+    uint16_t                numKeywords;  /* total number of keywords  */
+    uint16_t                numUsers;    /* total number of users  */
+    uint16_t                numActiveUserKeywordPairs;    /* total number of active user+keyword pairs in SM */
+    bool                    isStripped; /* if corresponding keyword is stripped or not */
+    uint16_t                *langPerKw; /* Language code of each keyword */
+    /* number active Users per keyword - included as convenience */
+    uint16_t                *numUsersSetPerKw;
+    bool                    *isUserDefinedKeyword;
+    /* Ordered 'truth' table of all possible pairs of users for each keyword.
+    * Active entries marked with 1, inactive 0.keywordPhrase
+    * 16-bit short (rather than boolean) is used to match SM model data size */
+    uint16_t                **userKeywordPairFlags;
+    uint16_t                model_indicator; /* for SM 3.0, indicate which models were combined */
+} listen_sound_model_header;
+
+
+
+
+// SVA 2.0
+// %%% this should match the 'sensitivity' data structure input in VoiceWakeupParamType
+typedef struct {
+    uint8_t   size     ;  // number of keyword plus activePair confidence levels set d
+    uint8_t   *pConfLevels;  // level of each keyword and each active user+keyword pair
+} listen_confidence_levels ;
+
+// SVA 2.0
+typedef enum {
+    kSingleKWDetectionEvent = 1,         /* SVA 1.0 model */
+    kMultiKWDetectionEvent = 2,       /* SVA 2.0 model */
+} listen_detection_type_enum;
+
+
+// duplicates existing SVA1.0 typedef
+// Do not include listen_detection_entry_v1 in SVA 1.0 header if both headers included
+typedef struct {
+    char keyword[MAX_STRING_LEN];
+    uint16_t keywordConfidenceLevel;
+    uint16_t userConfidenceLevel;
+} listen_detection_event_v1;
+
+// denotes that a particular entry in confidence level array is not active
+static const uint8_t  NO_CONF_LEVEL = 0;
+
+typedef struct {
+
+    char     keywordPhrase[MAX_STRING_LEN]; /* string containing phrase string of keyword with highest confidence score */
+    char     userName[MAX_STRING_LEN];  /* string containing name of user with highest confidence score */
+
+    uint8_t  highestKeywordConfidenceLevel;  // set to zero if detection status is Failed
+    uint8_t  highestUserConfidenceLevel;     // set to zero if detection status is Failed
+
+    listen_confidence_levels  pairConfidenceLevels; // confidence levels of ALL pair (active or not)
+} listen_detection_event_v2;
+
+// modified for SVA 2.0 - this should override SVA 1.0 typedef
+typedef struct {
+    // %%% uint16_t version;
+    listen_detection_type_enum   detection_data_type;
+    // data structure filled is based on detection_data_type
+    union {
+        listen_detection_event_v1 event_v1;  // for SVA 1.0
+        listen_detection_event_v2 event_v2;  // for SVA 2.0
+    } event;
+} listen_detection_event_type;
+
+typedef enum {
+    kSucess = 0,
+    kFailed = 1,
+    kBadParam,
+    kKeywordNotFound,
+    kUserNotFound,
+    kUserKwPairNotActive,
+    kSMVersionUnsupported,
+    kUserDataForKwAlreadyPresent,
+    kDuplicateKeyword,
+    kDuplicateUserKeywordPair,
+    kMaxKeywordsExceeded,
+    kMaxUsersExceeded,
+    kEventStructUnsupported,    // payload contains event data that can not be processed, or mismatches SM version
+    kLastKeyword,
+    kNoSignal,
+    kLowSnr,
+    kRecordingTooShort,
+    kRecordingTooLong,
+    kNeedRetrain,
+    kUserUDKPairNotRemoved,
+    kCannotCreateUserUDK,
+    kOutputArrayTooSmall,
+    kTooManyAbnormalUserScores,
+    kWrongModel,
+    kWrongModelAndIndicator,
+    kDuplicateModel,
+} listen_status_enum;
+
+/*
+*   Notes:
+*       1. The client code that calls getKeywordPhrases(), getUserNames() must allocate DstStr as [MAX_STRING_LEN]
+*       2. The client code that calls getUserKeywordModelSize(), createUserDefinedKeywordModel(),
+*           createUserKeywordModel() should assign meaningful string for keywordId or userId, empty string is not recommended.
+*       3. verifyUserRecording() should be called before calling createUserKeywordModel(). If pConfidenceLevel returned
+*           in verifyUserRecording() is below a CONFIDENCE_THRESHOLD value, the recording should be rejected and not used
+*           to a create user model. The client code should decide the CONFIDENCE_THRESHOLD value, a recommended value range for
+*           CONFIDENCE_THRESHOLD is 60~70.
+*
+*/
+
+    /*
+    * findKeywordEndPosition
+    *
+    * Returns the keyword end position of user recordings from the keyword model
+    * the keyword model finds the keyword end position by using keyword end finding algorithm inside SVA
+    *
+    * Param [in]  pKeywordModel - pointer to keyword model data which will be used to find keyword end
+    * Param [in]  keywordId - null terminated string contains keyword phrase string
+    * Param [in]  pUserRecording - a single recording of user speaking keyword
+                                   other speech such as following command may follows
+    * Param [out] pKendPosition - returns keyword end position from the start of user recording in number of samples
+    *
+    * Return - status
+    *       kBadParam - When any input pointer (except pEpdParameter) is NULL
+    *       kKeywordNotFound - When keywordId not exist in the model
+    *       kSMVersionUnsupported - When pKeywordModel is not 2.0 model
+    */
+DllFunc listen_status_enum CDECLARE findKeywordEndPosition(
+                listen_model_type           *pKeywordModel,
+                keywordId_t                 keywordId,
+                listen_user_recording       *pUserRecording,
+                uint32_t                    *pKendPosition);
+
+    /*
+    * verifyUserRecording
+    *
+    * Returns the confidence level ( 0 ~ 100 ) that user recording matches keyword
+    * User data is to be appended for a specific keyword in the model
+    * // will be updated or removed
+    * if input is SM 3.0 which combiend with GMM and other sound models,
+    * then parsing to GMM model and run same procedure.
+    *
+    * Param [in]  pKeywordModel - pointer to user-independent keyword model data
+    * Param [in]  keywordId - null terminated string contains keyword phrase string
+    * Param [in]  listen_epd_params - epd parameter
+                                      if null is passing, default epd parameter will be used internally
+    * Param [in]  pUserRecording - a single recording of user speaking keyword
+    * Param [out] pConfidenceLevel - returns confidence level returned by keyword detection
+    *
+    * Return - status
+    *       kBadParam - When any input pointer (except pEpdParameter) is NULL
+    *       kKeywordNotFound - When keywordId not exist in the model
+    *       kSMVersionUnsupported - When pKeywordModel is not 2.0 (have to contain GMM) model
+    *       kLowSnr - When user recording is too noisy
+    *       kNoSignal - When user recording is non-speech
+    */
+DllFunc listen_status_enum CDECLARE verifyUserRecording(
+        listen_model_type           *pKeywordModel,
+        keywordId_t                 keywordId, // add for SVA 2.0
+        listen_epd_params           *pEpdParameter,
+        listen_user_recording       *pUserRecording,
+        int16_t                     *pConfidenceLevel);
+
+    /*
+    * checkUserRecording
+    *
+    * Returns the status of user recordings that if user recording has problem with SNR(Signal Noise Ratio) and length
+    *
+    * Param [in]  pLanguageModel - pointer to language model
+    * Param [in]  pEpdParameter - pointer to EPD parameters
+    *                            Default parameter will be used if eEpdParameter is NULL
+    * Param [in]  pUserRecording - User recording that is going to be tested
+    * Param [out]  pOutSnr - SNR of user recording
+    * Param [in]  maxPhonemeLength (optional parameter) - maximum phoneme length allowed for each user recording
+    *                                                   - It is optional parameter, whose default value is 0.
+    *
+    * Return - status
+    *       kBadParam - When any input pointer (except pEpdParameter) is NULL
+    *         kLowSnr   - When user recording is too noisy
+    *         kNoSignal - When user recording is non-speech
+    *       kRecordingTooShort - When user recording is too short
+    */
+DllFunc listen_status_enum CDECLARE checkUserRecording(
+        listen_language_model_type  *pLanguageModel,
+        listen_epd_params           *pEpdParameter,
+        listen_user_recording       *pUserRecording,
+        float                       *pOutSnr,
+        uint32_t                    maxPhonemeLength);
+
+    /*
+    * checkRecordingsQuality
+    *
+    * Returns the status of the last user recording in recording array that
+    * if user recording has problem with SNR(Signal Noise Ratio) and length
+    * Check the consistency of the input recordings if numUserRecording > 1
+    *
+    * Param [in]  pLanguageModel - pointer to language model
+    * Param [in]  pEpdParameter - pointer to EPD parameters
+    *                            Default parameter will be used if eEpdParameter is NULL
+    * Param [in]  numUserRecording - number of input recordings
+    * Param [in]  pUserRecordings - User recordings those are going to be tested
+    * Param [out]  pOutSnr - SNR of user recording
+    *
+    * Return - status
+    *       kBadParam - When any input pointer (except pEpdParameter) is NULL
+    *         kLowSnr   - When user recording is too noisy
+    *         kNoSignal - When user recording is non-speech
+    *       kRecordingTooShort - When user recording is too short
+    */
+
+DllFunc listen_status_enum CDECLARE checkRecordingsQuality(
+        listen_language_model_type  *pLanguageModel,
+        listen_epd_params           *pEpdParameter,
+        uint32_t                     numUserRecording,
+        listen_user_recording       *pUserRecordings[],
+        float                       *pOutSnr);
+
+    /*
+    * tuneUserDefinedKeywordModelThreshold
+    *
+    * This function tunes threshold of user defined keyword.
+    *
+    * This function can be used when programmer want to make testing stage after training stage of user defined keyword
+    * even though threshold of user defined keyword is automatically tunned when create user defined keyword,
+    * this function can be useful when tune more threshold of user defined keyword
+    *
+    * Param [in]  pUserDefinedKeyword - pointer to user defined keyword
+    * Param [in]  keywordId - keyword spell
+    * Param [in]  pUserRecording - user recording from testing stage
+    * Param [out]  pOutputUserDefinedKeyword - tunned user defined keyword
+    *
+    * Return - listen_status_enum
+    * Return - status
+    *       kBadParam - When any input pointer is NULL, or pUserDefinedKeyword is not UDK
+    *       kKeywordNotFound - When keywordId not exist in the model
+    */
+DllFunc listen_status_enum CDECLARE tuneUserDefinedKeywordModelThreshold(
+        listen_model_type           *pUserDefinedKeyword,
+        keywordId_t                 keywordId,
+        listen_user_recording       *pUserRecording,
+        listen_model_type           *pOutputUserDefinedKeyword);
+
+
+    /*
+    * getUserDefinedKeywordSize
+    *
+    * Get the size required to hold user defined keyword model that extends given keyword model
+    * with give user data
+    *
+    * Param [in]  pUserDefinedKeyword - pointer to previous user defined keyword
+                                        if pUserDefinedKeyword is NULL, this will create new user defined keyword model
+                                        if pUserDefinedKeyword is not NULL, this will train incrementally ( not supported now )
+
+    * Param [in]  keywordId - keyword spell of user defined keyword
+    * Param [in]  userId - user spell of user defined keyword
+    * Param [in]  pEpdParameter - epd parameter which is used for chopping user recording.
+                                   if eEpdParameter is NULL, default parameter will be used
+    * Param [in]  numUserRecording - number of user recording
+    * Param [in]  pUserRecordings[] -  multiple recording of user speaking keyword
+    * Param [in]  pLanguageModel - language model
+    * Param [out]  pOutputSize - pointer to where output model size will be written
+    *
+    * Return - listen_status_enum
+    * Return - status
+    *       kBadParam - When any input pointer (except pUserDefinedKeyword, pEpdParameter) is NULL, or pLanguageModel is fake
+    *       kNoSignal - When user recording is non-speech
+    */
+DllFunc listen_status_enum CDECLARE getUserDefinedKeywordSize(
+        listen_model_type           *pUserDefinedKeyword,
+        keywordId_t                 keywordId,
+        userId_t                    userId,
+        listen_epd_params           *pEpdParameter,
+        uint32_t                    numUserRecording,
+        listen_user_recording       *pUserRecordings[],
+        listen_language_model_type  *pLanguageModel,
+        uint32_t                    *pOutputSize);
+
+    /*
+    * getUserDefinedKeywordApproxSize
+    *
+    * Get the size required to hold user-keyword model that extends given keyword model
+    * with give user data
+    *
+    * Param [in]  keywordId - null terminated string containing keyword phrase string
+    * Param [in]  userId - null terminated string containing user name string
+    * Param [in]  pLanguageModel - pointer to language model data
+    * Param [out] pOutputSize - size of approximated output model
+    * Param [in]  maxPhonemeLength (optional parameter) - maximum phoneme length allowed for each user recording
+    *                                                   - It is optional parameter, whose default value is 0.
+    *
+    * Return - status
+    *       kBadParam - When any input pointer is NULL
+    */
+
+DllFunc listen_status_enum CDECLARE getUserDefinedKeywordApproxSize(
+    keywordId_t keywordId,
+    userId_t userId,
+    listen_language_model_type *pLanguageModel,
+    uint32_t                        *pOutputSize,
+    uint32_t                        maxPhonemeLength);
+
+    /*
+    * createUserDefinedKeywordModel
+    *
+    * Description : Create User Defined Keyword Model
+    *
+    * Param [in]  pUserDefinedKeyword - pointer to previous user defined keyword
+                                        if pUserDefinedKeyword is NULL, this will create new user defined keyword model
+                                        if pUserDefinedKeyword is not NULL, this will train incrementally ( not supported now )
+
+    * Param [in]  keywordId - keyword spell of user defined keyword
+    * Param [in]  userId - user spell of user defined keyword
+    * Param [in]  pEpdParameter - epd parameter which is used for chopping user recording.
+                                   if eEpdParameter is NULL, default parameter will be used
+    * Param [in]  numUserRecording - number of user recording
+    * Param [in]  pUserRecordings[] - multiple recording of user speaking keyword
+    * Param [in]  pLanguageModel - language model
+    * Param [out] pOutputUserDefinedKeyword - pointer to where output model will be written
+    * Param [out] pMatchingScore - pointer to matching score
+    *
+    * Return - listen_status_enum
+    * Return - status
+    *       kBadParam - When any input pointer (except pUserDefinedKeyword, pEpdParameter) is NULL, or pLanguageModel is fake
+    *       kNoSignal - When user recording is non-speech
+    *       kCannotCreateUserUDK - When creation process fails somewhere
+    *       kOutputArrayTooSmall - When output size is smaller than actual udk model size
+    */
+DllFunc listen_status_enum CDECLARE createUserDefinedKeywordModel(
+        listen_model_type          *pUserDefinedKeyword,
+        keywordId_t                 keywordId,
+        userId_t                    userId,
+        listen_epd_params           *pEpdParameter,
+        uint32_t                     numUserRecording,
+        listen_user_recording      *pUserRecordings[],
+        listen_language_model_type  *pLanguageModel,
+        listen_model_type           *pOutputUserDefinedKeyword,
+        int16_t                     *pMatchingScore);
+
+    /*
+    * getStrippedUserKeywordModelSize
+    *
+    * Return stripped model size
+    *
+    * Param[in] pModel - pointer to (user)keyword model data
+    * Param[out] nStrippedModelSize - return model size of stripped model
+    *
+    * Return - status
+    *           kBadParam - When any input pointer is NULL
+    *           kSMVersionUnsupported - When pModel is not 2.0 model
+    *
+    */
+DllFunc listen_status_enum CDECLARE getStrippedUserKeywordModelSize(
+        listen_model_type           *pModel,
+        uint32_t                    *nStrippedModelSize);
+
+
+    /*
+    * stripUserKeywordModel
+    *
+    * Return stripped model
+    *
+    * Param[in] pModel - pointer to (user)keyword model data
+    * Param[out] pStrippedModel - pointer to stripped model data
+    *
+    * Return - status
+    *           kBadParam - When any input pointer is NULL
+    *           kSMVersionUnsupported - When pModel is not 2.0 model
+    *
+    */
+DllFunc listen_status_enum CDECLARE stripUserKeywordModel(
+        listen_model_type           *pModel,
+        listen_model_type           *pStrippedModel);
+
+    /*
+    * getUserKeywordModelSize
+    *
+    * Get the size required to hold user-keyword model that extends given keyword model
+    * with give user data
+    *
+    * Param [in]  pKeywordModel - pointer to keyword model data
+    * Param [in]  keywordId - null terminated string containing keyword phrase string
+    * Param [in]  userId - null terminated string containing user name string
+    * Param [out] nUserKeywordModelSize - size of user keyword model
+    *
+    * Return - status
+    *       kBadParam - When any input pointer is NULL
+    *       kKeywordNotFound - When keywordId not exist in the model
+    *       kSMVersionUnsupported - When pKeywordModel is not 2.0/3.0 model
+    */
+DllFunc listen_status_enum CDECLARE getUserKeywordModelSize(
+        listen_model_type           *pKeywordModel,
+        keywordId_t                 keywordId, // add for SVA 2.0
+        userId_t                    userId, // add for SVA 2.0
+        uint32_t                    *nUserKeywordModelSize);
+
+    /*
+    * createUserKeywordModel
+    *
+    * Create a user keyword model
+    * Writes the user keyword model into given memory location
+    *
+    * Param [in]  pKeywordModel - pointer to Keyword model  or User keyword model data
+                                if it is keyword model, create user-keyword model
+                                if it is user keyword model, incrementally train user keyword model
+    * Param [in]  keywordId - user data is to be appended for keyword in model with given identifier
+    * Param [in]  userId - identifier of user data is created
+    *            If identifier is already used, will replace existing user data with newly created data.
+    *            The User Name is passed to this function so that if this is the first time user data is
+    *            being added for a new user, the User's Name can be stored in the SM
+    * Param [in]  pEpdParameter - end point detection parameter
+    *                             if eEpdParameter is NULL, default parameter will be used
+    * Param [in]  numUserRecording - number of user recordings
+    * Param [in]  pUserRecordings - multiple recording of user speaking keyword
+    * Param [out] pUserKeywordModel - pointer to where user keyword model data is to be written
+    * Param [out] pUserMatchingScore - pointer to user matching score
+    * Return - status
+    *       kBadParam - When any input pointer (except pEpdParameter) is NULL
+    *       kKeywordNotFound - When keywordId not exist in the model
+    *       kSMVersionUnsupported - When pKeywordModel is not 2.0 or 3.0 model
+    *        kLowSnr    - When user recording is too noisy
+    *        kNoSignal - When user recording is non-speech
+    *       kCannotCreateUserUDK - When pKeywordModel is UDK model
+    */
+DllFunc listen_status_enum CDECLARE createUserKeywordModel(
+        listen_model_type           *pKeywordModel,
+        keywordId_t                 keywordId, // add for SVA 2.0
+        userId_t                    userId, // add for SVA 2.0
+        listen_epd_params           *pEpdParameter,
+        uint32_t                    numUserRecording,
+        listen_user_recording       *pUserRecordings[],
+        listen_model_type           *pUserKeywordModel,
+        int16_t                     *pUserMatchingScore);
+
+// Since size of new SM after removing data will be less than or equal to size of
+// input SM, this function could be optional and size of pInputModel could be used
+// to allocate memory for pResultModel when deleteFromModel() called.
+    /*
+    * getSizeAfterDeleting
+    *
+    * Return the size of sound model after removing data from a given SM for either
+    * a keyword, a user, or a specific user+keyword pair.
+    *
+    * Param [in]  pInputModel - pointer to sound model
+    * Param [in]  keywordId - data for this keyword in model with given identifier is removed
+    *           If userId is 'null', then all keyword-only data and all user data associated
+    *           with the given non-null keywordId is removed.
+    *           If userId is also non-null, then only data associated with the userId+keywordId
+    *           pair is removed.
+    * Param [in]  userId - all data for this user in model with given identifier is removed
+    *           If keywordId is 'null', then all all user data for the given non-null userId
+    *           is removed.
+    *           If keywordId is also non-null, then only data associated with the userId+keywordId
+    *           pair is removed.
+    * Param [out]  nOutputModelSize - outputs size of resulting soundmodel after removing data.
+    * Return - status
+    *       kBadParam - When any input pointer (except keywordId, userId) is NULL
+    *       kLastKeyword - When pInputModel has only one keyword
+    *       kSMVersionUnsupported - When pInputModel is not 2.0 model
+    *       kKeywordNotFound - When keywordId not exist in the model
+    *       kUserNotFound - When userId not exist in the model
+    *       kUserKWPairNotActive - When <keywordId, userId> pair not exist in the model
+    *       kUserUDKPairNotRemoved - When <keywordId, userId> pair to delete is UDK
+    */
+DllFunc listen_status_enum CDECLARE getSizeAfterDeleting(
+        listen_model_type           *pInputModel,
+        keywordId_t                 keywordId, // add for SVA 2.0
+        userId_t                    userId, // add for SVA 2.0
+        uint32_t                    *nOutputModelSize);
+
+// If getSizeAfterDeleting() supported, call it get size of new sound model after
+// removing desired data from given input sound model, and
+// allocate ResultModel with this size
+// Otherwise, use size of input SoundModel since size of ResultModel will be
+// less than or equal to size of input SoundModel.
+    /*
+    * deleteFromModel
+    *
+    * Return a new sound model after removing data from a given SM for a keyword, a user,
+    * or a user+keyword pair.
+    *
+    * Param [in]  pInputModel - pointer to sound model
+    * Param [in]  keywordId - data for this keyword in model with given identifier is removed
+    *           If userId is 'null', then all keyword-only data and all user data associated
+    *           with the given non-null keywordId is removed.
+    *           If userId is also non-null, then only data associated with the userId+keywordId
+    *           pair is removed.
+    * Param [in]  userId - all data for this user in model with given identifier is removed
+    *           If keywordId is 'null', then all all user data for the given non-null userId
+    *           is removed.
+    *           If keywordId is also non-null, then only data associated with the userId+keywordId
+    *           pair is removed.
+    * Param [out]  pResultModel - pointer to where user keyword model data is to be written
+    * Return - status
+    *       kBadParam - When any input pointer (except keywordId, userId) is NULL
+    *       kLastKeyword - When pInputModel has only one keyword
+    *       kSMVersionUnsupported - When pInputModel is not 2.0 or 3.0 model
+    *       kKeywordNotFound - When keywordId not exist in the model
+    *       kUserNotFound - When userId not exist in the model
+    *       kUserKWPairNotActive - When <keywordId, userId> pair not exist in the model
+    *       kUserUDKPairNotRemoved - When <keywordId, userId> pair to delete is UDK
+    */
+DllFunc listen_status_enum CDECLARE deleteFromModel(
+        listen_model_type           *pInputModel,
+        keywordId_t                 keywordId, // add for SVA 2.0
+        userId_t                    userId, // add for SVA 2.0
+        listen_model_type           *pResultModel);
+
+
+    /*
+    * getMergedModelSize
+    *
+    * Return the size of sound model after merging required models
+    *
+    * Param [in]  numModels - number of model files to be merged
+    * Param [in]  pModels - array of pointers to Keyword or User keyword model data
+    * Param [out]  nOutputModelSize - outputs size of resulting soundmodel after merging models
+    *
+    * Return - status
+    *       kBadParam - When any input pointer is NULL
+    *       kSMVersionUnsupported - When pInputModel is not 2.0 model
+    *       kDuplicateKeyword - When same keywordId exists in more than 1 model
+    *       kDuplicateUserKeywordPair
+    *       kMaxKeywordsExceeded
+    *       kMaxUsersExceeded,
+    */
+DllFunc listen_status_enum CDECLARE getMergedModelSize(
+        uint16_t                    numModels,
+        listen_model_type           *pModels[],
+        uint32_t                    *nOutputModelSize);
+
+
+
+    /*
+    * mergeModels
+    *
+    * merges two or more Sound Models
+    *
+    * Writes the new merged model into given memory location
+    *
+    * Param [in]  numModels - number of model files to be merged
+    * Param [in]  pModels - array of pointers to Keyword or User keyword model data
+    * Param [out]  pMergedModel - pointer to where merged model data is to be written
+    * Return - status
+    *       kBadParam - When any input pointer is NULL
+    *       kSMVersionUnsupported - When pInputModel is not 2.0 model
+    *       kDuplicateKeyword - When same keywordId exists in more than 1 model
+    *       kDuplicateUserKeywordPair - N/A to current version
+    *       kMaxKeywordsExceeded - N/A to current version
+    *       kMaxUsersExceeded - N/A to current version
+    */
+DllFunc listen_status_enum CDECLARE mergeModels(
+        uint16_t                    numModels,
+        listen_model_type       *pModels[],
+        listen_model_type       *pMergedModel);
+
+
+
+/* ParseFromBigSoundModel
+*
+* Parse the big 3.0 sound model to individual sub models
+*
+* Param [in]   *pSM3p0Model – The pointer to the big 3.0 sound model
+* Param [out]  p1stStageModel - pointer to parsed 1stStageModel
+* Param [out]  p2ndStageKWModel - pointer to parsed 2nd stage KW Model
+* Param [out]  p2stStageVoPModel - pointer to parsed 2nd stage VoP Model
+* Param [out]  indicator – returned indicator, indicating what types of models parsed/returned
+* Return - status
+*       kBadParam - When any input pointer is NULL
+*       kSMVersionUnsupported - When pInputModel is not 3.0 model
+*       kDuplicateKeyword - When same keywordId exists in more than 1 model
+*       kWrongModel - when input is broken
+*/
+
+DllFunc listen_status_enum CDECLARE parseFromBigSoundModel(
+        listen_model_type       *pSM3p0Model,
+        listen_model_type       *p1stStageModel,
+        listen_model_type       *p2ndStageKWModel,
+        listen_model_type       *p2stStageVoPModel,
+        uint16_t                *indicator );
+
+
+
+
+    /*
+    * parseDetectionEventData
+    *
+    * parse event payload into detection event.
+    *
+    * Version of input SM will detemine DetectionType created/returned
+    *
+    * Param [in]  pUserKeywordModel - pointer to keyword or user keyword model data
+    * Param [in]  pEventPayload - pointer to received event payload data
+    * Param [out] pDetectEvent - pointer to where detection event data is to be written
+    * Return - status
+    *       kBadParam - When any input pointer is NULL
+    *       kSMVersionUnsupported - When pUserKeywordModel is not 2.0 model
+    *       kEventStructUnsupported - When pEventPayload->size != numKeywords + numActiveUsers
+    */
+
+DllFunc listen_status_enum CDECLARE parseDetectionEventData(
+        listen_model_type           *pUserKeywordModel,
+        listen_event_payload        *pEventPayload,
+        listen_detection_event_type *pDetectionEvent);
+
+
+// Declared in both SVA 1.0 and SVA 2.0 versions and SML 3.0 of ListenSoundModelMLib
+//
+    /*
+    * querySoundModel
+    *
+    * Returns the information about a sound model
+    * Sound model could be of any type: Keyword, UserKeyword, TargetSound,...
+    * Sound model could be any versions
+    *
+    * Param [in] pSoundModel - pointer to model data
+    * Param [out] pListenSoundModelInfo - returns information about the give sound model
+    *
+    * Return - status
+    *       kBadParam - When any input pointer is NULL
+    *       kFailed - When input model failed to be decoded
+    *        kSMVersionUnsupported - When pSoundModel is fake model (invalid model other than 1.0 model, 2.0 model and 3.0 model)
+    */
+DllFunc listen_status_enum CDECLARE querySoundModel(
+        listen_model_type           *pSoundModel,
+        listen_sound_model_info     *pListenSoundModelInfo);
+
+
+    /*
+    * getSoundModelHeader
+    *
+    * Returns additional information about the sound model
+    * Sound model could be of any type: Keyword, UserKeyword, TargetSound,...
+    * Keyword
+    *
+    * Param [in] pSoundModel - pointer to model data
+    * Param [out] pListenSoundModelHeader - returns header field from sound model
+    *
+    * Return - status
+    *       kBadParam - When any input pointer is NULL
+    *       kSMVersionUnsupported - When pSoundModel is not 2.0 or 3.0 model
+    */
+
+DllFunc listen_status_enum CDECLARE getSoundModelHeader(
+        listen_model_type           *pSoundModel,
+        listen_sound_model_header   *pListenSoundModelHeader);
+
+
+    /*
+    * release sound model header
+    *
+    * deallocate sound model header
+    * Return - status
+    *       kBadParam - When any input pointer is NULL
+    */
+DllFunc listen_status_enum CDECLARE releaseSoundModelHeader(
+        listen_sound_model_header   *pListenSoundModelHeader);
+
+
+    /*
+    * getKeywordPhrases
+    *
+    * Get keyword phrase string for all Keywords defined in given SM 2.0 / 3.0
+    *
+    * App calling this function must allocate memory for all phrases
+    * by getting the number of keywords from querySoundModel() and allocating
+    * totalNumKeywords*MAX_STRING_LEN
+    * This function copies phrases into this allocated keywords array
+    *
+    * Param [in]  pSoundModel - pointer to model data
+    * Param [in/out] numKeywords - [in]  number of string entries allocated in keywords array
+    *                             [out] number of keyword phrase strings copied keyword array
+    * Param [out] keywords - array of keyword phrase null-terminated strings
+    *
+    * Return - status
+    *       kBadParam - When any input pointer is NULL, or numKeywords < real keywords number
+    *       kSMVersionUnsupported - When pSoundModel is not 2.0 or 3.0 model
+    */
+DllFunc listen_status_enum CDECLARE getKeywordPhrases(
+        listen_model_type           *pSoundModel,
+        uint16_t                    *numKeywords,
+        keywordId_t                 *keywords);
+
+
+    /*
+    * getUserNames
+    *
+    * Get user names for user data associated with a given SM 2.0 / 3.0
+    *
+    * App calling this function must allocate memory for all names
+    * by getting the number of users  from querySoundModel() and allocating
+    * totalNumUsers*MAX_STRING_LEN
+    * This function copies names into this allocated keywords array
+    *
+    * Param [in]  pSoundModel - pointer to model data
+    * Param [in/out] numUsers - [in]  number of string entries allocated in users array
+    *                          [out] number of user name strings copied users array
+    * Param [out] users - array of user name null-terminated strings
+    *
+    * Return - status
+    *       kBadParam - When any input pointer is NULL, or numUsers < real users number, or pSoundModel is keyword-only model
+    *       kSMVersionUnsupported - When pSoundModel is not 2.0 or 3.0 model
+    */
+DllFunc listen_status_enum CDECLARE getUserNames(
+        listen_model_type           *pSoundModel,
+        uint16_t                        *numUsers,
+        userId_t                        *users);
+
+    /*
+    * loadConfParams
+    *
+    * Load configurable parameters to the sound model library
+    *
+    * Param [in] pConfData - pointer to param data
+    * Param [in] confDataSize - size of memory allocated for param data
+    *
+    * Return - status
+    *       kBadParam - When any input pointer is NULL
+    */
+DllFunc listen_status_enum CDECLARE loadConfParams(
+        uint8_t                     *pConfData,
+        uint32_t                    confDataSize);
+    /*
+    * getBinaryModelSize
+    *
+    * Return binary model size
+    *
+    * Param[in] pListenModel - pointer to (user)keyword model data
+    * Param[out] nBinaryModelSize - return model size of binary model
+    *
+    * Return - status
+    *           kBadParam - When any input pointer is NULL
+    *           kSMVersionUnsupported - When pModel is not 2.0 or 3.0 model
+    *
+    */
+
+DllFunc listen_status_enum CDECLARE getBinaryModelSize(
+        listen_model_type           *pListenModel,
+        uint32_t                    *nBinaryModelSize);
+
+    /*
+    * getSortedKeywordStatesUserKeywordModelSize
+    *
+    * Return sorted model size
+    *
+    * Param[in] pModel - pointer to (user)keyword model data
+    * Param[out] nSortedModelSize - return model size of sorted keyword states model
+    *
+    * Return - status
+    *           kBadParam - When any input pointer is NULL
+    *
+    */
+
+DllFunc listen_status_enum CDECLARE getSortedKeywordStatesUserKeywordModelSize(
+    listen_model_type           *pModel,
+    uint32_t                    *nSortedModelSize);
+
+    /*
+    * sortKeywordStatesOfUserKeywordModel
+    *
+    * Return sorted model
+    *
+    * Param[in] pInputModel - pointer to (user)keyword model data
+    * Param[out] pSortedModel - pointer to sorted keyword states model data
+    *
+    * Return - status
+    *           kBadParam - When any input pointer is NULL
+    *           kSMVersionUnsupported - when pModel is not 2.0 model
+    *
+    */
+
+DllFunc listen_status_enum CDECLARE sortKeywordStatesOfUserKeywordModel(
+        listen_model_type           *pInputModel,
+        listen_model_type           *pSortedModel);
+
+
+#ifdef __cplusplus
+};
+#endif
+
+#endif /* __LISTEN_SOUND_MODEL_LIB_V3_H__ */
+
diff --git a/utils/src/ACDPlatformInfo.cpp b/utils/src/ACDPlatformInfo.cpp
index f283718..a33fb77 100644
--- a/utils/src/ACDPlatformInfo.cpp
+++ b/utils/src/ACDPlatformInfo.cpp
@@ -37,7 +37,6 @@
 
 #include "PalCommon.h"
 #include "PalDefs.h"
-#include "kvh2xml.h"
 
 #define LOG_TAG "PAL: ACDPlatformInfo"
 
diff --git a/utils/src/SoundTriggerPlatformInfo.cpp b/utils/src/SoundTriggerPlatformInfo.cpp
index 32a86d0..67b0a7b 100644
--- a/utils/src/SoundTriggerPlatformInfo.cpp
+++ b/utils/src/SoundTriggerPlatformInfo.cpp
@@ -68,7 +68,6 @@
 
 #include "PalCommon.h"
 #include "PalDefs.h"
-#include "kvh2xml.h"
 
 #define LOG_TAG "PAL: SoundTriggerPlatformInf"
 
diff --git a/utils/src/SoundTriggerXmlParser.cpp b/utils/src/SoundTriggerXmlParser.cpp
index 169dbc7..3d539f4 100644
--- a/utils/src/SoundTriggerXmlParser.cpp
+++ b/utils/src/SoundTriggerXmlParser.cpp
@@ -36,7 +36,6 @@
 #include "PalCommon.h"
 #include "SoundTriggerXmlParser.h"
 #include "ResourceManager.h"
-#include "kvh2xml.h"
 
 CaptureProfile::CaptureProfile(const std::string name) :
     name_(name),