Fix the input info missing for SurfaceView

Layer snapshots with buffers but without inputinfo were not sent to input or other window info listeners. This was due to a bug in how we checked to see if the layer needed an input info. FIx this to send SurfaceView layers to window info listeners.

Fixes: 365167765
Test: LayerSnapshotTest
Test: LayerLifecycleManagerTest
Flag: EXEMPT bugfix
Change-Id: I49e5d1e503af860a8324cc8b36589748ca2b7a25
diff --git a/services/surfaceflinger/tests/unittests/LayerSnapshotTest.cpp b/services/surfaceflinger/tests/unittests/LayerSnapshotTest.cpp
index 9020723..75d2fa3 100644
--- a/services/surfaceflinger/tests/unittests/LayerSnapshotTest.cpp
+++ b/services/surfaceflinger/tests/unittests/LayerSnapshotTest.cpp
@@ -1762,6 +1762,7 @@
     UPDATE_AND_VERIFY(mSnapshotBuilder, {2});
     EXPECT_TRUE(getSnapshot(1)->isHiddenByPolicy());
 }
+
 TEST_F(LayerSnapshotTest, edgeExtensionPropagatesInHierarchy) {
     if (!com::android::graphics::libgui::flags::edge_extension_shader()) {
         GTEST_SKIP() << "Skipping test because edge_extension_shader is off";
@@ -1920,4 +1921,18 @@
     EXPECT_GE(getSnapshot({.id = 1221})->transformedBounds.top, 0);
 }
 
+TEST_F(LayerSnapshotTest, shouldUpdateInputWhenNoInputInfo) {
+    // By default the layer has no buffer, so we don't expect it to have an input info
+    EXPECT_FALSE(getSnapshot(111)->hasInputInfo());
+
+    setBuffer(111);
+
+    UPDATE_AND_VERIFY(mSnapshotBuilder, STARTING_ZORDER);
+
+    EXPECT_TRUE(getSnapshot(111)->hasInputInfo());
+    EXPECT_TRUE(getSnapshot(111)->inputInfo.inputConfig.test(
+            gui::WindowInfo::InputConfig::NO_INPUT_CHANNEL));
+    EXPECT_FALSE(getSnapshot(2)->hasInputInfo());
+}
+
 } // namespace android::surfaceflinger::frontend