SF: Configure input windows with the first input-enabled display

We can have a situation where more than one DisplayDevice can receive
input for a layer stack. In this situation, we don't have a clear way to
distinguish which display we should use for input. We change the
implemntation so that we use the first input-enabled display in
mDisplays to configure the input windows.

In the case where a display is mirrored using the same layer stack, this
would help if the display we actually want to receive input is listed
first.

Bug: 219191788
Test: manual: Developer options > "Simulate secondary display"
Change-Id: Ic9cfff75f0178f80decf6cf1ffd3ba81a766caa6
diff --git a/services/surfaceflinger/SurfaceFlinger.cpp b/services/surfaceflinger/SurfaceFlinger.cpp
index ee1ea40..8e5f9f8 100644
--- a/services/surfaceflinger/SurfaceFlinger.cpp
+++ b/services/surfaceflinger/SurfaceFlinger.cpp
@@ -3281,15 +3281,15 @@
             continue;
         }
 
-        // There is more than one display for the layerStack. In this case, the display that is
-        // configured to receive input takes precedence.
+        // There is more than one display for the layerStack. In this case, the first display that
+        // is configured to receive input takes precedence.
         auto& details = it->second;
-        if (!display->receivesInput()) {
+        if (details.receivesInput) {
+            ALOGW_IF(display->receivesInput(),
+                     "Multiple displays claim to accept input for the same layer stack: %u",
+                     layerStackId);
             continue;
         }
-        ALOGE_IF(details.receivesInput,
-                 "Multiple displays claim to accept input for the same layer stack: %u",
-                 layerStackId);
         details.receivesInput = display->receivesInput();
         details.isSecure = display->isSecure();
         details.transform = std::move(transform);