Loading services/inputflinger/dispatcher/InputDispatcher.cpp +0 −24 Original line number Diff line number Diff line Loading @@ -5129,13 +5129,6 @@ void InputDispatcher::setInputWindowsLocked( // Copy old handles for release if they are no longer present. const std::vector<sp<WindowInfoHandle>> oldWindowHandles = getWindowHandlesLocked(displayId); // Save the old windows' orientation by ID before it gets updated. std::unordered_map<int32_t, uint32_t> oldWindowOrientations; for (const sp<WindowInfoHandle>& handle : oldWindowHandles) { oldWindowOrientations.emplace(handle->getId(), handle->getInfo()->transform.getOrientation()); } updateWindowHandlesForDisplayLocked(windowInfoHandles, displayId); const std::vector<sp<WindowInfoHandle>>& windowHandles = getWindowHandlesLocked(displayId); Loading Loading @@ -5189,23 +5182,6 @@ void InputDispatcher::setInputWindowsLocked( } } // Determine if the orientation of any of the input windows have changed, and cancel all // pointer events if necessary. for (const sp<WindowInfoHandle>& oldWindowHandle : oldWindowHandles) { const sp<WindowInfoHandle> newWindowHandle = getWindowHandleLocked(oldWindowHandle); if (newWindowHandle != nullptr && newWindowHandle->getInfo()->transform.getOrientation() != oldWindowOrientations[oldWindowHandle->getId()]) { std::shared_ptr<InputChannel> inputChannel = getInputChannelLocked(newWindowHandle->getToken()); if (inputChannel != nullptr) { CancelationOptions options(CancelationOptions::Mode::CANCEL_POINTER_EVENTS, "touched window's orientation changed"); synthesizeCancelationEventsForInputChannelLocked(inputChannel, options); } } } // Release information for windows that are no longer present. // This ensures that unused input channels are released promptly. // Otherwise, they might stick around until the window handle is destroyed Loading services/inputflinger/tests/InputDispatcher_test.cpp +9 −6 Original line number Diff line number Diff line Loading @@ -3932,9 +3932,7 @@ TEST_F(InputDispatcherTest, TouchpadThreeFingerSwipeNotSentToSingleWindow) { /** * Send a two-pointer gesture to a single window. The window's orientation changes in response to * the first pointer. * Ensure that the second pointer is not sent to the window. * * The subsequent gesture should be correctly delivered to the window. * Ensure that the second pointer and the subsequent gesture is correctly delivered to the window. */ TEST_F(InputDispatcherTest, MultiplePointersWithRotatingWindow) { std::shared_ptr<FakeApplicationHandle> application = std::make_shared<FakeApplicationHandle>(); Loading Loading @@ -3964,8 +3962,6 @@ TEST_F(InputDispatcherTest, MultiplePointersWithRotatingWindow) { mDispatcher->setInputWindows({{ADISPLAY_ID_DEFAULT, {windowDup}}}); window->consumeMotionEvent(WithMotionAction(ACTION_CANCEL)); mDispatcher->notifyMotion(MotionArgsBuilder(POINTER_1_DOWN, AINPUT_SOURCE_TOUCHSCREEN) .downTime(baseTime + 10) .eventTime(baseTime + 30) Loading @@ -3973,19 +3969,26 @@ TEST_F(InputDispatcherTest, MultiplePointersWithRotatingWindow) { .pointer(PointerBuilder(1, ToolType::FINGER).x(200).y(200)) .build()); // Finish the gesture and start a new one. Ensure the new gesture is sent to the window window->consumeMotionEvent(WithMotionAction(POINTER_1_DOWN)); // Finish the gesture and start a new one. Ensure all events are sent to the window. mDispatcher->notifyMotion(MotionArgsBuilder(POINTER_1_UP, AINPUT_SOURCE_TOUCHSCREEN) .downTime(baseTime + 10) .eventTime(baseTime + 40) .pointer(PointerBuilder(0, ToolType::FINGER).x(100).y(100)) .pointer(PointerBuilder(1, ToolType::FINGER).x(200).y(200)) .build()); window->consumeMotionEvent(WithMotionAction(POINTER_1_UP)); mDispatcher->notifyMotion(MotionArgsBuilder(ACTION_UP, AINPUT_SOURCE_TOUCHSCREEN) .downTime(baseTime + 10) .eventTime(baseTime + 50) .pointer(PointerBuilder(0, ToolType::FINGER).x(100).y(100)) .build()); window->consumeMotionEvent(WithMotionAction(ACTION_UP)); mDispatcher->notifyMotion(MotionArgsBuilder(ACTION_DOWN, AINPUT_SOURCE_TOUCHSCREEN) .downTime(baseTime + 60) .eventTime(baseTime + 60) Loading Loading
services/inputflinger/dispatcher/InputDispatcher.cpp +0 −24 Original line number Diff line number Diff line Loading @@ -5129,13 +5129,6 @@ void InputDispatcher::setInputWindowsLocked( // Copy old handles for release if they are no longer present. const std::vector<sp<WindowInfoHandle>> oldWindowHandles = getWindowHandlesLocked(displayId); // Save the old windows' orientation by ID before it gets updated. std::unordered_map<int32_t, uint32_t> oldWindowOrientations; for (const sp<WindowInfoHandle>& handle : oldWindowHandles) { oldWindowOrientations.emplace(handle->getId(), handle->getInfo()->transform.getOrientation()); } updateWindowHandlesForDisplayLocked(windowInfoHandles, displayId); const std::vector<sp<WindowInfoHandle>>& windowHandles = getWindowHandlesLocked(displayId); Loading Loading @@ -5189,23 +5182,6 @@ void InputDispatcher::setInputWindowsLocked( } } // Determine if the orientation of any of the input windows have changed, and cancel all // pointer events if necessary. for (const sp<WindowInfoHandle>& oldWindowHandle : oldWindowHandles) { const sp<WindowInfoHandle> newWindowHandle = getWindowHandleLocked(oldWindowHandle); if (newWindowHandle != nullptr && newWindowHandle->getInfo()->transform.getOrientation() != oldWindowOrientations[oldWindowHandle->getId()]) { std::shared_ptr<InputChannel> inputChannel = getInputChannelLocked(newWindowHandle->getToken()); if (inputChannel != nullptr) { CancelationOptions options(CancelationOptions::Mode::CANCEL_POINTER_EVENTS, "touched window's orientation changed"); synthesizeCancelationEventsForInputChannelLocked(inputChannel, options); } } } // Release information for windows that are no longer present. // This ensures that unused input channels are released promptly. // Otherwise, they might stick around until the window handle is destroyed Loading
services/inputflinger/tests/InputDispatcher_test.cpp +9 −6 Original line number Diff line number Diff line Loading @@ -3932,9 +3932,7 @@ TEST_F(InputDispatcherTest, TouchpadThreeFingerSwipeNotSentToSingleWindow) { /** * Send a two-pointer gesture to a single window. The window's orientation changes in response to * the first pointer. * Ensure that the second pointer is not sent to the window. * * The subsequent gesture should be correctly delivered to the window. * Ensure that the second pointer and the subsequent gesture is correctly delivered to the window. */ TEST_F(InputDispatcherTest, MultiplePointersWithRotatingWindow) { std::shared_ptr<FakeApplicationHandle> application = std::make_shared<FakeApplicationHandle>(); Loading Loading @@ -3964,8 +3962,6 @@ TEST_F(InputDispatcherTest, MultiplePointersWithRotatingWindow) { mDispatcher->setInputWindows({{ADISPLAY_ID_DEFAULT, {windowDup}}}); window->consumeMotionEvent(WithMotionAction(ACTION_CANCEL)); mDispatcher->notifyMotion(MotionArgsBuilder(POINTER_1_DOWN, AINPUT_SOURCE_TOUCHSCREEN) .downTime(baseTime + 10) .eventTime(baseTime + 30) Loading @@ -3973,19 +3969,26 @@ TEST_F(InputDispatcherTest, MultiplePointersWithRotatingWindow) { .pointer(PointerBuilder(1, ToolType::FINGER).x(200).y(200)) .build()); // Finish the gesture and start a new one. Ensure the new gesture is sent to the window window->consumeMotionEvent(WithMotionAction(POINTER_1_DOWN)); // Finish the gesture and start a new one. Ensure all events are sent to the window. mDispatcher->notifyMotion(MotionArgsBuilder(POINTER_1_UP, AINPUT_SOURCE_TOUCHSCREEN) .downTime(baseTime + 10) .eventTime(baseTime + 40) .pointer(PointerBuilder(0, ToolType::FINGER).x(100).y(100)) .pointer(PointerBuilder(1, ToolType::FINGER).x(200).y(200)) .build()); window->consumeMotionEvent(WithMotionAction(POINTER_1_UP)); mDispatcher->notifyMotion(MotionArgsBuilder(ACTION_UP, AINPUT_SOURCE_TOUCHSCREEN) .downTime(baseTime + 10) .eventTime(baseTime + 50) .pointer(PointerBuilder(0, ToolType::FINGER).x(100).y(100)) .build()); window->consumeMotionEvent(WithMotionAction(ACTION_UP)); mDispatcher->notifyMotion(MotionArgsBuilder(ACTION_DOWN, AINPUT_SOURCE_TOUCHSCREEN) .downTime(baseTime + 60) .eventTime(baseTime + 60) Loading