Add __android_log_is_loggable_len#6
Conversation
A variant of __android_log_is_loggable that allows passing non-null-terminated tag, avoiding the need for allocating a temporary buffer when called from android_logger. The function is available since Android API 30 [1], the same as __android_log_write_log_message that's already present in the code. [1] https://cs.android.com/android/platform/superproject/main/+/main:system/logging/liblog/include/android/log.h;l=358
| #[allow(non_camel_case_types)] | ||
| pub type c_size_t = raw::c_ulong; | ||
|
|
||
| // automatically generated by rust-bindgen |
There was a problem hiding this comment.
On the side (unrelated to this PR), this doesn't sound very up-to-date :). There's no script or documentation explaining how to run bindgen to regenerate/update this file, and it's probably been edited by hand many times.
There was a problem hiding this comment.
It's a bit awkward to have bindgen for android NDK (requires andoid NDK, which you can't ask every dev to install :)), unless it's separate from cargo build. Yes, it was done by hand, at least partially. In my defense, I thought these kinds of system definitions should not change, otherwise they would break downstream massively.
There was a problem hiding this comment.
There's always the option to just run it once and check in the generated bindings - without modifying them by hand - that is exactly what I do for the ndk-sys crate 🙂
That way there is at least a reference describing how to exactly translate the bindings. Existing symbols shouldn't change - and I guess everyone hoped/expected the log API to stay very small - but adding new APIs becomes slightly more convenient.
There was a problem hiding this comment.
Thanks for contributing with your knowledge :)
A variant of __android_log_is_loggable that allows passing non-null-terminated tag, avoiding the need for allocating a temporary buffer when called from android_logger.
The function is available since Android API 30 [1], the same as __android_log_write_log_message that's already present in the code.
[1] https://cs.android.com/android/platform/superproject/main/+/main:system/logging/liblog/include/android/log.h;l=358