log: update aosp/2717613 patch for version update
android_logger 0.15 splits sources into multiple files, which means the
symlink we used no longer works when android_logger is embedded into log
crate. Instead, use #[path] annotation on the module.
Also simplify the existing patch a little:
- The default initialization of AndroidLogger now behaves in the same
way as the one we used before.
- once_cell is no longer needed.
Bug: 390554805
Bug: 390555176
Bug: 359442427
Test: atest external/rust/android-crates-io/crates/android_logger \
Test: system/logging/rust
Test: on the entire CL chain
Change-Id: I497800fbe993070136004a76f4c0b4fd3145207f
diff --git a/crates/log/patches/0001-Enable-default-initializing-liblog_rust-to-write-to-.patch b/crates/log/patches/0001-Enable-default-initializing-liblog_rust-to-write-to-.patch
index bdd191e..06cdd89 100644
--- a/crates/log/patches/0001-Enable-default-initializing-liblog_rust-to-write-to-.patch
+++ b/crates/log/patches/0001-Enable-default-initializing-liblog_rust-to-write-to-.patch
@@ -1,6 +1,6 @@
-From cd85e49c438e3aa9dbe2989f91e5ad7d3f4816de Mon Sep 17 00:00:00 2001
+From 5463a7be6408ee158c1fe2bea948af785d45b9dc Mon Sep 17 00:00:00 2001
From: Marcin Radomski <dextero@google.com>
-Date: Thu, 17 Aug 2023 16:11:56 +0000
+Date: Thu, 20 Mar 2025 13:37:51 +0000
Subject: [PATCH] Enable default-initializing liblog_rust to write to logcat on
Android
@@ -22,37 +22,27 @@
Test: observe logcat logs on all level from FFI call
Test: observe all logs on non-FFI call without initializing the logger
Test: observe set log filter applying only to non-FFI call
-Change-Id: I04dd334c66e5a2be8cfb19e87be3afb9146e5aa6
+Change-Id: I027e3ed859718aa3aaf3ed9703466f7a9df9d1d7
---
- src/android_logger.rs | 1 +
- src/lib.rs | 23 +++++++++++++++++++++++
- 2 files changed, 24 insertions(+)
+ src/lib.rs | 22 ++++++++++++++++++++++
+ 1 file changed, 22 insertions(+)
-diff --git b/src/android_logger.rs a/src/android_logger.rs
-new file mode 120000
-index 00000000..84b8625c
---- /dev/null
-+++ a/src/android_logger.rs
-@@ -0,0 +1 @@
-+../../android_logger/src/lib.rs
-\ No newline at end of file
-diff --git b/src/lib.rs a/src/lib.rs
-index 6b43a9ae..799b88e1 100644
---- b/src/lib.rs
-+++ a/src/lib.rs
-@@ -397,6 +397,11 @@ mod serde;
+diff --git a/src/lib.rs b/src/lib.rs
+index 843893d0..09507729 100644
+--- a/src/lib.rs
++++ b/src/lib.rs
+@@ -405,6 +405,10 @@ mod serde;
#[cfg(feature = "kv")]
pub mod kv;
+#[cfg(default_log_impl)]
-+extern crate once_cell;
-+#[cfg(default_log_impl)]
++#[path = "../../android_logger/src/lib.rs"]
+mod android_logger;
+
#[cfg(target_has_atomic = "ptr")]
use std::sync::atomic::{AtomicUsize, Ordering};
-@@ -458,7 +463,10 @@ const UNINITIALIZED: usize = 0;
+@@ -466,7 +470,10 @@ const UNINITIALIZED: usize = 0;
const INITIALIZING: usize = 1;
const INITIALIZED: usize = 2;
@@ -63,7 +53,7 @@
static LOG_LEVEL_NAMES: [&str; 6] = ["OFF", "ERROR", "WARN", "INFO", "DEBUG", "TRACE"];
-@@ -1505,6 +1513,21 @@ pub fn logger() -> &'static dyn Log {
+@@ -1513,6 +1520,21 @@ pub fn logger() -> &'static dyn Log {
// write to the `LOGGER` static and initialization of the logger
// internal state synchronized with current thread.
if STATE.load(Ordering::Acquire) != INITIALIZED {
@@ -86,5 +76,5 @@
&NOP
} else {
--
-2.42.0.rc1.204.g551eb34607-goog
+2.49.0.rc1.451.g8f38331e32-goog
diff --git a/crates/log/src/android_logger.rs b/crates/log/src/android_logger.rs
deleted file mode 120000
index 84b8625..0000000
--- a/crates/log/src/android_logger.rs
+++ /dev/null
@@ -1 +0,0 @@
-../../android_logger/src/lib.rs
\ No newline at end of file