Loading services/inputflinger/reader/EventHub.cpp +16 −0 Original line number Diff line number Diff line Loading @@ -1072,6 +1072,22 @@ status_t EventHub::getAbsoluteAxisValue(int32_t deviceId, int32_t axis, int32_t* return -1; } base::Result<std::vector<int32_t>> EventHub::getMtSlotValues(int32_t deviceId, int32_t axis, size_t slotCount) const { std::scoped_lock _l(mLock); const Device* device = getDeviceLocked(deviceId); if (device == nullptr || !device->hasValidFd() || !device->absBitmask.test(axis)) { return base::ResultError("device problem or axis not supported", NAME_NOT_FOUND); } std::vector<int32_t> outValues(slotCount + 1); outValues[0] = axis; const size_t bufferSize = outValues.size() * sizeof(int32_t); if (ioctl(device->fd, EVIOCGMTSLOTS(bufferSize), outValues.data()) != OK) { return base::ErrnoError(); } return std::move(outValues); } bool EventHub::markSupportedKeyCodes(int32_t deviceId, const std::vector<int32_t>& keyCodes, uint8_t* outFlags) const { std::scoped_lock _l(mLock); Loading services/inputflinger/reader/InputDevice.cpp +1 −1 Original line number Diff line number Diff line Loading @@ -359,6 +359,7 @@ std::list<NotifyArgs> InputDevice::process(const RawEvent* rawEvents, size_t cou if (mDropUntilNextSync) { if (rawEvent->type == EV_SYN && rawEvent->code == SYN_REPORT) { out += reset(rawEvent->when); mDropUntilNextSync = false; ALOGD_IF(debugRawEvents(), "Recovered from input event buffer overrun."); } else { Loading @@ -368,7 +369,6 @@ std::list<NotifyArgs> InputDevice::process(const RawEvent* rawEvents, size_t cou } else if (rawEvent->type == EV_SYN && rawEvent->code == SYN_DROPPED) { ALOGI("Detected input event buffer overrun for device %s.", getName().c_str()); mDropUntilNextSync = true; out += reset(rawEvent->when); } else { for_each_mapper_in_subdevice(rawEvent->deviceId, [&](InputMapper& mapper) { out += mapper.process(rawEvent); Loading services/inputflinger/reader/include/EventHub.h +6 −0 Original line number Diff line number Diff line Loading @@ -334,6 +334,10 @@ public: virtual int32_t getSwitchState(int32_t deviceId, int32_t sw) const = 0; virtual status_t getAbsoluteAxisValue(int32_t deviceId, int32_t axis, int32_t* outValue) const = 0; /* Query Multi-Touch slot values for an axis. Returns error or an 1 indexed array of size * (slotCount + 1). The value at the 0 index is set to queried axis. */ virtual base::Result<std::vector<int32_t>> getMtSlotValues(int32_t deviceId, int32_t axis, size_t slotCount) const = 0; virtual int32_t getKeyCodeForKeyLocation(int32_t deviceId, int32_t locationKeyCode) const = 0; /* Loading Loading @@ -526,6 +530,8 @@ public: int32_t locationKeyCode) const override final; status_t getAbsoluteAxisValue(int32_t deviceId, int32_t axis, int32_t* outValue) const override final; base::Result<std::vector<int32_t>> getMtSlotValues(int32_t deviceId, int32_t axis, size_t slotCount) const override final; bool markSupportedKeyCodes(int32_t deviceId, const std::vector<int32_t>& keyCodes, uint8_t* outFlags) const override final; Loading services/inputflinger/reader/include/InputDevice.h +4 −0 Original line number Diff line number Diff line Loading @@ -349,6 +349,10 @@ public: inline status_t getAbsoluteAxisValue(int32_t code, int32_t* outValue) const { return mEventHub->getAbsoluteAxisValue(mId, code, outValue); } inline base::Result<std::vector<int32_t>> getMtSlotValues(int32_t axis, size_t slotCount) const { return mEventHub->getMtSlotValues(mId, axis, slotCount); } inline bool markSupportedKeyCodes(const std::vector<int32_t>& keyCodes, uint8_t* outFlags) const { return mEventHub->markSupportedKeyCodes(mId, keyCodes, outFlags); Loading services/inputflinger/reader/mapper/MultiTouchInputMapper.cpp +2 −6 Original line number Diff line number Diff line Loading @@ -35,12 +35,8 @@ MultiTouchInputMapper::MultiTouchInputMapper(InputDeviceContext& deviceContext, MultiTouchInputMapper::~MultiTouchInputMapper() {} std::list<NotifyArgs> MultiTouchInputMapper::reset(nsecs_t when) { // The evdev multi-touch protocol does not allow userspace applications to query the initial or // current state of the pointers at any time. This means if we clear our accumulated state when // resetting the input mapper, there's no way to rebuild the full initial state of the pointers. // We can only wait for updates to all the pointers and axes. Rather than clearing the state and // rebuilding the state from scratch, we work around this kernel API limitation by never // fully clearing any state specific to the multi-touch protocol. mPointerIdBits.clear(); mMultiTouchMotionAccumulator.reset(mDeviceContext); return TouchInputMapper::reset(when); } Loading Loading
services/inputflinger/reader/EventHub.cpp +16 −0 Original line number Diff line number Diff line Loading @@ -1072,6 +1072,22 @@ status_t EventHub::getAbsoluteAxisValue(int32_t deviceId, int32_t axis, int32_t* return -1; } base::Result<std::vector<int32_t>> EventHub::getMtSlotValues(int32_t deviceId, int32_t axis, size_t slotCount) const { std::scoped_lock _l(mLock); const Device* device = getDeviceLocked(deviceId); if (device == nullptr || !device->hasValidFd() || !device->absBitmask.test(axis)) { return base::ResultError("device problem or axis not supported", NAME_NOT_FOUND); } std::vector<int32_t> outValues(slotCount + 1); outValues[0] = axis; const size_t bufferSize = outValues.size() * sizeof(int32_t); if (ioctl(device->fd, EVIOCGMTSLOTS(bufferSize), outValues.data()) != OK) { return base::ErrnoError(); } return std::move(outValues); } bool EventHub::markSupportedKeyCodes(int32_t deviceId, const std::vector<int32_t>& keyCodes, uint8_t* outFlags) const { std::scoped_lock _l(mLock); Loading
services/inputflinger/reader/InputDevice.cpp +1 −1 Original line number Diff line number Diff line Loading @@ -359,6 +359,7 @@ std::list<NotifyArgs> InputDevice::process(const RawEvent* rawEvents, size_t cou if (mDropUntilNextSync) { if (rawEvent->type == EV_SYN && rawEvent->code == SYN_REPORT) { out += reset(rawEvent->when); mDropUntilNextSync = false; ALOGD_IF(debugRawEvents(), "Recovered from input event buffer overrun."); } else { Loading @@ -368,7 +369,6 @@ std::list<NotifyArgs> InputDevice::process(const RawEvent* rawEvents, size_t cou } else if (rawEvent->type == EV_SYN && rawEvent->code == SYN_DROPPED) { ALOGI("Detected input event buffer overrun for device %s.", getName().c_str()); mDropUntilNextSync = true; out += reset(rawEvent->when); } else { for_each_mapper_in_subdevice(rawEvent->deviceId, [&](InputMapper& mapper) { out += mapper.process(rawEvent); Loading
services/inputflinger/reader/include/EventHub.h +6 −0 Original line number Diff line number Diff line Loading @@ -334,6 +334,10 @@ public: virtual int32_t getSwitchState(int32_t deviceId, int32_t sw) const = 0; virtual status_t getAbsoluteAxisValue(int32_t deviceId, int32_t axis, int32_t* outValue) const = 0; /* Query Multi-Touch slot values for an axis. Returns error or an 1 indexed array of size * (slotCount + 1). The value at the 0 index is set to queried axis. */ virtual base::Result<std::vector<int32_t>> getMtSlotValues(int32_t deviceId, int32_t axis, size_t slotCount) const = 0; virtual int32_t getKeyCodeForKeyLocation(int32_t deviceId, int32_t locationKeyCode) const = 0; /* Loading Loading @@ -526,6 +530,8 @@ public: int32_t locationKeyCode) const override final; status_t getAbsoluteAxisValue(int32_t deviceId, int32_t axis, int32_t* outValue) const override final; base::Result<std::vector<int32_t>> getMtSlotValues(int32_t deviceId, int32_t axis, size_t slotCount) const override final; bool markSupportedKeyCodes(int32_t deviceId, const std::vector<int32_t>& keyCodes, uint8_t* outFlags) const override final; Loading
services/inputflinger/reader/include/InputDevice.h +4 −0 Original line number Diff line number Diff line Loading @@ -349,6 +349,10 @@ public: inline status_t getAbsoluteAxisValue(int32_t code, int32_t* outValue) const { return mEventHub->getAbsoluteAxisValue(mId, code, outValue); } inline base::Result<std::vector<int32_t>> getMtSlotValues(int32_t axis, size_t slotCount) const { return mEventHub->getMtSlotValues(mId, axis, slotCount); } inline bool markSupportedKeyCodes(const std::vector<int32_t>& keyCodes, uint8_t* outFlags) const { return mEventHub->markSupportedKeyCodes(mId, keyCodes, outFlags); Loading
services/inputflinger/reader/mapper/MultiTouchInputMapper.cpp +2 −6 Original line number Diff line number Diff line Loading @@ -35,12 +35,8 @@ MultiTouchInputMapper::MultiTouchInputMapper(InputDeviceContext& deviceContext, MultiTouchInputMapper::~MultiTouchInputMapper() {} std::list<NotifyArgs> MultiTouchInputMapper::reset(nsecs_t when) { // The evdev multi-touch protocol does not allow userspace applications to query the initial or // current state of the pointers at any time. This means if we clear our accumulated state when // resetting the input mapper, there's no way to rebuild the full initial state of the pointers. // We can only wait for updates to all the pointers and axes. Rather than clearing the state and // rebuilding the state from scratch, we work around this kernel API limitation by never // fully clearing any state specific to the multi-touch protocol. mPointerIdBits.clear(); mMultiTouchMotionAccumulator.reset(mDeviceContext); return TouchInputMapper::reset(when); } Loading