Add pids for processes that dlopens implementations am: bd0d8f7823 am: 6fd759f86f am: 3e61805121
am: 64c8dd55da

Change-Id: I6ce2eaf9e59d843c963f7d3c993fa1e57afe89d3
diff --git a/transport/Android.bp b/transport/Android.bp
index 4e424be..f76e2ab 100644
--- a/transport/Android.bp
+++ b/transport/Android.bp
@@ -34,6 +34,7 @@
         "libhidlbase",
         "libhwbinder",
         "libcutils",
+        "libvndksupport",
     ],
     export_shared_lib_headers: [
         "libbase",
diff --git a/transport/ServiceManagement.cpp b/transport/ServiceManagement.cpp
index b14479e..7e62ca2 100644
--- a/transport/ServiceManagement.cpp
+++ b/transport/ServiceManagement.cpp
@@ -36,6 +36,7 @@
 #include <android-base/properties.h>
 #include <hwbinder/IPCThreadState.h>
 #include <hwbinder/Parcel.h>
+#include <vndksupport/linker.h>
 
 #include <android/hidl/manager/1.0/IServiceManager.h>
 #include <android/hidl/manager/1.0/BpHwServiceManager.h>
@@ -45,10 +46,6 @@
 #define RE_PATH         RE_COMPONENT "(?:[.]" RE_COMPONENT ")*"
 static const std::regex gLibraryFileNamePattern("(" RE_PATH "@[0-9]+[.][0-9]+)-impl(.*?).so");
 
-extern "C" {
-    android_namespace_t* android_get_exported_namespace(const char*);
-}
-
 using android::base::WaitForProperty;
 
 using android::hidl::manager::V1_0::IServiceManager;
@@ -272,7 +269,6 @@
         const std::string prefix = packageAndVersion + "-impl";
         const std::string sym = "HIDL_FETCH_" + ifaceName;
 
-        const android_namespace_t* sphal_namespace = android_get_exported_namespace("sphal");
         const int dlMode = RTLD_LAZY;
         void *handle = nullptr;
 
@@ -289,26 +285,9 @@
             for (const std::string &lib : libs) {
                 const std::string fullPath = path + lib;
 
-                // If sphal namespace is available, try to load from the
-                // namespace first. If it fails, fall back to the original
-                // dlopen, which loads from the current namespace.
-                if (sphal_namespace != nullptr && path != HAL_LIBRARY_PATH_SYSTEM) {
-                    const android_dlextinfo dlextinfo = {
-                        .flags = ANDROID_DLEXT_USE_NAMESPACE,
-                        // const_cast is dirty but required because
-                        // library_namespace field is non-const.
-                        .library_namespace = const_cast<android_namespace_t*>(sphal_namespace),
-                    };
-                    handle = android_dlopen_ext(fullPath.c_str(), dlMode, &dlextinfo);
-                    if (handle == nullptr) {
-                        const char* error = dlerror();
-                        LOG(WARNING) << "Failed to dlopen " << lib << " from sphal namespace:"
-                                     << (error == nullptr ? "unknown error" : error);
-                    } else {
-                        LOG(DEBUG) << lib << " loaded from sphal namespace.";
-                    }
-                }
-                if (handle == nullptr) {
+                if (path != HAL_LIBRARY_PATH_SYSTEM) {
+                    handle = android_load_sphal_library(fullPath.c_str(), dlMode);
+                } else {
                     handle = dlopen(fullPath.c_str(), dlMode);
                 }
 
diff --git a/transport/token/1.0/utils/Android.bp b/transport/token/1.0/utils/Android.bp
index 0360d99..ab77a2a 100644
--- a/transport/token/1.0/utils/Android.bp
+++ b/transport/token/1.0/utils/Android.bp
@@ -14,6 +14,7 @@
 
 cc_library {
     name: "android.hidl.token@1.0-utils",
+    vendor_available: true,
 
     srcs: [
         "HybridInterface.cpp",