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

Commit 6ec52260 authored by Siarhei Vishniakou's avatar Siarhei Vishniakou Committed by Android (Google) Code Review
Browse files

Merge "Disable key repeat for...

Merge "Disable key repeat for PendingKey_IsDroppedWhileMotionIsProcessedAndNewTouchComesIn test" into main
parents b46b26e1 fa2a049c
Loading
Loading
Loading
Loading
+3 −0
Original line number Diff line number Diff line
@@ -243,6 +243,9 @@ phony {
        "Bug-115739809",
        "StructLayout_test",

        // jni
        "libservices.core",

        // rust targets
        "libinput_rust_test",

+4 −3
Original line number Diff line number Diff line
@@ -6927,11 +6927,12 @@ sp<WindowInfoHandle> InputDispatcher::findWallpaperWindowBelow(
    return nullptr;
}

void InputDispatcher::setKeyRepeatConfiguration(nsecs_t timeout, nsecs_t delay) {
void InputDispatcher::setKeyRepeatConfiguration(std::chrono::nanoseconds timeout,
                                                std::chrono::nanoseconds delay) {
    std::scoped_lock _l(mLock);

    mConfig.keyRepeatTimeout = timeout;
    mConfig.keyRepeatDelay = delay;
    mConfig.keyRepeatTimeout = timeout.count();
    mConfig.keyRepeatDelay = delay.count();
}

} // namespace android::inputdispatcher
+2 −1
Original line number Diff line number Diff line
@@ -145,7 +145,8 @@ public:
    // Public to allow tests to verify that a Monitor can get ANR.
    void setMonitorDispatchingTimeoutForTest(std::chrono::nanoseconds timeout);

    void setKeyRepeatConfiguration(nsecs_t timeout, nsecs_t delay) override;
    void setKeyRepeatConfiguration(std::chrono::nanoseconds timeout,
                                   std::chrono::nanoseconds delay) override;

private:
    enum class DropReason {
+2 −1
Original line number Diff line number Diff line
@@ -221,7 +221,8 @@ public:
    /*
     * Updates key repeat configuration timeout and delay.
     */
    virtual void setKeyRepeatConfiguration(nsecs_t timeout, nsecs_t delay) = 0;
    virtual void setKeyRepeatConfiguration(std::chrono::nanoseconds timeout,
                                           std::chrono::nanoseconds delay) = 0;
};

} // namespace android
+4 −3
Original line number Diff line number Diff line
@@ -6748,8 +6748,8 @@ TEST_F(InputDispatcherFallbackKeyTest, CanceledKeyCancelsFallback) {
class InputDispatcherKeyRepeatTest : public InputDispatcherTest {
protected:
    static constexpr nsecs_t KEY_REPEAT_TIMEOUT = 40 * 1000000; // 40 ms
    static constexpr nsecs_t KEY_REPEAT_DELAY = 40 * 1000000;   // 40 ms
    static constexpr std::chrono::nanoseconds KEY_REPEAT_TIMEOUT = 40ms;
    static constexpr std::chrono::nanoseconds KEY_REPEAT_DELAY = 40ms;
    std::shared_ptr<FakeApplicationHandle> mApp;
    sp<FakeWindowHandle> mWindow;
@@ -8131,7 +8131,8 @@ TEST_F(InputDispatcherSingleWindowAnr,
    // Injection is async, so it will succeed
    ASSERT_EQ(InputEventInjectionResult::SUCCEEDED,
              injectKey(*mDispatcher, AKEY_EVENT_ACTION_DOWN, /*repeatCount=*/0,
                        ADISPLAY_ID_DEFAULT, InputEventInjectionSync::NONE));
                        ADISPLAY_ID_DEFAULT, InputEventInjectionSync::NONE, INJECT_EVENT_TIMEOUT,
                        /*allowKeyRepeat=*/false));
    // At this point, key is still pending, and should not be sent to the application yet.
    // Make sure the `assertNoEvents` check doesn't take too long. It uses
    // CONSUME_TIMEOUT_NO_EVENT_EXPECTED under the hood.