GestureConverter: add classification to fling stops
This fixes fling stopping in Docs by causing the fling stop events to be
sent down its touch event pathway rather than its mouse event one (which
doesn't have the concept of cancellations).
In future we could consider adding a separate classification for fling
stops rather than using the one for the swipe motion itself, but for now
we think it makes semantic sense to have both with the same
classification since they're kind of parts of the same gesture.
Bug: 281106755
Test: with a Google Doc open, fling with two fingers on a touchpad, then
touch the pad again and check that the fling stops without moving
the insertion point
Flag: com.android.input.flags.enable_touchpad_fling_stop
Change-Id: Ia4fb358d510c1058eecee74ad862253d6bd2cd50
diff --git a/services/inputflinger/tests/GestureConverter_test.cpp b/services/inputflinger/tests/GestureConverter_test.cpp
index 337b52b..6a009b2 100644
--- a/services/inputflinger/tests/GestureConverter_test.cpp
+++ b/services/inputflinger/tests/GestureConverter_test.cpp
@@ -1192,12 +1192,12 @@
VariantWith<NotifyMotionArgs>(
WithMotionAction(AMOTION_EVENT_ACTION_CANCEL)),
VariantWith<NotifyMotionArgs>(
- AllOf(WithMotionAction(AMOTION_EVENT_ACTION_HOVER_ENTER),
- WithMotionClassification(MotionClassification::NONE)))));
+ WithMotionAction(AMOTION_EVENT_ACTION_HOVER_ENTER))));
ASSERT_THAT(args,
- Each(VariantWith<NotifyMotionArgs>(AllOf(WithCoords(POINTER_X, POINTER_Y),
- WithToolType(ToolType::FINGER),
- WithDisplayId(ADISPLAY_ID_DEFAULT)))));
+ Each(VariantWith<NotifyMotionArgs>(
+ AllOf(WithCoords(POINTER_X, POINTER_Y), WithToolType(ToolType::FINGER),
+ WithDisplayId(ADISPLAY_ID_DEFAULT),
+ WithMotionClassification(MotionClassification::TWO_FINGER_SWIPE)))));
}
TEST_F(GestureConverterTest, Tap) {
@@ -2613,12 +2613,12 @@
VariantWith<NotifyMotionArgs>(
WithMotionAction(AMOTION_EVENT_ACTION_CANCEL)),
VariantWith<NotifyMotionArgs>(
- AllOf(WithMotionAction(AMOTION_EVENT_ACTION_HOVER_ENTER),
- WithMotionClassification(MotionClassification::NONE)))));
+ WithMotionAction(AMOTION_EVENT_ACTION_HOVER_ENTER))));
ASSERT_THAT(args,
- Each(VariantWith<NotifyMotionArgs>(AllOf(WithCoords(0, 0),
- WithToolType(ToolType::FINGER),
- WithDisplayId(ADISPLAY_ID_DEFAULT)))));
+ Each(VariantWith<NotifyMotionArgs>(
+ AllOf(WithCoords(0, 0), WithToolType(ToolType::FINGER),
+ WithDisplayId(ADISPLAY_ID_DEFAULT),
+ WithMotionClassification(MotionClassification::TWO_FINGER_SWIPE)))));
}
TEST_F(GestureConverterTestWithChoreographer, Tap) {