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

Commit ea535856 authored by Treehugger Robot's avatar Treehugger Robot Committed by Android (Google) Code Review
Browse files

Merge "InputReader: Bump generation when associated display changes" into main

parents cbd66776 55c5ee21
Loading
Loading
Loading
Loading
+6 −0
Original line number Diff line number Diff line
@@ -265,6 +265,8 @@ std::list<NotifyArgs> InputDevice::configureInternal(nsecs_t when,
        }

        if (!changes.any() || changes.test(Change::DISPLAY_INFO)) {
            const auto oldAssociatedDisplayId = getAssociatedDisplayId();

            // In most situations, no port or name will be specified.
            mAssociatedDisplayPort = std::nullopt;
            mAssociatedDisplayUniqueId = std::nullopt;
@@ -306,6 +308,10 @@ std::list<NotifyArgs> InputDevice::configureInternal(nsecs_t when,
                          getName().c_str(), mAssociatedDisplayUniqueId->c_str());
                }
            }

            if (getAssociatedDisplayId() != oldAssociatedDisplayId) {
                bumpGeneration();
            }
        }

        for_each_mapper([this, when, &readerConfig, changes, &out](InputMapper& mapper) {
+3 −0
Original line number Diff line number Diff line
@@ -2893,9 +2893,12 @@ TEST_F(InputDeviceTest, Configure_UniqueId_CorrectlyMatches) {
    mFakePolicy->addDisplayViewport(SECONDARY_DISPLAY_ID, DISPLAY_WIDTH, DISPLAY_HEIGHT,
                                    ui::ROTATION_0, /* isActive= */ true, DISPLAY_UNIQUE_ID,
                                    NO_PORT, ViewportType::INTERNAL);
    const auto initialGeneration = mDevice->getGeneration();
    unused += mDevice->configure(ARBITRARY_TIME, mFakePolicy->getReaderConfiguration(),
                                 InputReaderConfiguration::Change::DISPLAY_INFO);
    ASSERT_EQ(DISPLAY_UNIQUE_ID, mDevice->getAssociatedDisplayUniqueId());
    ASSERT_GT(mDevice->getGeneration(), initialGeneration);
    ASSERT_EQ(mDevice->getDeviceInfo().getAssociatedDisplayId(), SECONDARY_DISPLAY_ID);
}

/**