diff options
author | Matthew Maurer <mmaurer@google.com> | 2022-02-24 14:07:03 -0800 |
---|---|---|
committer | Matthew Maurer <mmaurer@google.com> | 2022-02-24 14:08:08 -0800 |
commit | 84b4a698b96c73d98faa7d0347368a09bc779c81 (patch) | |
tree | 60cf0c5bf15f5d91b9fe511d9e2e36d8f9a29208 | |
parent | c6a999020b54e2106d756bc2a73741b6a1d319f3 (diff) | |
download | android_logger-84b4a698b96c73d98faa7d0347368a09bc779c81.tar.gz |
Use older API to avoid requiring API v30
Test: Check that keystore still outputs logs to system
Bug: 221185310
Change-Id: I25174f1617557e270db70cd432cec78c037c6b75
-rw-r--r-- | patches/0002-Use-older-API-to-avoid-requiring-API-v30.patch | 41 | ||||
-rw-r--r-- | src/lib.rs | 14 |
2 files changed, 45 insertions, 10 deletions
diff --git a/patches/0002-Use-older-API-to-avoid-requiring-API-v30.patch b/patches/0002-Use-older-API-to-avoid-requiring-API-v30.patch new file mode 100644 index 0000000..721e9eb --- /dev/null +++ b/patches/0002-Use-older-API-to-avoid-requiring-API-v30.patch @@ -0,0 +1,41 @@ +From ec84856e0f0bc5a307529122bfed3d94d2ef4011 Mon Sep 17 00:00:00 2001 +From: Matthew Maurer <mmaurer@google.com> +Date: Thu, 24 Feb 2022 14:07:03 -0800 +Subject: [PATCH] Use older API to avoid requiring API v30 + +Test: Check that keystore still outputs logs to system +Bug: 221185310 +Change-Id: I25174f1617557e270db70cd432cec78c037c6b75 +--- + src/lib.rs | 14 ++++---------- + 1 file changed, 4 insertions(+), 10 deletions(-) + +diff --git a/src/lib.rs b/src/lib.rs +index d21be3f..bc4fa61 100644 +--- a/src/lib.rs ++++ b/src/lib.rs +@@ -113,17 +113,11 @@ impl LogId { + /// Output log to android system. + #[cfg(target_os = "android")] + fn android_log(log_id: log_ffi::log_id_t, prio: log_ffi::LogPriority, tag: &CStr, msg: &CStr) { +- let mut message = log_ffi::__android_log_message { +- struct_size: std::mem::size_of::<log_ffi::__android_log_message>(), +- buffer_id: log_id as i32, +- priority: prio as i32, +- tag: tag.as_ptr() as *const log_ffi::c_char, +- file: ptr::null(), +- line: 0, +- message: msg.as_ptr() as *const log_ffi::c_char, +- }; + unsafe { +- log_ffi::__android_log_write_log_message(&mut message as *mut _); ++ log_ffi::__android_log_buf_write(log_id as i32, ++ prio as i32, ++ tag.as_ptr() as *const log_ffi::c_char, ++ msg.as_ptr() as *const log_ffi::c_char); + }; + } + +-- +2.35.1.574.g5d30c73bfb-goog + @@ -113,17 +113,11 @@ impl LogId { /// Output log to android system. #[cfg(target_os = "android")] fn android_log(log_id: log_ffi::log_id_t, prio: log_ffi::LogPriority, tag: &CStr, msg: &CStr) { - let mut message = log_ffi::__android_log_message { - struct_size: std::mem::size_of::<log_ffi::__android_log_message>(), - buffer_id: log_id as i32, - priority: prio as i32, - tag: tag.as_ptr() as *const log_ffi::c_char, - file: ptr::null(), - line: 0, - message: msg.as_ptr() as *const log_ffi::c_char, - }; unsafe { - log_ffi::__android_log_write_log_message(&mut message as *mut _); + log_ffi::__android_log_buf_write(log_id as i32, + prio as i32, + tag.as_ptr() as *const log_ffi::c_char, + msg.as_ptr() as *const log_ffi::c_char); }; } |