Do not slide event into the new window which can't receive motion event

When we slide an event into a new window, we should check if the window
 can receive motion events to prevent incorrect dispatching of events.

Bug: None
Test: atest inputflinger_tests

Signed-off-by: Linnan Li <lilinnan@xiaomi.corp-partner.google.com>
(cherry picked from https://partner-android-review.googlesource.com/q/commit:76f89b7a1bac7a3be2fc8f5b990e39a45a265afa)
Merged-In: Idc604c4db40f77ee682b88060b9e9d3f33c594aa
Change-Id: Idc604c4db40f77ee682b88060b9e9d3f33c594aa
diff --git a/services/inputflinger/dispatcher/InputDispatcher.cpp b/services/inputflinger/dispatcher/InputDispatcher.cpp
index 8858f0c..7f54bf1 100644
--- a/services/inputflinger/dispatcher/InputDispatcher.cpp
+++ b/services/inputflinger/dispatcher/InputDispatcher.cpp
@@ -2558,9 +2558,9 @@
                 return {};
             }
 
-            // Drop touch events if requested by input feature
+            // Do not slide events to the window which can not receive motion event
             if (newTouchedWindowHandle != nullptr &&
-                shouldDropInput(entry, newTouchedWindowHandle)) {
+                !canWindowReceiveMotionLocked(newTouchedWindowHandle, entry)) {
                 newTouchedWindowHandle = nullptr;
             }