Input window info has the same token with newTouchedWindowHandle is not obscured window

The mirrored window also has its own input window info. And its token
is the same as the original window's token. So we can check the token
to excluded the mirrored window from an obscured window.

Bug: 144075853
Test: adb shell settings put secure window_magnification 1
1. Turn on window magnification
2. Go to a11y menu service setting and click on the switch.
3. Move window magnification overlay above the setting dialog.
4. Click the dialog ok button.

Change-Id: Ida21a80b7d24bc1fed00a228462ed5db3db43af2
diff --git a/services/inputflinger/dispatcher/InputDispatcher.cpp b/services/inputflinger/dispatcher/InputDispatcher.cpp
index 308d19b..01a40de 100644
--- a/services/inputflinger/dispatcher/InputDispatcher.cpp
+++ b/services/inputflinger/dispatcher/InputDispatcher.cpp
@@ -1993,13 +1993,13 @@
     int32_t displayId = windowHandle->getInfo()->displayId;
     const std::vector<sp<InputWindowHandle>> windowHandles = getWindowHandlesLocked(displayId);
     for (const sp<InputWindowHandle>& otherHandle : windowHandles) {
-        if (otherHandle == windowHandle) {
+        if (haveSameToken(otherHandle, windowHandle)) {
             break;
         }
 
         const InputWindowInfo* otherInfo = otherHandle->getInfo();
-        if (otherInfo->displayId == displayId && otherInfo->visible &&
-            !otherInfo->isTrustedOverlay() && otherInfo->frameContainsPoint(x, y)) {
+        if (otherInfo->visible && !otherInfo->isTrustedOverlay() &&
+            otherInfo->frameContainsPoint(x, y)) {
             return true;
         }
     }
@@ -2011,13 +2011,13 @@
     const std::vector<sp<InputWindowHandle>> windowHandles = getWindowHandlesLocked(displayId);
     const InputWindowInfo* windowInfo = windowHandle->getInfo();
     for (const sp<InputWindowHandle>& otherHandle : windowHandles) {
-        if (otherHandle == windowHandle) {
+        if (haveSameToken(otherHandle, windowHandle)) {
             break;
         }
 
         const InputWindowInfo* otherInfo = otherHandle->getInfo();
-        if (otherInfo->displayId == displayId && otherInfo->visible &&
-            !otherInfo->isTrustedOverlay() && otherInfo->overlaps(windowInfo)) {
+        if (otherInfo->visible && !otherInfo->isTrustedOverlay() &&
+            otherInfo->overlaps(windowInfo)) {
             return true;
         }
     }