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

Commit 4fddffcc authored by Siarhei Vishniakou's avatar Siarhei Vishniakou
Browse files

Documentation for KeyEvent.getRepeatCount()

The existing documentation suggests that ACTION_UP events will contain a
valid repeat count that is equal to the repeat count of the latest
ACTION_DOWN event. However, in practice, that is not the case.

Rather than changing the behaviour to follow the existing documentation,
change documentation to conform to the existing behaviour. The rationale
here is that changing the behaviour might mean that some apps would
start relying on getRepeatCount() being non-zero. But this would only
work on the latest Android release. So if an app is tested only on the
latest Android release, and not on the release before this behaviour was
changed, the app would be broken on the older releases of Android.

Test: CTS tests will be added for injection
Bug: 113341746
Change-Id: Ia53e0e606c0b3c64135ef00950dc8a19f62933ca
parent b8d66722
Loading
Loading
Loading
Loading
+5 −4
Original line number Diff line number Diff line
@@ -2523,10 +2523,11 @@ public class KeyEvent extends InputEvent implements Parcelable {
    }

    /**
     * Retrieve the repeat count of the event.  For both key up and key down
     * events, this is the number of times the key has repeated with the first
     * down starting at 0 and counting up from there.  For multiple key
     * events, this is the number of down/up pairs that have occurred.
     * Retrieve the repeat count of the event.  For key down events,
     * this is the number of times the key has repeated with the first
     * down starting at 0 and counting up from there.  For key up events,
     * this is always equal to zero. For multiple key events,
     * this is the number of down/up pairs that have occurred.
     *
     * @return The number of times the key has repeated.
     */