summaryrefslogtreecommitdiffstats
path: root/core/java/android/inputmethodservice
diff options
context:
space:
mode:
authorYohei Yukawa <yukawa@google.com>2015-06-11 11:45:34 -0700
committerYohei Yukawa <yukawa@google.com>2015-06-11 11:45:34 -0700
commit5c31de33ccc99404f54452de1974bb2960b31343 (patch)
tree14302197f2f3a85d55150d183d940c5a33373f58 /core/java/android/inputmethodservice
parent62974816a325fa6ea49d6f9800b962af85a9856a (diff)
downloadframeworks_base-5c31de33ccc99404f54452de1974bb2960b31343.zip
frameworks_base-5c31de33ccc99404f54452de1974bb2960b31343.tar.gz
frameworks_base-5c31de33ccc99404f54452de1974bb2960b31343.tar.bz2
Keyboard.Key#onReleased() should handle inside parameter.
The boolean parameter of Keyboard.Key#onReleased(boolean) has been somehow ignored since Capcake. With this CL, that method starts working as documented. Alternatively we could fix the issue when and only when the application's targetSdkVersion >= 23. We didn't do that because: - Although Keyboard.Key class is a public API, it is supposed to be used almost only by android.inputmethodservice.KeyboardView. The risk of unwanted compatibility problems is low. - Fixing that is beneficial for users because it actually fixes UX issue when applications/IMEs that still rely on KeyboardView run in Android M. - All the fields that are related to Keyboard.Key#onReleased are public fields so developers can easily work around anyway. Bug: 21446448 Change-Id: I392166c77cd9dd2c432dc4f1274312f8355de02b
Diffstat (limited to 'core/java/android/inputmethodservice')
-rw-r--r--core/java/android/inputmethodservice/Keyboard.java20
1 files changed, 15 insertions, 5 deletions
diff --git a/core/java/android/inputmethodservice/Keyboard.java b/core/java/android/inputmethodservice/Keyboard.java
index 45f1889..4d0ee7d 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.
+ *
+ * <p>Toggled state of the key will be flipped when all the following conditions are
+ * fulfilled:</p>
+ *
+ * <ul>
+ * <li>This is a sticky key, that is, {@link #sticky} is {@code true}.
+ * <li>The parameter {@code inside} is {@code true}.
+ * <li>{@link Build.VERSION.SDK_INT} is greater than {@link VERSION_CODES.LOLLIPOP_MR1}.
+ * </ul>
+ *
+ * @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;
}
}