From 651f8383e66a32741d78f485c714ced345db7b3d Mon Sep 17 00:00:00 2001 From: Vijay Venkatraman Date: Wed, 25 Jan 2017 18:52:17 +0000 Subject: [PATCH] Revert "Revert "Exporting C headers from system/core"" This reverts commit a3f2be2b73cebb057218db2a19e8fad04ecb88f6. Test: compile Change-Id: I04b3a8e47e1fa3eb9d80c14ae3a90c68a780e858 --- include/cutils | 1 + include/log | 1 + include/log/logd.h | 1 - include/log/logger.h | 1 - include/private/android_logger.h | 195 +----------------- libcutils/Android.bp | 21 ++ .../cutils/android_get_control_file.h | 0 .../include}/cutils/android_reboot.h | 0 .../include}/cutils/ashmem.h | 0 .../include}/cutils/atomic.h | 0 .../include}/cutils/bitops.h | 0 .../include}/cutils/compiler.h | 0 .../include}/cutils/config_utils.h | 0 {include => libcutils/include}/cutils/fs.h | 0 .../include}/cutils/hashmap.h | 0 .../include}/cutils/iosched_policy.h | 0 .../include}/cutils/jstring.h | 0 {include => libcutils/include}/cutils/klog.h | 0 {include => libcutils/include}/cutils/list.h | 0 {include => libcutils/include}/cutils/log.h | 0 .../include}/cutils/memory.h | 0 {include => libcutils/include}/cutils/misc.h | 0 .../include}/cutils/multiuser.h | 0 .../include}/cutils/native_handle.h | 0 .../include}/cutils/open_memstream.h | 0 .../include}/cutils/partition_utils.h | 0 .../include}/cutils/properties.h | 0 .../include}/cutils/qtaguid.h | 0 .../include}/cutils/record_stream.h | 0 .../include}/cutils/sched_policy.h | 0 .../include}/cutils/sockets.h | 0 .../include}/cutils/str_parms.h | 0 .../include}/cutils/threads.h | 0 {include => libcutils/include}/cutils/trace.h | 0 .../include}/cutils/uevent.h | 0 .../cutils/android_get_control_file.h | 1 + .../include_vndk/cutils/android_reboot.h | 1 + libcutils/include_vndk/cutils/ashmem.h | 1 + libcutils/include_vndk/cutils/atomic.h | 1 + libcutils/include_vndk/cutils/bitops.h | 1 + libcutils/include_vndk/cutils/compiler.h | 1 + libcutils/include_vndk/cutils/config_utils.h | 1 + libcutils/include_vndk/cutils/fs.h | 1 + libcutils/include_vndk/cutils/hashmap.h | 1 + .../include_vndk/cutils/iosched_policy.h | 1 + libcutils/include_vndk/cutils/jstring.h | 1 + libcutils/include_vndk/cutils/klog.h | 1 + libcutils/include_vndk/cutils/list.h | 1 + libcutils/include_vndk/cutils/log.h | 21 ++ libcutils/include_vndk/cutils/memory.h | 1 + libcutils/include_vndk/cutils/misc.h | 1 + libcutils/include_vndk/cutils/multiuser.h | 1 + libcutils/include_vndk/cutils/native_handle.h | 1 + .../include_vndk/cutils/open_memstream.h | 1 + .../include_vndk/cutils/partition_utils.h | 1 + libcutils/include_vndk/cutils/properties.h | 1 + libcutils/include_vndk/cutils/qtaguid.h | 1 + libcutils/include_vndk/cutils/record_stream.h | 1 + libcutils/include_vndk/cutils/sched_policy.h | 1 + libcutils/include_vndk/cutils/sockets.h | 1 + libcutils/include_vndk/cutils/str_parms.h | 1 + libcutils/include_vndk/cutils/threads.h | 1 + libcutils/include_vndk/cutils/trace.h | 1 + libcutils/include_vndk/cutils/uevent.h | 1 + liblog/Android.bp | 7 + .../include}/log/event_tag_map.h | 0 {include => liblog/include}/log/log.h | 0 .../include}/log/log_event_list.h | 0 liblog/include/log/logd.h | 5 + liblog/include/log/logger.h | 5 + {include => liblog/include}/log/logprint.h | 0 {include => liblog/include}/log/uio.h | 0 liblog/include/private/android_logger.h | 194 +++++++++++++++++ liblog/include_vndk/android | 1 + liblog/include_vndk/log/log.h | 22 ++ 75 files changed, 307 insertions(+), 196 deletions(-) create mode 120000 include/cutils create mode 120000 include/log delete mode 100644 include/log/logd.h delete mode 100644 include/log/logger.h mode change 100644 => 120000 include/private/android_logger.h rename {include => libcutils/include}/cutils/android_get_control_file.h (100%) rename {include => libcutils/include}/cutils/android_reboot.h (100%) rename {include => libcutils/include}/cutils/ashmem.h (100%) rename {include => libcutils/include}/cutils/atomic.h (100%) rename {include => libcutils/include}/cutils/bitops.h (100%) rename {include => libcutils/include}/cutils/compiler.h (100%) rename {include => libcutils/include}/cutils/config_utils.h (100%) rename {include => libcutils/include}/cutils/fs.h (100%) rename {include => libcutils/include}/cutils/hashmap.h (100%) rename {include => libcutils/include}/cutils/iosched_policy.h (100%) rename {include => libcutils/include}/cutils/jstring.h (100%) rename {include => libcutils/include}/cutils/klog.h (100%) rename {include => libcutils/include}/cutils/list.h (100%) rename {include => libcutils/include}/cutils/log.h (100%) rename {include => libcutils/include}/cutils/memory.h (100%) rename {include => libcutils/include}/cutils/misc.h (100%) rename {include => libcutils/include}/cutils/multiuser.h (100%) rename {include => libcutils/include}/cutils/native_handle.h (100%) rename {include => libcutils/include}/cutils/open_memstream.h (100%) rename {include => libcutils/include}/cutils/partition_utils.h (100%) rename {include => libcutils/include}/cutils/properties.h (100%) rename {include => libcutils/include}/cutils/qtaguid.h (100%) rename {include => libcutils/include}/cutils/record_stream.h (100%) rename {include => libcutils/include}/cutils/sched_policy.h (100%) rename {include => libcutils/include}/cutils/sockets.h (100%) rename {include => libcutils/include}/cutils/str_parms.h (100%) rename {include => libcutils/include}/cutils/threads.h (100%) rename {include => libcutils/include}/cutils/trace.h (100%) rename {include => libcutils/include}/cutils/uevent.h (100%) create mode 120000 libcutils/include_vndk/cutils/android_get_control_file.h create mode 120000 libcutils/include_vndk/cutils/android_reboot.h create mode 120000 libcutils/include_vndk/cutils/ashmem.h create mode 120000 libcutils/include_vndk/cutils/atomic.h create mode 120000 libcutils/include_vndk/cutils/bitops.h create mode 120000 libcutils/include_vndk/cutils/compiler.h create mode 120000 libcutils/include_vndk/cutils/config_utils.h create mode 120000 libcutils/include_vndk/cutils/fs.h create mode 120000 libcutils/include_vndk/cutils/hashmap.h create mode 120000 libcutils/include_vndk/cutils/iosched_policy.h create mode 120000 libcutils/include_vndk/cutils/jstring.h create mode 120000 libcutils/include_vndk/cutils/klog.h create mode 120000 libcutils/include_vndk/cutils/list.h create mode 100644 libcutils/include_vndk/cutils/log.h create mode 120000 libcutils/include_vndk/cutils/memory.h create mode 120000 libcutils/include_vndk/cutils/misc.h create mode 120000 libcutils/include_vndk/cutils/multiuser.h create mode 120000 libcutils/include_vndk/cutils/native_handle.h create mode 120000 libcutils/include_vndk/cutils/open_memstream.h create mode 120000 libcutils/include_vndk/cutils/partition_utils.h create mode 120000 libcutils/include_vndk/cutils/properties.h create mode 120000 libcutils/include_vndk/cutils/qtaguid.h create mode 120000 libcutils/include_vndk/cutils/record_stream.h create mode 120000 libcutils/include_vndk/cutils/sched_policy.h create mode 120000 libcutils/include_vndk/cutils/sockets.h create mode 120000 libcutils/include_vndk/cutils/str_parms.h create mode 120000 libcutils/include_vndk/cutils/threads.h create mode 120000 libcutils/include_vndk/cutils/trace.h create mode 120000 libcutils/include_vndk/cutils/uevent.h rename {include => liblog/include}/log/event_tag_map.h (100%) rename {include => liblog/include}/log/log.h (100%) rename {include => liblog/include}/log/log_event_list.h (100%) create mode 100644 liblog/include/log/logd.h create mode 100644 liblog/include/log/logger.h rename {include => liblog/include}/log/logprint.h (100%) rename {include => liblog/include}/log/uio.h (100%) create mode 100644 liblog/include/private/android_logger.h create mode 120000 liblog/include_vndk/android create mode 100644 liblog/include_vndk/log/log.h diff --git a/include/cutils b/include/cutils new file mode 120000 index 000000000..ac2ed4004 --- /dev/null +++ b/include/cutils @@ -0,0 +1 @@ +../libcutils/include/cutils/ \ No newline at end of file diff --git a/include/log b/include/log new file mode 120000 index 000000000..714065f45 --- /dev/null +++ b/include/log @@ -0,0 +1 @@ +../liblog/include/log \ No newline at end of file diff --git a/include/log/logd.h b/include/log/logd.h deleted file mode 100644 index 0e0248e50..000000000 --- a/include/log/logd.h +++ /dev/null @@ -1 +0,0 @@ -#include diff --git a/include/log/logger.h b/include/log/logger.h deleted file mode 100644 index 0e0248e50..000000000 --- a/include/log/logger.h +++ /dev/null @@ -1 +0,0 @@ -#include diff --git a/include/private/android_logger.h b/include/private/android_logger.h deleted file mode 100644 index 9f81b1f06..000000000 --- a/include/private/android_logger.h +++ /dev/null @@ -1,194 +0,0 @@ -/* - * Copyright (C) 2015 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. - */ - -/* This file is used to define the internal protocol for the Android Logger */ - -#ifndef _SYSTEM_CORE_INCLUDE_PRIVATE_ANDROID_LOGGER_H_ -#define _SYSTEM_CORE_INCLUDE_PRIVATE_ANDROID_LOGGER_H_ - -/* Android private interfaces */ - -#include -#include -#include - -#if (defined(__cplusplus) && defined(_USING_LIBCXX)) -extern "C++" { -#include -} -#endif - -#include -#include - -#define LOGGER_MAGIC 'l' - -#if defined(__cplusplus) -extern "C" { -#endif - -/* Header Structure to pstore */ -typedef struct __attribute__((__packed__)) { - uint8_t magic; - uint16_t len; - uint16_t uid; - uint16_t pid; -} android_pmsg_log_header_t; - -/* Header Structure to logd, and second header for pstore */ -typedef struct __attribute__((__packed__)) { - typeof_log_id_t id; - uint16_t tid; - log_time realtime; -} android_log_header_t; - -/* Event Header Structure to logd */ -typedef struct __attribute__((__packed__)) { - int32_t tag; // Little Endian Order -} android_event_header_t; - -/* Event payload EVENT_TYPE_INT */ -typedef struct __attribute__((__packed__)) { - int8_t type; // EVENT_TYPE_INT - int32_t data; // Little Endian Order -} android_event_int_t; - -/* Event with single EVENT_TYPE_INT */ -typedef struct __attribute__((__packed__)) { - android_event_header_t header; - android_event_int_t payload; -} android_log_event_int_t; - -/* Event payload EVENT_TYPE_LONG */ -typedef struct __attribute__((__packed__)) { - int8_t type; // EVENT_TYPE_LONG - int64_t data; // Little Endian Order -} android_event_long_t; - -/* Event with single EVENT_TYPE_LONG */ -typedef struct __attribute__((__packed__)) { - android_event_header_t header; - android_event_long_t payload; -} android_log_event_long_t; - -/* - * Event payload EVENT_TYPE_STRING - * - * Danger: do not embed this structure into another structure. - * This structure uses a flexible array member, and when - * compiled using g++, __builtin_object_size(data, 1) returns - * a bad value. This is possibly a g++ bug, or a bug due to - * the fact that flexible array members are not supported - * in C++. - * http://stackoverflow.com/questions/4412749/are-flexible-array-members-valid-in-c - */ - -typedef struct __attribute__((__packed__)) { - int8_t type; // EVENT_TYPE_STRING; - int32_t length; // Little Endian Order - char data[]; -} android_event_string_t; - -/* Event with single EVENT_TYPE_STRING */ -typedef struct __attribute__((__packed__)) { - android_event_header_t header; - int8_t type; // EVENT_TYPE_STRING; - int32_t length; // Little Endian Order - char data[]; -} android_log_event_string_t; - -#define ANDROID_LOG_PMSG_FILE_MAX_SEQUENCE 256 /* 1MB file */ -#define ANDROID_LOG_PMSG_FILE_SEQUENCE 1000 - -ssize_t __android_log_pmsg_file_write( - log_id_t logId, - char prio, - const char* filename, - const char* buf, size_t len); - -#define LOG_ID_ANY ((log_id_t)-1) -#define ANDROID_LOG_ANY ANDROID_LOG_UNKNOWN - -/* first 5 arguments match __android_log_msg_file_write, a cast is safe */ -typedef ssize_t (*__android_log_pmsg_file_read_fn)( - log_id_t logId, - char prio, - const char* filename, - const char* buf, size_t len, void* arg); - -ssize_t __android_log_pmsg_file_read( - log_id_t logId, char prio, const char* prefix, - __android_log_pmsg_file_read_fn fn, void* arg); - -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 */ -#define BOOL_DEFAULT_FLAG_PERSIST 0x2 /* , persist., ro. */ -#define BOOL_DEFAULT_FLAG_ENG 0x4 /* off for user */ -#define BOOL_DEFAULT_FLAG_SVELTE 0x8 /* off for low_ram */ -bool __android_logger_property_get_bool(const char* key, int flag); - -#define LOG_BUFFER_SIZE (256 * 1024) /* Tuned with ro.logd.size per-platform */ -#define LOG_BUFFER_MIN_SIZE (64 * 1024UL) -#define LOG_BUFFER_MAX_SIZE (256 * 1024 * 1024UL) -unsigned long __android_logger_get_buffer_size(log_id_t logId); -bool __android_logger_valid_buffer_size(unsigned long value); - -/* Retrieve the composed event buffer */ -int android_log_write_list_buffer(android_log_context ctx, const char** msg); - -#ifdef __cplusplus -#ifdef __class_android_log_event_list_defined -#ifndef __class_android_log_event_list_private_defined -#define __class_android_log_event_list_private_defined -/* android_log_context C++ helpers */ -extern "C++" { -class __android_log_event_list : public android_log_event_list { - __android_log_event_list(const android_log_event_list&) = delete; - void operator =(const __android_log_event_list&) = delete; - -public: - explicit __android_log_event_list(int tag) : android_log_event_list(tag) { } - explicit __android_log_event_list(log_msg& log_msg) : android_log_event_list(log_msg) { } - -#if defined(_USING_LIBCXX) - operator std::string() { - if (ret) return std::string(""); - const char* cp = NULL; - ssize_t len = android_log_write_list_buffer(ctx, &cp); - if (len < 0) ret = len; - if (!cp || (len <= 0)) return std::string(""); - return std::string(cp, len); - } -#endif - -}; -} -#endif -#endif -#endif - -#if defined(__cplusplus) -} -#endif - -#endif /* _SYSTEM_CORE_INCLUDE_PRIVATE_ANDROID_LOGGER_H_ */ diff --git a/include/private/android_logger.h b/include/private/android_logger.h new file mode 120000 index 000000000..f187a6d22 --- /dev/null +++ b/include/private/android_logger.h @@ -0,0 +1 @@ +../../liblog/include/private/android_logger.h \ No newline at end of file diff --git a/libcutils/Android.bp b/libcutils/Android.bp index b96e3ae24..f6c0f0e01 100644 --- a/libcutils/Android.bp +++ b/libcutils/Android.bp @@ -30,6 +30,23 @@ libcutils_nonwindows_sources = [ "str_parms.c", ] +cc_library_headers { + name: "libcutils_vndk_headers", + host_supported: true, + export_include_dirs: ["include_vndk"], +} + +cc_library_headers { + name: "libcutils_headers", + host_supported: true, + export_include_dirs: ["include"], + target: { + windows: { + enabled: true, + }, + }, +} + cc_library { name: "libcutils", host_supported: true, @@ -51,6 +68,7 @@ cc_library { "threads.c", ], + target: { host: { srcs: ["dlmalloc_stubs.c"], @@ -117,6 +135,9 @@ cc_library { }, shared_libs: ["liblog"], + header_libs: ["libcutils_headers"], + export_header_lib_headers: ["libcutils_headers"], + product_variables: { cpusets: { cflags: ["-DUSE_CPUSETS"], diff --git a/include/cutils/android_get_control_file.h b/libcutils/include/cutils/android_get_control_file.h similarity index 100% rename from include/cutils/android_get_control_file.h rename to libcutils/include/cutils/android_get_control_file.h diff --git a/include/cutils/android_reboot.h b/libcutils/include/cutils/android_reboot.h similarity index 100% rename from include/cutils/android_reboot.h rename to libcutils/include/cutils/android_reboot.h diff --git a/include/cutils/ashmem.h b/libcutils/include/cutils/ashmem.h similarity index 100% rename from include/cutils/ashmem.h rename to libcutils/include/cutils/ashmem.h diff --git a/include/cutils/atomic.h b/libcutils/include/cutils/atomic.h similarity index 100% rename from include/cutils/atomic.h rename to libcutils/include/cutils/atomic.h diff --git a/include/cutils/bitops.h b/libcutils/include/cutils/bitops.h similarity index 100% rename from include/cutils/bitops.h rename to libcutils/include/cutils/bitops.h diff --git a/include/cutils/compiler.h b/libcutils/include/cutils/compiler.h similarity index 100% rename from include/cutils/compiler.h rename to libcutils/include/cutils/compiler.h diff --git a/include/cutils/config_utils.h b/libcutils/include/cutils/config_utils.h similarity index 100% rename from include/cutils/config_utils.h rename to libcutils/include/cutils/config_utils.h diff --git a/include/cutils/fs.h b/libcutils/include/cutils/fs.h similarity index 100% rename from include/cutils/fs.h rename to libcutils/include/cutils/fs.h diff --git a/include/cutils/hashmap.h b/libcutils/include/cutils/hashmap.h similarity index 100% rename from include/cutils/hashmap.h rename to libcutils/include/cutils/hashmap.h diff --git a/include/cutils/iosched_policy.h b/libcutils/include/cutils/iosched_policy.h similarity index 100% rename from include/cutils/iosched_policy.h rename to libcutils/include/cutils/iosched_policy.h diff --git a/include/cutils/jstring.h b/libcutils/include/cutils/jstring.h similarity index 100% rename from include/cutils/jstring.h rename to libcutils/include/cutils/jstring.h diff --git a/include/cutils/klog.h b/libcutils/include/cutils/klog.h similarity index 100% rename from include/cutils/klog.h rename to libcutils/include/cutils/klog.h diff --git a/include/cutils/list.h b/libcutils/include/cutils/list.h similarity index 100% rename from include/cutils/list.h rename to libcutils/include/cutils/list.h diff --git a/include/cutils/log.h b/libcutils/include/cutils/log.h similarity index 100% rename from include/cutils/log.h rename to libcutils/include/cutils/log.h diff --git a/include/cutils/memory.h b/libcutils/include/cutils/memory.h similarity index 100% rename from include/cutils/memory.h rename to libcutils/include/cutils/memory.h diff --git a/include/cutils/misc.h b/libcutils/include/cutils/misc.h similarity index 100% rename from include/cutils/misc.h rename to libcutils/include/cutils/misc.h diff --git a/include/cutils/multiuser.h b/libcutils/include/cutils/multiuser.h similarity index 100% rename from include/cutils/multiuser.h rename to libcutils/include/cutils/multiuser.h diff --git a/include/cutils/native_handle.h b/libcutils/include/cutils/native_handle.h similarity index 100% rename from include/cutils/native_handle.h rename to libcutils/include/cutils/native_handle.h diff --git a/include/cutils/open_memstream.h b/libcutils/include/cutils/open_memstream.h similarity index 100% rename from include/cutils/open_memstream.h rename to libcutils/include/cutils/open_memstream.h diff --git a/include/cutils/partition_utils.h b/libcutils/include/cutils/partition_utils.h similarity index 100% rename from include/cutils/partition_utils.h rename to libcutils/include/cutils/partition_utils.h diff --git a/include/cutils/properties.h b/libcutils/include/cutils/properties.h similarity index 100% rename from include/cutils/properties.h rename to libcutils/include/cutils/properties.h diff --git a/include/cutils/qtaguid.h b/libcutils/include/cutils/qtaguid.h similarity index 100% rename from include/cutils/qtaguid.h rename to libcutils/include/cutils/qtaguid.h diff --git a/include/cutils/record_stream.h b/libcutils/include/cutils/record_stream.h similarity index 100% rename from include/cutils/record_stream.h rename to libcutils/include/cutils/record_stream.h diff --git a/include/cutils/sched_policy.h b/libcutils/include/cutils/sched_policy.h similarity index 100% rename from include/cutils/sched_policy.h rename to libcutils/include/cutils/sched_policy.h diff --git a/include/cutils/sockets.h b/libcutils/include/cutils/sockets.h similarity index 100% rename from include/cutils/sockets.h rename to libcutils/include/cutils/sockets.h diff --git a/include/cutils/str_parms.h b/libcutils/include/cutils/str_parms.h similarity index 100% rename from include/cutils/str_parms.h rename to libcutils/include/cutils/str_parms.h diff --git a/include/cutils/threads.h b/libcutils/include/cutils/threads.h similarity index 100% rename from include/cutils/threads.h rename to libcutils/include/cutils/threads.h diff --git a/include/cutils/trace.h b/libcutils/include/cutils/trace.h similarity index 100% rename from include/cutils/trace.h rename to libcutils/include/cutils/trace.h diff --git a/include/cutils/uevent.h b/libcutils/include/cutils/uevent.h similarity index 100% rename from include/cutils/uevent.h rename to libcutils/include/cutils/uevent.h diff --git a/libcutils/include_vndk/cutils/android_get_control_file.h b/libcutils/include_vndk/cutils/android_get_control_file.h new file mode 120000 index 000000000..70d6a3b0b --- /dev/null +++ b/libcutils/include_vndk/cutils/android_get_control_file.h @@ -0,0 +1 @@ +../../include/cutils/android_get_control_file.h \ No newline at end of file diff --git a/libcutils/include_vndk/cutils/android_reboot.h b/libcutils/include_vndk/cutils/android_reboot.h new file mode 120000 index 000000000..9e1bf4cc4 --- /dev/null +++ b/libcutils/include_vndk/cutils/android_reboot.h @@ -0,0 +1 @@ +../../include/cutils/android_reboot.h \ No newline at end of file diff --git a/libcutils/include_vndk/cutils/ashmem.h b/libcutils/include_vndk/cutils/ashmem.h new file mode 120000 index 000000000..5c07beb06 --- /dev/null +++ b/libcutils/include_vndk/cutils/ashmem.h @@ -0,0 +1 @@ +../../include/cutils/ashmem.h \ No newline at end of file diff --git a/libcutils/include_vndk/cutils/atomic.h b/libcutils/include_vndk/cutils/atomic.h new file mode 120000 index 000000000..f4f14fe7d --- /dev/null +++ b/libcutils/include_vndk/cutils/atomic.h @@ -0,0 +1 @@ +../../include/cutils/atomic.h \ No newline at end of file diff --git a/libcutils/include_vndk/cutils/bitops.h b/libcutils/include_vndk/cutils/bitops.h new file mode 120000 index 000000000..edbd60c04 --- /dev/null +++ b/libcutils/include_vndk/cutils/bitops.h @@ -0,0 +1 @@ +../../include/cutils/bitops.h \ No newline at end of file diff --git a/libcutils/include_vndk/cutils/compiler.h b/libcutils/include_vndk/cutils/compiler.h new file mode 120000 index 000000000..08ebc103e --- /dev/null +++ b/libcutils/include_vndk/cutils/compiler.h @@ -0,0 +1 @@ +../../include/cutils/compiler.h \ No newline at end of file diff --git a/libcutils/include_vndk/cutils/config_utils.h b/libcutils/include_vndk/cutils/config_utils.h new file mode 120000 index 000000000..e011738d7 --- /dev/null +++ b/libcutils/include_vndk/cutils/config_utils.h @@ -0,0 +1 @@ +../../include/cutils/config_utils.h \ No newline at end of file diff --git a/libcutils/include_vndk/cutils/fs.h b/libcutils/include_vndk/cutils/fs.h new file mode 120000 index 000000000..576bfa3a4 --- /dev/null +++ b/libcutils/include_vndk/cutils/fs.h @@ -0,0 +1 @@ +../../include/cutils/fs.h \ No newline at end of file diff --git a/libcutils/include_vndk/cutils/hashmap.h b/libcutils/include_vndk/cutils/hashmap.h new file mode 120000 index 000000000..6b18406ae --- /dev/null +++ b/libcutils/include_vndk/cutils/hashmap.h @@ -0,0 +1 @@ +../../include/cutils/hashmap.h \ No newline at end of file diff --git a/libcutils/include_vndk/cutils/iosched_policy.h b/libcutils/include_vndk/cutils/iosched_policy.h new file mode 120000 index 000000000..26cf33323 --- /dev/null +++ b/libcutils/include_vndk/cutils/iosched_policy.h @@ -0,0 +1 @@ +../../include/cutils/iosched_policy.h \ No newline at end of file diff --git a/libcutils/include_vndk/cutils/jstring.h b/libcutils/include_vndk/cutils/jstring.h new file mode 120000 index 000000000..f3fd546ab --- /dev/null +++ b/libcutils/include_vndk/cutils/jstring.h @@ -0,0 +1 @@ +../../include/cutils/jstring.h \ No newline at end of file diff --git a/libcutils/include_vndk/cutils/klog.h b/libcutils/include_vndk/cutils/klog.h new file mode 120000 index 000000000..8ca85ff65 --- /dev/null +++ b/libcutils/include_vndk/cutils/klog.h @@ -0,0 +1 @@ +../../include/cutils/klog.h \ No newline at end of file diff --git a/libcutils/include_vndk/cutils/list.h b/libcutils/include_vndk/cutils/list.h new file mode 120000 index 000000000..9fa4c90f3 --- /dev/null +++ b/libcutils/include_vndk/cutils/list.h @@ -0,0 +1 @@ +../../include/cutils/list.h \ No newline at end of file diff --git a/libcutils/include_vndk/cutils/log.h b/libcutils/include_vndk/cutils/log.h new file mode 100644 index 000000000..ae74024a3 --- /dev/null +++ b/libcutils/include_vndk/cutils/log.h @@ -0,0 +1,21 @@ +/*Special log.h file for VNDK linking modules*/ +/* + * Copyright (C) 2005-2017 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. +*/ +#ifndef _LIBS_CUTIL_LOG_H +#define _LIBS_CUTIL_LOG_H +#warning "Deprecated: don't include cutils/log.h, use either android/log.h or log/log.h" +#include +#endif /* _LIBS_CUTIL_LOG_H */ diff --git a/libcutils/include_vndk/cutils/memory.h b/libcutils/include_vndk/cutils/memory.h new file mode 120000 index 000000000..e0e7abcb6 --- /dev/null +++ b/libcutils/include_vndk/cutils/memory.h @@ -0,0 +1 @@ +../../include/cutils/memory.h \ No newline at end of file diff --git a/libcutils/include_vndk/cutils/misc.h b/libcutils/include_vndk/cutils/misc.h new file mode 120000 index 000000000..db09eb59e --- /dev/null +++ b/libcutils/include_vndk/cutils/misc.h @@ -0,0 +1 @@ +../../include/cutils/misc.h \ No newline at end of file diff --git a/libcutils/include_vndk/cutils/multiuser.h b/libcutils/include_vndk/cutils/multiuser.h new file mode 120000 index 000000000..524111f1c --- /dev/null +++ b/libcutils/include_vndk/cutils/multiuser.h @@ -0,0 +1 @@ +../../include/cutils/multiuser.h \ No newline at end of file diff --git a/libcutils/include_vndk/cutils/native_handle.h b/libcutils/include_vndk/cutils/native_handle.h new file mode 120000 index 000000000..e324d4e75 --- /dev/null +++ b/libcutils/include_vndk/cutils/native_handle.h @@ -0,0 +1 @@ +../../include/cutils/native_handle.h \ No newline at end of file diff --git a/libcutils/include_vndk/cutils/open_memstream.h b/libcutils/include_vndk/cutils/open_memstream.h new file mode 120000 index 000000000..c89408490 --- /dev/null +++ b/libcutils/include_vndk/cutils/open_memstream.h @@ -0,0 +1 @@ +../../include/cutils/open_memstream.h \ No newline at end of file diff --git a/libcutils/include_vndk/cutils/partition_utils.h b/libcutils/include_vndk/cutils/partition_utils.h new file mode 120000 index 000000000..d9734c8ef --- /dev/null +++ b/libcutils/include_vndk/cutils/partition_utils.h @@ -0,0 +1 @@ +../../include/cutils/partition_utils.h \ No newline at end of file diff --git a/libcutils/include_vndk/cutils/properties.h b/libcutils/include_vndk/cutils/properties.h new file mode 120000 index 000000000..d56118e67 --- /dev/null +++ b/libcutils/include_vndk/cutils/properties.h @@ -0,0 +1 @@ +../../include/cutils/properties.h \ No newline at end of file diff --git a/libcutils/include_vndk/cutils/qtaguid.h b/libcutils/include_vndk/cutils/qtaguid.h new file mode 120000 index 000000000..bc02441a6 --- /dev/null +++ b/libcutils/include_vndk/cutils/qtaguid.h @@ -0,0 +1 @@ +../../include/cutils/qtaguid.h \ No newline at end of file diff --git a/libcutils/include_vndk/cutils/record_stream.h b/libcutils/include_vndk/cutils/record_stream.h new file mode 120000 index 000000000..8de649456 --- /dev/null +++ b/libcutils/include_vndk/cutils/record_stream.h @@ -0,0 +1 @@ +../../include/cutils/record_stream.h \ No newline at end of file diff --git a/libcutils/include_vndk/cutils/sched_policy.h b/libcutils/include_vndk/cutils/sched_policy.h new file mode 120000 index 000000000..ddebdd0f6 --- /dev/null +++ b/libcutils/include_vndk/cutils/sched_policy.h @@ -0,0 +1 @@ +../../include/cutils/sched_policy.h \ No newline at end of file diff --git a/libcutils/include_vndk/cutils/sockets.h b/libcutils/include_vndk/cutils/sockets.h new file mode 120000 index 000000000..585250c31 --- /dev/null +++ b/libcutils/include_vndk/cutils/sockets.h @@ -0,0 +1 @@ +../../include/cutils/sockets.h \ No newline at end of file diff --git a/libcutils/include_vndk/cutils/str_parms.h b/libcutils/include_vndk/cutils/str_parms.h new file mode 120000 index 000000000..9c79a8f88 --- /dev/null +++ b/libcutils/include_vndk/cutils/str_parms.h @@ -0,0 +1 @@ +../../include/cutils/str_parms.h \ No newline at end of file diff --git a/libcutils/include_vndk/cutils/threads.h b/libcutils/include_vndk/cutils/threads.h new file mode 120000 index 000000000..99330ffad --- /dev/null +++ b/libcutils/include_vndk/cutils/threads.h @@ -0,0 +1 @@ +../../include/cutils/threads.h \ No newline at end of file diff --git a/libcutils/include_vndk/cutils/trace.h b/libcutils/include_vndk/cutils/trace.h new file mode 120000 index 000000000..b12e14073 --- /dev/null +++ b/libcutils/include_vndk/cutils/trace.h @@ -0,0 +1 @@ +../../include/cutils/trace.h \ No newline at end of file diff --git a/libcutils/include_vndk/cutils/uevent.h b/libcutils/include_vndk/cutils/uevent.h new file mode 120000 index 000000000..451283a0f --- /dev/null +++ b/libcutils/include_vndk/cutils/uevent.h @@ -0,0 +1 @@ +../../include/cutils/uevent.h \ No newline at end of file diff --git a/liblog/Android.bp b/liblog/Android.bp index 40cdcee11..dce316d6d 100644 --- a/liblog/Android.bp +++ b/liblog/Android.bp @@ -79,6 +79,8 @@ cc_library { }, }, + export_include_dirs: ["include"], + cflags: [ "-Werror", "-fvisibility=hidden", @@ -111,6 +113,11 @@ ndk_headers { license: "NOTICE", } +cc_library_headers { + name: "liblog_vndk_headers", + export_include_dirs: ["include_vndk"], +} + ndk_library { name: "liblog.ndk", symbol_file: "liblog.map.txt", diff --git a/include/log/event_tag_map.h b/liblog/include/log/event_tag_map.h similarity index 100% rename from include/log/event_tag_map.h rename to liblog/include/log/event_tag_map.h diff --git a/include/log/log.h b/liblog/include/log/log.h similarity index 100% rename from include/log/log.h rename to liblog/include/log/log.h diff --git a/include/log/log_event_list.h b/liblog/include/log/log_event_list.h similarity index 100% rename from include/log/log_event_list.h rename to liblog/include/log/log_event_list.h diff --git a/liblog/include/log/logd.h b/liblog/include/log/logd.h new file mode 100644 index 000000000..77400cad3 --- /dev/null +++ b/liblog/include/log/logd.h @@ -0,0 +1,5 @@ +#ifndef _LIBS_LOG_LOGD_H +#define _LIBS_LOG_LOGD_H +#include +#warning "Deprecated: do not include log/logd.h, use log/log.h instead" +#endif /*_LIBS_LOG_LOGD_H*/ diff --git a/liblog/include/log/logger.h b/liblog/include/log/logger.h new file mode 100644 index 000000000..1bf2d1746 --- /dev/null +++ b/liblog/include/log/logger.h @@ -0,0 +1,5 @@ +#ifndef _LIBS_LOG_LOGGER_H +#define _LIBS_LOG_LOGGER_H +#include +#warning "Deprecated: do not include log/logger.h, use log/log.h instead" +#endif /*_LIBS_LOG_LOGGER_H*/ diff --git a/include/log/logprint.h b/liblog/include/log/logprint.h similarity index 100% rename from include/log/logprint.h rename to liblog/include/log/logprint.h diff --git a/include/log/uio.h b/liblog/include/log/uio.h similarity index 100% rename from include/log/uio.h rename to liblog/include/log/uio.h diff --git a/liblog/include/private/android_logger.h b/liblog/include/private/android_logger.h new file mode 100644 index 000000000..9f81b1f06 --- /dev/null +++ b/liblog/include/private/android_logger.h @@ -0,0 +1,194 @@ +/* + * Copyright (C) 2015 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. + */ + +/* This file is used to define the internal protocol for the Android Logger */ + +#ifndef _SYSTEM_CORE_INCLUDE_PRIVATE_ANDROID_LOGGER_H_ +#define _SYSTEM_CORE_INCLUDE_PRIVATE_ANDROID_LOGGER_H_ + +/* Android private interfaces */ + +#include +#include +#include + +#if (defined(__cplusplus) && defined(_USING_LIBCXX)) +extern "C++" { +#include +} +#endif + +#include +#include + +#define LOGGER_MAGIC 'l' + +#if defined(__cplusplus) +extern "C" { +#endif + +/* Header Structure to pstore */ +typedef struct __attribute__((__packed__)) { + uint8_t magic; + uint16_t len; + uint16_t uid; + uint16_t pid; +} android_pmsg_log_header_t; + +/* Header Structure to logd, and second header for pstore */ +typedef struct __attribute__((__packed__)) { + typeof_log_id_t id; + uint16_t tid; + log_time realtime; +} android_log_header_t; + +/* Event Header Structure to logd */ +typedef struct __attribute__((__packed__)) { + int32_t tag; // Little Endian Order +} android_event_header_t; + +/* Event payload EVENT_TYPE_INT */ +typedef struct __attribute__((__packed__)) { + int8_t type; // EVENT_TYPE_INT + int32_t data; // Little Endian Order +} android_event_int_t; + +/* Event with single EVENT_TYPE_INT */ +typedef struct __attribute__((__packed__)) { + android_event_header_t header; + android_event_int_t payload; +} android_log_event_int_t; + +/* Event payload EVENT_TYPE_LONG */ +typedef struct __attribute__((__packed__)) { + int8_t type; // EVENT_TYPE_LONG + int64_t data; // Little Endian Order +} android_event_long_t; + +/* Event with single EVENT_TYPE_LONG */ +typedef struct __attribute__((__packed__)) { + android_event_header_t header; + android_event_long_t payload; +} android_log_event_long_t; + +/* + * Event payload EVENT_TYPE_STRING + * + * Danger: do not embed this structure into another structure. + * This structure uses a flexible array member, and when + * compiled using g++, __builtin_object_size(data, 1) returns + * a bad value. This is possibly a g++ bug, or a bug due to + * the fact that flexible array members are not supported + * in C++. + * http://stackoverflow.com/questions/4412749/are-flexible-array-members-valid-in-c + */ + +typedef struct __attribute__((__packed__)) { + int8_t type; // EVENT_TYPE_STRING; + int32_t length; // Little Endian Order + char data[]; +} android_event_string_t; + +/* Event with single EVENT_TYPE_STRING */ +typedef struct __attribute__((__packed__)) { + android_event_header_t header; + int8_t type; // EVENT_TYPE_STRING; + int32_t length; // Little Endian Order + char data[]; +} android_log_event_string_t; + +#define ANDROID_LOG_PMSG_FILE_MAX_SEQUENCE 256 /* 1MB file */ +#define ANDROID_LOG_PMSG_FILE_SEQUENCE 1000 + +ssize_t __android_log_pmsg_file_write( + log_id_t logId, + char prio, + const char* filename, + const char* buf, size_t len); + +#define LOG_ID_ANY ((log_id_t)-1) +#define ANDROID_LOG_ANY ANDROID_LOG_UNKNOWN + +/* first 5 arguments match __android_log_msg_file_write, a cast is safe */ +typedef ssize_t (*__android_log_pmsg_file_read_fn)( + log_id_t logId, + char prio, + const char* filename, + const char* buf, size_t len, void* arg); + +ssize_t __android_log_pmsg_file_read( + log_id_t logId, char prio, const char* prefix, + __android_log_pmsg_file_read_fn fn, void* arg); + +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 */ +#define BOOL_DEFAULT_FLAG_PERSIST 0x2 /* , persist., ro. */ +#define BOOL_DEFAULT_FLAG_ENG 0x4 /* off for user */ +#define BOOL_DEFAULT_FLAG_SVELTE 0x8 /* off for low_ram */ +bool __android_logger_property_get_bool(const char* key, int flag); + +#define LOG_BUFFER_SIZE (256 * 1024) /* Tuned with ro.logd.size per-platform */ +#define LOG_BUFFER_MIN_SIZE (64 * 1024UL) +#define LOG_BUFFER_MAX_SIZE (256 * 1024 * 1024UL) +unsigned long __android_logger_get_buffer_size(log_id_t logId); +bool __android_logger_valid_buffer_size(unsigned long value); + +/* Retrieve the composed event buffer */ +int android_log_write_list_buffer(android_log_context ctx, const char** msg); + +#ifdef __cplusplus +#ifdef __class_android_log_event_list_defined +#ifndef __class_android_log_event_list_private_defined +#define __class_android_log_event_list_private_defined +/* android_log_context C++ helpers */ +extern "C++" { +class __android_log_event_list : public android_log_event_list { + __android_log_event_list(const android_log_event_list&) = delete; + void operator =(const __android_log_event_list&) = delete; + +public: + explicit __android_log_event_list(int tag) : android_log_event_list(tag) { } + explicit __android_log_event_list(log_msg& log_msg) : android_log_event_list(log_msg) { } + +#if defined(_USING_LIBCXX) + operator std::string() { + if (ret) return std::string(""); + const char* cp = NULL; + ssize_t len = android_log_write_list_buffer(ctx, &cp); + if (len < 0) ret = len; + if (!cp || (len <= 0)) return std::string(""); + return std::string(cp, len); + } +#endif + +}; +} +#endif +#endif +#endif + +#if defined(__cplusplus) +} +#endif + +#endif /* _SYSTEM_CORE_INCLUDE_PRIVATE_ANDROID_LOGGER_H_ */ diff --git a/liblog/include_vndk/android b/liblog/include_vndk/android new file mode 120000 index 000000000..69fbc0947 --- /dev/null +++ b/liblog/include_vndk/android @@ -0,0 +1 @@ +../../include/android/ \ No newline at end of file diff --git a/liblog/include_vndk/log/log.h b/liblog/include_vndk/log/log.h new file mode 100644 index 000000000..f3eb3fe14 --- /dev/null +++ b/liblog/include_vndk/log/log.h @@ -0,0 +1,22 @@ +/*Special log.h file for VNDK linking modules*/ + +#ifndef _LIBS_LOG_LOG_H +#define _LIBS_LOG_LOG_H + +#include + +/*The following files will be included once they are available*/ +/*#include */ +/*#include */ + +/* + * LOG_TAG is the local tag used for the following simplified + * logging macros. You can change this preprocessor definition + * before using the other macros to change the tag. + */ + +#ifndef LOG_TAG +#define LOG_TAG NULL +#endif + +#endif /*_LIBS_LOG_LOG_H*/