[sf] Use layer id as snapshot ids

Flicker tests rely on layer ids for some assertions. So when possible
use the layer id for the snapshot used to generate layer traces.
Also keep track of the order in which layers are added so its easier to
write tests.

Test: atest FlickerTests w/new fe
Bug: 238781169
Change-Id: Ie0f93ca956e6d043c9d95d00bc205d242e47c4cc
diff --git a/services/surfaceflinger/LayerProtoHelper.cpp b/services/surfaceflinger/LayerProtoHelper.cpp
index 5d92485..3472d20 100644
--- a/services/surfaceflinger/LayerProtoHelper.cpp
+++ b/services/surfaceflinger/LayerProtoHelper.cpp
@@ -392,7 +392,11 @@
 
     layerInfo->set_id(snapshot.uniqueSequence);
     layerInfo->set_original_id(snapshot.sequence);
-    layerInfo->set_name(requestedState.name);
+    if (!snapshot.path.isClone()) {
+        layerInfo->set_name(requestedState.name);
+    } else {
+        layerInfo->set_name(requestedState.name + "(Mirror)");
+    }
     layerInfo->set_type("Layer");
 
     LayerProtoHelper::writeToProto(requestedState.transparentRegion,