InputDispatcher: Remove gesture monitor implementation
Bug: 162194035
Test: atest inputflinger_tests
Change-Id: I4404c9625f879d805aabdbda6d502dac1d0cd881
diff --git a/services/inputflinger/tests/InputDispatcher_test.cpp b/services/inputflinger/tests/InputDispatcher_test.cpp
index 7d8b58f..e2f0343 100644
--- a/services/inputflinger/tests/InputDispatcher_test.cpp
+++ b/services/inputflinger/tests/InputDispatcher_test.cpp
@@ -1126,6 +1126,16 @@
expectedFlags);
}
+ void consumeMotionOutsideWithZeroedCoords(int32_t expectedDisplayId = ADISPLAY_ID_DEFAULT,
+ int32_t expectedFlags = 0) {
+ InputEvent* event = consume();
+ ASSERT_EQ(AINPUT_EVENT_TYPE_MOTION, event->getType());
+ const MotionEvent& motionEvent = static_cast<MotionEvent&>(*event);
+ EXPECT_EQ(AMOTION_EVENT_ACTION_OUTSIDE, motionEvent.getActionMasked());
+ EXPECT_EQ(0.f, motionEvent.getRawPointerCoords(0)->getX());
+ EXPECT_EQ(0.f, motionEvent.getRawPointerCoords(0)->getY());
+ }
+
void consumeFocusEvent(bool hasFocus, bool inTouchMode = true) {
ASSERT_NE(mInputReceiver, nullptr)
<< "Cannot consume events from a window with no receiver";
@@ -2768,8 +2778,7 @@
FakeMonitorReceiver(const std::unique_ptr<InputDispatcher>& dispatcher, const std::string name,
int32_t displayId) {
base::Result<std::unique_ptr<InputChannel>> channel =
- dispatcher->createInputMonitor(displayId, false /*isGestureMonitor*/, name,
- MONITOR_PID);
+ dispatcher->createInputMonitor(displayId, name, MONITOR_PID);
mInputReceiver = std::make_unique<FakeInputReceiver>(std::move(*channel), name);
}
@@ -5612,11 +5621,7 @@
touch();
- InputEvent* event = w->consume();
- ASSERT_EQ(AINPUT_EVENT_TYPE_MOTION, event->getType());
- MotionEvent& motionEvent = static_cast<MotionEvent&>(*event);
- EXPECT_EQ(0.0f, motionEvent.getRawPointerCoords(0)->getX());
- EXPECT_EQ(0.0f, motionEvent.getRawPointerCoords(0)->getY());
+ w->consumeMotionOutsideWithZeroedCoords();
}
TEST_F(InputDispatcherUntrustedTouchesTest, WindowWithOpacityBelowThreshold_AllowsTouch) {
@@ -6424,20 +6429,23 @@
/**
* A spy window can listen for touches outside its touchable region using the WATCH_OUTSIDE_TOUCHES
- * flag.
+ * flag, but it will get zero-ed out coordinates if the foreground has a different owner.
*/
TEST_F(InputDispatcherSpyWindowTest, WatchOutsideTouches) {
auto window = createForeground();
+ window->setOwnerInfo(12, 34);
auto spy = createSpy(WindowInfo::Flag::NOT_TOUCH_MODAL | WindowInfo::Flag::WATCH_OUTSIDE_TOUCH);
+ spy->setOwnerInfo(56, 78);
spy->setFrame(Rect{0, 0, 20, 20});
mDispatcher->setInputWindows({{ADISPLAY_ID_DEFAULT, {spy, window}}});
// Inject an event outside the spy window's frame and touchable region.
ASSERT_EQ(InputEventInjectionResult::SUCCEEDED,
- injectMotionDown(mDispatcher, AINPUT_SOURCE_TOUCHSCREEN, ADISPLAY_ID_DEFAULT))
+ injectMotionDown(mDispatcher, AINPUT_SOURCE_TOUCHSCREEN, ADISPLAY_ID_DEFAULT,
+ {100, 200}))
<< "Inject motion event should return InputEventInjectionResult::SUCCEEDED";
window->consumeMotionDown();
- spy->consumeMotionOutside();
+ spy->consumeMotionOutsideWithZeroedCoords();
}
/**