aboutsummaryrefslogtreecommitdiffstats
path: root/java/src/com/android/inputmethod/latin/RichInputConnection.java
diff options
context:
space:
mode:
authorJean Chalard <jchalard@google.com>2014-06-05 17:48:10 +0900
committerJean Chalard <jchalard@google.com>2014-06-06 11:18:23 +0900
commit9fd9a68d8797ed500d07d5e149cd4da50be2df15 (patch)
tree9e16696c8ba73c77812fcd4d95d4c84f68ff57ba /java/src/com/android/inputmethod/latin/RichInputConnection.java
parent9d4d61f9c1273cbe1761c5eccb18e6df9a7490bc (diff)
downloadlatinime-9fd9a68d8797ed500d07d5e149cd4da50be2df15.tar.gz
latinime-9fd9a68d8797ed500d07d5e149cd4da50be2df15.tar.xz
latinime-9fd9a68d8797ed500d07d5e149cd4da50be2df15.zip
Fix a bug on rotation with selection.
The symptom : when text is selected and the device is rotated, sometimes the keyboard sets the word as being composed around the start of the selection. Upon the next rotation this ends up with the keyboard committing some text in place of the selection. The cause : another bug in the framework with rotation >.> The keyboard receives a call to startInput with a wrong cursor position, namely one that does not represent a selection. The keyboard sets a composition according to this wrong data. When the keyboard is rotated again, it commits the text, which takes the place of the selection. The solution : actually when restarting input the keyboard realizes that the cursor position is wrong. We cancel composition at that time. For robustness, this change also implements two other defensive changes : upon call to onUpdateSelection, we actually realize that the previous values were wrong, so we also fix it at that time, and in addition, when rotating, we finishComposingText() instead of commitText() which is less dangerous. Implementing this later change also allows us to let less internal variables from InputLogic escape to LatinIME, so it's also a good change for design. Bug: 14140799 Change-Id: Ib10de18e53e376ac1bbc8487e13d969828483346
Diffstat (limited to 'java/src/com/android/inputmethod/latin/RichInputConnection.java')
-rw-r--r--java/src/com/android/inputmethod/latin/RichInputConnection.java4
1 files changed, 4 insertions, 0 deletions
diff --git a/java/src/com/android/inputmethod/latin/RichInputConnection.java b/java/src/com/android/inputmethod/latin/RichInputConnection.java
index 9d72c64fc..96476b2ee 100644
--- a/java/src/com/android/inputmethod/latin/RichInputConnection.java
+++ b/java/src/com/android/inputmethod/latin/RichInputConnection.java
@@ -891,4 +891,8 @@ public final class RichInputConnection {
public boolean hasSelection() {
return mExpectedSelEnd != mExpectedSelStart;
}
+
+ public boolean isCursorPositionKnown() {
+ return INVALID_CURSOR_POSITION != mExpectedSelStart;
+ }
}