Merge "Allow disabling protolog exceptions"

This commit is contained in:
Winson Chung
2020-10-29 16:17:25 +00:00
committed by Android (Google) Code Review
2 changed files with 31 additions and 12 deletions

View File

@@ -35,6 +35,10 @@ package com.android.internal.protolog.common;
* during build.
*/
public class ProtoLog {
// Needs to be set directly otherwise the protologtool tries to transform the method call
public static boolean REQUIRE_PROTOLOGTOOL = true;
/**
* DEBUG level log.
*
@@ -44,8 +48,10 @@ public class ProtoLog {
*/
public static void d(IProtoLogGroup group, String messageString, Object... args) {
// Stub, replaced by the ProtoLogTool.
throw new UnsupportedOperationException(
"ProtoLog calls MUST be processed with ProtoLogTool");
if (REQUIRE_PROTOLOGTOOL) {
throw new UnsupportedOperationException(
"ProtoLog calls MUST be processed with ProtoLogTool");
}
}
/**
@@ -57,8 +63,10 @@ public class ProtoLog {
*/
public static void v(IProtoLogGroup group, String messageString, Object... args) {
// Stub, replaced by the ProtoLogTool.
throw new UnsupportedOperationException(
"ProtoLog calls MUST be processed with ProtoLogTool");
if (REQUIRE_PROTOLOGTOOL) {
throw new UnsupportedOperationException(
"ProtoLog calls MUST be processed with ProtoLogTool");
}
}
/**
@@ -70,8 +78,10 @@ public class ProtoLog {
*/
public static void i(IProtoLogGroup group, String messageString, Object... args) {
// Stub, replaced by the ProtoLogTool.
throw new UnsupportedOperationException(
"ProtoLog calls MUST be processed with ProtoLogTool");
if (REQUIRE_PROTOLOGTOOL) {
throw new UnsupportedOperationException(
"ProtoLog calls MUST be processed with ProtoLogTool");
}
}
/**
@@ -83,8 +93,10 @@ public class ProtoLog {
*/
public static void w(IProtoLogGroup group, String messageString, Object... args) {
// Stub, replaced by the ProtoLogTool.
throw new UnsupportedOperationException(
"ProtoLog calls MUST be processed with ProtoLogTool");
if (REQUIRE_PROTOLOGTOOL) {
throw new UnsupportedOperationException(
"ProtoLog calls MUST be processed with ProtoLogTool");
}
}
/**
@@ -96,8 +108,10 @@ public class ProtoLog {
*/
public static void e(IProtoLogGroup group, String messageString, Object... args) {
// Stub, replaced by the ProtoLogTool.
throw new UnsupportedOperationException(
"ProtoLog calls MUST be processed with ProtoLogTool");
if (REQUIRE_PROTOLOGTOOL) {
throw new UnsupportedOperationException(
"ProtoLog calls MUST be processed with ProtoLogTool");
}
}
/**
@@ -109,7 +123,9 @@ public class ProtoLog {
*/
public static void wtf(IProtoLogGroup group, String messageString, Object... args) {
// Stub, replaced by the ProtoLogTool.
throw new UnsupportedOperationException(
"ProtoLog calls MUST be processed with ProtoLogTool");
if (REQUIRE_PROTOLOGTOOL) {
throw new UnsupportedOperationException(
"ProtoLog calls MUST be processed with ProtoLogTool");
}
}
}

View File

@@ -34,6 +34,7 @@ import android.provider.Settings;
import android.util.Log;
import android.util.TimingsTraceLog;
import com.android.internal.protolog.common.ProtoLog;
import com.android.systemui.dagger.ContextComponentHelper;
import com.android.systemui.dagger.GlobalRootComponent;
import com.android.systemui.dagger.SysUIComponent;
@@ -69,6 +70,8 @@ public class SystemUIApplication extends Application implements
public SystemUIApplication() {
super();
Log.v(TAG, "SystemUIApplication constructed.");
// SysUI may be building without protolog preprocessing in some cases
ProtoLog.REQUIRE_PROTOLOGTOOL = false;
}
@Override