summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: cd76985)
raw | patch | inline | side by side (parent: cd76985)
author | Jiyong Park <jiyong@google.com> | |
Wed, 16 Aug 2017 14:30:42 +0000 (23:30 +0900) | ||
committer | Jae Shin <jaeshin@google.com> | |
Thu, 26 Oct 2017 05:21:57 +0000 (05:21 +0000) |
Bug: 64747884
Test: VtsHalRenderscriptV1_0TargetTest successful on the device built
with BOARD_VNDK_VERSION=current and [system] namespace config is applied
to /data/nativetest[64]/* processes.
Merged-In: I9e967c80ac2dba718cd47e1f378bcbf18abe9ad2
Change-Id: I9e967c80ac2dba718cd47e1f378bcbf18abe9ad2
(cherry picked from commit a7ef697a0a520015f961012d53d852a8cece20df)
Test: VtsHalRenderscriptV1_0TargetTest successful on the device built
with BOARD_VNDK_VERSION=current and [system] namespace config is applied
to /data/nativetest[64]/* processes.
Merged-In: I9e967c80ac2dba718cd47e1f378bcbf18abe9ad2
Change-Id: I9e967c80ac2dba718cd47e1f378bcbf18abe9ad2
(cherry picked from commit a7ef697a0a520015f961012d53d852a8cece20df)
renderscript/1.0/default/Device.cpp | patch | blob | history |
index 3aae06097507a5df5acd4800aa1a7cf98779f3b2..4831a8b987b59c1e4a4ae9182e8328cfd2b4c700 100644 (file)
#include "Context.h"
#include "Device.h"
+#include <android/dlext.h>
+#include <dlfcn.h>
+
namespace android {
namespace hardware {
namespace renderscript {
static_assert(sizeof(size_t) <= sizeof(uint64_t), "RenderScript HIDL Error: sizeof(size_t) > sizeof(uint64_t)");
const char* filename = "libRS_internal.so";
- void* handle = dlopen(filename, RTLD_LAZY | RTLD_LOCAL);
+ // Try to load libRS_internal.so from the "rs" namespace directly.
+ typedef struct android_namespace_t* (*GetExportedNamespaceFnPtr)(const char*);
+ GetExportedNamespaceFnPtr getExportedNamespace =
+ (GetExportedNamespaceFnPtr)dlsym(RTLD_DEFAULT, "android_get_exported_namespace");
+ void* handle = nullptr;
+ if (getExportedNamespace != nullptr) {
+ android_namespace_t* rs_namespace = getExportedNamespace("rs");
+ if (rs_namespace != nullptr) {
+ const android_dlextinfo dlextinfo = {
+ .flags = ANDROID_DLEXT_USE_NAMESPACE, .library_namespace = rs_namespace,
+ };
+ handle = android_dlopen_ext(filename, RTLD_LAZY | RTLD_LOCAL, &dlextinfo);
+ }
+ }
+ if (handle == nullptr) {
+ // if there is no "rs" namespace (in case when this HAL impl is loaded
+ // into a vendor process), then use the plain dlopen.
+ handle = dlopen(filename, RTLD_LAZY | RTLD_LOCAL);
+ }
dispatchTable dispatchHal = {
.SetNativeLibDir = (SetNativeLibDirFnPtr) nullptr,