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

Commit ca8dc9e4 authored by Pablo Gamito's avatar Pablo Gamito
Browse files

Initialize ProtoLog instances statically

This will guarantee that for each process ProtoLog is loaded into and used and instance will be created.

Flag: NONE part of refactor
Test: none
Change-Id: Ie6aeece2003641f1d3a02403afe042c0d741d499
parent 6b96f8c8
Loading
Loading
Loading
Loading
+12 −0
Original line number Diff line number Diff line
@@ -169,4 +169,16 @@ public class ProtoLog {
            sProtoLogInstance.log(logLevel, group, stringMessage, args);
        }
    }

    static {
        if (android.tracing.Flags.perfettoProtologTracing()) {
            sProtoLogInstance = new PerfettoProtoLogImpl();
        } else {
            if (REQUIRE_PROTOLOGTOOL) {
                throw new RuntimeException("REQUIRE_PROTOLOGTOOL not set to false.");
            } else {
                sProtoLogInstance = new LogcatOnlyProtoLogImpl();
            }
        }
    }
}