Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit f3645eab authored by Harry Cutts's avatar Harry Cutts Committed by Android (Google) Code Review
Browse files

Merge "GestureConverter: add classification to fling stops" into main

parents 95660fb1 574781a7
Loading
Loading
Loading
Loading
+2 −1
Original line number Diff line number Diff line
@@ -420,8 +420,8 @@ std::list<NotifyArgs> GestureConverter::handleFling(nsecs_t when, nsecs_t readTi

                    std::list<NotifyArgs> out;
                    mDownTime = when;
                    mCurrentClassification = MotionClassification::TWO_FINGER_SWIPE;
                    out += exitHover(when, readTime, xCursorPosition, yCursorPosition);
                    // TODO(b/281106755): add a MotionClassification value for fling stops.
                    out.push_back(makeMotionArgs(when, readTime, AMOTION_EVENT_ACTION_DOWN,
                                                 /*actionButton=*/0, /*buttonState=*/0,
                                                 /*pointerCount=*/1, &coords, xCursorPosition,
@@ -431,6 +431,7 @@ std::list<NotifyArgs> GestureConverter::handleFling(nsecs_t when, nsecs_t readTi
                                                 /*pointerCount=*/1, &coords, xCursorPosition,
                                                 yCursorPosition));
                    out += enterHover(when, readTime, xCursorPosition, yCursorPosition);
                    mCurrentClassification = MotionClassification::NONE;
                    return out;
                } else {
                    // Use the tap down state of a fling gesture as an indicator that a contact
+10 −10
Original line number Diff line number Diff line
@@ -1192,12 +1192,12 @@ TEST_F(GestureConverterTest, FlingTapDownAfterScrollStopsFling) {
                            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 @@ TEST_F(GestureConverterTestWithChoreographer, FlingTapDownAfterScrollStopsFling)
                            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) {