Add STEsePreProcess for init settings am: 6df02928f6 am: 690fa32667 am: aed5c488d2
Original change: https://android-review.googlesource.com/c/platform/hardware/st/secure_element2/+/1839849
Change-Id: I01aaeae7e255bfe762f0dcfa9b85e25c1909159c
diff --git a/secure_element/1.2/GtoService.cpp b/secure_element/1.2/GtoService.cpp
index 54d9732..34a0624 100644
--- a/secure_element/1.2/GtoService.cpp
+++ b/secure_element/1.2/GtoService.cpp
@@ -11,10 +11,12 @@
****************************************************************************/
#include <android/hardware/secure_element/1.2/ISecureElement.h>
+#include <dlfcn.h>
#include <hidl/LegacySupport.h>
#include <log/log.h>
#include "SecureElement.h"
+typedef int (*STEsePreProcess)(void);
// Generated HIDL files
using android::hardware::secure_element::V1_2::ISecureElement;
@@ -28,6 +30,19 @@
int main() {
ALOGD("android::hardware::secure_element::V1_2 is starting.");
ALOGD("Thales Secure Element HAL for eSE1 Service 1.5.0 is starting. libse-gto v1.13");
+ // Ignore this dlopen if libstpreprocess21.so doesn't exist.
+ void* stdll = dlopen("/vendor/lib64/libstpreprocess21.so", RTLD_NOW);
+ if (stdll) {
+ STEsePreProcess fn = (STEsePreProcess)dlsym(stdll, "pre_process");
+ if (fn) {
+ int ret = fn();
+ if (ret == 0) {
+ ALOGD("STEsePreProcess=%d", ret);
+ } else {
+ ALOGE("Error STEsePreProcess=%d", ret);
+ }
+ }
+ }
sp<ISecureElement> se_service = new SecureElement("eSE1");
configureRpcThreadpool(1, true);
status_t status = se_service->registerAsService("eSE1");