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

Commit 133bfdfa authored by Kristian Dreher's avatar Kristian Dreher Committed by Jean-Baptiste Queru
Browse files

Corrected repeat count for key repeat in input device.

Previously the key event repeat count was always zero when the repeated
key down events was generated by the input device in the Linux kernel.

Change-Id: I86b7fd2a75880bc54d052ef404c3654b7ed14c52
parent 855a9e6d
Loading
Loading
Loading
Loading
+26 −9
Original line number Diff line number Diff line
@@ -6435,18 +6435,30 @@ public class WindowManagerService extends IWindowManager.Stub
                            case RawInputEvent.CLASS_KEYBOARD:
                                KeyEvent ke = (KeyEvent)ev.event;
                                if (ke.isDown()) {
                                    lastKey = ke;
                                    lastKeyTime = curTime;
                                    if (lastKey != null &&
                                            ke.getKeyCode() == lastKey.getKeyCode()) {
                                        keyRepeatCount++;
                                        // Arbitrary long timeout to block
                                        // repeating here since we know that
                                        // the device driver takes care of it.
                                        nextKeyTime = lastKeyTime + LONG_WAIT;
                                        if (DEBUG_INPUT) Log.v(
                                                TAG, "Received repeated key down");
                                    } else {
                                        downTime = curTime;
                                        keyRepeatCount = 0;
                                    lastKeyTime = curTime;
                                        nextKeyTime = lastKeyTime
                                                + ViewConfiguration.getLongPressTimeout();
                                        if (DEBUG_INPUT) Log.v(
                                            TAG, "Received key down: first repeat @ "
                                            + nextKeyTime);
                                    }
                                    lastKey = ke;
                                } else {
                                    lastKey = null;
                                    downTime = 0;
                                    keyRepeatCount = 0;
                                    // Arbitrary long timeout.
                                    lastKeyTime = curTime;
                                    nextKeyTime = curTime + LONG_WAIT;
@@ -6454,7 +6466,12 @@ public class WindowManagerService extends IWindowManager.Stub
                                        TAG, "Received key up: ignore repeat @ "
                                        + nextKeyTime);
                                }
                                dispatchKey((KeyEvent)ev.event, 0, 0);
                                if (keyRepeatCount > 0) {
                                    dispatchKey(KeyEvent.changeTimeRepeat(ke,
                                            ke.getEventTime(), keyRepeatCount), 0, 0);
                                } else {
                                    dispatchKey(ke, 0, 0);
                                }
                                mQueue.recycleEvent(ev);
                                break;
                            case RawInputEvent.CLASS_TOUCHSCREEN: