Loading services/inputflinger/dispatcher/InputDispatcher.cpp +1 −1 Original line number Diff line number Diff line Loading @@ -6598,7 +6598,7 @@ void InputDispatcher::monitor() { * this method can be safely called from any thread, as long as you've ensured that * the work you are interested in completing has already been queued. */ bool InputDispatcher::waitForIdle() { bool InputDispatcher::waitForIdle() const { /** * Timeout should represent the longest possible time that a device might spend processing * events and commands. Loading services/inputflinger/dispatcher/InputDispatcher.h +3 −3 Original line number Diff line number Diff line Loading @@ -89,7 +89,7 @@ public: void dump(std::string& dump) override; void monitor() override; bool waitForIdle() override; bool waitForIdle() const override; status_t start() override; status_t stop() override; Loading Loading @@ -169,10 +169,10 @@ private: InputDispatcherPolicyInterface& mPolicy; android::InputDispatcherConfiguration mConfig GUARDED_BY(mLock); std::mutex mLock; mutable std::mutex mLock; std::condition_variable mDispatcherIsAlive; std::condition_variable mDispatcherEnteredIdle; mutable std::condition_variable mDispatcherEnteredIdle; sp<Looper> mLooper; Loading services/inputflinger/dispatcher/include/InputDispatcherInterface.h +1 −1 Original line number Diff line number Diff line Loading @@ -50,7 +50,7 @@ public: * Return true if the dispatcher is idle. * Return false if the timeout waiting for the dispatcher to become idle has expired. */ virtual bool waitForIdle() = 0; virtual bool waitForIdle() const = 0; /* Make the dispatcher start processing events. * Loading services/inputflinger/tests/InputDispatcher_test.cpp +9 −7 Original line number Diff line number Diff line Loading @@ -383,7 +383,9 @@ public: mPointerCaptureRequest.reset(); } void assertDropTargetEquals(const sp<IBinder>& targetToken) { void assertDropTargetEquals(const InputDispatcherInterface& dispatcher, const sp<IBinder>& targetToken) { dispatcher.waitForIdle(); std::scoped_lock lock(mLock); ASSERT_TRUE(mNotifyDropWindowWasCalled); ASSERT_EQ(targetToken, mDropTargetWindowToken); Loading Loading @@ -8450,7 +8452,7 @@ TEST_F(InputDispatcherDragTests, DragAndDrop) { {150, 50})) << "Inject motion event should return InputEventInjectionResult::SUCCEEDED"; mDragWindow->consumeMotionUp(ADISPLAY_ID_DEFAULT); mFakePolicy->assertDropTargetEquals(mSecondWindow->getToken()); mFakePolicy->assertDropTargetEquals(*mDispatcher, mSecondWindow->getToken()); mWindow->assertNoEvents(); mSecondWindow->assertNoEvents(); } Loading Loading @@ -8481,7 +8483,7 @@ TEST_F(InputDispatcherDragTests, StylusDragAndDrop) { mDragWindow->consumeMotionMove(ADISPLAY_ID_DEFAULT); mWindow->assertNoEvents(); mSecondWindow->assertNoEvents(); mFakePolicy->assertDropTargetEquals(mSecondWindow->getToken()); mFakePolicy->assertDropTargetEquals(*mDispatcher, mSecondWindow->getToken()); // nothing to the window. ASSERT_EQ(InputEventInjectionResult::SUCCEEDED, Loading Loading @@ -8527,7 +8529,7 @@ TEST_F(InputDispatcherDragTests, DragAndDropOnInvalidWindow) { {150, 50})) << "Inject motion event should return InputEventInjectionResult::SUCCEEDED"; mDragWindow->consumeMotionUp(ADISPLAY_ID_DEFAULT); mFakePolicy->assertDropTargetEquals(nullptr); mFakePolicy->assertDropTargetEquals(*mDispatcher, nullptr); mWindow->assertNoEvents(); mSecondWindow->assertNoEvents(); } Loading Loading @@ -8610,7 +8612,7 @@ TEST_F(InputDispatcherDragTests, DragAndDropWhenSplitTouch) { injectMotionEvent(mDispatcher, secondFingerUpEvent, INJECT_EVENT_TIMEOUT, InputEventInjectionSync::WAIT_FOR_RESULT)); mDragWindow->consumeMotionUp(ADISPLAY_ID_DEFAULT); mFakePolicy->assertDropTargetEquals(mWindow->getToken()); mFakePolicy->assertDropTargetEquals(*mDispatcher, mWindow->getToken()); mWindow->assertNoEvents(); mSecondWindow->consumeMotionMove(); } Loading Loading @@ -8660,7 +8662,7 @@ TEST_F(InputDispatcherDragTests, DragAndDropWhenMultiDisplays) { {150, 50})) << "Inject motion event should return InputEventInjectionResult::SUCCEEDED"; mDragWindow->consumeMotionUp(ADISPLAY_ID_DEFAULT); mFakePolicy->assertDropTargetEquals(mSecondWindow->getToken()); mFakePolicy->assertDropTargetEquals(*mDispatcher, mSecondWindow->getToken()); mWindow->assertNoEvents(); mSecondWindow->assertNoEvents(); } Loading Loading @@ -8709,7 +8711,7 @@ TEST_F(InputDispatcherDragTests, MouseDragAndDrop) { .build())) << "Inject motion event should return InputEventInjectionResult::SUCCEEDED"; mDragWindow->consumeMotionUp(ADISPLAY_ID_DEFAULT); mFakePolicy->assertDropTargetEquals(mSecondWindow->getToken()); mFakePolicy->assertDropTargetEquals(*mDispatcher, mSecondWindow->getToken()); mWindow->assertNoEvents(); mSecondWindow->assertNoEvents(); } Loading Loading
services/inputflinger/dispatcher/InputDispatcher.cpp +1 −1 Original line number Diff line number Diff line Loading @@ -6598,7 +6598,7 @@ void InputDispatcher::monitor() { * this method can be safely called from any thread, as long as you've ensured that * the work you are interested in completing has already been queued. */ bool InputDispatcher::waitForIdle() { bool InputDispatcher::waitForIdle() const { /** * Timeout should represent the longest possible time that a device might spend processing * events and commands. Loading
services/inputflinger/dispatcher/InputDispatcher.h +3 −3 Original line number Diff line number Diff line Loading @@ -89,7 +89,7 @@ public: void dump(std::string& dump) override; void monitor() override; bool waitForIdle() override; bool waitForIdle() const override; status_t start() override; status_t stop() override; Loading Loading @@ -169,10 +169,10 @@ private: InputDispatcherPolicyInterface& mPolicy; android::InputDispatcherConfiguration mConfig GUARDED_BY(mLock); std::mutex mLock; mutable std::mutex mLock; std::condition_variable mDispatcherIsAlive; std::condition_variable mDispatcherEnteredIdle; mutable std::condition_variable mDispatcherEnteredIdle; sp<Looper> mLooper; Loading
services/inputflinger/dispatcher/include/InputDispatcherInterface.h +1 −1 Original line number Diff line number Diff line Loading @@ -50,7 +50,7 @@ public: * Return true if the dispatcher is idle. * Return false if the timeout waiting for the dispatcher to become idle has expired. */ virtual bool waitForIdle() = 0; virtual bool waitForIdle() const = 0; /* Make the dispatcher start processing events. * Loading
services/inputflinger/tests/InputDispatcher_test.cpp +9 −7 Original line number Diff line number Diff line Loading @@ -383,7 +383,9 @@ public: mPointerCaptureRequest.reset(); } void assertDropTargetEquals(const sp<IBinder>& targetToken) { void assertDropTargetEquals(const InputDispatcherInterface& dispatcher, const sp<IBinder>& targetToken) { dispatcher.waitForIdle(); std::scoped_lock lock(mLock); ASSERT_TRUE(mNotifyDropWindowWasCalled); ASSERT_EQ(targetToken, mDropTargetWindowToken); Loading Loading @@ -8450,7 +8452,7 @@ TEST_F(InputDispatcherDragTests, DragAndDrop) { {150, 50})) << "Inject motion event should return InputEventInjectionResult::SUCCEEDED"; mDragWindow->consumeMotionUp(ADISPLAY_ID_DEFAULT); mFakePolicy->assertDropTargetEquals(mSecondWindow->getToken()); mFakePolicy->assertDropTargetEquals(*mDispatcher, mSecondWindow->getToken()); mWindow->assertNoEvents(); mSecondWindow->assertNoEvents(); } Loading Loading @@ -8481,7 +8483,7 @@ TEST_F(InputDispatcherDragTests, StylusDragAndDrop) { mDragWindow->consumeMotionMove(ADISPLAY_ID_DEFAULT); mWindow->assertNoEvents(); mSecondWindow->assertNoEvents(); mFakePolicy->assertDropTargetEquals(mSecondWindow->getToken()); mFakePolicy->assertDropTargetEquals(*mDispatcher, mSecondWindow->getToken()); // nothing to the window. ASSERT_EQ(InputEventInjectionResult::SUCCEEDED, Loading Loading @@ -8527,7 +8529,7 @@ TEST_F(InputDispatcherDragTests, DragAndDropOnInvalidWindow) { {150, 50})) << "Inject motion event should return InputEventInjectionResult::SUCCEEDED"; mDragWindow->consumeMotionUp(ADISPLAY_ID_DEFAULT); mFakePolicy->assertDropTargetEquals(nullptr); mFakePolicy->assertDropTargetEquals(*mDispatcher, nullptr); mWindow->assertNoEvents(); mSecondWindow->assertNoEvents(); } Loading Loading @@ -8610,7 +8612,7 @@ TEST_F(InputDispatcherDragTests, DragAndDropWhenSplitTouch) { injectMotionEvent(mDispatcher, secondFingerUpEvent, INJECT_EVENT_TIMEOUT, InputEventInjectionSync::WAIT_FOR_RESULT)); mDragWindow->consumeMotionUp(ADISPLAY_ID_DEFAULT); mFakePolicy->assertDropTargetEquals(mWindow->getToken()); mFakePolicy->assertDropTargetEquals(*mDispatcher, mWindow->getToken()); mWindow->assertNoEvents(); mSecondWindow->consumeMotionMove(); } Loading Loading @@ -8660,7 +8662,7 @@ TEST_F(InputDispatcherDragTests, DragAndDropWhenMultiDisplays) { {150, 50})) << "Inject motion event should return InputEventInjectionResult::SUCCEEDED"; mDragWindow->consumeMotionUp(ADISPLAY_ID_DEFAULT); mFakePolicy->assertDropTargetEquals(mSecondWindow->getToken()); mFakePolicy->assertDropTargetEquals(*mDispatcher, mSecondWindow->getToken()); mWindow->assertNoEvents(); mSecondWindow->assertNoEvents(); } Loading Loading @@ -8709,7 +8711,7 @@ TEST_F(InputDispatcherDragTests, MouseDragAndDrop) { .build())) << "Inject motion event should return InputEventInjectionResult::SUCCEEDED"; mDragWindow->consumeMotionUp(ADISPLAY_ID_DEFAULT); mFakePolicy->assertDropTargetEquals(mSecondWindow->getToken()); mFakePolicy->assertDropTargetEquals(*mDispatcher, mSecondWindow->getToken()); mWindow->assertNoEvents(); mSecondWindow->assertNoEvents(); } Loading