[sf] provide a unique id for snapshots

Input and layer tracing relies on the fact that all layers
have a unique id. Because mirror layers are no longer
implemented by duplicating layers, we can have multiple
snapshots with the same id. To fix this, provide a unique
id that can be used by consumers who require them.

Test: atest FlickerTest
Bug: 238781169
Change-Id: Ibe54154b6e14f72bfe73a15faa0e7e0d19293e36
diff --git a/services/surfaceflinger/FrontEnd/LayerSnapshotBuilder.cpp b/services/surfaceflinger/FrontEnd/LayerSnapshotBuilder.cpp
index db6e716..344dab4 100644
--- a/services/surfaceflinger/FrontEnd/LayerSnapshotBuilder.cpp
+++ b/services/surfaceflinger/FrontEnd/LayerSnapshotBuilder.cpp
@@ -957,7 +957,7 @@
     }
 
     snapshot.inputInfo.name = requested.name;
-    snapshot.inputInfo.id = static_cast<int32_t>(requested.id);
+    snapshot.inputInfo.id = static_cast<int32_t>(snapshot.uniqueSequence);
     snapshot.inputInfo.ownerUid = static_cast<int32_t>(requested.ownerUid);
     snapshot.inputInfo.ownerPid = requested.ownerPid;
     snapshot.inputInfo.displayId = static_cast<int32_t>(snapshot.outputFilter.layerStack.id);