summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author Martin Stjernholm <mast@google.com> 2022-07-27 02:10:03 +0100
committer Martin Stjernholm <mast@google.com> 2022-09-09 17:36:29 +0000
commitc55265c083eee1af192e8f34bc0096e593f3a211 (patch)
tree5bee8323a6270878235173447cda90bbabc51eb4
parent488517a2ad08abbfd095eb5b7da11313c9e07efd (diff)
Use a different name for the product classloader namespace.
This is a correction - it reused the vendor classloader namspace name by mistake when product apps were introduced. Test: `atest libnativeloader_e2e_tests` and look at logcat messages Bug: 137356719 Change-Id: I3e8cfcb9ed8112bb0144ff2ea53fe7a8bcb63694
-rw-r--r--libnativeloader/library_namespaces.cpp17
-rw-r--r--libnativeloader/native_loader_test.cpp2
2 files changed, 10 insertions, 9 deletions
diff --git a/libnativeloader/library_namespaces.cpp b/libnativeloader/library_namespaces.cpp
index 96d4ddeac6..0d038f54ab 100644
--- a/libnativeloader/library_namespaces.cpp
+++ b/libnativeloader/library_namespaces.cpp
@@ -64,15 +64,16 @@ constexpr const char* kVndkProductNamespaceName = "vndk_product";
// system namespace with the names of libs listed in the public.libraries.txt.
// This way an app can only load its own JNI libraries along with the public libs.
constexpr const char* kClassloaderNamespaceName = "classloader-namespace";
-// Same thing for vendor APKs.
+// Same thing for unbundled vendor APKs.
constexpr const char* kVendorClassloaderNamespaceName = "vendor-classloader-namespace";
-// If the namespace is shared then add this suffix to form
-// "classloader-namespace-shared" or "vendor-classloader-namespace-shared",
-// respectively. A shared namespace (cf. ANDROID_NAMESPACE_TYPE_SHARED) has
+// Same thing for unbundled product APKs.
+constexpr const char* kProductClassloaderNamespaceName = "product-classloader-namespace";
+// If the namespace is shared then add this suffix to help identify it in debug
+// messages. A shared namespace (cf. ANDROID_NAMESPACE_TYPE_SHARED) has
// inherited all the libraries of the parent classloader namespace, or the
-// system namespace for the main app classloader. It is used to give full
-// access to the platform libraries for apps bundled in the system image,
-// including their later updates installed in /data.
+// system namespace for the main app classloader. It is used to give full access
+// to the platform libraries for apps bundled in the system image, including
+// their later updates installed in /data.
constexpr const char* kSharedNamespaceSuffix = "-shared";
// (http://b/27588281) This is a workaround for apps using custom classloaders and calling
@@ -262,7 +263,7 @@ Result<NativeLoaderNamespace*> LibraryNamespaces::Create(JNIEnv* env, uint32_t t
system_exposed_libraries = system_exposed_libraries + ':' + llndk_libraries_product();
// Different name is useful for debugging
- namespace_name = kVendorClassloaderNamespaceName;
+ namespace_name = kProductClassloaderNamespaceName;
}
}
diff --git a/libnativeloader/native_loader_test.cpp b/libnativeloader/native_loader_test.cpp
index 7bf4cb754a..3825614545 100644
--- a/libnativeloader/native_loader_test.cpp
+++ b/libnativeloader/native_loader_test.cpp
@@ -378,7 +378,7 @@ TEST_P(NativeLoaderTest_Create, UnbundledProductApp) {
is_shared = false;
if (is_product_vndk_version_defined()) {
- expected_namespace_name = "vendor-classloader-namespace";
+ expected_namespace_name = "product-classloader-namespace";
expected_library_path = expected_library_path + ":/product/" LIB_DIR ":/system/product/" LIB_DIR;
expected_permitted_path =
expected_permitted_path + ":/product/" LIB_DIR ":/system/product/" LIB_DIR;