diff options
75 files changed, 307 insertions, 196 deletions
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 @@ | |||
1 | #include <log/log.h> | ||
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 @@ | |||
1 | #include <log/log.h> | ||
diff --git a/include/private/android_logger.h b/include/private/android_logger.h index 9f81b1f06..f187a6d22 100644..120000 --- a/include/private/android_logger.h +++ b/include/private/android_logger.h | |||
@@ -1,194 +1 @@ | |||
1 | /* | ../../liblog/include/private/android_logger.h \ No newline at end of file | |
2 | * Copyright (C) 2015 The Android Open Source Project | ||
3 | * | ||
4 | * Licensed under the Apache License, Version 2.0 (the "License"); | ||
5 | * you may not use this file except in compliance with the License. | ||
6 | * You may obtain a copy of the License at | ||
7 | * | ||
8 | * http://www.apache.org/licenses/LICENSE-2.0 | ||
9 | * | ||
10 | * Unless required by applicable law or agreed to in writing, software | ||
11 | * distributed under the License is distributed on an "AS IS" BASIS, | ||
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
13 | * See the License for the specific language governing permissions and | ||
14 | * limitations under the License. | ||
15 | */ | ||
16 | |||
17 | /* This file is used to define the internal protocol for the Android Logger */ | ||
18 | |||
19 | #ifndef _SYSTEM_CORE_INCLUDE_PRIVATE_ANDROID_LOGGER_H_ | ||
20 | #define _SYSTEM_CORE_INCLUDE_PRIVATE_ANDROID_LOGGER_H_ | ||
21 | |||
22 | /* Android private interfaces */ | ||
23 | |||
24 | #include <stdbool.h> | ||
25 | #include <stdint.h> | ||
26 | #include <sys/types.h> | ||
27 | |||
28 | #if (defined(__cplusplus) && defined(_USING_LIBCXX)) | ||
29 | extern "C++" { | ||
30 | #include <string> | ||
31 | } | ||
32 | #endif | ||
33 | |||
34 | #include <log/log_event_list.h> | ||
35 | #include <log/log.h> | ||
36 | |||
37 | #define LOGGER_MAGIC 'l' | ||
38 | |||
39 | #if defined(__cplusplus) | ||
40 | extern "C" { | ||
41 | #endif | ||
42 | |||
43 | /* Header Structure to pstore */ | ||
44 | typedef struct __attribute__((__packed__)) { | ||
45 | uint8_t magic; | ||
46 | uint16_t len; | ||
47 | uint16_t uid; | ||
48 | uint16_t pid; | ||
49 | } android_pmsg_log_header_t; | ||
50 | |||
51 | /* Header Structure to logd, and second header for pstore */ | ||
52 | typedef struct __attribute__((__packed__)) { | ||
53 | typeof_log_id_t id; | ||
54 | uint16_t tid; | ||
55 | log_time realtime; | ||
56 | } android_log_header_t; | ||
57 | |||
58 | /* Event Header Structure to logd */ | ||
59 | typedef struct __attribute__((__packed__)) { | ||
60 | int32_t tag; // Little Endian Order | ||
61 | } android_event_header_t; | ||
62 | |||
63 | /* Event payload EVENT_TYPE_INT */ | ||
64 | typedef struct __attribute__((__packed__)) { | ||
65 | int8_t type; // EVENT_TYPE_INT | ||
66 | int32_t data; // Little Endian Order | ||
67 | } android_event_int_t; | ||
68 | |||
69 | /* Event with single EVENT_TYPE_INT */ | ||
70 | typedef struct __attribute__((__packed__)) { | ||
71 | android_event_header_t header; | ||
72 | android_event_int_t payload; | ||
73 | } android_log_event_int_t; | ||
74 | |||
75 | /* Event payload EVENT_TYPE_LONG */ | ||
76 | typedef struct __attribute__((__packed__)) { | ||
77 | int8_t type; // EVENT_TYPE_LONG | ||
78 | int64_t data; // Little Endian Order | ||
79 | } android_event_long_t; | ||
80 | |||
81 | /* Event with single EVENT_TYPE_LONG */ | ||
82 | typedef struct __attribute__((__packed__)) { | ||
83 | android_event_header_t header; | ||
84 | android_event_long_t payload; | ||
85 | } android_log_event_long_t; | ||
86 | |||
87 | /* | ||
88 | * Event payload EVENT_TYPE_STRING | ||
89 | * | ||
90 | * Danger: do not embed this structure into another structure. | ||
91 | * This structure uses a flexible array member, and when | ||
92 | * compiled using g++, __builtin_object_size(data, 1) returns | ||
93 | * a bad value. This is possibly a g++ bug, or a bug due to | ||
94 | * the fact that flexible array members are not supported | ||
95 | * in C++. | ||
96 | * http://stackoverflow.com/questions/4412749/are-flexible-array-members-valid-in-c | ||
97 | */ | ||
98 | |||
99 | typedef struct __attribute__((__packed__)) { | ||
100 | int8_t type; // EVENT_TYPE_STRING; | ||
101 | int32_t length; // Little Endian Order | ||
102 | char data[]; | ||
103 | } android_event_string_t; | ||
104 | |||
105 | /* Event with single EVENT_TYPE_STRING */ | ||
106 | typedef struct __attribute__((__packed__)) { | ||
107 | android_event_header_t header; | ||
108 | int8_t type; // EVENT_TYPE_STRING; | ||
109 | int32_t length; // Little Endian Order | ||
110 | char data[]; | ||
111 | } android_log_event_string_t; | ||
112 | |||
113 | #define ANDROID_LOG_PMSG_FILE_MAX_SEQUENCE 256 /* 1MB file */ | ||
114 | #define ANDROID_LOG_PMSG_FILE_SEQUENCE 1000 | ||
115 | |||
116 | ssize_t __android_log_pmsg_file_write( | ||
117 | log_id_t logId, | ||
118 | char prio, | ||
119 | const char* filename, | ||
120 | const char* buf, size_t len); | ||
121 | |||
122 | #define LOG_ID_ANY ((log_id_t)-1) | ||
123 | #define ANDROID_LOG_ANY ANDROID_LOG_UNKNOWN | ||
124 | |||
125 | /* first 5 arguments match __android_log_msg_file_write, a cast is safe */ | ||
126 | typedef ssize_t (*__android_log_pmsg_file_read_fn)( | ||
127 | log_id_t logId, | ||
128 | char prio, | ||
129 | const char* filename, | ||
130 | const char* buf, size_t len, void* arg); | ||
131 | |||
132 | ssize_t __android_log_pmsg_file_read( | ||
133 | log_id_t logId, char prio, const char* prefix, | ||
134 | __android_log_pmsg_file_read_fn fn, void* arg); | ||
135 | |||
136 | int __android_log_security_bwrite(int32_t tag, const void* payload, size_t len); | ||
137 | int __android_log_security_bswrite(int32_t tag, const char* payload); | ||
138 | int __android_log_security(); /* Device Owner is present */ | ||
139 | |||
140 | int __android_log_is_debuggable(); | ||
141 | |||
142 | #define BOOL_DEFAULT_FLAG_TRUE_FALSE 0x1 | ||
143 | #define BOOL_DEFAULT_FALSE 0x0 /* false if property not present */ | ||
144 | #define BOOL_DEFAULT_TRUE 0x1 /* true if property not present */ | ||
145 | #define BOOL_DEFAULT_FLAG_PERSIST 0x2 /* <key>, persist.<key>, ro.<key> */ | ||
146 | #define BOOL_DEFAULT_FLAG_ENG 0x4 /* off for user */ | ||
147 | #define BOOL_DEFAULT_FLAG_SVELTE 0x8 /* off for low_ram */ | ||
148 | bool __android_logger_property_get_bool(const char* key, int flag); | ||
149 | |||
150 | #define LOG_BUFFER_SIZE (256 * 1024) /* Tuned with ro.logd.size per-platform */ | ||
151 | #define LOG_BUFFER_MIN_SIZE (64 * 1024UL) | ||
152 | #define LOG_BUFFER_MAX_SIZE (256 * 1024 * 1024UL) | ||
153 | unsigned long __android_logger_get_buffer_size(log_id_t logId); | ||
154 | bool __android_logger_valid_buffer_size(unsigned long value); | ||
155 | |||
156 | /* Retrieve the composed event buffer */ | ||
157 | int android_log_write_list_buffer(android_log_context ctx, const char** msg); | ||
158 | |||
159 | #ifdef __cplusplus | ||
160 | #ifdef __class_android_log_event_list_defined | ||
161 | #ifndef __class_android_log_event_list_private_defined | ||
162 | #define __class_android_log_event_list_private_defined | ||
163 | /* android_log_context C++ helpers */ | ||
164 | extern "C++" { | ||
165 | class __android_log_event_list : public android_log_event_list { | ||
166 | __android_log_event_list(const android_log_event_list&) = delete; | ||
167 | void operator =(const __android_log_event_list&) = delete; | ||
168 | |||
169 | public: | ||
170 | explicit __android_log_event_list(int tag) : android_log_event_list(tag) { } | ||
171 | explicit __android_log_event_list(log_msg& log_msg) : android_log_event_list(log_msg) { } | ||
172 | |||
173 | #if defined(_USING_LIBCXX) | ||
174 | operator std::string() { | ||
175 | if (ret) return std::string(""); | ||
176 | const char* cp = NULL; | ||
177 | ssize_t len = android_log_write_list_buffer(ctx, &cp); | ||
178 | if (len < 0) ret = len; | ||
179 | if (!cp || (len <= 0)) return std::string(""); | ||
180 | return std::string(cp, len); | ||
181 | } | ||
182 | #endif | ||
183 | |||
184 | }; | ||
185 | } | ||
186 | #endif | ||
187 | #endif | ||
188 | #endif | ||
189 | |||
190 | #if defined(__cplusplus) | ||
191 | } | ||
192 | #endif | ||
193 | |||
194 | #endif /* _SYSTEM_CORE_INCLUDE_PRIVATE_ANDROID_LOGGER_H_ */ | ||
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 = [ | |||
30 | "str_parms.c", | 30 | "str_parms.c", |
31 | ] | 31 | ] |
32 | 32 | ||
33 | cc_library_headers { | ||
34 | name: "libcutils_vndk_headers", | ||
35 | host_supported: true, | ||
36 | export_include_dirs: ["include_vndk"], | ||
37 | } | ||
38 | |||
39 | cc_library_headers { | ||
40 | name: "libcutils_headers", | ||
41 | host_supported: true, | ||
42 | export_include_dirs: ["include"], | ||
43 | target: { | ||
44 | windows: { | ||
45 | enabled: true, | ||
46 | }, | ||
47 | }, | ||
48 | } | ||
49 | |||
33 | cc_library { | 50 | cc_library { |
34 | name: "libcutils", | 51 | name: "libcutils", |
35 | host_supported: true, | 52 | host_supported: true, |
@@ -51,6 +68,7 @@ cc_library { | |||
51 | "threads.c", | 68 | "threads.c", |
52 | ], | 69 | ], |
53 | 70 | ||
71 | |||
54 | target: { | 72 | target: { |
55 | host: { | 73 | host: { |
56 | srcs: ["dlmalloc_stubs.c"], | 74 | srcs: ["dlmalloc_stubs.c"], |
@@ -117,6 +135,9 @@ cc_library { | |||
117 | }, | 135 | }, |
118 | 136 | ||
119 | shared_libs: ["liblog"], | 137 | shared_libs: ["liblog"], |
138 | header_libs: ["libcutils_headers"], | ||
139 | export_header_lib_headers: ["libcutils_headers"], | ||
140 | |||
120 | product_variables: { | 141 | product_variables: { |
121 | cpusets: { | 142 | cpusets: { |
122 | cflags: ["-DUSE_CPUSETS"], | 143 | cflags: ["-DUSE_CPUSETS"], |
diff --git a/include/cutils/android_get_control_file.h b/libcutils/include/cutils/android_get_control_file.h index ed8fbf830..ed8fbf830 100644 --- a/include/cutils/android_get_control_file.h +++ b/libcutils/include/cutils/android_get_control_file.h | |||
diff --git a/include/cutils/android_reboot.h b/libcutils/include/cutils/android_reboot.h index a3861a02d..a3861a02d 100644 --- a/include/cutils/android_reboot.h +++ b/libcutils/include/cutils/android_reboot.h | |||
diff --git a/include/cutils/ashmem.h b/libcutils/include/cutils/ashmem.h index d80caa698..d80caa698 100644 --- a/include/cutils/ashmem.h +++ b/libcutils/include/cutils/ashmem.h | |||
diff --git a/include/cutils/atomic.h b/libcutils/include/cutils/atomic.h index 0c88bfedd..0c88bfedd 100644 --- a/include/cutils/atomic.h +++ b/libcutils/include/cutils/atomic.h | |||
diff --git a/include/cutils/bitops.h b/libcutils/include/cutils/bitops.h index 045830d90..045830d90 100644 --- a/include/cutils/bitops.h +++ b/libcutils/include/cutils/bitops.h | |||
diff --git a/include/cutils/compiler.h b/libcutils/include/cutils/compiler.h index 70f884a1e..70f884a1e 100644 --- a/include/cutils/compiler.h +++ b/libcutils/include/cutils/compiler.h | |||
diff --git a/include/cutils/config_utils.h b/libcutils/include/cutils/config_utils.h index 2dea6f19f..2dea6f19f 100644 --- a/include/cutils/config_utils.h +++ b/libcutils/include/cutils/config_utils.h | |||
diff --git a/include/cutils/fs.h b/libcutils/include/cutils/fs.h index a34ce8602..a34ce8602 100644 --- a/include/cutils/fs.h +++ b/libcutils/include/cutils/fs.h | |||
diff --git a/include/cutils/hashmap.h b/libcutils/include/cutils/hashmap.h index 5cb344c15..5cb344c15 100644 --- a/include/cutils/hashmap.h +++ b/libcutils/include/cutils/hashmap.h | |||
diff --git a/include/cutils/iosched_policy.h b/libcutils/include/cutils/iosched_policy.h index 07c5d1fca..07c5d1fca 100644 --- a/include/cutils/iosched_policy.h +++ b/libcutils/include/cutils/iosched_policy.h | |||
diff --git a/include/cutils/jstring.h b/libcutils/include/cutils/jstring.h index a3426081a..a3426081a 100644 --- a/include/cutils/jstring.h +++ b/libcutils/include/cutils/jstring.h | |||
diff --git a/include/cutils/klog.h b/libcutils/include/cutils/klog.h index e7cd30046..e7cd30046 100644 --- a/include/cutils/klog.h +++ b/libcutils/include/cutils/klog.h | |||
diff --git a/include/cutils/list.h b/libcutils/include/cutils/list.h index 4ba2cfd49..4ba2cfd49 100644 --- a/include/cutils/list.h +++ b/libcutils/include/cutils/list.h | |||
diff --git a/include/cutils/log.h b/libcutils/include/cutils/log.h index 0e0248e50..0e0248e50 100644 --- a/include/cutils/log.h +++ b/libcutils/include/cutils/log.h | |||
diff --git a/include/cutils/memory.h b/libcutils/include/cutils/memory.h index 4d2688255..4d2688255 100644 --- a/include/cutils/memory.h +++ b/libcutils/include/cutils/memory.h | |||
diff --git a/include/cutils/misc.h b/libcutils/include/cutils/misc.h index 0de505f27..0de505f27 100644 --- a/include/cutils/misc.h +++ b/libcutils/include/cutils/misc.h | |||
diff --git a/include/cutils/multiuser.h b/libcutils/include/cutils/multiuser.h index 5bd9c7b82..5bd9c7b82 100644 --- a/include/cutils/multiuser.h +++ b/libcutils/include/cutils/multiuser.h | |||
diff --git a/include/cutils/native_handle.h b/libcutils/include/cutils/native_handle.h index 7d6a98802..7d6a98802 100644 --- a/include/cutils/native_handle.h +++ b/libcutils/include/cutils/native_handle.h | |||
diff --git a/include/cutils/open_memstream.h b/libcutils/include/cutils/open_memstream.h index c1a81ebbc..c1a81ebbc 100644 --- a/include/cutils/open_memstream.h +++ b/libcutils/include/cutils/open_memstream.h | |||
diff --git a/include/cutils/partition_utils.h b/libcutils/include/cutils/partition_utils.h index 72ca80d35..72ca80d35 100644 --- a/include/cutils/partition_utils.h +++ b/libcutils/include/cutils/partition_utils.h | |||
diff --git a/include/cutils/properties.h b/libcutils/include/cutils/properties.h index adf670bf1..adf670bf1 100644 --- a/include/cutils/properties.h +++ b/libcutils/include/cutils/properties.h | |||
diff --git a/include/cutils/qtaguid.h b/libcutils/include/cutils/qtaguid.h index f8550fda8..f8550fda8 100644 --- a/include/cutils/qtaguid.h +++ b/libcutils/include/cutils/qtaguid.h | |||
diff --git a/include/cutils/record_stream.h b/libcutils/include/cutils/record_stream.h index bfac87a53..bfac87a53 100644 --- a/include/cutils/record_stream.h +++ b/libcutils/include/cutils/record_stream.h | |||
diff --git a/include/cutils/sched_policy.h b/libcutils/include/cutils/sched_policy.h index 591bd4478..591bd4478 100644 --- a/include/cutils/sched_policy.h +++ b/libcutils/include/cutils/sched_policy.h | |||
diff --git a/include/cutils/sockets.h b/libcutils/include/cutils/sockets.h index d724dd6a5..d724dd6a5 100644 --- a/include/cutils/sockets.h +++ b/libcutils/include/cutils/sockets.h | |||
diff --git a/include/cutils/str_parms.h b/libcutils/include/cutils/str_parms.h index aa1435a08..aa1435a08 100644 --- a/include/cutils/str_parms.h +++ b/libcutils/include/cutils/str_parms.h | |||
diff --git a/include/cutils/threads.h b/libcutils/include/cutils/threads.h index 572749407..572749407 100644 --- a/include/cutils/threads.h +++ b/libcutils/include/cutils/threads.h | |||
diff --git a/include/cutils/trace.h b/libcutils/include/cutils/trace.h index fcbdc9b79..fcbdc9b79 100644 --- a/include/cutils/trace.h +++ b/libcutils/include/cutils/trace.h | |||
diff --git a/include/cutils/uevent.h b/libcutils/include/cutils/uevent.h index da1c2aae6..da1c2aae6 100644 --- a/include/cutils/uevent.h +++ b/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 @@ | |||
1 | /*Special log.h file for VNDK linking modules*/ | ||
2 | /* | ||
3 | * Copyright (C) 2005-2017 The Android Open Source Project | ||
4 | * | ||
5 | * Licensed under the Apache License, Version 2.0 (the "License"); | ||
6 | * you may not use this file except in compliance with the License. | ||
7 | * You may obtain a copy of the License at | ||
8 | * | ||
9 | * http://www.apache.org/licenses/LICENSE-2.0 | ||
10 | * | ||
11 | * Unless required by applicable law or agreed to in writing, software | ||
12 | * distributed under the License is distributed on an "AS IS" BASIS, | ||
13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
14 | * See the License for the specific language governing permissions and | ||
15 | * limitations under the License. | ||
16 | */ | ||
17 | #ifndef _LIBS_CUTIL_LOG_H | ||
18 | #define _LIBS_CUTIL_LOG_H | ||
19 | #warning "Deprecated: don't include cutils/log.h, use either android/log.h or log/log.h" | ||
20 | #include <log/log.h> | ||
21 | #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 bbe7d793e..dd0a77816 100644 --- a/liblog/Android.bp +++ b/liblog/Android.bp | |||
@@ -79,6 +79,8 @@ cc_library { | |||
79 | }, | 79 | }, |
80 | }, | 80 | }, |
81 | 81 | ||
82 | export_include_dirs: ["include"], | ||
83 | |||
82 | cflags: [ | 84 | cflags: [ |
83 | "-Werror", | 85 | "-Werror", |
84 | "-fvisibility=hidden", | 86 | "-fvisibility=hidden", |
@@ -111,6 +113,11 @@ ndk_headers { | |||
111 | license: "NOTICE", | 113 | license: "NOTICE", |
112 | } | 114 | } |
113 | 115 | ||
116 | cc_library_headers { | ||
117 | name: "liblog_vndk_headers", | ||
118 | export_include_dirs: ["include_vndk"], | ||
119 | } | ||
120 | |||
114 | ndk_library { | 121 | ndk_library { |
115 | name: "liblog.ndk", | 122 | name: "liblog.ndk", |
116 | symbol_file: "liblog.map.txt", | 123 | symbol_file: "liblog.map.txt", |
diff --git a/include/log/event_tag_map.h b/liblog/include/log/event_tag_map.h index 22e62ec98..22e62ec98 100644 --- a/include/log/event_tag_map.h +++ b/liblog/include/log/event_tag_map.h | |||
diff --git a/include/log/log.h b/liblog/include/log/log.h index ece9ea6d1..ece9ea6d1 100644 --- a/include/log/log.h +++ b/liblog/include/log/log.h | |||
diff --git a/include/log/log_event_list.h b/liblog/include/log/log_event_list.h index 31d49b2f9..31d49b2f9 100644 --- a/include/log/log_event_list.h +++ b/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 @@ | |||
1 | #ifndef _LIBS_LOG_LOGD_H | ||
2 | #define _LIBS_LOG_LOGD_H | ||
3 | #include <log/log.h> | ||
4 | #warning "Deprecated: do not include log/logd.h, use log/log.h instead" | ||
5 | #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 @@ | |||
1 | #ifndef _LIBS_LOG_LOGGER_H | ||
2 | #define _LIBS_LOG_LOGGER_H | ||
3 | #include <log/log.h> | ||
4 | #warning "Deprecated: do not include log/logger.h, use log/log.h instead" | ||
5 | #endif /*_LIBS_LOG_LOGGER_H*/ | ||
diff --git a/include/log/logprint.h b/liblog/include/log/logprint.h index 3509e7f51..3509e7f51 100644 --- a/include/log/logprint.h +++ b/liblog/include/log/logprint.h | |||
diff --git a/include/log/uio.h b/liblog/include/log/uio.h index 7059da5f7..7059da5f7 100644 --- a/include/log/uio.h +++ b/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 @@ | |||
1 | /* | ||
2 | * Copyright (C) 2015 The Android Open Source Project | ||
3 | * | ||
4 | * Licensed under the Apache License, Version 2.0 (the "License"); | ||
5 | * you may not use this file except in compliance with the License. | ||
6 | * You may obtain a copy of the License at | ||
7 | * | ||
8 | * http://www.apache.org/licenses/LICENSE-2.0 | ||
9 | * | ||
10 | * Unless required by applicable law or agreed to in writing, software | ||
11 | * distributed under the License is distributed on an "AS IS" BASIS, | ||
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
13 | * See the License for the specific language governing permissions and | ||
14 | * limitations under the License. | ||
15 | */ | ||
16 | |||
17 | /* This file is used to define the internal protocol for the Android Logger */ | ||
18 | |||
19 | #ifndef _SYSTEM_CORE_INCLUDE_PRIVATE_ANDROID_LOGGER_H_ | ||
20 | #define _SYSTEM_CORE_INCLUDE_PRIVATE_ANDROID_LOGGER_H_ | ||
21 | |||
22 | /* Android private interfaces */ | ||
23 | |||
24 | #include <stdbool.h> | ||
25 | #include <stdint.h> | ||
26 | #include <sys/types.h> | ||
27 | |||
28 | #if (defined(__cplusplus) && defined(_USING_LIBCXX)) | ||
29 | extern "C++" { | ||
30 | #include <string> | ||
31 | } | ||
32 | #endif | ||
33 | |||
34 | #include <log/log_event_list.h> | ||
35 | #include <log/log.h> | ||
36 | |||
37 | #define LOGGER_MAGIC 'l' | ||
38 | |||
39 | #if defined(__cplusplus) | ||
40 | extern "C" { | ||
41 | #endif | ||
42 | |||
43 | /* Header Structure to pstore */ | ||
44 | typedef struct __attribute__((__packed__)) { | ||
45 | uint8_t magic; | ||
46 | uint16_t len; | ||
47 | uint16_t uid; | ||
48 | uint16_t pid; | ||
49 | } android_pmsg_log_header_t; | ||
50 | |||
51 | /* Header Structure to logd, and second header for pstore */ | ||
52 | typedef struct __attribute__((__packed__)) { | ||
53 | typeof_log_id_t id; | ||
54 | uint16_t tid; | ||
55 | log_time realtime; | ||
56 | } android_log_header_t; | ||
57 | |||
58 | /* Event Header Structure to logd */ | ||
59 | typedef struct __attribute__((__packed__)) { | ||
60 | int32_t tag; // Little Endian Order | ||
61 | } android_event_header_t; | ||
62 | |||
63 | /* Event payload EVENT_TYPE_INT */ | ||
64 | typedef struct __attribute__((__packed__)) { | ||
65 | int8_t type; // EVENT_TYPE_INT | ||
66 | int32_t data; // Little Endian Order | ||
67 | } android_event_int_t; | ||
68 | |||
69 | /* Event with single EVENT_TYPE_INT */ | ||
70 | typedef struct __attribute__((__packed__)) { | ||
71 | android_event_header_t header; | ||
72 | android_event_int_t payload; | ||
73 | } android_log_event_int_t; | ||
74 | |||
75 | /* Event payload EVENT_TYPE_LONG */ | ||
76 | typedef struct __attribute__((__packed__)) { | ||
77 | int8_t type; // EVENT_TYPE_LONG | ||
78 | int64_t data; // Little Endian Order | ||
79 | } android_event_long_t; | ||
80 | |||
81 | /* Event with single EVENT_TYPE_LONG */ | ||
82 | typedef struct __attribute__((__packed__)) { | ||
83 | android_event_header_t header; | ||
84 | android_event_long_t payload; | ||
85 | } android_log_event_long_t; | ||
86 | |||
87 | /* | ||
88 | * Event payload EVENT_TYPE_STRING | ||
89 | * | ||
90 | * Danger: do not embed this structure into another structure. | ||
91 | * This structure uses a flexible array member, and when | ||
92 | * compiled using g++, __builtin_object_size(data, 1) returns | ||
93 | * a bad value. This is possibly a g++ bug, or a bug due to | ||
94 | * the fact that flexible array members are not supported | ||
95 | * in C++. | ||
96 | * http://stackoverflow.com/questions/4412749/are-flexible-array-members-valid-in-c | ||
97 | */ | ||
98 | |||
99 | typedef struct __attribute__((__packed__)) { | ||
100 | int8_t type; // EVENT_TYPE_STRING; | ||
101 | int32_t length; // Little Endian Order | ||
102 | char data[]; | ||
103 | } android_event_string_t; | ||
104 | |||
105 | /* Event with single EVENT_TYPE_STRING */ | ||
106 | typedef struct __attribute__((__packed__)) { | ||
107 | android_event_header_t header; | ||
108 | int8_t type; // EVENT_TYPE_STRING; | ||
109 | int32_t length; // Little Endian Order | ||
110 | char data[]; | ||
111 | } android_log_event_string_t; | ||
112 | |||
113 | #define ANDROID_LOG_PMSG_FILE_MAX_SEQUENCE 256 /* 1MB file */ | ||
114 | #define ANDROID_LOG_PMSG_FILE_SEQUENCE 1000 | ||
115 | |||
116 | ssize_t __android_log_pmsg_file_write( | ||
117 | log_id_t logId, | ||
118 | char prio, | ||
119 | const char* filename, | ||
120 | const char* buf, size_t len); | ||
121 | |||
122 | #define LOG_ID_ANY ((log_id_t)-1) | ||
123 | #define ANDROID_LOG_ANY ANDROID_LOG_UNKNOWN | ||
124 | |||
125 | /* first 5 arguments match __android_log_msg_file_write, a cast is safe */ | ||
126 | typedef ssize_t (*__android_log_pmsg_file_read_fn)( | ||
127 | log_id_t logId, | ||
128 | char prio, | ||
129 | const char* filename, | ||
130 | const char* buf, size_t len, void* arg); | ||
131 | |||
132 | ssize_t __android_log_pmsg_file_read( | ||
133 | log_id_t logId, char prio, const char* prefix, | ||
134 | __android_log_pmsg_file_read_fn fn, void* arg); | ||
135 | |||
136 | int __android_log_security_bwrite(int32_t tag, const void* payload, size_t len); | ||
137 | int __android_log_security_bswrite(int32_t tag, const char* payload); | ||
138 | int __android_log_security(); /* Device Owner is present */ | ||
139 | |||
140 | int __android_log_is_debuggable(); | ||
141 | |||
142 | #define BOOL_DEFAULT_FLAG_TRUE_FALSE 0x1 | ||
143 | #define BOOL_DEFAULT_FALSE 0x0 /* false if property not present */ | ||
144 | #define BOOL_DEFAULT_TRUE 0x1 /* true if property not present */ | ||
145 | #define BOOL_DEFAULT_FLAG_PERSIST 0x2 /* <key>, persist.<key>, ro.<key> */ | ||
146 | #define BOOL_DEFAULT_FLAG_ENG 0x4 /* off for user */ | ||
147 | #define BOOL_DEFAULT_FLAG_SVELTE 0x8 /* off for low_ram */ | ||
148 | bool __android_logger_property_get_bool(const char* key, int flag); | ||
149 | |||
150 | #define LOG_BUFFER_SIZE (256 * 1024) /* Tuned with ro.logd.size per-platform */ | ||
151 | #define LOG_BUFFER_MIN_SIZE (64 * 1024UL) | ||
152 | #define LOG_BUFFER_MAX_SIZE (256 * 1024 * 1024UL) | ||
153 | unsigned long __android_logger_get_buffer_size(log_id_t logId); | ||
154 | bool __android_logger_valid_buffer_size(unsigned long value); | ||
155 | |||
156 | /* Retrieve the composed event buffer */ | ||
157 | int android_log_write_list_buffer(android_log_context ctx, const char** msg); | ||
158 | |||
159 | #ifdef __cplusplus | ||
160 | #ifdef __class_android_log_event_list_defined | ||
161 | #ifndef __class_android_log_event_list_private_defined | ||
162 | #define __class_android_log_event_list_private_defined | ||
163 | /* android_log_context C++ helpers */ | ||
164 | extern "C++" { | ||
165 | class __android_log_event_list : public android_log_event_list { | ||
166 | __android_log_event_list(const android_log_event_list&) = delete; | ||
167 | void operator =(const __android_log_event_list&) = delete; | ||
168 | |||
169 | public: | ||
170 | explicit __android_log_event_list(int tag) : android_log_event_list(tag) { } | ||
171 | explicit __android_log_event_list(log_msg& log_msg) : android_log_event_list(log_msg) { } | ||
172 | |||
173 | #if defined(_USING_LIBCXX) | ||
174 | operator std::string() { | ||
175 | if (ret) return std::string(""); | ||
176 | const char* cp = NULL; | ||
177 | ssize_t len = android_log_write_list_buffer(ctx, &cp); | ||
178 | if (len < 0) ret = len; | ||
179 | if (!cp || (len <= 0)) return std::string(""); | ||
180 | return std::string(cp, len); | ||
181 | } | ||
182 | #endif | ||
183 | |||
184 | }; | ||
185 | } | ||
186 | #endif | ||
187 | #endif | ||
188 | #endif | ||
189 | |||
190 | #if defined(__cplusplus) | ||
191 | } | ||
192 | #endif | ||
193 | |||
194 | #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 @@ | |||
1 | /*Special log.h file for VNDK linking modules*/ | ||
2 | |||
3 | #ifndef _LIBS_LOG_LOG_H | ||
4 | #define _LIBS_LOG_LOG_H | ||
5 | |||
6 | #include <android/log.h> | ||
7 | |||
8 | /*The following files will be included once they are available*/ | ||
9 | /*#include <log/log_id.h>*/ | ||
10 | /*#include <log/log_radio.h>*/ | ||
11 | |||
12 | /* | ||
13 | * LOG_TAG is the local tag used for the following simplified | ||
14 | * logging macros. You can change this preprocessor definition | ||
15 | * before using the other macros to change the tag. | ||
16 | */ | ||
17 | |||
18 | #ifndef LOG_TAG | ||
19 | #define LOG_TAG NULL | ||
20 | #endif | ||
21 | |||
22 | #endif /*_LIBS_LOG_LOG_H*/ | ||