Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 83bd073b authored by Pasty Chang's avatar Pasty Chang
Browse files

Revert "InputDispatcher: Allow all windows to be removed from a ..."

Revert submission 19396488

Reason for revert: Reason for revert: DroidMonitor-triggered revert due to breakage https://android-build.googleplex.com/builds/tests/view?invocationId=I83300010074249798&testResultId=TR51728160843391916, bug 240320932
Reverted Changes:
I0b50d6789:InputDispatcher: Allow all windows to be removed f...
Ibe0e4326d:Send WindowInfo even if the window isn't associate...

Bug: 240320932
Change-Id: If6c7018be45ff07e45a65bea6ab0267fa5426578
parent 7bc179c1
Loading
Loading
Loading
Loading
+0 −7
Original line number Diff line number Diff line
@@ -6371,13 +6371,6 @@ void InputDispatcher::onWindowInfosChanged(const std::vector<WindowInfo>& window

    { // acquire lock
        std::scoped_lock _l(mLock);

        // Ensure that we have an entry created for all existing displays so that if a displayId has
        // no windows, we can tell that the windows were removed from the display.
        for (const auto& [displayId, _] : mWindowHandlesByDisplay) {
            handlesPerDisplay[displayId];
        }

        mDisplayInfos.clear();
        for (const auto& displayInfo : displayInfos) {
            mDisplayInfos.emplace(displayInfo.displayId, displayInfo);
+0 −29
Original line number Diff line number Diff line
@@ -2370,35 +2370,6 @@ TEST_F(InputDispatcherTest, ActionOutsideSentOnlyWhenAWindowIsTouched) {
    thirdWindow->consumeMotionDown();
}

TEST_F(InputDispatcherTest, OnWindowInfosChanged_RemoveAllWindowsOnDisplay) {
    std::shared_ptr<FakeApplicationHandle> application = std::make_shared<FakeApplicationHandle>();
    sp<FakeWindowHandle> window =
            new FakeWindowHandle(application, mDispatcher, "Fake Window", ADISPLAY_ID_DEFAULT);
    window->setFocusable(true);

    mDispatcher->onWindowInfosChanged({*window->getInfo()}, {});
    setFocusedWindow(window);

    window->consumeFocusEvent(true);

    NotifyKeyArgs keyDown = generateKeyArgs(AKEY_EVENT_ACTION_DOWN, ADISPLAY_ID_DEFAULT);
    NotifyKeyArgs keyUp = generateKeyArgs(AKEY_EVENT_ACTION_UP, ADISPLAY_ID_DEFAULT);
    mDispatcher->notifyKey(&keyDown);
    mDispatcher->notifyKey(&keyUp);

    window->consumeKeyDown(ADISPLAY_ID_DEFAULT);
    window->consumeKeyUp(ADISPLAY_ID_DEFAULT);

    // All windows are removed from the display. Ensure that we can no longer dispatch to it.
    mDispatcher->onWindowInfosChanged({}, {});

    window->consumeFocusEvent(false);

    mDispatcher->notifyKey(&keyDown);
    mDispatcher->notifyKey(&keyUp);
    window->assertNoEvents();
}

/**
 * Ensure the correct coordinate spaces are used by InputDispatcher.
 *