From e19343ab520ed0756f2ea7d9ba35ec4882b68fb5 Mon Sep 17 00:00:00 2001 From: Matthew Maurer Date: Thu, 24 Feb 2022 13:46:10 -0800 Subject: Add support for selecting log buffers While `__android_log_write_log_message` can select a target log buffer, it did not exist before API version 30. To allow selecting a log buffer for earlier APIs, we add a signature for `__android_log_buf_write`. Test: Check keystore2 logs still end up in system Bug: 221185310 Change-Id: I741a17df5026e16e3cb3263876c4f588eb3ff60e --- ...001-Add-support-for-selecting-log-buffers.patch | 33 ++++++++++++++++++++++ src/lib.rs | 5 ++++ 2 files changed, 38 insertions(+) create mode 100644 patches/0001-Add-support-for-selecting-log-buffers.patch diff --git a/patches/0001-Add-support-for-selecting-log-buffers.patch b/patches/0001-Add-support-for-selecting-log-buffers.patch new file mode 100644 index 0000000..f56fa6d --- /dev/null +++ b/patches/0001-Add-support-for-selecting-log-buffers.patch @@ -0,0 +1,33 @@ +From fb544f370ca1ae5b5c9de3a0c336ad9986537443 Mon Sep 17 00:00:00 2001 +From: Matthew Maurer +Date: Thu, 24 Feb 2022 13:41:53 -0800 +Subject: [PATCH] Add support for selecting log buffers + +While `__android_log_write_log_message` can select a target log buffer, +it did not exist before API version 30. To allow selecting a log buffer +for earlier APIs, we add a signature for `__android_log_buf_write`. + +Change-Id: Ie933a9b00436a626bd200242047d646c564e9e13 +--- + src/lib.rs | 5 +++++ + 1 file changed, 5 insertions(+) + +diff --git a/src/lib.rs b/src/lib.rs +index eba5b19..b648ed5 100644 +--- a/src/lib.rs ++++ b/src/lib.rs +@@ -66,6 +66,11 @@ extern "C" { + tag: *const c_char, + text: *const c_char) + -> c_int; ++ pub fn __android_log_buf_write(bufID: c_int, ++ prio: c_int, ++ tag: *const c_char, ++ text: *const c_char) ++ -> c_int; + pub fn __android_log_print(prio: c_int, + tag: *const c_char, + fmt: *const c_char, +-- +2.35.1.574.g5d30c73bfb-goog + diff --git a/src/lib.rs b/src/lib.rs index eba5b19..b648ed5 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -66,6 +66,11 @@ extern "C" { tag: *const c_char, text: *const c_char) -> c_int; + pub fn __android_log_buf_write(bufID: c_int, + prio: c_int, + tag: *const c_char, + text: *const c_char) + -> c_int; pub fn __android_log_print(prio: c_int, tag: *const c_char, fmt: *const c_char, -- cgit v1.2.3 From f385b9af8f4c3358e5e15d6dbfdd1889c0360257 Mon Sep 17 00:00:00 2001 From: Colin Cross Date: Tue, 8 Mar 2022 15:12:48 -0800 Subject: Tweak linux_glibc properties for musl builds in external/rust/crates/android_log-sys For convenience, builds against musl libc currently use the linux_glibc properties because they are almost always linux-specific and not glibc-specific. In preparation for removing this hack, tweak the linux_glibc properties by either moving them to host_linux, which will apply to linux_glibc, linux_musl and linux_bionic, or by setting appropriate musl or linux_musl properties. Properties that must not be repeated while musl uses linux_musl and also still uses the linux_glibc properties are moved to glibc properties, which don't apply to musl. Whether these stay as glibc properties or get moved back to linux_glibc later once the musl hack is removed is TBD. Bug: 223257095 Test: m checkbuild Test: m USE_HOST_MUSL=true host-native Change-Id: Ic692b12ec4ee369f70ed238ed727f1d7090f414c --- Android.bp | 4 ++++ cargo2android_glibc.bp | 6 +++++- 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/Android.bp b/Android.bp index 812d4e2..185de12 100644 --- a/Android.bp +++ b/Android.bp @@ -62,5 +62,9 @@ rust_library { // liblog is not added as a dependency for linux_glibc target enabled: false, }, + linux_musl: { + // liblog is not added as a dependency for linux_musl target + enabled: false, + }, }, } diff --git a/cargo2android_glibc.bp b/cargo2android_glibc.bp index f4d25cf..7d62503 100644 --- a/cargo2android_glibc.bp +++ b/cargo2android_glibc.bp @@ -3,4 +3,8 @@ target: { // liblog is not added as a dependency for linux_glibc target enabled: false, }, -} \ No newline at end of file + linux_musl: { + // liblog is not added as a dependency for linux_musl target + enabled: false, + }, +} -- cgit v1.2.3 From 4a5cb040d4881b5d6d222ee015670d596925b2df Mon Sep 17 00:00:00 2001 From: David LeGare Date: Wed, 2 Mar 2022 19:54:27 +0000 Subject: Update TEST_MAPPING Test: cd external/rust/crates && atest --host -c Change-Id: I59901f9c169679a0dbb1de37ed332ede168cb4fe --- TEST_MAPPING | 6 ------ 1 file changed, 6 deletions(-) diff --git a/TEST_MAPPING b/TEST_MAPPING index 37d7815..619d83c 100644 --- a/TEST_MAPPING +++ b/TEST_MAPPING @@ -39,9 +39,6 @@ { "name": "logger_test_multiple_init" }, - { - "name": "open_then_run_module" - }, { "name": "virtualizationservice_device_test" } @@ -80,9 +77,6 @@ { "name": "logger_test_multiple_init" }, - { - "name": "open_then_run_module" - }, { "name": "virtualizationservice_device_test" } -- cgit v1.2.3