SF: Add mirror layers to transaction trace

Test: atest TransactionTracingTest
Bug: 200284593
Change-Id: I40fbf806f68c6b0bad29fb4568ac5ae1a547cc3b
diff --git a/services/surfaceflinger/Tracing/TransactionProtoParser.cpp b/services/surfaceflinger/Tracing/TransactionProtoParser.cpp
index 783b36e..d12b253 100644
--- a/services/surfaceflinger/Tracing/TransactionProtoParser.cpp
+++ b/services/surfaceflinger/Tracing/TransactionProtoParser.cpp
@@ -278,6 +278,7 @@
     proto.set_name(args.name);
     proto.set_flags(args.flags);
     proto.set_parent_id(args.parentId);
+    proto.set_mirror_from_id(args.mirrorFromId);
     return proto;
 }
 
@@ -312,6 +313,7 @@
     outArgs.name = proto.name();
     outArgs.flags = proto.flags();
     outArgs.parentId = proto.parent_id();
+    outArgs.mirrorFromId = proto.mirror_from_id();
 }
 
 void TransactionProtoParser::fromProto(const proto::LayerState& proto,
@@ -320,6 +322,7 @@
     fromProto(proto, getLayerHandle, static_cast<layer_state_t&>(outState));
     if (proto.what() & layer_state_t::eReparent) {
         outState.parentId = proto.parent_id();
+        outState.args.parentId = outState.parentId;
     }
     if (proto.what() & layer_state_t::eRelativeLayerChanged) {
         outState.relativeParentId = proto.relative_parent_id();
@@ -508,7 +511,9 @@
                                                DisplayIdToHandleFn getDisplayHandle) {
     DisplayState display;
     display.what = proto.what();
-    display.token = getDisplayHandle(proto.id());
+    if (getDisplayHandle != nullptr) {
+        display.token = getDisplayHandle(proto.id());
+    }
 
     if (display.what & DisplayState::eLayerStackChanged) {
         display.layerStack.id = proto.layer_stack();