Consume MOVE from different devices one at a time

The events received by the spy window may be batched, and batches could
be processed out of order.
To avoid this confusing behaviour, consume the events one at a time.

Fixes: 332314982
Test: TEST=inputflinger_tests; m $TEST && adb sync && adb shell -t /data/nativetest64/$TEST/$TEST --gtest_filter="*MultiDevicePilfer" --gtest_repeat=10000 --gtest_break_on_failure
Change-Id: I9a50bea24401fa55b54687ab227bd2ed5c3d43ba
diff --git a/services/inputflinger/tests/FakeWindows.cpp b/services/inputflinger/tests/FakeWindows.cpp
index bfe09bc..a6955ec 100644
--- a/services/inputflinger/tests/FakeWindows.cpp
+++ b/services/inputflinger/tests/FakeWindows.cpp
@@ -309,6 +309,9 @@
     }
     std::unique_ptr<MotionEvent> motionEvent =
             std::unique_ptr<MotionEvent>(static_cast<MotionEvent*>(event.release()));
+    if (motionEvent == nullptr) {
+        return nullptr;
+    }
     EXPECT_THAT(*motionEvent, matcher) << " on " << mName;
     return motionEvent;
 }