Check that window handle is visible

Ensure inputwindowhandle is visible before letting it receive focused
events.

This is a temporary fix. The issue currently is that two windows can
have focus at the same time. The input consumer is made not visible,
but focus is never removed from it.

Bug: 120187922
Test: tested on taimen.
To reproduce:
enable quickstep: in settings, type "swipe", then the last setting
"swipe up on home button" choose "enable".
Next, open an app (clock or messages, for example). Open settings app.
In settings, navigate at least 1 depth into a subsetting. Next, use the
wheel to select the first app that was open. Try to click back button or
use volume keys, both should work.

Change-Id: I5730a7c7e0740fe6db2d4d581837c1af8d8740fd
(cherry picked from commit 49ee32334ad04d2e3bbee6e9216882eef8807bf2)
diff --git a/services/inputflinger/InputDispatcher.cpp b/services/inputflinger/InputDispatcher.cpp
index bea4f91..12d91bb 100644
--- a/services/inputflinger/InputDispatcher.cpp
+++ b/services/inputflinger/InputDispatcher.cpp
@@ -3093,7 +3093,7 @@
                     continue;
                 }
 
-                if (windowHandle->getInfo()->hasFocus) {
+                if (windowHandle->getInfo()->hasFocus && windowHandle->getInfo()->visible) {
                     newFocusedWindowHandle = windowHandle;
                 }
                 if (windowHandle == mLastHoverWindowHandle) {