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

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

Mark some functions in InputReader code as const

This helps us reason about their side-effects.

Bug: 378308551
Test: TEST=inputflinger_tests; m $TEST && $ANDROID_HOST_OUT/nativetest64/$TEST/$TEST --gtest_filter="*ChangeAssociatedDisplayIdWhenTouchIsActive*"
Flag: EXEMPT refactor
Change-Id: I0a2e34b066254833c1fdc03c8dd3eee0962f979f
parent a834cedf
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -1085,7 +1085,7 @@ EventHubInterface* InputReader::ContextImpl::getEventHub() {
    return mReader->mEventHub.get();
}

int32_t InputReader::ContextImpl::getNextId() {
int32_t InputReader::ContextImpl::getNextId() const {
    return mIdGenerator.nextId();
}

+1 −1
Original line number Diff line number Diff line
@@ -154,7 +154,7 @@ protected:
                REQUIRES(mReader->mLock) override;
        InputReaderPolicyInterface* getPolicy() REQUIRES(mReader->mLock) override;
        EventHubInterface* getEventHub() REQUIRES(mReader->mLock) override;
        int32_t getNextId() NO_THREAD_SAFETY_ANALYSIS override;
        int32_t getNextId() const NO_THREAD_SAFETY_ANALYSIS override;
        void updateLedMetaState(int32_t metaState) REQUIRES(mReader->mLock) override;
        int32_t getLedMetaState() REQUIRES(mReader->mLock) REQUIRES(mLock) override;
        void setPreventingTouchpadTaps(bool prevent) REQUIRES(mReader->mLock)
+1 −1
Original line number Diff line number Diff line
@@ -55,7 +55,7 @@ public:
    virtual InputReaderPolicyInterface* getPolicy() = 0;
    virtual EventHubInterface* getEventHub() = 0;

    virtual int32_t getNextId() = 0;
    virtual int32_t getNextId() const = 0;

    virtual void updateLedMetaState(int32_t metaState) = 0;
    virtual int32_t getLedMetaState() = 0;
+1 −1
Original line number Diff line number Diff line
@@ -419,7 +419,7 @@ int32_t CursorInputMapper::getScanCodeState(uint32_t sourceMask, int32_t scanCod
    }
}

std::optional<ui::LogicalDisplayId> CursorInputMapper::getAssociatedDisplayId() {
std::optional<ui::LogicalDisplayId> CursorInputMapper::getAssociatedDisplayId() const {
    return mDisplayId;
}

+1 −1
Original line number Diff line number Diff line
@@ -63,7 +63,7 @@ public:

    virtual int32_t getScanCodeState(uint32_t sourceMask, int32_t scanCode) override;

    virtual std::optional<ui::LogicalDisplayId> getAssociatedDisplayId() override;
    virtual std::optional<ui::LogicalDisplayId> getAssociatedDisplayId() const override;

private:
    // Amount that trackball needs to move in order to generate a key event.
Loading