From e0dda3c8e2c8341e60383619e4ab780bb3b02403 Mon Sep 17 00:00:00 2001 From: Stephen Smalley Date: Wed, 29 Jan 2014 12:55:58 -0500 Subject: [PATCH] Map SELinux log levels to Android log levels. Change-Id: I202c543ca6e4110c4011d1904eada4b75b59ff10 Signed-off-by: Stephen Smalley --- core/jni/android_os_SELinux.cpp | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/core/jni/android_os_SELinux.cpp b/core/jni/android_os_SELinux.cpp index ca278cf00d4f6..2b85fefbd8e5f 100644 --- a/core/jni/android_os_SELinux.cpp +++ b/core/jni/android_os_SELinux.cpp @@ -443,8 +443,21 @@ static JNINativeMethod method_table[] = { static int log_callback(int type, const char *fmt, ...) { va_list ap; + int priority; + + switch (type) { + case SELINUX_WARNING: + priority = ANDROID_LOG_WARN; + break; + case SELINUX_INFO: + priority = ANDROID_LOG_INFO; + break; + default: + priority = ANDROID_LOG_ERROR; + break; + } va_start(ap, fmt); - LOG_PRI_VA(ANDROID_LOG_ERROR, "SELinux", fmt, ap); + LOG_PRI_VA(priority, "SELinux", fmt, ap); va_end(ap); return 0; }