2828#include < MultiTouchInputMapper.h>
2929#include < NotifyArgsBuilders.h>
3030#include < PeripheralController.h>
31+ #include < ScopedFlagOverride.h>
3132#include < SingleTouchInputMapper.h>
3233#include < TestEventMatchers.h>
3334#include < TestInputListener.h>
@@ -4526,13 +4527,20 @@ TEST_F(SingleTouchInputMapperTest, Process_ShouldHandleAllToolTypes) {
45264527
45274528 NotifyMotionArgs motionArgs;
45284529
4530+ // Hold down the mouse button for the duration of the test, since the mouse tools require
4531+ // the button to be pressed to make sure they are not hovering.
4532+ processKey (mapper, BTN_MOUSE, 1 );
4533+
45294534 // default tool type is finger
45304535 processDown (mapper, 100 , 200 );
45314536 processSync (mapper);
45324537 ASSERT_NO_FATAL_FAILURE (mFakeListener ->assertNotifyMotionWasCalled (&motionArgs));
45334538 ASSERT_EQ (AMOTION_EVENT_ACTION_DOWN, motionArgs.action );
45344539 ASSERT_EQ (ToolType::FINGER, motionArgs.pointerProperties [0 ].toolType );
45354540
4541+ ASSERT_NO_FATAL_FAILURE (mFakeListener ->assertNotifyMotionWasCalled (
4542+ WithMotionAction (AMOTION_EVENT_ACTION_BUTTON_PRESS)));
4543+
45364544 // eraser
45374545 processKey (mapper, BTN_TOOL_RUBBER, 1 );
45384546 processSync (mapper);
@@ -7175,6 +7183,10 @@ TEST_F(MultiTouchInputMapperTest, Process_ShouldHandleAllToolTypes) {
71757183
71767184 NotifyMotionArgs motionArgs;
71777185
7186+ // Hold down the mouse button for the duration of the test, since the mouse tools require
7187+ // the button to be pressed to make sure they are not hovering.
7188+ processKey (mapper, BTN_MOUSE, 1 );
7189+
71787190 // default tool type is finger
71797191 processId (mapper, 1 );
71807192 processPosition (mapper, 100 , 200 );
@@ -7183,6 +7195,9 @@ TEST_F(MultiTouchInputMapperTest, Process_ShouldHandleAllToolTypes) {
71837195 ASSERT_EQ (AMOTION_EVENT_ACTION_DOWN, motionArgs.action );
71847196 ASSERT_EQ (ToolType::FINGER, motionArgs.pointerProperties [0 ].toolType );
71857197
7198+ ASSERT_NO_FATAL_FAILURE (mFakeListener ->assertNotifyMotionWasCalled (
7199+ WithMotionAction (AMOTION_EVENT_ACTION_BUTTON_PRESS)));
7200+
71867201 // eraser
71877202 processKey (mapper, BTN_TOOL_RUBBER, 1 );
71887203 processSync (mapper);
@@ -7520,6 +7535,7 @@ TEST_F(MultiTouchInputMapperTest, Configure_AssignsDisplayUniqueId) {
75207535}
75217536
75227537TEST_F (MultiTouchInputMapperTest, Process_Pointer_ShouldHandleDisplayId) {
7538+ SCOPED_FLAG_OVERRIDE (disable_touch_input_mapper_pointer_usage, true );
75237539 prepareSecondaryDisplay (ViewportType::EXTERNAL);
75247540
75257541 prepareDisplay (ui::ROTATION_0);
@@ -7532,9 +7548,9 @@ TEST_F(MultiTouchInputMapperTest, Process_Pointer_ShouldHandleDisplayId) {
75327548 processPosition (mapper, 100 , 100 );
75337549 processSync (mapper);
75347550
7535- ASSERT_NO_FATAL_FAILURE (mFakeListener ->assertNotifyMotionWasCalled (&motionArgs));
7536- ASSERT_EQ (AMOTION_EVENT_ACTION_HOVER_MOVE, motionArgs. action );
7537- ASSERT_EQ (DISPLAY_ID, motionArgs. displayId );
7551+ ASSERT_NO_FATAL_FAILURE (mFakeListener ->assertNotifyMotionWasCalled (
7552+ AllOf ( WithMotionAction (AMOTION_EVENT_ACTION_DOWN), WithDisplayId (DISPLAY_ID),
7553+ WithSource (AINPUT_SOURCE_MOUSE), WithToolType (ToolType::FINGER))) );
75387554}
75397555
75407556/* *
@@ -8604,6 +8620,8 @@ class MultiTouchPointerModeTest : public MultiTouchInputMapperTest {
86048620 * fingers start to move downwards, the gesture should be swipe.
86058621 */
86068622TEST_F (MultiTouchPointerModeTest, PointerGestureMaxSwipeWidthSwipe) {
8623+ SCOPED_FLAG_OVERRIDE (disable_touch_input_mapper_pointer_usage, false );
8624+
86078625 // The min freeform gesture width is 25units/mm x 30mm = 750
86088626 // which is greater than fraction of the diagnal length of the touchpad (349).
86098627 // Thus, MaxSwipWidth is 750.
@@ -8664,6 +8682,8 @@ TEST_F(MultiTouchPointerModeTest, PointerGestureMaxSwipeWidthSwipe) {
86648682 * the gesture should be swipe.
86658683 */
86668684TEST_F (MultiTouchPointerModeTest, PointerGestureMaxSwipeWidthLowResolutionSwipe) {
8685+ SCOPED_FLAG_OVERRIDE (disable_touch_input_mapper_pointer_usage, false );
8686+
86678687 // The min freeform gesture width is 5units/mm x 30mm = 150
86688688 // which is greater than fraction of the diagnal length of the touchpad (349).
86698689 // Thus, MaxSwipWidth is the fraction of the diagnal length, 349.
@@ -8723,6 +8743,8 @@ TEST_F(MultiTouchPointerModeTest, PointerGestureMaxSwipeWidthLowResolutionSwipe)
87238743 * freeform gestures after two fingers start to move downwards.
87248744 */
87258745TEST_F (MultiTouchPointerModeTest, PointerGestureMaxSwipeWidthFreeform) {
8746+ SCOPED_FLAG_OVERRIDE (disable_touch_input_mapper_pointer_usage, false );
8747+
87268748 preparePointerMode (/* xResolution=*/ 25 , /* yResolution=*/ 25 );
87278749 MultiTouchInputMapper& mapper = constructAndAddMapper<MultiTouchInputMapper>();
87288750
@@ -8818,6 +8840,8 @@ TEST_F(MultiTouchPointerModeTest, PointerGestureMaxSwipeWidthFreeform) {
88188840}
88198841
88208842TEST_F (MultiTouchPointerModeTest, TwoFingerSwipeOffsets) {
8843+ SCOPED_FLAG_OVERRIDE (disable_touch_input_mapper_pointer_usage, false );
8844+
88218845 preparePointerMode (/* xResolution=*/ 25 , /* yResolution=*/ 25 );
88228846 MultiTouchInputMapper& mapper = constructAndAddMapper<MultiTouchInputMapper>();
88238847 NotifyMotionArgs motionArgs;
@@ -8864,6 +8888,8 @@ TEST_F(MultiTouchPointerModeTest, TwoFingerSwipeOffsets) {
88648888}
88658889
88668890TEST_F (MultiTouchPointerModeTest, WhenViewportActiveStatusChanged_PointerGestureIsReset) {
8891+ SCOPED_FLAG_OVERRIDE (disable_touch_input_mapper_pointer_usage, false );
8892+
88678893 preparePointerMode (/* xResolution=*/ 25 , /* yResolution=*/ 25 );
88688894 mFakeEventHub ->addKey (EVENTHUB_ID, BTN_TOOL_PEN, 0 , AKEYCODE_UNKNOWN, 0 );
88698895 MultiTouchInputMapper& mapper = constructAndAddMapper<MultiTouchInputMapper>();
0 commit comments