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

Commit c00f5e92 authored by Arpit Singh's avatar Arpit Singh
Browse files

Keep mouse pointer hidden while typing

An optimisation causes mouse pointer to remain visible while user is
typing.
As Mouse pointer may reappear while user is typing and may
not hide again if IME connection remains active and touchpad is used.
This leads to an incosistent state where toucpad-pad is disabled but
cursor is visible while user is actively typing on PK.

Bug: 301055381
Test: atest KeyboardInputMapperUnitTest
Change-Id: Id37d57d924e4f1f1b8875b078c48762a5d523acc
parent 102d39db
Loading
Loading
Loading
Loading
+2 −1
Original line number Diff line number Diff line
@@ -451,7 +451,8 @@ std::list<NotifyArgs> KeyboardInputMapper::cancelAllDownKeys(nsecs_t when) {
void KeyboardInputMapper::onKeyDownProcessed() {
    InputReaderContext& context = *getContext();
    if (context.isPreventingTouchpadTaps()) {
        // avoid pinging java service unnecessarily
        // avoid pinging java service unnecessarily, just fade pointer again if it became visible
        context.fadePointer();
        return;
    }
    // Ignore meta keys or multiple simultaneous down keys as they are likely to be keyboard
+9 −0
Original line number Diff line number Diff line
@@ -111,6 +111,15 @@ TEST_F(KeyboardInputMapperUnitTest, AlphanumericKeystrokesWithIMeConnectionHideP
    testPointerVisibilityForKeys({KEY_0, KEY_A}, /* expectVisible= */ false);
}

/**
 * Pointer should still hide if touchpad taps are already disabled
 */
TEST_F(KeyboardInputMapperUnitTest, AlphanumericKeystrokesWithTouchpadTapDisabledHidePointer) {
    mFakePolicy->setIsInputMethodConnectionActive(true);
    EXPECT_CALL(mMockInputReaderContext, isPreventingTouchpadTaps).WillRepeatedly(Return(true));
    testPointerVisibilityForKeys({KEY_0, KEY_A}, /* expectVisible= */ false);
}

/**
 * Pointer visibility should remain unaffected by meta keys even if Input Method Connection is
 * active