diff options
| author | 2022-11-09 17:49:22 -0800 | |
|---|---|---|
| committer | 2022-11-22 19:12:07 +0000 | |
| commit | b8c35487e7a424f0cce1b9f7e9ab7d1f845fd78e (patch) | |
| tree | cb9ea7c78c8e7353f732155d39b064bc9c72c734 | |
| parent | 2290d001a604440e20eb124d93b146013d4d7184 (diff) | |
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
| -rw-r--r-- | services/inputflinger/reader/mapper/RotaryEncoderInputMapper.cpp | 39 |
1 files changed, 19 insertions, 20 deletions
diff --git a/services/inputflinger/reader/mapper/RotaryEncoderInputMapper.cpp b/services/inputflinger/reader/mapper/RotaryEncoderInputMapper.cpp index 29a1bda3ee..06d4dc342d 100644 --- a/services/inputflinger/reader/mapper/RotaryEncoderInputMapper.cpp +++ b/services/inputflinger/reader/mapper/RotaryEncoderInputMapper.cpp @@ -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; - // 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(); + // This is not a pointer, so it's not associated with a display. + int32_t displayId = ADISPLAY_ID_NONE; + + if (mOrientation == DISPLAY_ORIENTATION_180) { + scroll = -scroll; + } + + 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, |