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

Commit 290b072d authored by Harry Cutts's avatar Harry Cutts
Browse files

InputDevice: clear absolute axis info if not found

In change I57de645c889de53c8be0f9f8744a62e92fafdadb, getAbsoluteAxisInfo
was modified to handle EventHub::getAbsoluteAxisInfo returning an
optional. However, the old form of EventHub::getAbsoluteAxisInfo had the
side effect of clearing the RawAbsoluteAxisInfo struct that it was
passed a pointer to if the axis isn't present, crucially setting valid
to false. To avoid a behaviour change due to the refactor, mimic that in
InputDevice::getAbsoluteAxisInfo.

Test: atest inputflinger_tests
Test: m checkinput
Bug: 245989146
Flag: EXEMPT refactor
Change-Id: If32272f983139c2e9d5f1e548fb209c21d191180
parent f8e23023
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -308,6 +308,7 @@ public:
    inline status_t getAbsoluteAxisInfo(int32_t code, RawAbsoluteAxisInfo* axisInfo) const {
        std::optional<RawAbsoluteAxisInfo> info = mEventHub->getAbsoluteAxisInfo(mId, code);
        if (!info.has_value()) {
            axisInfo->clear();
            return NAME_NOT_FOUND;
        }
        *axisInfo = *info;