diff options
author | Dimitry Ivanov <dimitry@google.com> | 2016-04-20 16:07:30 -0700 |
---|---|---|
committer | Dimitry Ivanov <dimitry@google.com> | 2016-04-27 11:44:42 -0700 |
commit | 5539db0b4f915bf15de742d1378904a553dc80dc (patch) | |
tree | 692cb3a71c1756a1b523f23802193f8b32d0db31 /libnativeloader | |
parent | f92838ca1d5e315943022b7225a6c97c6c1283f4 (diff) | |
download | system_core-5539db0b4f915bf15de742d1378904a553dc80dc.tar.gz system_core-5539db0b4f915bf15de742d1378904a553dc80dc.tar.bz2 system_core-5539db0b4f915bf15de742d1378904a553dc80dc.zip |
Enable namespaces for all target sdk versions
We previously relied on the fact that target sdk version 0
implies system_server, which is not true, target sdk version
may be set to 0 for other apps and it means 1 - the earliest
version of android. This change enables namespaces for
apps targeting all sdk version and for system_server.
Bug: http://b/27702070
Change-Id: I16fbdeb6868c7035aec71132c80c150c08ea2cc3
(cherry picked from commit 213676b88019016f8c968a05c50a196e2aaaeff8)
Diffstat (limited to 'libnativeloader')
-rw-r--r-- | libnativeloader/native_loader.cpp | 12 |
1 files changed, 3 insertions, 9 deletions
diff --git a/libnativeloader/native_loader.cpp b/libnativeloader/native_loader.cpp index 81dc31667..af14be8ad 100644 --- a/libnativeloader/native_loader.cpp +++ b/libnativeloader/native_loader.cpp @@ -172,10 +172,6 @@ class LibraryNamespaces { static std::mutex g_namespaces_mutex; static LibraryNamespaces* g_namespaces = new LibraryNamespaces; - -static bool namespaces_enabled(uint32_t target_sdk_version) { - return target_sdk_version > 0; -} #endif void InitializeNativeLoader() { @@ -193,10 +189,7 @@ jstring CreateClassLoaderNamespace(JNIEnv* env, jstring library_path, jstring permitted_path) { #if defined(__ANDROID__) - if (!namespaces_enabled(target_sdk_version)) { - return nullptr; - } - + UNUSED(target_sdk_version); std::lock_guard<std::mutex> guard(g_namespaces_mutex); android_namespace_t* ns = g_namespaces->Create(env, class_loader, @@ -220,7 +213,8 @@ void* OpenNativeLibrary(JNIEnv* env, jobject class_loader, jstring library_path) { #if defined(__ANDROID__) - if (!namespaces_enabled(target_sdk_version) || class_loader == nullptr) { + UNUSED(target_sdk_version); + if (class_loader == nullptr) { return dlopen(path, RTLD_NOW); } |