diff options
| -rw-r--r-- | adb/adb.cpp | 2 | ||||
| -rw-r--r-- | init/builtins.cpp | 1 | ||||
| -rw-r--r-- | libmemunreachable/Android.bp | 1 | ||||
| -rw-r--r-- | libmetricslogger/Android.bp | 7 | ||||
| -rw-r--r-- | libmetricslogger/include/metricslogger/metrics_logger.h | 41 | ||||
| -rw-r--r-- | libmetricslogger/metrics_logger.cpp | 29 | ||||
| -rw-r--r-- | logcat/event.logtags | 3 |
7 files changed, 82 insertions, 2 deletions
diff --git a/adb/adb.cpp b/adb/adb.cpp index 70e083b5f7..c791c7b6c7 100644 --- a/adb/adb.cpp +++ b/adb/adb.cpp @@ -1222,7 +1222,7 @@ int handle_host_request(const char* service, TransportType type, const char* ser std::string error; atransport* t = acquire_one_transport(type, serial, transport_id, nullptr, &error); if (!t) { - return SendFail(reply_fd, error); + return -1; } int ret = handle_forward_request(service, t, reply_fd); diff --git a/init/builtins.cpp b/init/builtins.cpp index acbeca2334..8bd92ccdd3 100644 --- a/init/builtins.cpp +++ b/init/builtins.cpp @@ -519,6 +519,7 @@ static Result<Success> queue_fs_event(int code) { if (e4crypt_install_keyring()) { return Error() << "e4crypt_install_keyring() failed"; } + property_set("ro.crypto.state", "encrypted"); property_set("ro.crypto.type", "file"); // Although encrypted, vold has already set the device up, so we do not need to diff --git a/libmemunreachable/Android.bp b/libmemunreachable/Android.bp index caca3774e3..f872d0fd0e 100644 --- a/libmemunreachable/Android.bp +++ b/libmemunreachable/Android.bp @@ -88,7 +88,6 @@ cc_test { cc_test { name: "memunreachable_binder_test", defaults: ["libmemunreachable_defaults"], - test_suites: ["vts"], srcs: [ "tests/Binder_test.cpp", ], diff --git a/libmetricslogger/Android.bp b/libmetricslogger/Android.bp index 6549b8d56b..e6e17ce875 100644 --- a/libmetricslogger/Android.bp +++ b/libmetricslogger/Android.bp @@ -29,6 +29,13 @@ cc_library_shared { defaults: ["metricslogger_defaults"], } +// static version of libmetricslogger, needed by a few art static binaries +cc_library_static { + name: "libmetricslogger_static", + srcs: metricslogger_lib_src_files, + defaults: ["metricslogger_defaults"], +} + // metricslogger shared library, debug // ----------------------------------------------------------------------------- cc_library_shared { diff --git a/libmetricslogger/include/metricslogger/metrics_logger.h b/libmetricslogger/include/metricslogger/metrics_logger.h index 189bc4b63f..2c768695dd 100644 --- a/libmetricslogger/include/metricslogger/metrics_logger.h +++ b/libmetricslogger/include/metricslogger/metrics_logger.h @@ -14,6 +14,7 @@ * limitations under the License. */ +#include <log/log_event_list.h> #include <cstdint> #include <string> @@ -32,6 +33,34 @@ void LogCounter(const std::string& name, int32_t val); // |value| in the field |field|. void LogMultiAction(int32_t category, int32_t field, const std::string& value); +// Logs a Tron complex event. +// +// A complex event can include data in a structure not suppored by the other +// log event types above. +// +// Note that instances of this class are single use. You must call Record() +// to write the event to the event log. +class ComplexEventLogger { + private: + android_log_event_list logger; + + public: + // Create a complex event with category|category|. + explicit ComplexEventLogger(int category); + // Add tagged data to the event, with the given tag and integer value. + void AddTaggedData(int tag, int32_t value); + // Add tagged data to the event, with the given tag and string value. + void AddTaggedData(int tag, const std::string& value); + // Add tagged data to the event, with the given tag and integer value. + void AddTaggedData(int tag, int64_t value); + // Add tagged data to the event, with the given tag and float value. + void AddTaggedData(int tag, float value); + // Record this event. This method can only be used once per instance + // of ComplexEventLogger. Do not made any subsequent calls to AddTaggedData + // after recording an event. + void Record(); +}; + // TODO: replace these with the metric_logger.proto definitions enum { LOGBUILDER_CATEGORY = 757, @@ -44,11 +73,23 @@ enum { ACTION_BOOT = 1098, FIELD_PLATFORM_REASON = 1099, + + ACTION_HIDDEN_API_ACCESSED = 1391, + FIELD_HIDDEN_API_ACCESS_METHOD = 1392, + FIELD_HIDDEN_API_ACCESS_DENIED = 1393, + FIELD_HIDDEN_API_SIGNATURE = 1394, }; enum { TYPE_ACTION = 4, }; +enum { + ACCESS_METHOD_NONE = 0, + ACCESS_METHOD_REFLECTION = 1, + ACCESS_METHOD_JNI = 2, + ACCESS_METHOD_LINKING = 3, +}; + } // namespace metricslogger } // namespace android diff --git a/libmetricslogger/metrics_logger.cpp b/libmetricslogger/metrics_logger.cpp index fdc44071b5..912fa12816 100644 --- a/libmetricslogger/metrics_logger.cpp +++ b/libmetricslogger/metrics_logger.cpp @@ -23,9 +23,14 @@ namespace { +#ifdef __ANDROID__ EventTagMap* kEventTagMap = android_openEventTagMap(nullptr); const int kSysuiMultiActionTag = android_lookupEventTagNum( kEventTagMap, "sysui_multi_action", "(content|4)", ANDROID_LOG_UNKNOWN); +#else +// android_openEventTagMap does not work on host builds. +const int kSysuiMultiActionTag = 0; +#endif } // namespace @@ -53,5 +58,29 @@ void LogMultiAction(int32_t category, int32_t field, const std::string& value) { << field << value << LOG_ID_EVENTS; } +ComplexEventLogger::ComplexEventLogger(int category) : logger(kSysuiMultiActionTag) { + logger << LOGBUILDER_CATEGORY << category; +} + +void ComplexEventLogger::AddTaggedData(int tag, int32_t value) { + logger << tag << value; +} + +void ComplexEventLogger::AddTaggedData(int tag, const std::string& value) { + logger << tag << value; +} + +void ComplexEventLogger::AddTaggedData(int tag, int64_t value) { + logger << tag << value; +} + +void ComplexEventLogger::AddTaggedData(int tag, float value) { + logger << tag << value; +} + +void ComplexEventLogger::Record() { + logger << LOG_ID_EVENTS; +} + } // namespace metricslogger } // namespace android diff --git a/logcat/event.logtags b/logcat/event.logtags index bb769da32c..750761f420 100644 --- a/logcat/event.logtags +++ b/logcat/event.logtags @@ -120,6 +120,9 @@ 70200 aggregation (aggregation time|2|3) 70201 aggregation_test (field1|1|2),(field2|1|2),(field3|1|2),(field4|1|2),(field5|1|2) +# gms refuses to register this log tag, b/30156345 +70220 gms_unknown + # libc failure logging 80100 bionic_event_memcpy_buffer_overflow (uid|1) 80105 bionic_event_strcat_buffer_overflow (uid|1) |
