diff --git a/packages/SystemUI/shared/src/com/android/systemui/shared/tracing/FrameProtoTracer.java b/packages/SystemUI/shared/src/com/android/systemui/shared/tracing/FrameProtoTracer.java index 356e0ca7193c1..4394ecbf79eb9 100644 --- a/packages/SystemUI/shared/src/com/android/systemui/shared/tracing/FrameProtoTracer.java +++ b/packages/SystemUI/shared/src/com/android/systemui/shared/tracing/FrameProtoTracer.java @@ -49,7 +49,7 @@ public class FrameProtoTracer private final TraceBuffer mBuffer; private final File mTraceFile; private final ProtoTraceParams mParams; - private final Choreographer mChoreographer; + private Choreographer mChoreographer; private final Queue mPool = new LinkedList<>(); private final ArrayList> mTraceables = new ArrayList<>(); private final ArrayList> mTmpTraceables = new ArrayList<>(); @@ -94,7 +94,6 @@ public class FrameProtoTracer } }); mTraceFile = params.getTraceFile(); - mChoreographer = Choreographer.getMainThreadInstance(); } public void start() { @@ -140,6 +139,9 @@ public class FrameProtoTracer } // Schedule an update on the next frame + if (mChoreographer == null) { + mChoreographer = Choreographer.getMainThreadInstance(); + } mChoreographer.postFrameCallback(this); mFrameScheduled = true; }