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

Commit 4fff058e authored by Winson Chung's avatar Winson Chung
Browse files

Allow disabling protolog exceptions

Bug: 171417169
Test: Build and make sure protologs still works and sysui gradle
      project can build as well
Change-Id: I29684d8b3b5fc49e8179dc15eac9c37cf706322b
parent 0197100d
Loading
Loading
Loading
Loading
+28 −12
Original line number Diff line number Diff line
@@ -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,9 +48,11 @@ public class ProtoLog {
     */
    public static void d(IProtoLogGroup group, String messageString, Object... args) {
        // Stub, replaced by the ProtoLogTool.
        if (REQUIRE_PROTOLOGTOOL) {
            throw new UnsupportedOperationException(
                    "ProtoLog calls MUST be processed with ProtoLogTool");
        }
    }

    /**
     * VERBOSE level log.
@@ -57,9 +63,11 @@ public class ProtoLog {
     */
    public static void v(IProtoLogGroup group, String messageString, Object... args) {
        // Stub, replaced by the ProtoLogTool.
        if (REQUIRE_PROTOLOGTOOL) {
            throw new UnsupportedOperationException(
                    "ProtoLog calls MUST be processed with ProtoLogTool");
        }
    }

    /**
     * INFO level log.
@@ -70,9 +78,11 @@ public class ProtoLog {
     */
    public static void i(IProtoLogGroup group, String messageString, Object... args) {
        // Stub, replaced by the ProtoLogTool.
        if (REQUIRE_PROTOLOGTOOL) {
            throw new UnsupportedOperationException(
                    "ProtoLog calls MUST be processed with ProtoLogTool");
        }
    }

    /**
     * WARNING level log.
@@ -83,9 +93,11 @@ public class ProtoLog {
     */
    public static void w(IProtoLogGroup group, String messageString, Object... args) {
        // Stub, replaced by the ProtoLogTool.
        if (REQUIRE_PROTOLOGTOOL) {
            throw new UnsupportedOperationException(
                    "ProtoLog calls MUST be processed with ProtoLogTool");
        }
    }

    /**
     * ERROR level log.
@@ -96,9 +108,11 @@ public class ProtoLog {
     */
    public static void e(IProtoLogGroup group, String messageString, Object... args) {
        // Stub, replaced by the ProtoLogTool.
        if (REQUIRE_PROTOLOGTOOL) {
            throw new UnsupportedOperationException(
                    "ProtoLog calls MUST be processed with ProtoLogTool");
        }
    }

    /**
     * WHAT A TERRIBLE FAILURE level log.
@@ -109,7 +123,9 @@ public class ProtoLog {
     */
    public static void wtf(IProtoLogGroup group, String messageString, Object... args) {
        // Stub, replaced by the ProtoLogTool.
        if (REQUIRE_PROTOLOGTOOL) {
            throw new UnsupportedOperationException(
                    "ProtoLog calls MUST be processed with ProtoLogTool");
        }
    }
}
+3 −0
Original line number Diff line number Diff line
@@ -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