diff options
| -rw-r--r-- | libnativeloader/Android.bp | 77 | ||||
| -rw-r--r-- | libnativeloader/open_system_library.cpp | 55 |
2 files changed, 34 insertions, 98 deletions
diff --git a/libnativeloader/Android.bp b/libnativeloader/Android.bp index e9c26c592c..9d8fdb153c 100644 --- a/libnativeloader/Android.bp +++ b/libnativeloader/Android.bp @@ -9,6 +9,28 @@ package { default_applicable_licenses: ["art_license"], } +cc_library_headers { + name: "libnativeloader-headers", + defaults: ["art_defaults"], + apex_available: [ + "//apex_available:platform", + "com.android.art", + "com.android.art.debug", + "com.android.media", + ], + visibility: [ + "//art:__subpackages__", + // TODO(b/133140750): Clean this up. + "//frameworks/av/media/libstagefright", + "//frameworks/native/libs/graphicsenv", + "//frameworks/native/vulkan/libvulkan", + ], + host_supported: true, + export_include_dirs: ["include"], + header_libs: ["jni_headers"], + export_header_lib_headers: ["jni_headers"], +} + cc_defaults { name: "libnativeloader-defaults", defaults: ["art_defaults"], @@ -75,6 +97,9 @@ art_cc_library { }, } +// Wrapper that loads nativeloader.so lazily, to be used to deal with layer +// inversion in places like in early boot where libnativeloader and/or +// libnativebridge aren't available. // TODO(b/124250621) eliminate the need for this library cc_library { name: "libnativeloader_lazy", @@ -95,33 +120,14 @@ cc_library { shared_libs: ["liblog"], } -cc_library_headers { - name: "libnativeloader-headers", - defaults: ["art_defaults"], - apex_available: [ - "//apex_available:platform", - "com.android.art", - "com.android.art.debug", - "com.android.media", - ], - visibility: [ - "//art:__subpackages__", - // TODO(b/133140750): Clean this up. - "//frameworks/av/media/libstagefright", - "//frameworks/native/libs/graphicsenv", - "//frameworks/native/vulkan/libvulkan", - ], - host_supported: true, - export_include_dirs: ["include"], - header_libs: ["jni_headers"], - export_header_lib_headers: ["jni_headers"], -} - cc_defaults { name: "libnativeloader-test-defaults", defaults: [ "art_module_source_build_defaults", - "art_test_defaults", + // Cannot use art_standalone_gtest_defaults because it makes us link + // libnativebridge statically through libart-gtest, but we need to mock + // its symbols here. + "art_standalone_test_defaults", ], host_supported: false, @@ -145,13 +151,16 @@ cc_defaults { "libbase", ], + test_for: [ + "com.android.art", + "com.android.art.debug", + ], test_suites: ["device-tests"], } art_cc_test { name: "libnativeloader_test", defaults: [ - "art_standalone_test_defaults", "libnativeloader-test-defaults", ], tidy_timeout_srcs: [ @@ -161,30 +170,12 @@ art_cc_test { "library_namespaces_test.cpp", "native_loader_api_test.c", "native_loader_test.cpp", - "open_system_library.cpp", - ], - static_libs: [ - "libbase", - "libnativeloader", ], shared_libs: [ - "liblog", + "libnativeloader", ], - target: { - android: { - static_libs: [ - "libPlatformProperties", - ], - }, - }, - - // Added to CTS for API coverage of libnativeloader which is backed by the - // ART module. - test_config_template: ":art-gtests-target-standalone-cts-template", test_suites: [ - "cts", "mts-art", - "mcts-art", ], } diff --git a/libnativeloader/open_system_library.cpp b/libnativeloader/open_system_library.cpp deleted file mode 100644 index 63175aa91f..0000000000 --- a/libnativeloader/open_system_library.cpp +++ /dev/null @@ -1,55 +0,0 @@ -/* - * Copyright (C) 2014 The Android Open Source Project - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#define LOG_TAG "nativeloader_test" - -#include <dlfcn.h> -#include <log/log.h> - -#ifdef ART_TARGET_ANDROID -#include "nativeloader/dlext_namespaces.h" -#endif - -namespace android { - -extern "C" { - -// TODO(b/268440756): Find a way to reuse it from libnativebridge. -void* OpenSystemLibrary(const char* path, int flags) { -#ifdef ART_TARGET_ANDROID - // The system namespace is called "default" for binaries in /system and - // "system" for those in the Runtime APEX. Try "system" first since - // "default" always exists. - // TODO(b/185587109): Get rid of this error prone logic. - android_namespace_t* system_ns = android_get_exported_namespace("system"); - if (system_ns == nullptr) { - system_ns = android_get_exported_namespace("default"); - const char* message = "Failed to get system namespace for loading %s"; - LOG_ALWAYS_FATAL_IF(system_ns == nullptr, message, path); - } - const android_dlextinfo dlextinfo = { - .flags = ANDROID_DLEXT_USE_NAMESPACE, - .library_namespace = system_ns, - }; - return android_dlopen_ext(path, flags, &dlextinfo); -#else - return dlopen(path, flags); -#endif -} - -} // extern "C" - -} // namespace android |