From 8e81742dc0266eb959f80e8e473968058bca0271 Mon Sep 17 00:00:00 2001 From: Makoto Onuki Date: Mon, 23 Mar 2020 10:05:48 -0700 Subject: [PATCH] Make Log.isLogagble @FastNative This CL doens't change println_native() because: - To avoid potential risks (jank?) because it's kind of late in the RVC cycle. - The JNI overhead is unlikely to be a major problem in logging. If apps are making *that* many log calls, that itself would be a bigger problem. Test: treehugger / boot Bug: 152217649 Change-Id: I86aeb62b217e5331e6bbd02a0ba592fd050a41b2 --- core/java/android/util/Log.java | 3 +++ 1 file changed, 3 insertions(+) diff --git a/core/java/android/util/Log.java b/core/java/android/util/Log.java index 9921bf0bc5278..2ded473930f7a 100644 --- a/core/java/android/util/Log.java +++ b/core/java/android/util/Log.java @@ -27,6 +27,8 @@ import com.android.internal.os.RuntimeInit; import com.android.internal.util.FastPrintWriter; import com.android.internal.util.LineBreakBufferedWriter; +import dalvik.annotation.optimization.FastNative; + import java.io.PrintWriter; import java.io.StringWriter; import java.io.Writer; @@ -228,6 +230,7 @@ public final class Log { * for Nougat (7.0) releases (API <= 23) and prior, there is no * tag limit of concern after this API level. */ + @FastNative public static native boolean isLoggable(@Nullable String tag, @Level int level); /**