Dump offscreen layers in dumpsys and winscope trace

Now that clients can keep layers alive by holding a reference to its handle and clients can also
create layers, we need to an easier way to keep track of layers that are offscreen but not
destroyed. This change keeps track of the calling pid and uid so it is easier to track the creating
process. Since the tracing thread will also read from mOffscreenLayers, we want to protect
access to it with the tracing lock.

Bug:127687760
Test: run dumpsys check for offscreen layers
Test: capture sf trace and check for offscreen layers
Change-Id: I400f33b11b0a4f78f4c35027c457eb56ff12c22e
diff --git a/services/surfaceflinger/SurfaceFlinger.h b/services/surfaceflinger/SurfaceFlinger.h
index 8408ef5..d44ff9c 100644
--- a/services/surfaceflinger/SurfaceFlinger.h
+++ b/services/surfaceflinger/SurfaceFlinger.h
@@ -876,8 +876,11 @@
     void dumpDisplayIdentificationData(std::string& result) const;
     void dumpWideColorInfo(std::string& result) const;
     LayersProto dumpDrawingStateProto(uint32_t traceFlags = SurfaceTracing::TRACE_ALL) const;
+    void dumpOffscreenLayersProto(LayersProto& layersProto,
+                                  uint32_t traceFlags = SurfaceTracing::TRACE_ALL) const;
     LayersProto dumpProtoFromMainThread(uint32_t traceFlags = SurfaceTracing::TRACE_ALL)
             EXCLUDES(mStateLock);
+    void dumpOffscreenLayers(std::string& result) EXCLUDES(mStateLock);
     void withTracingLock(std::function<void()> operation) REQUIRES(mStateLock);
 
     bool isLayerTripleBufferingDisabled() const {