Loading services/inputflinger/dispatcher/InputDispatcher.cpp +8 −1 Original line number Original line Diff line number Diff line Loading @@ -676,7 +676,6 @@ InputDispatcher::InputDispatcher(const sp<InputDispatcherPolicyInterface>& polic SurfaceComposerClient::getDefault()->addWindowInfosListener(mWindowInfoListener); SurfaceComposerClient::getDefault()->addWindowInfosListener(mWindowInfoListener); #endif #endif mKeyRepeatState.lastKeyEntry = nullptr; mKeyRepeatState.lastKeyEntry = nullptr; policy->getDispatcherConfiguration(&mConfig); } } InputDispatcher::~InputDispatcher() { InputDispatcher::~InputDispatcher() { Loading Loading @@ -6606,6 +6605,14 @@ void InputDispatcher::cancelCurrentTouch() { mLooper->wake(); mLooper->wake(); } } void InputDispatcher::requestRefreshConfiguration() { InputDispatcherConfiguration config; mPolicy->getDispatcherConfiguration(&config); std::scoped_lock _l(mLock); mConfig = config; } void InputDispatcher::setMonitorDispatchingTimeoutForTest(std::chrono::nanoseconds timeout) { void InputDispatcher::setMonitorDispatchingTimeoutForTest(std::chrono::nanoseconds timeout) { std::scoped_lock _l(mLock); std::scoped_lock _l(mLock); mMonitorDispatchingTimeout = timeout; mMonitorDispatchingTimeout = timeout; Loading services/inputflinger/dispatcher/InputDispatcher.h +3 −1 Original line number Original line Diff line number Diff line Loading @@ -149,6 +149,8 @@ public: void cancelCurrentTouch() override; void cancelCurrentTouch() override; void requestRefreshConfiguration() override; // Public to allow tests to verify that a Monitor can get ANR. // Public to allow tests to verify that a Monitor can get ANR. void setMonitorDispatchingTimeoutForTest(std::chrono::nanoseconds timeout); void setMonitorDispatchingTimeoutForTest(std::chrono::nanoseconds timeout); Loading @@ -166,7 +168,7 @@ private: std::unique_ptr<InputThread> mThread; std::unique_ptr<InputThread> mThread; sp<InputDispatcherPolicyInterface> mPolicy; sp<InputDispatcherPolicyInterface> mPolicy; android::InputDispatcherConfiguration mConfig; android::InputDispatcherConfiguration mConfig GUARDED_BY(mLock); std::mutex mLock; std::mutex mLock; Loading services/inputflinger/dispatcher/include/InputDispatcherInterface.h +6 −0 Original line number Original line Diff line number Diff line Loading @@ -225,6 +225,12 @@ public: * Abort the current touch stream. * Abort the current touch stream. */ */ virtual void cancelCurrentTouch() = 0; virtual void cancelCurrentTouch() = 0; /** * Request that the InputDispatcher's configuration, which can be obtained through the policy, * be updated. */ virtual void requestRefreshConfiguration() = 0; }; }; } // namespace android } // namespace android services/inputflinger/tests/InputDispatcher_test.cpp +1 −0 Original line number Original line Diff line number Diff line Loading @@ -5284,6 +5284,7 @@ protected: mFakePolicy = sp<FakeInputDispatcherPolicy>::make(); mFakePolicy = sp<FakeInputDispatcherPolicy>::make(); mFakePolicy->setKeyRepeatConfiguration(KEY_REPEAT_TIMEOUT, KEY_REPEAT_DELAY); mFakePolicy->setKeyRepeatConfiguration(KEY_REPEAT_TIMEOUT, KEY_REPEAT_DELAY); mDispatcher = std::make_unique<InputDispatcher>(mFakePolicy); mDispatcher = std::make_unique<InputDispatcher>(mFakePolicy); mDispatcher->requestRefreshConfiguration(); mDispatcher->setInputDispatchMode(/*enabled*/ true, /*frozen*/ false); mDispatcher->setInputDispatchMode(/*enabled*/ true, /*frozen*/ false); ASSERT_EQ(OK, mDispatcher->start()); ASSERT_EQ(OK, mDispatcher->start()); Loading Loading
services/inputflinger/dispatcher/InputDispatcher.cpp +8 −1 Original line number Original line Diff line number Diff line Loading @@ -676,7 +676,6 @@ InputDispatcher::InputDispatcher(const sp<InputDispatcherPolicyInterface>& polic SurfaceComposerClient::getDefault()->addWindowInfosListener(mWindowInfoListener); SurfaceComposerClient::getDefault()->addWindowInfosListener(mWindowInfoListener); #endif #endif mKeyRepeatState.lastKeyEntry = nullptr; mKeyRepeatState.lastKeyEntry = nullptr; policy->getDispatcherConfiguration(&mConfig); } } InputDispatcher::~InputDispatcher() { InputDispatcher::~InputDispatcher() { Loading Loading @@ -6606,6 +6605,14 @@ void InputDispatcher::cancelCurrentTouch() { mLooper->wake(); mLooper->wake(); } } void InputDispatcher::requestRefreshConfiguration() { InputDispatcherConfiguration config; mPolicy->getDispatcherConfiguration(&config); std::scoped_lock _l(mLock); mConfig = config; } void InputDispatcher::setMonitorDispatchingTimeoutForTest(std::chrono::nanoseconds timeout) { void InputDispatcher::setMonitorDispatchingTimeoutForTest(std::chrono::nanoseconds timeout) { std::scoped_lock _l(mLock); std::scoped_lock _l(mLock); mMonitorDispatchingTimeout = timeout; mMonitorDispatchingTimeout = timeout; Loading
services/inputflinger/dispatcher/InputDispatcher.h +3 −1 Original line number Original line Diff line number Diff line Loading @@ -149,6 +149,8 @@ public: void cancelCurrentTouch() override; void cancelCurrentTouch() override; void requestRefreshConfiguration() override; // Public to allow tests to verify that a Monitor can get ANR. // Public to allow tests to verify that a Monitor can get ANR. void setMonitorDispatchingTimeoutForTest(std::chrono::nanoseconds timeout); void setMonitorDispatchingTimeoutForTest(std::chrono::nanoseconds timeout); Loading @@ -166,7 +168,7 @@ private: std::unique_ptr<InputThread> mThread; std::unique_ptr<InputThread> mThread; sp<InputDispatcherPolicyInterface> mPolicy; sp<InputDispatcherPolicyInterface> mPolicy; android::InputDispatcherConfiguration mConfig; android::InputDispatcherConfiguration mConfig GUARDED_BY(mLock); std::mutex mLock; std::mutex mLock; Loading
services/inputflinger/dispatcher/include/InputDispatcherInterface.h +6 −0 Original line number Original line Diff line number Diff line Loading @@ -225,6 +225,12 @@ public: * Abort the current touch stream. * Abort the current touch stream. */ */ virtual void cancelCurrentTouch() = 0; virtual void cancelCurrentTouch() = 0; /** * Request that the InputDispatcher's configuration, which can be obtained through the policy, * be updated. */ virtual void requestRefreshConfiguration() = 0; }; }; } // namespace android } // namespace android
services/inputflinger/tests/InputDispatcher_test.cpp +1 −0 Original line number Original line Diff line number Diff line Loading @@ -5284,6 +5284,7 @@ protected: mFakePolicy = sp<FakeInputDispatcherPolicy>::make(); mFakePolicy = sp<FakeInputDispatcherPolicy>::make(); mFakePolicy->setKeyRepeatConfiguration(KEY_REPEAT_TIMEOUT, KEY_REPEAT_DELAY); mFakePolicy->setKeyRepeatConfiguration(KEY_REPEAT_TIMEOUT, KEY_REPEAT_DELAY); mDispatcher = std::make_unique<InputDispatcher>(mFakePolicy); mDispatcher = std::make_unique<InputDispatcher>(mFakePolicy); mDispatcher->requestRefreshConfiguration(); mDispatcher->setInputDispatchMode(/*enabled*/ true, /*frozen*/ false); mDispatcher->setInputDispatchMode(/*enabled*/ true, /*frozen*/ false); ASSERT_EQ(OK, mDispatcher->start()); ASSERT_EQ(OK, mDispatcher->start()); Loading