Loading services/inputflinger/dispatcher/InputDispatcher.cpp +4 −2 Original line number Diff line number Diff line Loading @@ -1421,8 +1421,10 @@ void InputDispatcher::dispatchPointerCaptureChangedLocked( // Enable Pointer Capture. if (haveWindowWithPointerCapture && (entry->pointerCaptureRequest == mCurrentPointerCaptureRequest)) { LOG_ALWAYS_FATAL("This request to enable Pointer Capture has already been dispatched " "to the window."); // This can happen if pointer capture is disabled and re-enabled before we notify the // app of the state change, so there is no need to notify the app. ALOGI("Skipping dispatch of Pointer Capture being enabled: no state change."); return; } if (!mCurrentPointerCaptureRequest.enable) { // This can happen if a window requests capture and immediately releases capture. Loading services/inputflinger/tests/InputDispatcher_test.cpp +19 −0 Original line number Diff line number Diff line Loading @@ -5671,6 +5671,25 @@ TEST_F(InputDispatcherPointerCaptureTests, EnableRequestFollowsSequenceNumbers) mWindow->consumeCaptureEvent(true); } TEST_F(InputDispatcherPointerCaptureTests, RapidToggleRequests) { requestAndVerifyPointerCapture(mWindow, true); // App toggles pointer capture off and on. mDispatcher->requestPointerCapture(mWindow->getToken(), false); mFakePolicy->assertSetPointerCaptureCalled(false); mDispatcher->requestPointerCapture(mWindow->getToken(), true); auto enableRequest = mFakePolicy->assertSetPointerCaptureCalled(true); // InputReader notifies that the latest "enable" request was processed, while skipping over the // preceding "disable" request. notifyPointerCaptureChanged(enableRequest); // Since pointer capture was never disabled during the rapid toggle, the window does not receive // any notifications. mWindow->assertNoEvents(); } class InputDispatcherUntrustedTouchesTest : public InputDispatcherTest { protected: constexpr static const float MAXIMUM_OBSCURING_OPACITY = 0.8; Loading Loading
services/inputflinger/dispatcher/InputDispatcher.cpp +4 −2 Original line number Diff line number Diff line Loading @@ -1421,8 +1421,10 @@ void InputDispatcher::dispatchPointerCaptureChangedLocked( // Enable Pointer Capture. if (haveWindowWithPointerCapture && (entry->pointerCaptureRequest == mCurrentPointerCaptureRequest)) { LOG_ALWAYS_FATAL("This request to enable Pointer Capture has already been dispatched " "to the window."); // This can happen if pointer capture is disabled and re-enabled before we notify the // app of the state change, so there is no need to notify the app. ALOGI("Skipping dispatch of Pointer Capture being enabled: no state change."); return; } if (!mCurrentPointerCaptureRequest.enable) { // This can happen if a window requests capture and immediately releases capture. Loading
services/inputflinger/tests/InputDispatcher_test.cpp +19 −0 Original line number Diff line number Diff line Loading @@ -5671,6 +5671,25 @@ TEST_F(InputDispatcherPointerCaptureTests, EnableRequestFollowsSequenceNumbers) mWindow->consumeCaptureEvent(true); } TEST_F(InputDispatcherPointerCaptureTests, RapidToggleRequests) { requestAndVerifyPointerCapture(mWindow, true); // App toggles pointer capture off and on. mDispatcher->requestPointerCapture(mWindow->getToken(), false); mFakePolicy->assertSetPointerCaptureCalled(false); mDispatcher->requestPointerCapture(mWindow->getToken(), true); auto enableRequest = mFakePolicy->assertSetPointerCaptureCalled(true); // InputReader notifies that the latest "enable" request was processed, while skipping over the // preceding "disable" request. notifyPointerCaptureChanged(enableRequest); // Since pointer capture was never disabled during the rapid toggle, the window does not receive // any notifications. mWindow->assertNoEvents(); } class InputDispatcherUntrustedTouchesTest : public InputDispatcherTest { protected: constexpr static const float MAXIMUM_OBSCURING_OPACITY = 0.8; Loading