Loading libnativeloader/library_namespaces.cpp +5 −5 Original line number Diff line number Diff line Loading @@ -44,7 +44,7 @@ namespace { // vendor and system namespaces. constexpr const char* kVendorNamespaceName = "sphal"; constexpr const char* kVndkNamespaceName = "vndk"; constexpr const char* kRuntimeNamespaceName = "runtime"; constexpr const char* kArtNamespaceName = "art"; constexpr const char* kNeuralNetworksNamespaceName = "neuralnetworks"; // classloader-namespace is a linker namespace that is created for the loaded Loading Loading @@ -237,10 +237,10 @@ Result<NativeLoaderNamespace*> LibraryNamespaces::Create(JNIEnv* env, uint32_t t return linked.error(); } auto runtime_ns = NativeLoaderNamespace::GetExportedNamespace(kRuntimeNamespaceName, is_bridged); // Runtime apex does not exist in host, and under certain build conditions. if (runtime_ns) { linked = app_ns->Link(*runtime_ns, runtime_public_libraries()); auto art_ns = NativeLoaderNamespace::GetExportedNamespace(kArtNamespaceName, is_bridged); // ART APEX does not exist on host, and under certain build conditions. if (art_ns) { linked = app_ns->Link(*art_ns, art_public_libraries()); if (!linked) { return linked.error(); } Loading libnativeloader/native_loader.cpp +0 −4 Original line number Diff line number Diff line Loading @@ -63,10 +63,6 @@ android_namespace_t* FindExportedNamespace(const char* caller_location) { LOG_ALWAYS_FATAL_IF((dot_index == std::string::npos), "Error finding namespace of apex: no dot in apex name %s", caller_location); std::string name = location.substr(dot_index + 1, slash_index - dot_index - 1); // TODO(b/139408016): Rename the runtime namespace to "art". if (name == "art") { name = "runtime"; } android_namespace_t* boot_namespace = android_get_exported_namespace(name.c_str()); LOG_ALWAYS_FATAL_IF((boot_namespace == nullptr), "Error finding namespace of apex: no namespace called %s", name.c_str()); Loading libnativeloader/native_loader_test.cpp +6 −6 Original line number Diff line number Diff line Loading @@ -83,7 +83,7 @@ class Platform { static std::unordered_map<std::string, Platform::mock_namespace_handle> namespaces = { {"platform", TO_MOCK_NAMESPACE(TO_ANDROID_NAMESPACE("platform"))}, {"default", TO_MOCK_NAMESPACE(TO_ANDROID_NAMESPACE("default"))}, {"runtime", TO_MOCK_NAMESPACE(TO_ANDROID_NAMESPACE("runtime"))}, {"art", TO_MOCK_NAMESPACE(TO_ANDROID_NAMESPACE("art"))}, {"sphal", TO_MOCK_NAMESPACE(TO_ANDROID_NAMESPACE("sphal"))}, {"vndk", TO_MOCK_NAMESPACE(TO_ANDROID_NAMESPACE("vndk"))}, {"neuralnetworks", TO_MOCK_NAMESPACE(TO_ANDROID_NAMESPACE("neuralnetworks"))}, Loading Loading @@ -338,13 +338,13 @@ class NativeLoaderTest_Create : public NativeLoaderTest { std::string expected_permitted_path = std::string("/data:/mnt/expand:") + permitted_path; std::string expected_parent_namespace = "platform"; bool expected_link_with_platform_ns = true; bool expected_link_with_runtime_ns = true; bool expected_link_with_art_ns = true; bool expected_link_with_sphal_ns = !vendor_public_libraries().empty(); bool expected_link_with_vndk_ns = false; bool expected_link_with_default_ns = false; bool expected_link_with_neuralnetworks_ns = true; std::string expected_shared_libs_to_platform_ns = default_public_libraries(); std::string expected_shared_libs_to_runtime_ns = runtime_public_libraries(); std::string expected_shared_libs_to_art_ns = art_public_libraries(); std::string expected_shared_libs_to_sphal_ns = vendor_public_libraries(); std::string expected_shared_libs_to_vndk_ns = vndksp_libraries(); std::string expected_shared_libs_to_default_ns = default_public_libraries(); Loading @@ -368,9 +368,9 @@ class NativeLoaderTest_Create : public NativeLoaderTest { StrEq(expected_shared_libs_to_platform_ns))) .WillOnce(Return(true)); } if (expected_link_with_runtime_ns) { EXPECT_CALL(*mock, mock_link_namespaces(Eq(IsBridged()), _, NsEq("runtime"), StrEq(expected_shared_libs_to_runtime_ns))) if (expected_link_with_art_ns) { EXPECT_CALL(*mock, mock_link_namespaces(Eq(IsBridged()), _, NsEq("art"), StrEq(expected_shared_libs_to_art_ns))) .WillOnce(Return(true)); } if (expected_link_with_sphal_ns) { Loading libnativeloader/public_libraries.cpp +3 −3 Original line number Diff line number Diff line Loading @@ -181,10 +181,10 @@ static std::string InitDefaultPublicLibraries(bool for_preload) { return android::base::Join(*sonames, ':'); } // Remove the public libs in the runtime namespace. // Remove the public libs in the art namespace. // These libs are listed in public.android.txt, but we don't want the rest of android // in default namespace to dlopen the libs. // For example, libicuuc.so is exposed to classloader namespace from runtime namespace. // For example, libicuuc.so is exposed to classloader namespace from art namespace. // Unfortunately, it does not have stable C symbols, and default namespace should only use // stable symbols in libandroidicu.so. http://b/120786417 for (const std::string& lib_name : kArtApexPublicLibraries) { Loading Loading @@ -281,7 +281,7 @@ const std::string& default_public_libraries() { return list; } const std::string& runtime_public_libraries() { const std::string& art_public_libraries() { static std::string list = InitArtPublicLibraries(); return list; } Loading libnativeloader/public_libraries.h +1 −1 Original line number Diff line number Diff line Loading @@ -29,7 +29,7 @@ using android::base::Result; // e.g., if it is a vendor app or not, different set of libraries are made available. const std::string& preloadable_public_libraries(); const std::string& default_public_libraries(); const std::string& runtime_public_libraries(); const std::string& art_public_libraries(); const std::string& vendor_public_libraries(); const std::string& extended_public_libraries(); const std::string& neuralnetworks_public_libraries(); Loading Loading
libnativeloader/library_namespaces.cpp +5 −5 Original line number Diff line number Diff line Loading @@ -44,7 +44,7 @@ namespace { // vendor and system namespaces. constexpr const char* kVendorNamespaceName = "sphal"; constexpr const char* kVndkNamespaceName = "vndk"; constexpr const char* kRuntimeNamespaceName = "runtime"; constexpr const char* kArtNamespaceName = "art"; constexpr const char* kNeuralNetworksNamespaceName = "neuralnetworks"; // classloader-namespace is a linker namespace that is created for the loaded Loading Loading @@ -237,10 +237,10 @@ Result<NativeLoaderNamespace*> LibraryNamespaces::Create(JNIEnv* env, uint32_t t return linked.error(); } auto runtime_ns = NativeLoaderNamespace::GetExportedNamespace(kRuntimeNamespaceName, is_bridged); // Runtime apex does not exist in host, and under certain build conditions. if (runtime_ns) { linked = app_ns->Link(*runtime_ns, runtime_public_libraries()); auto art_ns = NativeLoaderNamespace::GetExportedNamespace(kArtNamespaceName, is_bridged); // ART APEX does not exist on host, and under certain build conditions. if (art_ns) { linked = app_ns->Link(*art_ns, art_public_libraries()); if (!linked) { return linked.error(); } Loading
libnativeloader/native_loader.cpp +0 −4 Original line number Diff line number Diff line Loading @@ -63,10 +63,6 @@ android_namespace_t* FindExportedNamespace(const char* caller_location) { LOG_ALWAYS_FATAL_IF((dot_index == std::string::npos), "Error finding namespace of apex: no dot in apex name %s", caller_location); std::string name = location.substr(dot_index + 1, slash_index - dot_index - 1); // TODO(b/139408016): Rename the runtime namespace to "art". if (name == "art") { name = "runtime"; } android_namespace_t* boot_namespace = android_get_exported_namespace(name.c_str()); LOG_ALWAYS_FATAL_IF((boot_namespace == nullptr), "Error finding namespace of apex: no namespace called %s", name.c_str()); Loading
libnativeloader/native_loader_test.cpp +6 −6 Original line number Diff line number Diff line Loading @@ -83,7 +83,7 @@ class Platform { static std::unordered_map<std::string, Platform::mock_namespace_handle> namespaces = { {"platform", TO_MOCK_NAMESPACE(TO_ANDROID_NAMESPACE("platform"))}, {"default", TO_MOCK_NAMESPACE(TO_ANDROID_NAMESPACE("default"))}, {"runtime", TO_MOCK_NAMESPACE(TO_ANDROID_NAMESPACE("runtime"))}, {"art", TO_MOCK_NAMESPACE(TO_ANDROID_NAMESPACE("art"))}, {"sphal", TO_MOCK_NAMESPACE(TO_ANDROID_NAMESPACE("sphal"))}, {"vndk", TO_MOCK_NAMESPACE(TO_ANDROID_NAMESPACE("vndk"))}, {"neuralnetworks", TO_MOCK_NAMESPACE(TO_ANDROID_NAMESPACE("neuralnetworks"))}, Loading Loading @@ -338,13 +338,13 @@ class NativeLoaderTest_Create : public NativeLoaderTest { std::string expected_permitted_path = std::string("/data:/mnt/expand:") + permitted_path; std::string expected_parent_namespace = "platform"; bool expected_link_with_platform_ns = true; bool expected_link_with_runtime_ns = true; bool expected_link_with_art_ns = true; bool expected_link_with_sphal_ns = !vendor_public_libraries().empty(); bool expected_link_with_vndk_ns = false; bool expected_link_with_default_ns = false; bool expected_link_with_neuralnetworks_ns = true; std::string expected_shared_libs_to_platform_ns = default_public_libraries(); std::string expected_shared_libs_to_runtime_ns = runtime_public_libraries(); std::string expected_shared_libs_to_art_ns = art_public_libraries(); std::string expected_shared_libs_to_sphal_ns = vendor_public_libraries(); std::string expected_shared_libs_to_vndk_ns = vndksp_libraries(); std::string expected_shared_libs_to_default_ns = default_public_libraries(); Loading @@ -368,9 +368,9 @@ class NativeLoaderTest_Create : public NativeLoaderTest { StrEq(expected_shared_libs_to_platform_ns))) .WillOnce(Return(true)); } if (expected_link_with_runtime_ns) { EXPECT_CALL(*mock, mock_link_namespaces(Eq(IsBridged()), _, NsEq("runtime"), StrEq(expected_shared_libs_to_runtime_ns))) if (expected_link_with_art_ns) { EXPECT_CALL(*mock, mock_link_namespaces(Eq(IsBridged()), _, NsEq("art"), StrEq(expected_shared_libs_to_art_ns))) .WillOnce(Return(true)); } if (expected_link_with_sphal_ns) { Loading
libnativeloader/public_libraries.cpp +3 −3 Original line number Diff line number Diff line Loading @@ -181,10 +181,10 @@ static std::string InitDefaultPublicLibraries(bool for_preload) { return android::base::Join(*sonames, ':'); } // Remove the public libs in the runtime namespace. // Remove the public libs in the art namespace. // These libs are listed in public.android.txt, but we don't want the rest of android // in default namespace to dlopen the libs. // For example, libicuuc.so is exposed to classloader namespace from runtime namespace. // For example, libicuuc.so is exposed to classloader namespace from art namespace. // Unfortunately, it does not have stable C symbols, and default namespace should only use // stable symbols in libandroidicu.so. http://b/120786417 for (const std::string& lib_name : kArtApexPublicLibraries) { Loading Loading @@ -281,7 +281,7 @@ const std::string& default_public_libraries() { return list; } const std::string& runtime_public_libraries() { const std::string& art_public_libraries() { static std::string list = InitArtPublicLibraries(); return list; } Loading
libnativeloader/public_libraries.h +1 −1 Original line number Diff line number Diff line Loading @@ -29,7 +29,7 @@ using android::base::Result; // e.g., if it is a vendor app or not, different set of libraries are made available. const std::string& preloadable_public_libraries(); const std::string& default_public_libraries(); const std::string& runtime_public_libraries(); const std::string& art_public_libraries(); const std::string& vendor_public_libraries(); const std::string& extended_public_libraries(); const std::string& neuralnetworks_public_libraries(); Loading