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

Commit b8c35487 authored by Yeabkal Wubshit's avatar Yeabkal Wubshit
Browse files

Remove Unneeded RotaryEncoderInputMapper Calls

This is a minor cleanup (not feature add/bug fix) to remove unneeded
statements running on each rotary encoder input event.

Bug: 258546395
Test: no new behavior added/removed. Existing tests pass.
Change-Id: I86aece4ca61dffbb1a33e776b0e3272c6f34ea40
parent 2290d001
Loading
Loading
Loading
Loading
+19 −20
Original line number Diff line number Diff line
@@ -97,35 +97,34 @@ std::list<NotifyArgs> RotaryEncoderInputMapper::process(const RawEvent* rawEvent

std::list<NotifyArgs> RotaryEncoderInputMapper::sync(nsecs_t when, nsecs_t readTime) {
    std::list<NotifyArgs> out;
    PointerCoords pointerCoords;
    pointerCoords.clear();

    PointerProperties pointerProperties;
    pointerProperties.clear();
    pointerProperties.id = 0;
    pointerProperties.toolType = AMOTION_EVENT_TOOL_TYPE_UNKNOWN;

    float scroll = mRotaryEncoderScrollAccumulator.getRelativeVWheel();
    bool scrolled = scroll != 0;

    // Send motion event.
    if (scrolled) {
        int32_t metaState = getContext()->getGlobalMetaState();
        // This is not a pointer, so it's not associated with a display.
        int32_t displayId = ADISPLAY_ID_NONE;

    // Moving the rotary encoder should wake the device (if specified).
    uint32_t policyFlags = 0;
    if (scrolled && getDeviceContext().isExternal()) {
        policyFlags |= POLICY_FLAG_WAKE;
    }

        if (mOrientation == DISPLAY_ORIENTATION_180) {
            scroll = -scroll;
        }

    // Send motion event.
    if (scrolled) {
        int32_t metaState = getContext()->getGlobalMetaState();
        PointerCoords pointerCoords;
        pointerCoords.clear();
        pointerCoords.setAxisValue(AMOTION_EVENT_AXIS_SCROLL, scroll * mScalingFactor);

        PointerProperties pointerProperties;
        pointerProperties.clear();
        pointerProperties.id = 0;
        pointerProperties.toolType = AMOTION_EVENT_TOOL_TYPE_UNKNOWN;

        uint32_t policyFlags = 0;
        if (getDeviceContext().isExternal()) {
            policyFlags |= POLICY_FLAG_WAKE;
        }

        out.push_back(
                NotifyMotionArgs(getContext()->getNextId(), when, readTime, getDeviceId(), mSource,
                                 displayId, policyFlags, AMOTION_EVENT_ACTION_SCROLL, 0, 0,