Reland: Send WindowInfo even if the window isn't associated with a DisplayDevice

Previously reverted for b/240320932. Fixed broken test.

The previous behavior was the following: If a window was in a layerStack
for which there were no DisplayDevices that mapped to it, there was no
WindowInfo sent for it.

When a display is turned OFF, it is mapped to an invalid layer stack.
So when the primary display is turned OFF, there is no WindowInfo sent
for any windows on layerStack 0 as there are no DisplayDevices that now
map to it. In this model, no window can receive input when the display
is OFF.

In this CL, we change the behavior so that WindowInfos are sent even if
there are no DisplayDevices that map to its layerStack -- except that
in this case, we do not let the window receive touches, as we do not
have a valid transform associated with it.

Bug: 239788987
Test: See bug for repro steps
Test: Observe logs at runtime
Test: atest libgui_tests
Change-Id: Ib7e343685a0e3a87769883bdd5e24ac0e6d5e83f
(cherry picked from commit da0f62ce866950a67decdfed0748458fdeff9257)
diff --git a/services/surfaceflinger/SurfaceFlinger.cpp b/services/surfaceflinger/SurfaceFlinger.cpp
index 14e5c69..cbc068f 100644
--- a/services/surfaceflinger/SurfaceFlinger.cpp
+++ b/services/surfaceflinger/SurfaceFlinger.cpp
@@ -3329,11 +3329,11 @@
     mDrawingState.traverseInReverseZOrder([&](Layer* layer) {
         if (!layer->needsInputInfo()) return;
 
-        // Do not create WindowInfos for windows on displays that cannot receive input.
-        if (const auto opt = displayInputInfos.get(layer->getLayerStack())) {
-            const auto& info = opt->get();
-            outWindowInfos.push_back(layer->fillInputInfo(info.transform, info.isSecure));
-        }
+        const auto opt = displayInputInfos.get(layer->getLayerStack(),
+                                               [](const auto& info) -> Layer::InputDisplayArgs {
+                                                   return {&info.transform, info.isSecure};
+                                               });
+        outWindowInfos.push_back(layer->fillInputInfo(opt.value_or(Layer::InputDisplayArgs{})));
     });
 
     sNumWindowInfos = outWindowInfos.size();