Don't add offscreen layer twice to proto.

Fixes: 147691800
Test: Only one offscreen layer per id in dump
Change-Id: I9c741e87531ec0ed166dd1cdafc0961e243d1c96
diff --git a/services/surfaceflinger/Layer.h b/services/surfaceflinger/Layer.h
index 0fea131..05bffa0 100644
--- a/services/surfaceflinger/Layer.h
+++ b/services/surfaceflinger/Layer.h
@@ -453,8 +453,8 @@
 
     bool isRemovedFromCurrentState() const;
 
-    void writeToProto(LayersProto& layersProto,
-                      uint32_t traceFlags = SurfaceTracing::TRACE_ALL) const;
+    LayerProto* writeToProto(LayersProto& layersProto,
+                             uint32_t traceFlags = SurfaceTracing::TRACE_ALL) const;
 
     // Write states that are modified by the main thread. This includes drawing
     // state as well as buffer data. This should be called in the main or tracing