SF: Update metadata of unvisible layers to backend

ARC++ relies on metadata to convey a variety of information, including
window states through a in-house metadata. Some of them may change when
a layer is invisible, and ARC++ backend needs to respond to these
changes immediately. Such case may happen when user minimizes a window.

Bug: 340946541
Test: Minimize on ARC++.
Test: atest libsurfaceflinger_unittest
Change-Id: Ie384cc8bd672a8277ef9437f908a6f969e422aee
diff --git a/services/surfaceflinger/FrontEnd/LayerSnapshotBuilder.h b/services/surfaceflinger/FrontEnd/LayerSnapshotBuilder.h
index 1cec018..dbbad76 100644
--- a/services/surfaceflinger/FrontEnd/LayerSnapshotBuilder.h
+++ b/services/surfaceflinger/FrontEnd/LayerSnapshotBuilder.h
@@ -86,6 +86,11 @@
     // Visit each visible snapshot in z-order and move the snapshot if needed
     void forEachVisibleSnapshot(const Visitor& visitor);
 
+    typedef std::function<bool(const LayerSnapshot& snapshot)> ConstPredicate;
+    // Visit each snapshot that satisfies the predicate and move the snapshot if needed with visible
+    // snapshots in z-order
+    void forEachSnapshot(const Visitor& visitor, const ConstPredicate& predicate);
+
     // Visit each snapshot interesting to input reverse z-order
     void forEachInputSnapshot(const ConstVisitor& visitor) const;