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

Commit fe41386f authored by Vaibhav Devmurari's avatar Vaibhav Devmurari Committed by Android (Google) Code Review
Browse files

Merge "Shift notifyConfigurationChanged policy call to InputReader" into main

parents ba4079b0 c109d81d
Loading
Loading
Loading
Loading
+0 −6
Original line number Diff line number Diff line
@@ -1652,12 +1652,6 @@ bool InputDispatcher::dispatchConfigurationChangedLocked(nsecs_t currentTime,
    // Reset key repeating in case a keyboard device was added or removed or something.
    resetKeyRepeatLocked();

    // Enqueue a command to run outside the lock to tell the policy that the configuration changed.
    auto command = [this, eventTime = entry.eventTime]() REQUIRES(mLock) {
        scoped_unlock unlock(mLock);
        mPolicy.notifyConfigurationChanged(eventTime);
    };
    postCommandLocked(std::move(command));
    return true;
}

+0 −3
Original line number Diff line number Diff line
@@ -43,9 +43,6 @@ public:
    InputDispatcherPolicyInterface() = default;
    virtual ~InputDispatcherPolicyInterface() = default;

    /* Notifies the system that a configuration change has occurred. */
    virtual void notifyConfigurationChanged(nsecs_t when) = 0;

    /* Notifies the system that an application does not have a focused window.
     */
    virtual void notifyNoFocusedWindowAnr(
+3 −0
Original line number Diff line number Diff line
@@ -454,6 +454,9 @@ public:
     */
    virtual void notifyInputDevicesChanged(const std::vector<InputDeviceInfo>& inputDevices) = 0;

    /* Notifies the system that a configuration change has occurred. */
    virtual void notifyConfigurationChanged(nsecs_t when) = 0;

    /* Gets the keyboard layout for a particular input device. */
    virtual std::shared_ptr<KeyCharacterMap> getKeyboardLayoutOverlay(
            const InputDeviceIdentifier& identifier,
+9 −0
Original line number Diff line number Diff line
@@ -212,6 +212,15 @@ void InputReader::loopOnce() {
        mPolicy->notifyInputDevicesChanged(inputDevices);
    }

    // Notify the policy of configuration change. This must be after policy is notified about input
    // device changes so that policy can fetch newly added input devices on configuration change.
    for (const auto& args : notifyArgs) {
        const auto* configArgs = std::get_if<NotifyConfigurationChangedArgs>(&args);
        if (configArgs != nullptr) {
            mPolicy->notifyConfigurationChanged(configArgs->eventTime);
        }
    }

    // Notify the policy of the start of every new stylus gesture.
    for (const auto& args : notifyArgs) {
        const auto* motionArgs = std::get_if<NotifyMotionArgs>(&args);
+0 −12
Original line number Diff line number Diff line
@@ -54,13 +54,6 @@ void FakeInputDispatcherPolicy::assertFilterInputEventWasNotCalled() {
    ASSERT_EQ(nullptr, mFilteredEvent);
}

void FakeInputDispatcherPolicy::assertNotifyConfigurationChangedWasCalled(nsecs_t when) {
    std::scoped_lock lock(mLock);
    ASSERT_TRUE(mConfigurationChangedTime) << "Timed out waiting for configuration changed call";
    ASSERT_EQ(*mConfigurationChangedTime, when);
    mConfigurationChangedTime = std::nullopt;
}

void FakeInputDispatcherPolicy::assertNotifySwitchWasCalled(const NotifySwitchArgs& args) {
    std::scoped_lock lock(mLock);
    ASSERT_TRUE(mLastNotifySwitch);
@@ -342,11 +335,6 @@ std::optional<T> FakeInputDispatcherPolicy::getItemFromStorageLockedInterruptibl
    return std::make_optional(item);
}

void FakeInputDispatcherPolicy::notifyConfigurationChanged(nsecs_t when) {
    std::scoped_lock lock(mLock);
    mConfigurationChangedTime = when;
}

void FakeInputDispatcherPolicy::notifyWindowUnresponsive(const sp<IBinder>& connectionToken,
                                                         std::optional<gui::Pid> pid,
                                                         const std::string&) {
Loading