Snap for 8952093 from b12dd8bd647f8d31aafcbf4e536afc7a5223b53a to sdk-release

Change-Id: If61f5ca614e255eff15ecab713cb0be5d1b3d5ef
diff --git a/aidl/hal_st21nfc.cc b/aidl/hal_st21nfc.cc
index 755ece1..6c4fd71 100644
--- a/aidl/hal_st21nfc.cc
+++ b/aidl/hal_st21nfc.cc
@@ -345,6 +345,7 @@
 }
 
 int StNfc_hal_close(int nfc_mode_value) {
+  void* stdll = nullptr;
   STLOG_HAL_D("HAL st21nfc: %s nfc_mode = %d", __func__, nfc_mode_value);
 
   /* check if HAL is closed */
@@ -371,8 +372,11 @@
   std::string valueStr =
       android::base::GetProperty("persist.vendor.nfc.streset", "");
   if (valueStr.length() > 0) {
-    valueStr = VENDOR_LIB_PATH + valueStr + VENDOR_LIB_EXT;
-    void* stdll = dlopen(valueStr.c_str(), RTLD_NOW);
+    stdll = dlopen(valueStr.c_str(), RTLD_NOW);
+    if (!stdll) {
+      valueStr = VENDOR_LIB_PATH + valueStr + VENDOR_LIB_EXT;
+      stdll = dlopen(valueStr.c_str(), RTLD_NOW);
+    }
     if (stdll) {
       STLOG_HAL_D("STReset Cold reset");
       STEseReset fn = (STEseReset)dlsym(stdll, "cold_reset");
diff --git a/aidl/main.cpp b/aidl/main.cpp
index e596386..a9d7275 100644
--- a/aidl/main.cpp
+++ b/aidl/main.cpp
@@ -30,13 +30,17 @@
 typedef int (*STEseReset)(void);
 
 int main() {
+  void* stdll = nullptr;
   LOG(INFO) << "NFC AIDL HAL Service is starting up";
 
   std::string valueStr =
       android::base::GetProperty("persist.vendor.nfc.streset", "");
   if (valueStr.length() > 0) {
-    valueStr = VENDOR_LIB_PATH + valueStr + VENDOR_LIB_EXT;
-    void* stdll = dlopen(valueStr.c_str(), RTLD_NOW);
+    stdll = dlopen(valueStr.c_str(), RTLD_NOW);
+    if (!stdll) {
+      valueStr = VENDOR_LIB_PATH + valueStr + VENDOR_LIB_EXT;
+      stdll = dlopen(valueStr.c_str(), RTLD_NOW);
+    }
     if (stdll) {
       LOG(INFO) << "ST NFC HAL STReset starting.";
       STEseReset fn = (STEseReset)dlsym(stdll, "boot_reset");