From 213676b88019016f8c968a05c50a196e2aaaeff8 Mon Sep 17 00:00:00 2001 From: Dimitry Ivanov Date: Wed, 20 Apr 2016 16:07:30 -0700 Subject: 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 --- libnativeloader/native_loader.cpp | 12 +++--------- 1 file changed, 3 insertions(+), 9 deletions(-) (limited to 'libnativeloader') diff --git a/libnativeloader/native_loader.cpp b/libnativeloader/native_loader.cpp index f0360dbe1..c7e479ab0 100644 --- a/libnativeloader/native_loader.cpp +++ b/libnativeloader/native_loader.cpp @@ -159,10 +159,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() { @@ -180,10 +176,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 guard(g_namespaces_mutex); android_namespace_t* ns = g_namespaces->Create(env, class_loader, @@ -206,7 +199,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); } -- cgit v1.2.3