Add a workaround to prevent duplicate layers in traces
Track and skip any duplicate layers before adding it to the trace. Capture the transaction trace to disk when we detect this issue to help
identify the root cause.
CL also fixes offscreen layers to capture the layers from the hierarchy.
Flag: EXEMPT bugfix
Bug: 335383156
Test: capture active layers trace
Change-Id: If7158a19b2d090bb35af4c3a143c105b4be3d5bc
diff --git a/services/surfaceflinger/SurfaceFlinger.h b/services/surfaceflinger/SurfaceFlinger.h
index 65bfce2..b128fb7 100644
--- a/services/surfaceflinger/SurfaceFlinger.h
+++ b/services/surfaceflinger/SurfaceFlinger.h
@@ -1183,7 +1183,8 @@
perfetto::protos::LayersProto dumpDrawingStateProto(uint32_t traceFlags) const
REQUIRES(kMainThreadContext);
void dumpOffscreenLayersProto(perfetto::protos::LayersProto& layersProto,
- uint32_t traceFlags = LayerTracing::TRACE_ALL) const;
+ uint32_t traceFlags = LayerTracing::TRACE_ALL) const
+ REQUIRES(kMainThreadContext);
google::protobuf::RepeatedPtrField<perfetto::protos::DisplayProto> dumpDisplayProto() const;
void doActiveLayersTracingIfNeeded(bool isCompositionComputed, bool visibleRegionDirty,
TimePoint, VsyncId) REQUIRES(kMainThreadContext);