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

Commit b681c200 authored by Siarhei Vishniakou's avatar Siarhei Vishniakou
Browse files

Simplify hovering pointer condition

The hovering pointers are already getting cleared earlier in the
function (the call is 'tempTouchState.clearHoveringPointers();').

Therefore, the code path for "removeHoveringPointer" in response to
ACTION_HOVER_EXIT is never hit.

In this CL, we simplify this condition for clarity.

Bug: 273376858
Test: presubmit
Change-Id: Ifaa3b07cb8398a1a5715d6ce07c744a3bd5e7af5
parent bf880523
Loading
Loading
Loading
Loading
+4 −9
Original line number Diff line number Diff line
@@ -2330,16 +2330,11 @@ std::vector<InputTarget> InputDispatcher::findTouchedWindowTargetsLocked(
                continue;
            }

            if (isHoverAction) {
            if (maskedAction == AMOTION_EVENT_ACTION_HOVER_ENTER ||
                maskedAction == AMOTION_EVENT_ACTION_HOVER_MOVE) {
                const int32_t pointerId = entry.pointerProperties[0].id;
                if (maskedAction == AMOTION_EVENT_ACTION_HOVER_EXIT) {
                    // Pointer left. Remove it
                    tempTouchState.removeHoveringPointer(entry.deviceId, pointerId);
                } else {
                // The "windowHandle" is the target of this hovering pointer.
                    tempTouchState.addHoveringPointerToWindow(windowHandle, entry.deviceId,
                                                              pointerId);
                }
                tempTouchState.addHoveringPointerToWindow(windowHandle, entry.deviceId, pointerId);
            }

            // Set target flags.
+1 −0
Original line number Diff line number Diff line
@@ -3957,6 +3957,7 @@ TEST_F(InputDispatcherDisplayProjectionTest, WindowGetsEventsInCorrectCoordinate

    firstWindow->assertNoEvents();
    const MotionEvent* event = secondWindow->consumeMotion();
    ASSERT_NE(nullptr, event);
    EXPECT_EQ(AMOTION_EVENT_ACTION_DOWN, event->getAction());

    // Ensure that the events from the "getRaw" API are in logical display coordinates.