From 95b6f45b0e09b45daf6a7999cef039fabf587327 Mon Sep 17 00:00:00 2001 From: Jiyong Park Date: Mon, 9 Mar 2020 14:35:57 +0900 Subject: [PATCH] don't include liblog to APEXes liblog is a platform library that provides stable C API. There is no need to include the library, especialy by statically linking to it, in any APEX. It not only wastes the storage/ram, but also is incorrect because the socket interface to logd which is implemented in liblog is not guaranteed to be stable. Fixing this issue by converting static_libs: ["liblog"] into shared_libs: ["liblog"], in which case the dependency to the library is satisfied via the stub variant of the library. As a result, we could restrict the availablity of the library to the platform and the runtime APEX. Exempt-From-Owner-Approval: already approved when this was in internal master (ag/10572699) Bug: http://b/151051671 Bug: http://b/150827719 Test: m Change-Id: I5aab863cb12b8767b6979255c247000a59355b0e --- adb/Android.bp | 2 +- liblog/Android.bp | 6 +++++- libstats/push_compat/Android.bp | 2 ++ 3 files changed, 8 insertions(+), 2 deletions(-) diff --git a/adb/Android.bp b/adb/Android.bp index 139ee2347..abd6f32c6 100644 --- a/adb/Android.bp +++ b/adb/Android.bp @@ -589,7 +589,6 @@ cc_binary { "libcrypto_utils", "libcutils_sockets", "libdiagnose_usb", - "liblog", "libmdnssd", "libminijail", "libprotobuf-cpp-lite", @@ -603,6 +602,7 @@ cc_binary { "libadbd_auth", "libadbd_fs", "libcrypto", + "liblog", ], target: { diff --git a/liblog/Android.bp b/liblog/Android.bp index 50faa2a3d..0b98e1add 100644 --- a/liblog/Android.bp +++ b/liblog/Android.bp @@ -121,8 +121,12 @@ cc_library { logtags: ["event.logtags"], compile_multilib: "both", apex_available: [ - "//apex_available:anyapex", "//apex_available:platform", + // liblog is exceptionally available to the runtime APEX + // because the dynamic linker has to use it statically. + // See b/151051671 + "com.android.runtime", + // DO NOT add more apex names here ], } diff --git a/libstats/push_compat/Android.bp b/libstats/push_compat/Android.bp index 465c05a37..fcd8c8363 100644 --- a/libstats/push_compat/Android.bp +++ b/libstats/push_compat/Android.bp @@ -35,6 +35,8 @@ cc_defaults { header_libs: ["libstatssocket_headers"], static_libs: [ "libbase", + ], + shared_libs: [ "liblog", "libutils", ],