Loading core/java/com/android/internal/protolog/LogcatOnlyProtoLogImpl.java +15 −11 Original line number Diff line number Diff line Loading @@ -40,6 +40,8 @@ import java.util.List; */ @Deprecated public class LogcatOnlyProtoLogImpl implements IProtoLog { private static final String LOG_TAG = LogcatOnlyProtoLogImpl.class.getName(); @Override public void log(LogLevel logLevel, IProtoLogGroup group, long messageHash, int paramsMask, Object[] args) { Loading @@ -48,11 +50,12 @@ public class LogcatOnlyProtoLogImpl implements IProtoLog { @Override public void log(LogLevel logLevel, IProtoLogGroup group, String messageString, Object[] args) { if (REQUIRE_PROTOLOGTOOL) { throw new RuntimeException( "REQUIRE_PROTOLOGTOOL not set to false before the first log call."); if (REQUIRE_PROTOLOGTOOL && group.isLogToProto()) { Log.w(LOG_TAG, "ProtoLog message not processed. Failed to log it to proto. " + "Logging it below to logcat instead."); } if (group.isLogToLogcat() || group.isLogToProto()) { String formattedString = TextUtils.formatSimple(messageString, args); switch (logLevel) { case VERBOSE -> Log.v(group.getTag(), formattedString); Loading @@ -63,6 +66,7 @@ public class LogcatOnlyProtoLogImpl implements IProtoLog { case WTF -> Log.wtf(group.getTag(), formattedString); } } } @Override public boolean isProtoEnabled() { Loading core/java/com/android/internal/protolog/ProtoLog.java +3 −2 Original line number Diff line number Diff line Loading @@ -63,6 +63,9 @@ public class ProtoLog { * @param groups The ProtoLog groups that will be used in the process. */ public static void init(IProtoLogGroup... groups) { // These tracing instances are only used when we cannot or do not preprocess the source // files to extract out the log strings. Otherwise, the trace calls are replaced with calls // directly to the generated tracing implementations. if (android.tracing.Flags.perfettoProtologTracing()) { synchronized (sInitLock) { if (sProtoLogInstance != null) { Loading @@ -76,8 +79,6 @@ public class ProtoLog { sProtoLogInstance = new PerfettoProtoLogImpl(groups); } } else { // The first call to ProtoLog is likely to flip REQUIRE_PROTOLOGTOOL, which is when this // static block will be executed before REQUIRE_PROTOLOGTOOL is actually set. sProtoLogInstance = new LogcatOnlyProtoLogImpl(); } } Loading Loading
core/java/com/android/internal/protolog/LogcatOnlyProtoLogImpl.java +15 −11 Original line number Diff line number Diff line Loading @@ -40,6 +40,8 @@ import java.util.List; */ @Deprecated public class LogcatOnlyProtoLogImpl implements IProtoLog { private static final String LOG_TAG = LogcatOnlyProtoLogImpl.class.getName(); @Override public void log(LogLevel logLevel, IProtoLogGroup group, long messageHash, int paramsMask, Object[] args) { Loading @@ -48,11 +50,12 @@ public class LogcatOnlyProtoLogImpl implements IProtoLog { @Override public void log(LogLevel logLevel, IProtoLogGroup group, String messageString, Object[] args) { if (REQUIRE_PROTOLOGTOOL) { throw new RuntimeException( "REQUIRE_PROTOLOGTOOL not set to false before the first log call."); if (REQUIRE_PROTOLOGTOOL && group.isLogToProto()) { Log.w(LOG_TAG, "ProtoLog message not processed. Failed to log it to proto. " + "Logging it below to logcat instead."); } if (group.isLogToLogcat() || group.isLogToProto()) { String formattedString = TextUtils.formatSimple(messageString, args); switch (logLevel) { case VERBOSE -> Log.v(group.getTag(), formattedString); Loading @@ -63,6 +66,7 @@ public class LogcatOnlyProtoLogImpl implements IProtoLog { case WTF -> Log.wtf(group.getTag(), formattedString); } } } @Override public boolean isProtoEnabled() { Loading
core/java/com/android/internal/protolog/ProtoLog.java +3 −2 Original line number Diff line number Diff line Loading @@ -63,6 +63,9 @@ public class ProtoLog { * @param groups The ProtoLog groups that will be used in the process. */ public static void init(IProtoLogGroup... groups) { // These tracing instances are only used when we cannot or do not preprocess the source // files to extract out the log strings. Otherwise, the trace calls are replaced with calls // directly to the generated tracing implementations. if (android.tracing.Flags.perfettoProtologTracing()) { synchronized (sInitLock) { if (sProtoLogInstance != null) { Loading @@ -76,8 +79,6 @@ public class ProtoLog { sProtoLogInstance = new PerfettoProtoLogImpl(groups); } } else { // The first call to ProtoLog is likely to flip REQUIRE_PROTOLOGTOOL, which is when this // static block will be executed before REQUIRE_PROTOLOGTOOL is actually set. sProtoLogInstance = new LogcatOnlyProtoLogImpl(); } } Loading