Loading libnativeloader/Android.mk +9 −7 Original line number Diff line number Diff line LOCAL_PATH:= $(call my-dir) NATIVE_LOADER_COMMON_SRC_FILES := \ native_loader_common_src_files := \ native_loader.cpp native_loader_common_cflags := -Werror -Wall # Shared library for target # ======================================================== include $(CLEAR_VARS) LOCAL_MODULE:= libnativeloader LOCAL_SRC_FILES:= $(NATIVE_LOADER_COMMON_SRC_FILES) LOCAL_SRC_FILES:= $(native_loader_common_src_files) LOCAL_SHARED_LIBRARIES := libnativehelper liblog libcutils LOCAL_STATIC_LIBRARIES := libbase LOCAL_CLANG := true LOCAL_CFLAGS += -Werror -Wall LOCAL_CFLAGS := $(native_loader_common_cflags) LOCAL_CPPFLAGS := -std=gnu++14 -fvisibility=hidden LOCAL_LDFLAGS := -ldl LOCAL_MULTILIB := both Loading @@ -27,11 +29,11 @@ include $(CLEAR_VARS) LOCAL_MODULE:= libnativeloader LOCAL_SRC_FILES:= $(NATIVE_LOADER_COMMON_SRC_FILES) LOCAL_SRC_FILES:= $(native_loader_common_src_files) LOCAL_SHARED_LIBRARIES := libnativehelper liblog libcutils LOCAL_STATIC_LIBRARIES := libbase LOCAL_CLANG := true LOCAL_CFLAGS += -Werror -Wall LOCAL_CFLAGS := $(native_loader_common_cflags) LOCAL_CPPFLAGS := -std=gnu++14 -fvisibility=hidden LOCAL_LDFLAGS := -ldl LOCAL_MULTILIB := both Loading @@ -45,10 +47,10 @@ include $(CLEAR_VARS) LOCAL_MODULE:= libnativeloader LOCAL_SRC_FILES:= $(NATIVE_LOADER_COMMON_SRC_FILES) LOCAL_SRC_FILES:= $(native_loader_common_src_files) LOCAL_STATIC_LIBRARIES := libnativehelper libcutils liblog libbase LOCAL_CLANG := true LOCAL_CFLAGS += -Werror -Wall LOCAL_CFLAGS := $(native_loader_common_cflags) LOCAL_CPPFLAGS := -std=gnu++14 -fvisibility=hidden LOCAL_LDFLAGS := -ldl LOCAL_MULTILIB := both Loading libnativeloader/native_loader.cpp +19 −0 Original line number Diff line number Diff line Loading @@ -40,6 +40,12 @@ namespace android { static constexpr const char* kPublicNativeLibrariesSystemConfigPathFromRoot = "/etc/public.libraries.txt"; static constexpr const char* kPublicNativeLibrariesVendorConfig = "/vendor/etc/public.libraries.txt"; static bool is_debuggable() { char debuggable[PROP_VALUE_MAX]; property_get("ro.debuggable", debuggable, "0"); return std::string(debuggable) == "1"; } class LibraryNamespaces { public: LibraryNamespaces() : initialized_(false) { } Loading Loading @@ -113,6 +119,19 @@ class LibraryNamespaces { LOG_ALWAYS_FATAL_IF(!ReadConfig(public_native_libraries_system_config, &sonames), "Error reading public native library list from \"%s\": %s", public_native_libraries_system_config.c_str(), strerror(errno)); // For debuggable platform builds use ANDROID_ADDITIONAL_PUBLIC_LIBRARIES environment // variable to add libraries to the list. This is intended for platform tests only. if (is_debuggable()) { const char* additional_libs = getenv("ANDROID_ADDITIONAL_PUBLIC_LIBRARIES"); if (additional_libs != nullptr && additional_libs[0] != '\0') { std::vector<std::string> additional_libs_vector = base::Split(additional_libs, ":"); std::copy(additional_libs_vector.begin(), additional_libs_vector.end(), std::back_inserter(sonames)); } } // This file is optional, quietly ignore if the file does not exist. ReadConfig(kPublicNativeLibrariesVendorConfig, &sonames); Loading Loading
libnativeloader/Android.mk +9 −7 Original line number Diff line number Diff line LOCAL_PATH:= $(call my-dir) NATIVE_LOADER_COMMON_SRC_FILES := \ native_loader_common_src_files := \ native_loader.cpp native_loader_common_cflags := -Werror -Wall # Shared library for target # ======================================================== include $(CLEAR_VARS) LOCAL_MODULE:= libnativeloader LOCAL_SRC_FILES:= $(NATIVE_LOADER_COMMON_SRC_FILES) LOCAL_SRC_FILES:= $(native_loader_common_src_files) LOCAL_SHARED_LIBRARIES := libnativehelper liblog libcutils LOCAL_STATIC_LIBRARIES := libbase LOCAL_CLANG := true LOCAL_CFLAGS += -Werror -Wall LOCAL_CFLAGS := $(native_loader_common_cflags) LOCAL_CPPFLAGS := -std=gnu++14 -fvisibility=hidden LOCAL_LDFLAGS := -ldl LOCAL_MULTILIB := both Loading @@ -27,11 +29,11 @@ include $(CLEAR_VARS) LOCAL_MODULE:= libnativeloader LOCAL_SRC_FILES:= $(NATIVE_LOADER_COMMON_SRC_FILES) LOCAL_SRC_FILES:= $(native_loader_common_src_files) LOCAL_SHARED_LIBRARIES := libnativehelper liblog libcutils LOCAL_STATIC_LIBRARIES := libbase LOCAL_CLANG := true LOCAL_CFLAGS += -Werror -Wall LOCAL_CFLAGS := $(native_loader_common_cflags) LOCAL_CPPFLAGS := -std=gnu++14 -fvisibility=hidden LOCAL_LDFLAGS := -ldl LOCAL_MULTILIB := both Loading @@ -45,10 +47,10 @@ include $(CLEAR_VARS) LOCAL_MODULE:= libnativeloader LOCAL_SRC_FILES:= $(NATIVE_LOADER_COMMON_SRC_FILES) LOCAL_SRC_FILES:= $(native_loader_common_src_files) LOCAL_STATIC_LIBRARIES := libnativehelper libcutils liblog libbase LOCAL_CLANG := true LOCAL_CFLAGS += -Werror -Wall LOCAL_CFLAGS := $(native_loader_common_cflags) LOCAL_CPPFLAGS := -std=gnu++14 -fvisibility=hidden LOCAL_LDFLAGS := -ldl LOCAL_MULTILIB := both Loading
libnativeloader/native_loader.cpp +19 −0 Original line number Diff line number Diff line Loading @@ -40,6 +40,12 @@ namespace android { static constexpr const char* kPublicNativeLibrariesSystemConfigPathFromRoot = "/etc/public.libraries.txt"; static constexpr const char* kPublicNativeLibrariesVendorConfig = "/vendor/etc/public.libraries.txt"; static bool is_debuggable() { char debuggable[PROP_VALUE_MAX]; property_get("ro.debuggable", debuggable, "0"); return std::string(debuggable) == "1"; } class LibraryNamespaces { public: LibraryNamespaces() : initialized_(false) { } Loading Loading @@ -113,6 +119,19 @@ class LibraryNamespaces { LOG_ALWAYS_FATAL_IF(!ReadConfig(public_native_libraries_system_config, &sonames), "Error reading public native library list from \"%s\": %s", public_native_libraries_system_config.c_str(), strerror(errno)); // For debuggable platform builds use ANDROID_ADDITIONAL_PUBLIC_LIBRARIES environment // variable to add libraries to the list. This is intended for platform tests only. if (is_debuggable()) { const char* additional_libs = getenv("ANDROID_ADDITIONAL_PUBLIC_LIBRARIES"); if (additional_libs != nullptr && additional_libs[0] != '\0') { std::vector<std::string> additional_libs_vector = base::Split(additional_libs, ":"); std::copy(additional_libs_vector.begin(), additional_libs_vector.end(), std::back_inserter(sonames)); } } // This file is optional, quietly ignore if the file does not exist. ReadConfig(kPublicNativeLibrariesVendorConfig, &sonames); Loading