Merge "sthal: Update sthal to use new PAL PCM formats"
diff --git a/Android.mk b/Android.mk
index 0777a88..29efff1 100644
--- a/Android.mk
+++ b/Android.mk
@@ -44,6 +44,16 @@
libutils \
libar-pal
+ifeq ($(strip $(AUDIO_FEATURE_ENABLED_LSM_HIDL)),true)
+ LOCAL_HEADER_LIBRARIES += liblisten_headers
+
+ LOCAL_SHARED_LIBRARIES += \
+ vendor.qti.hardware.ListenSoundModel@1.0-impl \
+ vendor.qti.hardware.ListenSoundModel@1.0
+
+ LOCAL_CFLAGS += -DLSM_HIDL_ENABLED
+endif
+
include $(BUILD_SHARED_LIBRARY)
endif #TARGET_USES_QCOM_MM_AUDIO
endif #AUDIO_USE_STUB_HAL
diff --git a/SoundTriggerDevice.cpp b/SoundTriggerDevice.cpp
index 149b52e..5a233b0 100644
--- a/SoundTriggerDevice.cpp
+++ b/SoundTriggerDevice.cpp
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2019-2020, The Linux Foundation. All rights reserved.
+ * Copyright (c) 2019-2021, 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
@@ -63,6 +63,21 @@
std::shared_ptr<SoundTriggerDevice> SoundTriggerDevice::stdev_ = nullptr;
std::shared_ptr<sound_trigger_hw_device> SoundTriggerDevice::device_ = nullptr;
+#ifdef LSM_HIDL_ENABLED
+#include <hidl/HidlTransportSupport.h>
+#include <hidl/LegacySupport.h>
+
+#include <lsm_server_wrapper.h>
+
+#include <vendor/qti/hardware/ListenSoundModel/1.0/IListenSoundModel.h>
+using vendor::qti::hardware::ListenSoundModel::V1_0::IListenSoundModel;
+using vendor::qti::hardware::ListenSoundModel::V1_0::implementation::ListenSoundModel;
+using android::hardware::defaultPassthroughServiceImplementation;
+using android::sp;
+using namespace android::hardware;
+using android::OK;
+#endif
+
static int stdev_close(hw_device_t *device)
{
int status = 0;
@@ -447,6 +462,15 @@
return status;
}
+#ifdef LSM_HIDL_ENABLED
+ /* Register LSM Lib HIDL service */
+ ALOGD("%s: Register LSM HIDL service", __func__);
+ sp<IListenSoundModel> service = new ListenSoundModel();
+ configureRpcThreadpool(32, false /*callerWillJoin*/);
+ if(android::OK != service->registerAsService())
+ ALOGW("Could not register LSM HIDL service");
+#endif
+
// load audio hal
status = LoadAudioHal();
if (status) {