Loading services/inputflinger/include/InputReaderBase.h +5 −0 Original line number Diff line number Diff line Loading @@ -34,6 +34,7 @@ #include <vector> #include "PointerControllerInterface.h" #include "TouchpadHardwareState.h" #include "VibrationElement.h" #include "include/gestures.h" Loading Loading @@ -461,6 +462,10 @@ public: */ virtual void notifyInputDevicesChanged(const std::vector<InputDeviceInfo>& inputDevices) = 0; /* Sends the hardware state of a connected touchpad */ virtual void notifyTouchpadHardwareState(const SelfContainedHardwareState& schs, int32_t deviceId) = 0; /* Gets the keyboard layout for a particular input device. */ virtual std::shared_ptr<KeyCharacterMap> getKeyboardLayoutOverlay( const InputDeviceIdentifier& identifier, Loading services/inputflinger/reader/mapper/TouchpadInputMapper.cpp +2 −3 Original line number Diff line number Diff line Loading @@ -36,6 +36,7 @@ #include <log/log_main.h> #include <stats_pull_atom_callback.h> #include <statslog.h> #include "InputReaderBase.h" #include "TouchCursorInputMapperCommon.h" #include "TouchpadInputMapper.h" #include "gestures/HardwareProperties.h" Loading Loading @@ -424,10 +425,8 @@ std::list<NotifyArgs> TouchpadInputMapper::process(const RawEvent& rawEvent) { std::optional<SelfContainedHardwareState> state = mStateConverter.processRawEvent(rawEvent); if (state) { if (mTouchpadHardwareStateNotificationsEnabled) { // TODO(b/286551975): Notify policy of the touchpad hardware state. LOG(DEBUG) << "Notify touchpad hardware state here!"; getPolicy()->notifyTouchpadHardwareState(*state, rawEvent.deviceId); } updatePalmDetectionMetrics(); return sendHardwareState(rawEvent.when, rawEvent.readTime, *state); } else { Loading services/inputflinger/reader/mapper/gestures/HardwareStateConverter.h +1 −0 Original line number Diff line number Diff line Loading @@ -28,6 +28,7 @@ #include "accumulator/TouchButtonAccumulator.h" #include "include/TouchpadHardwareState.h" #include "TouchpadHardwareState.h" #include "include/gestures.h" namespace android { Loading services/inputflinger/tests/FakeInputReaderPolicy.cpp +18 −0 Original line number Diff line number Diff line Loading @@ -65,6 +65,17 @@ void FakeInputReaderPolicy::assertStylusGestureNotNotified() { ASSERT_FALSE(mDeviceIdOfNotifiedStylusGesture); } void FakeInputReaderPolicy::assertTouchpadHardwareStateNotified() { std::unique_lock lock(mLock); base::ScopedLockAssertion assumeLocked(mLock); const bool success = mTouchpadHardwareStateNotified.wait_for(lock, WAIT_TIMEOUT, [this]() REQUIRES(mLock) { return mTouchpadHardwareState.has_value(); }); ASSERT_TRUE(success) << "Timed out waiting for hardware state to be notified"; } void FakeInputReaderPolicy::clearViewports() { mViewports.clear(); mConfig.setDisplayViewports(mViewports); Loading Loading @@ -234,6 +245,13 @@ void FakeInputReaderPolicy::notifyInputDevicesChanged( mDevicesChangedCondition.notify_all(); } void FakeInputReaderPolicy::notifyTouchpadHardwareState(const SelfContainedHardwareState& schs, int32_t deviceId) { std::scoped_lock lock(mLock); mTouchpadHardwareState = schs; mTouchpadHardwareStateNotified.notify_all(); } std::shared_ptr<KeyCharacterMap> FakeInputReaderPolicy::getKeyboardLayoutOverlay( const InputDeviceIdentifier&, const std::optional<KeyboardLayoutInfo>) { return nullptr; Loading services/inputflinger/tests/FakeInputReaderPolicy.h +6 −0 Original line number Diff line number Diff line Loading @@ -42,6 +42,7 @@ public: void assertInputDevicesNotChanged(); void assertStylusGestureNotified(int32_t deviceId); void assertStylusGestureNotNotified(); void assertTouchpadHardwareStateNotified(); virtual void clearViewports(); std::optional<DisplayViewport> getDisplayViewportByUniqueId(const std::string& uniqueId) const; Loading Loading @@ -82,6 +83,8 @@ public: private: void getReaderConfiguration(InputReaderConfiguration* outConfig) override; void notifyInputDevicesChanged(const std::vector<InputDeviceInfo>& inputDevices) override; void notifyTouchpadHardwareState(const SelfContainedHardwareState& schs, int32_t deviceId) override; std::shared_ptr<KeyCharacterMap> getKeyboardLayoutOverlay( const InputDeviceIdentifier&, const std::optional<KeyboardLayoutInfo>) override; std::string getDeviceAlias(const InputDeviceIdentifier&) override; Loading @@ -101,6 +104,9 @@ private: std::condition_variable mStylusGestureNotifiedCondition; std::optional<DeviceId> mDeviceIdOfNotifiedStylusGesture GUARDED_BY(mLock){}; std::condition_variable mTouchpadHardwareStateNotified; std::optional<SelfContainedHardwareState> mTouchpadHardwareState GUARDED_BY(mLock){}; uint32_t mNextPointerCaptureSequenceNumber{0}; }; Loading Loading
services/inputflinger/include/InputReaderBase.h +5 −0 Original line number Diff line number Diff line Loading @@ -34,6 +34,7 @@ #include <vector> #include "PointerControllerInterface.h" #include "TouchpadHardwareState.h" #include "VibrationElement.h" #include "include/gestures.h" Loading Loading @@ -461,6 +462,10 @@ public: */ virtual void notifyInputDevicesChanged(const std::vector<InputDeviceInfo>& inputDevices) = 0; /* Sends the hardware state of a connected touchpad */ virtual void notifyTouchpadHardwareState(const SelfContainedHardwareState& schs, int32_t deviceId) = 0; /* Gets the keyboard layout for a particular input device. */ virtual std::shared_ptr<KeyCharacterMap> getKeyboardLayoutOverlay( const InputDeviceIdentifier& identifier, Loading
services/inputflinger/reader/mapper/TouchpadInputMapper.cpp +2 −3 Original line number Diff line number Diff line Loading @@ -36,6 +36,7 @@ #include <log/log_main.h> #include <stats_pull_atom_callback.h> #include <statslog.h> #include "InputReaderBase.h" #include "TouchCursorInputMapperCommon.h" #include "TouchpadInputMapper.h" #include "gestures/HardwareProperties.h" Loading Loading @@ -424,10 +425,8 @@ std::list<NotifyArgs> TouchpadInputMapper::process(const RawEvent& rawEvent) { std::optional<SelfContainedHardwareState> state = mStateConverter.processRawEvent(rawEvent); if (state) { if (mTouchpadHardwareStateNotificationsEnabled) { // TODO(b/286551975): Notify policy of the touchpad hardware state. LOG(DEBUG) << "Notify touchpad hardware state here!"; getPolicy()->notifyTouchpadHardwareState(*state, rawEvent.deviceId); } updatePalmDetectionMetrics(); return sendHardwareState(rawEvent.when, rawEvent.readTime, *state); } else { Loading
services/inputflinger/reader/mapper/gestures/HardwareStateConverter.h +1 −0 Original line number Diff line number Diff line Loading @@ -28,6 +28,7 @@ #include "accumulator/TouchButtonAccumulator.h" #include "include/TouchpadHardwareState.h" #include "TouchpadHardwareState.h" #include "include/gestures.h" namespace android { Loading
services/inputflinger/tests/FakeInputReaderPolicy.cpp +18 −0 Original line number Diff line number Diff line Loading @@ -65,6 +65,17 @@ void FakeInputReaderPolicy::assertStylusGestureNotNotified() { ASSERT_FALSE(mDeviceIdOfNotifiedStylusGesture); } void FakeInputReaderPolicy::assertTouchpadHardwareStateNotified() { std::unique_lock lock(mLock); base::ScopedLockAssertion assumeLocked(mLock); const bool success = mTouchpadHardwareStateNotified.wait_for(lock, WAIT_TIMEOUT, [this]() REQUIRES(mLock) { return mTouchpadHardwareState.has_value(); }); ASSERT_TRUE(success) << "Timed out waiting for hardware state to be notified"; } void FakeInputReaderPolicy::clearViewports() { mViewports.clear(); mConfig.setDisplayViewports(mViewports); Loading Loading @@ -234,6 +245,13 @@ void FakeInputReaderPolicy::notifyInputDevicesChanged( mDevicesChangedCondition.notify_all(); } void FakeInputReaderPolicy::notifyTouchpadHardwareState(const SelfContainedHardwareState& schs, int32_t deviceId) { std::scoped_lock lock(mLock); mTouchpadHardwareState = schs; mTouchpadHardwareStateNotified.notify_all(); } std::shared_ptr<KeyCharacterMap> FakeInputReaderPolicy::getKeyboardLayoutOverlay( const InputDeviceIdentifier&, const std::optional<KeyboardLayoutInfo>) { return nullptr; Loading
services/inputflinger/tests/FakeInputReaderPolicy.h +6 −0 Original line number Diff line number Diff line Loading @@ -42,6 +42,7 @@ public: void assertInputDevicesNotChanged(); void assertStylusGestureNotified(int32_t deviceId); void assertStylusGestureNotNotified(); void assertTouchpadHardwareStateNotified(); virtual void clearViewports(); std::optional<DisplayViewport> getDisplayViewportByUniqueId(const std::string& uniqueId) const; Loading Loading @@ -82,6 +83,8 @@ public: private: void getReaderConfiguration(InputReaderConfiguration* outConfig) override; void notifyInputDevicesChanged(const std::vector<InputDeviceInfo>& inputDevices) override; void notifyTouchpadHardwareState(const SelfContainedHardwareState& schs, int32_t deviceId) override; std::shared_ptr<KeyCharacterMap> getKeyboardLayoutOverlay( const InputDeviceIdentifier&, const std::optional<KeyboardLayoutInfo>) override; std::string getDeviceAlias(const InputDeviceIdentifier&) override; Loading @@ -101,6 +104,9 @@ private: std::condition_variable mStylusGestureNotifiedCondition; std::optional<DeviceId> mDeviceIdOfNotifiedStylusGesture GUARDED_BY(mLock){}; std::condition_variable mTouchpadHardwareStateNotified; std::optional<SelfContainedHardwareState> mTouchpadHardwareState GUARDED_BY(mLock){}; uint32_t mNextPointerCaptureSequenceNumber{0}; }; Loading