diff options
author | Jiyong Park <jiyong@google.com> | 2020-03-03 16:12:36 +0900 |
---|---|---|
committer | Jiyong Park <jiyong@google.com> | 2020-03-10 10:08:26 +0900 |
commit | 5280b5c03ee1dc4bc60a579626190dcbcbd9849a (patch) | |
tree | 585151ca3373e52a172e4443c95a01f78bd98a0b | |
parent | 7a287d075129bbe058f8df666ead2a0e5c5c5c2b (diff) |
libbase uses liblog symbols via dlsym when it is built for APEX
libbase is a popular library that is used by many APEXes either directly
or transitively. It is being used by several Mainline modules that were
launched with Q, in which case everything in the APEX - including
libbase - shouldn't use new APIs that are added post Q, i.e. R.
libbase however is using a few new R symbols from liblog, and this is
preventing those Q-launching Mainline modules that are built in R source
tree from being installed to Q devices.
Fortunately, the dependencies to the new R symbols are guarded with a
flag; when the existence of the symbols are not guaranteed, it uses
dlsym. This change fixes the aforementioned problem by turning on the
flag also when libbase is built for an APEX.
Bug: 149569129
Test: TARGET_BUILD_APPS=com.android.media
vendor/google/build/build_mainline_modules.sh
adb install --staged out/dist/mainline_modules_arm64/com.android.media.apex
adb reboot
The APEX is installed and mediaextractor process doesn't crash
Change-Id: I44b5ec028850613cb45fc3e792f43cd8e87cfd00
-rw-r--r-- | base/liblog_symbols.cpp | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/base/liblog_symbols.cpp b/base/liblog_symbols.cpp index d5dfcd28b..8d5917907 100644 --- a/base/liblog_symbols.cpp +++ b/base/liblog_symbols.cpp @@ -16,14 +16,20 @@ #include "liblog_symbols.h" -#if defined(__ANDROID__) && !defined(NO_LIBLOG_DLSYM) +#if defined(__ANDROID__) +#if !defined(NO_LIBLOG_DLSYM) || defined(__ANDROID_APEX__) +#define USE_DLSYM +#endif +#endif + +#ifdef USE_DLSYM #include <dlfcn.h> #endif namespace android { namespace base { -#if defined(__ANDROID__) && !defined(NO_LIBLOG_DLSYM) +#ifdef USE_DLSYM const std::optional<LibLogFunctions>& GetLibLogFunctions() { static std::optional<LibLogFunctions> liblog_functions = []() -> std::optional<LibLogFunctions> { |