summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPrabir Pradhan <prabirmsp@google.com>2023-01-05 19:03:09 +0000
committerAndroid (Google) Code Review <android-gerrit@google.com>2023-01-05 19:03:09 +0000
commiteae6a838571b66aa4dc4d1fb4d08029200ab503c (patch)
treeb4c3954a40d3f42e1cf68f463310afd1c706cc57
parentff0c66e855925476c5ce06ad133f9084e725f96a (diff)
downloadnative-eae6a838571b66aa4dc4d1fb4d08029200ab503c.tar.gz
DO NOT MERGE: Revert "Check display id of the last hover window before it is cleared"
This reverts commit ff0c66e855925476c5ce06ad133f9084e725f96a. Reason for revert: b/263272128 This platform change causes a regression in CTS tests. Since the CTS test fix will only be released in the next quarterly release, we must wait for the test to be released before landing this fix. Change-Id: If2db80acb83f6731f66b49f8827f428a85e27370
-rw-r--r--services/inputflinger/dispatcher/InputDispatcher.cpp11
-rw-r--r--services/inputflinger/tests/InputDispatcher_test.cpp53
2 files changed, 4 insertions, 60 deletions
diff --git a/services/inputflinger/dispatcher/InputDispatcher.cpp b/services/inputflinger/dispatcher/InputDispatcher.cpp
index 3267753712..5c47be9be0 100644
--- a/services/inputflinger/dispatcher/InputDispatcher.cpp
+++ b/services/inputflinger/dispatcher/InputDispatcher.cpp
@@ -4727,13 +4727,10 @@ void InputDispatcher::setInputWindowsLocked(
updateWindowHandlesForDisplayLocked(windowInfoHandles, displayId);
const std::vector<sp<WindowInfoHandle>>& windowHandles = getWindowHandlesLocked(displayId);
- if (mLastHoverWindowHandle) {
- const WindowInfo* lastHoverWindowInfo = mLastHoverWindowHandle->getInfo();
- if (lastHoverWindowInfo->displayId == displayId &&
- std::find(windowHandles.begin(), windowHandles.end(), mLastHoverWindowHandle) ==
- windowHandles.end()) {
- mLastHoverWindowHandle = nullptr;
- }
+ if (mLastHoverWindowHandle &&
+ std::find(windowHandles.begin(), windowHandles.end(), mLastHoverWindowHandle) ==
+ windowHandles.end()) {
+ mLastHoverWindowHandle = nullptr;
}
std::optional<FocusResolver::FocusChanges> changes =
diff --git a/services/inputflinger/tests/InputDispatcher_test.cpp b/services/inputflinger/tests/InputDispatcher_test.cpp
index fce0f999b5..58617f7383 100644
--- a/services/inputflinger/tests/InputDispatcher_test.cpp
+++ b/services/inputflinger/tests/InputDispatcher_test.cpp
@@ -2189,59 +2189,6 @@ TEST_F(InputDispatcherTest, HoverEnterMouseClickAndHoverExit) {
ADISPLAY_ID_DEFAULT, 0 /* expectedFlag */);
}
-TEST_F(InputDispatcherTest, HoverEnterMoveRemoveWindowsInSecondDisplay) {
- std::shared_ptr<FakeApplicationHandle> application = std::make_shared<FakeApplicationHandle>();
- sp<FakeWindowHandle> windowDefaultDisplay =
- sp<FakeWindowHandle>::make(application, mDispatcher, "DefaultDisplay",
- ADISPLAY_ID_DEFAULT);
- windowDefaultDisplay->setFrame(Rect(0, 0, 600, 800));
- sp<FakeWindowHandle> windowSecondDisplay =
- sp<FakeWindowHandle>::make(application, mDispatcher, "SecondDisplay",
- SECOND_DISPLAY_ID);
- windowSecondDisplay->setFrame(Rect(0, 0, 600, 800));
-
- mDispatcher->setInputWindows({{ADISPLAY_ID_DEFAULT, {windowDefaultDisplay}},
- {SECOND_DISPLAY_ID, {windowSecondDisplay}}});
-
- // Set cursor position in window in default display and check that hover enter and move
- // events are generated.
- ASSERT_EQ(InputEventInjectionResult::SUCCEEDED,
- injectMotionEvent(mDispatcher,
- MotionEventBuilder(AMOTION_EVENT_ACTION_HOVER_MOVE,
- AINPUT_SOURCE_MOUSE)
- .displayId(ADISPLAY_ID_DEFAULT)
- .pointer(PointerBuilder(0, AMOTION_EVENT_TOOL_TYPE_MOUSE)
- .x(300)
- .y(600))
- .build()));
- windowDefaultDisplay->consumeEvent(AINPUT_EVENT_TYPE_MOTION, AMOTION_EVENT_ACTION_HOVER_ENTER,
- ADISPLAY_ID_DEFAULT, 0 /* expectedFlag */);
- windowDefaultDisplay->consumeEvent(AINPUT_EVENT_TYPE_MOTION, AMOTION_EVENT_ACTION_HOVER_MOVE,
- ADISPLAY_ID_DEFAULT, 0 /* expectedFlag */);
-
- // Remove all windows in secondary display and check that no event happens on window in
- // primary display.
- mDispatcher->setInputWindows({{SECOND_DISPLAY_ID, {}}});
- windowDefaultDisplay->assertNoEvents();
-
- // Move cursor position in window in default display and check that only hover move
- // event is generated and not hover enter event.
- mDispatcher->setInputWindows({{ADISPLAY_ID_DEFAULT, {windowDefaultDisplay}},
- {SECOND_DISPLAY_ID, {windowSecondDisplay}}});
- ASSERT_EQ(InputEventInjectionResult::SUCCEEDED,
- injectMotionEvent(mDispatcher,
- MotionEventBuilder(AMOTION_EVENT_ACTION_HOVER_MOVE,
- AINPUT_SOURCE_MOUSE)
- .displayId(ADISPLAY_ID_DEFAULT)
- .pointer(PointerBuilder(0, AMOTION_EVENT_TOOL_TYPE_MOUSE)
- .x(400)
- .y(700))
- .build()));
- windowDefaultDisplay->consumeEvent(AINPUT_EVENT_TYPE_MOTION, AMOTION_EVENT_ACTION_HOVER_MOVE,
- ADISPLAY_ID_DEFAULT, 0 /* expectedFlag */);
- windowDefaultDisplay->assertNoEvents();
-}
-
TEST_F(InputDispatcherTest, DispatchMouseEventsUnderCursor) {
std::shared_ptr<FakeApplicationHandle> application = std::make_shared<FakeApplicationHandle>();