Ensure non visible layers that have input are traversed for input

If a Layer wasn't visible and nothing else changed that vsync, the
sortSnapshotsByZ function would return early and not update the z
ordered list to include the non visible input layer. Since layers can
have input even if they have no visible content, we need to include them

Test: LayerSnapshotTest#NonVisibleLayerWithInput
Bug: 320370937
Change-Id: I89dd0cdefbd0948f40089b6f7f321ad84b4ad357
diff --git a/services/surfaceflinger/FrontEnd/LayerSnapshotBuilder.cpp b/services/surfaceflinger/FrontEnd/LayerSnapshotBuilder.cpp
index bb32afa..8df5d8c 100644
--- a/services/surfaceflinger/FrontEnd/LayerSnapshotBuilder.cpp
+++ b/services/surfaceflinger/FrontEnd/LayerSnapshotBuilder.cpp
@@ -587,8 +587,8 @@
 bool LayerSnapshotBuilder::sortSnapshotsByZ(const Args& args) {
     if (!mResortSnapshots && args.forceUpdate == ForceUpdateFlags::NONE &&
         !args.layerLifecycleManager.getGlobalChanges().any(
-                RequestedLayerState::Changes::Hierarchy |
-                RequestedLayerState::Changes::Visibility)) {
+                RequestedLayerState::Changes::Hierarchy | RequestedLayerState::Changes::Visibility |
+                RequestedLayerState::Changes::Input)) {
         // We are not force updating and there are no hierarchy or visibility changes. Avoid sorting
         // the snapshots.
         return false;