Update snapshot changes flags when visibility changes

Layerhistory walks through all snapshots and checks the change
flags before updating its state. When a layer moves offscreen,
we update its snapshot but did not update the change flag. This
cl fixes this.

Bug: 345021645
Test: presubmit
Flag: EXEMPT bugfix

Change-Id: Icee06279f0fa8b0f4c0539e99dde8960ba3fab31
diff --git a/services/surfaceflinger/FrontEnd/LayerSnapshotBuilder.cpp b/services/surfaceflinger/FrontEnd/LayerSnapshotBuilder.cpp
index 6d4b0b5..ca53a0d 100644
--- a/services/surfaceflinger/FrontEnd/LayerSnapshotBuilder.cpp
+++ b/services/surfaceflinger/FrontEnd/LayerSnapshotBuilder.cpp
@@ -256,6 +256,9 @@
 }
 
 void updateVisibility(LayerSnapshot& snapshot, bool visible) {
+    if (snapshot.isVisible != visible) {
+        snapshot.changes |= RequestedLayerState::Changes::Visibility;
+    }
     snapshot.isVisible = visible;
 
     // TODO(b/238781169) we are ignoring this compat for now, since we will have