Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 34d0b07f authored by Treehugger Robot's avatar Treehugger Robot Committed by Android (Google) Code Review
Browse files

Merge "Change ProtoLog to log WTF instead of throwing when uninitialized." into main

parents dfdfa929 3fa0c033
Loading
Loading
Loading
Loading
+6 −2
Original line number Diff line number Diff line
@@ -24,6 +24,8 @@ import android.tracing.perfetto.DataSourceParams;
import android.tracing.perfetto.InitArguments;
import android.tracing.perfetto.Producer;

import android.util.Log;

import com.android.internal.annotations.VisibleForTesting;
import com.android.internal.protolog.common.IProtoLog;
import com.android.internal.protolog.common.IProtoLogGroup;
@@ -53,6 +55,8 @@ import com.android.internal.protolog.common.LogLevel;
public class ProtoLog {
// LINT.ThenChange(frameworks/base/tools/protologtool/src/com/android/protolog/tool/ProtoLogTool.kt)

    private static final String LOG_TAG = "ProtoLog";

    // Needs to be set directly otherwise the protologtool tries to transform the method call
    @Deprecated
    public static boolean REQUIRE_PROTOLOGTOOL = true;
@@ -236,8 +240,8 @@ public class ProtoLog {
            @NonNull String stringMessage, @NonNull Object... args) {
        final var instance = sController.mProtoLogInstance;
        if (instance == null) {
            throw new IllegalStateException(
                    "Trying to use ProtoLog before it is initialized in this process.");
            Log.wtf(LOG_TAG, "Trying to use ProtoLog before it is initialized in this process.");
            return;
        }

        if (instance.isEnabled(group, logLevel)) {