From 1f83aa424f537cf3f07e1d27dbbcc524818b5358 Mon Sep 17 00:00:00 2001 From: Steven Moreland Date: Thu, 13 Apr 2017 23:48:57 -0700 Subject: [PATCH] libcutils: compile with BOARD_VNDK_VERSION current - moved __android_log_is_debuggable to a new public header (log_properties.h) - vendor version of sched_policy uses ALOG* instead SLOG* Test: (sanity) liblog-unit-tests Test: (sanity) libcutils_test (noting b/b/32972117, two tests continue to fail) Test: system/core as a whole makes with BOARD_VNDK_VERSION := current now with no problems. Test: boots/works on internal marlin Bug: 33241851 Change-Id: I5bc1f348dc0f0c8814bec5b5c3d2c52c825ab640 --- adb/daemon/main.cpp | 2 +- adb/services.cpp | 2 +- adb/set_verity_enable_state_service.cpp | 2 +- adb/sockets.cpp | 2 +- fs_mgr/fs_mgr.cpp | 2 +- libcutils/Android.bp | 5 +++- libcutils/sched_policy.cpp | 7 +++++ libcutils/trace-dev.c | 3 +- liblog/event_tag_map.cpp | 1 + liblog/include/log/log_properties.h | 35 ++++++++++++++++++++++++ liblog/include/private/android_logger.h | 2 -- liblog/include_vndk/log/log_properties.h | 1 + liblog/liblog.map.txt | 1 + liblog/pmsg_writer.c | 1 + liblog/properties.c | 2 +- logd/LogTags.cpp | 2 +- 16 files changed, 59 insertions(+), 11 deletions(-) create mode 100644 liblog/include/log/log_properties.h create mode 120000 liblog/include_vndk/log/log_properties.h diff --git a/adb/daemon/main.cpp b/adb/daemon/main.cpp index 7da94ce10..7a87df461 100644 --- a/adb/daemon/main.cpp +++ b/adb/daemon/main.cpp @@ -32,10 +32,10 @@ #include #include #include +#include #include #include -#include #include "debuggerd/handler.h" #include "selinux/android.h" diff --git a/adb/services.cpp b/adb/services.cpp index 47f0a03d7..c9ea0395a 100644 --- a/adb/services.cpp +++ b/adb/services.cpp @@ -41,7 +41,7 @@ #include #include #include -#include +#include #endif #include "adb.h" diff --git a/adb/set_verity_enable_state_service.cpp b/adb/set_verity_enable_state_service.cpp index 76b156d66..d4dd25636 100644 --- a/adb/set_verity_enable_state_service.cpp +++ b/adb/set_verity_enable_state_service.cpp @@ -26,7 +26,7 @@ #include "android-base/properties.h" #include "android-base/stringprintf.h" -#include +#include #include "adb.h" #include "adb_io.h" diff --git a/adb/sockets.cpp b/adb/sockets.cpp index c05903f9e..59a48f56d 100644 --- a/adb/sockets.cpp +++ b/adb/sockets.cpp @@ -32,7 +32,7 @@ #if !ADB_HOST #include -#include +#include #endif #include "adb.h" diff --git a/fs_mgr/fs_mgr.cpp b/fs_mgr/fs_mgr.cpp index e635e531e..4ddcc52b2 100644 --- a/fs_mgr/fs_mgr.cpp +++ b/fs_mgr/fs_mgr.cpp @@ -48,8 +48,8 @@ #include #include #include +#include #include -#include // for __android_log_is_debuggable() #include "fs_mgr.h" #include "fs_mgr_avb.h" diff --git a/libcutils/Android.bp b/libcutils/Android.bp index f668f18e5..db1434b9f 100644 --- a/libcutils/Android.bp +++ b/libcutils/Android.bp @@ -144,7 +144,10 @@ cc_library { }, shared_libs: ["liblog"], - header_libs: ["libcutils_headers"], + header_libs: [ + "libcutils_headers", + "libutils_headers", + ], export_header_lib_headers: ["libcutils_headers"], cflags: [ diff --git a/libcutils/sched_policy.cpp b/libcutils/sched_policy.cpp index 73ca5180e..3837ca795 100644 --- a/libcutils/sched_policy.cpp +++ b/libcutils/sched_policy.cpp @@ -28,6 +28,13 @@ #define UNUSED __attribute__((__unused__)) +#ifndef SLOGE +#define SLOGE ALOGE +#endif +#ifndef SLOGW +#define SLOGW ALOGW +#endif + /* Re-map SP_DEFAULT to the system default policy, and leave other values unchanged. * Call this any place a SchedPolicy is used as an input parameter. * Returns the possibly re-mapped policy. diff --git a/libcutils/trace-dev.c b/libcutils/trace-dev.c index 113f423cb..d45e5a98e 100644 --- a/libcutils/trace-dev.c +++ b/libcutils/trace-dev.c @@ -29,7 +29,8 @@ #include #include #include -#include +#include +#include /** * Maximum size of a message that can be logged to the trace buffer. diff --git a/liblog/event_tag_map.cpp b/liblog/event_tag_map.cpp index bdad2c2e6..231f4d945 100644 --- a/liblog/event_tag_map.cpp +++ b/liblog/event_tag_map.cpp @@ -31,6 +31,7 @@ #include #include +#include #include #include #include diff --git a/liblog/include/log/log_properties.h b/liblog/include/log/log_properties.h new file mode 100644 index 000000000..7d398a6b4 --- /dev/null +++ b/liblog/include/log/log_properties.h @@ -0,0 +1,35 @@ +/* +** +** Copyright 2017, The Android Open Source Project +** +** This file is dual licensed. It may be redistributed and/or modified +** under the terms of the Apache 2.0 License OR version 2 of the GNU +** General Public License. +*/ + +#ifndef _LIBS_LOG_PROPERTIES_H +#define _LIBS_LOG_PROPERTIES_H + +#ifdef __cplusplus +extern "C" { +#endif + +#ifndef __ANDROID_USE_LIBLOG_IS_DEBUGGABLE_INTERFACE +#ifndef __ANDROID_API__ +#define __ANDROID_USE_LIBLOG_IS_DEBUGGABLE_INTERFACE 1 +#elif __ANDROID_API__ > 24 /* > Nougat */ +#define __ANDROID_USE_LIBLOG_IS_DEBUGGABLE_INTERFACE 1 +#else +#define __ANDROID_USE_LIBLOG_IS_DEBUGGABLE_INTERFACE 0 +#endif +#endif + +#if __ANDROID_USE_LIBLOG_IS_DEBUGGABLE_INTERFACE +int __android_log_is_debuggable(); +#endif + +#ifdef __cplusplus +} +#endif + +#endif /* _LIBS_LOG_PROPERTIES_H */ diff --git a/liblog/include/private/android_logger.h b/liblog/include/private/android_logger.h index e3ccfcff2..965de375c 100644 --- a/liblog/include/private/android_logger.h +++ b/liblog/include/private/android_logger.h @@ -135,8 +135,6 @@ int __android_log_security_bwrite(int32_t tag, const void* payload, size_t len); int __android_log_security_bswrite(int32_t tag, const char* payload); int __android_log_security(); /* Device Owner is present */ -int __android_log_is_debuggable(); - #define BOOL_DEFAULT_FLAG_TRUE_FALSE 0x1 #define BOOL_DEFAULT_FALSE 0x0 /* false if property not present */ #define BOOL_DEFAULT_TRUE 0x1 /* true if property not present */ diff --git a/liblog/include_vndk/log/log_properties.h b/liblog/include_vndk/log/log_properties.h new file mode 120000 index 000000000..bbec42614 --- /dev/null +++ b/liblog/include_vndk/log/log_properties.h @@ -0,0 +1 @@ +../../include/log/log_properties.h \ No newline at end of file diff --git a/liblog/liblog.map.txt b/liblog/liblog.map.txt index c00f2a08b..58fb1486f 100644 --- a/liblog/liblog.map.txt +++ b/liblog/liblog.map.txt @@ -39,4 +39,5 @@ LIBLOG_M { LIBLOG_O { global: __android_log_is_loggable_len; + __android_log_is_debuggable; # vndk }; diff --git a/liblog/pmsg_writer.c b/liblog/pmsg_writer.c index e71c176aa..dc428567f 100644 --- a/liblog/pmsg_writer.c +++ b/liblog/pmsg_writer.c @@ -26,6 +26,7 @@ #include #include +#include #include #include diff --git a/liblog/properties.c b/liblog/properties.c index adf19002e..c71cbcfc1 100644 --- a/liblog/properties.c +++ b/liblog/properties.c @@ -277,7 +277,7 @@ LIBLOG_ABI_PUBLIC int __android_log_is_loggable(int prio, const char* tag, return logLevel >= 0 && prio >= logLevel; } -LIBLOG_ABI_PRIVATE int __android_log_is_debuggable() { +LIBLOG_ABI_PUBLIC int __android_log_is_debuggable() { static uint32_t serial; static struct cache_char tag_cache; static const char key[] = "ro.debuggable"; diff --git a/logd/LogTags.cpp b/logd/LogTags.cpp index 67649b1e7..fcd45bd2b 100644 --- a/logd/LogTags.cpp +++ b/logd/LogTags.cpp @@ -32,8 +32,8 @@ #include #include #include +#include #include -#include #include "LogTags.h" #include "LogUtils.h"