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

Commit ba9364ac authored by Harry Cutts's avatar Harry Cutts
Browse files

Use a const InputDeviceContext ref in HardwareStateConverter

This involved changing a number of other references that could have been
const but weren't, hence this being a separate CL from the original.

Bug: 251196347
Test: build succeeds
Test: m inputflinger_tests && \
      $ANDROID_HOST_OUT/nativetest64/inputflinger_tests/inputflinger_tests \
      --gtest_filter='*HardwareStateConverterTest*'
Change-Id: Id4ecad74c9be19bd26aac525f0ebf44536677f85
parent 3a0ced4b
Loading
Loading
Loading
Loading
+1 −1
Original line number Original line Diff line number Diff line
@@ -403,7 +403,7 @@ public:
    inline status_t enableDevice() { return mEventHub->enableDevice(mId); }
    inline status_t enableDevice() { return mEventHub->enableDevice(mId); }
    inline status_t disableDevice() { return mEventHub->disableDevice(mId); }
    inline status_t disableDevice() { return mEventHub->disableDevice(mId); }


    inline const std::string getName() { return mDevice.getName(); }
    inline const std::string getName() const { return mDevice.getName(); }
    inline const std::string getDescriptor() { return mDevice.getDescriptor(); }
    inline const std::string getDescriptor() { return mDevice.getDescriptor(); }
    inline bool isExternal() { return mDevice.isExternal(); }
    inline bool isExternal() { return mDevice.isExternal(); }
    inline std::optional<uint8_t> getAssociatedDisplayPort() const {
    inline std::optional<uint8_t> getAssociatedDisplayPort() const {
+1 −1
Original line number Original line Diff line number Diff line
@@ -25,7 +25,7 @@ CursorButtonAccumulator::CursorButtonAccumulator() {
    clearButtons();
    clearButtons();
}
}


void CursorButtonAccumulator::reset(InputDeviceContext& deviceContext) {
void CursorButtonAccumulator::reset(const InputDeviceContext& deviceContext) {
    mBtnLeft = deviceContext.isKeyPressed(BTN_LEFT);
    mBtnLeft = deviceContext.isKeyPressed(BTN_LEFT);
    mBtnRight = deviceContext.isKeyPressed(BTN_RIGHT);
    mBtnRight = deviceContext.isKeyPressed(BTN_RIGHT);
    mBtnMiddle = deviceContext.isKeyPressed(BTN_MIDDLE);
    mBtnMiddle = deviceContext.isKeyPressed(BTN_MIDDLE);
+1 −1
Original line number Original line Diff line number Diff line
@@ -27,7 +27,7 @@ struct RawEvent;
class CursorButtonAccumulator {
class CursorButtonAccumulator {
public:
public:
    CursorButtonAccumulator();
    CursorButtonAccumulator();
    void reset(InputDeviceContext& deviceContext);
    void reset(const InputDeviceContext& deviceContext);


    void process(const RawEvent* rawEvent);
    void process(const RawEvent* rawEvent);


+2 −2
Original line number Original line Diff line number Diff line
@@ -26,8 +26,8 @@ namespace android {
MultiTouchMotionAccumulator::MultiTouchMotionAccumulator()
MultiTouchMotionAccumulator::MultiTouchMotionAccumulator()
      : mCurrentSlot(-1), mUsingSlotsProtocol(false) {}
      : mCurrentSlot(-1), mUsingSlotsProtocol(false) {}


void MultiTouchMotionAccumulator::configure(InputDeviceContext& deviceContext, size_t slotCount,
void MultiTouchMotionAccumulator::configure(const InputDeviceContext& deviceContext,
                                            bool usingSlotsProtocol) {
                                            size_t slotCount, bool usingSlotsProtocol) {
    mUsingSlotsProtocol = usingSlotsProtocol;
    mUsingSlotsProtocol = usingSlotsProtocol;
    mSlots = std::vector<Slot>(slotCount);
    mSlots = std::vector<Slot>(slotCount);


+2 −1
Original line number Original line Diff line number Diff line
@@ -72,7 +72,8 @@ public:


    MultiTouchMotionAccumulator();
    MultiTouchMotionAccumulator();


    void configure(InputDeviceContext& deviceContext, size_t slotCount, bool usingSlotsProtocol);
    void configure(const InputDeviceContext& deviceContext, size_t slotCount,
                   bool usingSlotsProtocol);
    void process(const RawEvent* rawEvent);
    void process(const RawEvent* rawEvent);
    void finishSync();
    void finishSync();


Loading