Fix drag and drop failed while recording video

The 'transferTouchFocus' would check if the two windows are exist and
if they are coming from same display. But the mirror surface would
share the same token of the original one. That could cause
'getWindowHandle' return the first window that not belongs to the
display of the target window.

To fix this, we would check the touch state to see if the from window
is being touched, and check if the target window is also coming from
same display, then do the transfer touch focus.

Bug: 195380978
Test: atest inputflinger_tests
Test: atest CrossAppDragAndDropTests
Test: enable video recording, do drag and drop
Change-Id: I458dfb138d446656117828f1229fcc871e8b5e1d
diff --git a/services/inputflinger/dispatcher/InputDispatcher.h b/services/inputflinger/dispatcher/InputDispatcher.h
index 2436e73..1aa78d9 100644
--- a/services/inputflinger/dispatcher/InputDispatcher.h
+++ b/services/inputflinger/dispatcher/InputDispatcher.h
@@ -653,6 +653,10 @@
     void doPokeUserActivityLockedInterruptible(CommandEntry* commandEntry) REQUIRES(mLock);
     void doOnPointerDownOutsideFocusLockedInterruptible(CommandEntry* commandEntry) REQUIRES(mLock);
 
+    // Find touched state and touched window by token.
+    std::pair<TouchState*, TouchedWindow*> findTouchStateAndWindowLocked(const sp<IBinder>& token)
+            REQUIRES(mLock);
+
     // Statistics gathering.
     LatencyAggregator mLatencyAggregator GUARDED_BY(mLock);
     LatencyTracker mLatencyTracker GUARDED_BY(mLock);