Update makefiles for vndk enabled. am: a129dc9c86 am: 730d57cab1
am: 9da4215ca0
Change-Id: I5d633c1827ca1e5ec8cc982b1057b86db02030de
diff --git a/manifest.xml b/manifest.xml
index fb1ee39..fdc9027 100644
--- a/manifest.xml
+++ b/manifest.xml
@@ -62,6 +62,15 @@
<instance>default</instance>
</interface>
</hal>
+ <hal format="hidl">
+ <name>android.system.net.netd</name>
+ <transport>hwbinder</transport>
+ <version>1.0</version>
+ <interface>
+ <name>INetd</name>
+ <instance>default</instance>
+ </interface>
+ </hal>
<hal>
<name>android.system.wifi.keystore</name>
<transport>hwbinder</transport>
diff --git a/transport/Android.bp b/transport/Android.bp
index acd3d2c..cf499ef 100644
--- a/transport/Android.bp
+++ b/transport/Android.bp
@@ -40,6 +40,7 @@
"libhidlbase",
"libhwbinder",
"libcutils",
+ "libvndksupport",
],
export_shared_lib_headers: [
"libbase",
diff --git a/transport/ServiceManagement.cpp b/transport/ServiceManagement.cpp
index a404d10..44a6f31 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.1/IServiceManager.h>
#include <android/hidl/manager/1.1/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 IServiceManager1_0 = android::hidl::manager::V1_0::IServiceManager;
@@ -275,7 +272,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;
@@ -301,26 +297,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);
}