summaryrefslogtreecommitdiffstats
path: root/libnativeloader/include/nativeloader
diff options
context:
space:
mode:
authorVictor Khimenko <khim@google.com>2018-07-09 17:01:22 +0200
committerVictor Khimenko <khim@google.com>2018-07-12 15:44:35 +0200
commit1443ec4972b727a9081e75a5697cc9d0a420c599 (patch)
treefde31def3f011928d5254a4fc70172e48661cde5 /libnativeloader/include/nativeloader
parent771f2c2a3edd1fcaf367837f3835a596415b2249 (diff)
downloadsystem_core-1443ec4972b727a9081e75a5697cc9d0a420c599.tar.gz
system_core-1443ec4972b727a9081e75a5697cc9d0a420c599.tar.bz2
system_core-1443ec4972b727a9081e75a5697cc9d0a420c599.zip
Separate namespace acquisition from library loading
This way native bridge namespace could be acquired in advance and when library must be loaded JNIEnv is not needed. Bug: http://b/79940628 Test: cts-tradefed run commandAndExit cts -m CtsGpuToolsHostTestCases Change-Id: If8bff272fc5245eb4e418807c3bdd29e82833ab8
Diffstat (limited to 'libnativeloader/include/nativeloader')
-rw-r--r--libnativeloader/include/nativeloader/native_loader.h13
1 files changed, 13 insertions, 0 deletions
diff --git a/libnativeloader/include/nativeloader/native_loader.h b/libnativeloader/include/nativeloader/native_loader.h
index 3563fc149..19a17832e 100644
--- a/libnativeloader/include/nativeloader/native_loader.h
+++ b/libnativeloader/include/nativeloader/native_loader.h
@@ -53,8 +53,21 @@ bool CloseNativeLibrary(void* handle, const bool needs_native_bridge);
#if defined(__ANDROID__)
// Look up linker namespace by class_loader. Returns nullptr if
// there is no namespace associated with the class_loader.
+// TODO(b/79940628): move users to FindNativeLoaderNamespaceByClassLoader and remove this function.
__attribute__((visibility("default")))
android_namespace_t* FindNamespaceByClassLoader(JNIEnv* env, jobject class_loader);
+// That version works with native bridge namespaces, but requires use of OpenNativeLibrary.
+class NativeLoaderNamespace;
+__attribute__((visibility("default")))
+NativeLoaderNamespace* FindNativeLoaderNamespaceByClassLoader(
+ JNIEnv* env, jobject class_loader);
+// Load library. Unlinke OpenNativeLibrary above couldn't create namespace on demand, but does
+// not require access to JNIEnv either.
+__attribute__((visibility("default")))
+void* OpenNativeLibrary(NativeLoaderNamespace* ns,
+ const char* path,
+ bool* needs_native_bridge,
+ std::string* error_msg);
#endif
__attribute__((visibility("default")))