diff --git a/core/java/android/inputmethodservice/Keyboard.java b/core/java/android/inputmethodservice/Keyboard.java index 45f18897b0e2d..4d0ee7d2a7305 100644 --- a/core/java/android/inputmethodservice/Keyboard.java +++ b/core/java/android/inputmethodservice/Keyboard.java @@ -400,16 +400,26 @@ public class Keyboard { public void onPressed() { pressed = !pressed; } - + /** - * Changes the pressed state of the key. If it is a sticky key, it will also change the - * toggled state of the key if the finger was release inside. - * @param inside whether the finger was released inside the key + * Changes the pressed state of the key. + * + *

Toggled state of the key will be flipped when all the following conditions are + * fulfilled:

+ * + * + * + * @param inside whether the finger was released inside the key. Works only on Android M and + * later. See the method document for details. * @see #onPressed() */ public void onReleased(boolean inside) { pressed = !pressed; - if (sticky) { + if (sticky && inside) { on = !on; } }