util/os_misc: use stable NDK __android_log_write helper

The NDK api __android_log_write has been available since api level 3,
which is preferred since NDK api is more stable. Meanwhile, use write
instead of print to avoid extra internal copy/truncate involved in the
print helper.

Acked-by: Valentine Burley <valentine.burley@collabora.com>
Reviewed-by: Dhruv Mark Collins <mark@igalia.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/41254>
This commit is contained in:
Yiwei Zhang 2026-04-28 15:36:54 -07:00 committed by Marge Bot
parent ebe835e94c
commit 8ea8e87378

View file

@ -56,7 +56,7 @@
#if DETECT_OS_ANDROID
# define LOG_TAG "MESA"
# include <unistd.h>
# include <log/log.h>
# include <android/log.h>
# include <sys/system_properties.h>
#elif DETECT_OS_LINUX || DETECT_OS_CYGWIN || DETECT_OS_SOLARIS || DETECT_OS_HURD || DETECT_OS_MANAGARM
# include <unistd.h>
@ -132,7 +132,7 @@ os_log_message(const char *message)
fputs(message, fout);
fflush(fout);
# if DETECT_OS_ANDROID
LOG_PRI(ANDROID_LOG_ERROR, LOG_TAG, "%s", message);
__android_log_write(ANDROID_LOG_ERROR, LOG_TAG, message);
# endif
#endif
}