summaryrefslogtreecommitdiffstats
path: root/core/java/com/android/internal/widget/EditableInputConnection.java
diff options
context:
space:
mode:
authorGilles Debunne <debunne@google.com>2012-02-24 16:07:09 -0800
committerGilles Debunne <debunne@google.com>2012-02-24 16:12:52 -0800
commit9d69ecbf61a4a142c3f4cbb9d5659faa6f85e832 (patch)
tree5ad899360d5ec59543d95a32685d8886982ca27d /core/java/com/android/internal/widget/EditableInputConnection.java
parenta16c98c155a51a035719bef5b76e973ee2295795 (diff)
downloadframeworks_base-9d69ecbf61a4a142c3f4cbb9d5659faa6f85e832.zip
frameworks_base-9d69ecbf61a4a142c3f4cbb9d5659faa6f85e832.tar.gz
frameworks_base-9d69ecbf61a4a142c3f4cbb9d5659faa6f85e832.tar.bz2
InputConnection is warned when finished
As said in https://android-git.corp.google.com/g/#/c/155992 finishComposingText is indeed too broad of a method. Introducing a new dedicated method to warn the InputConnection. Should solve the problems with a negative counter value. Change-Id: I5525d776916f0c42d5e6d4a4282aed590d7f0e9a
Diffstat (limited to 'core/java/com/android/internal/widget/EditableInputConnection.java')
-rw-r--r--core/java/com/android/internal/widget/EditableInputConnection.java32
1 files changed, 14 insertions, 18 deletions
diff --git a/core/java/com/android/internal/widget/EditableInputConnection.java b/core/java/com/android/internal/widget/EditableInputConnection.java
index 9579bce..4cbdf78 100644
--- a/core/java/com/android/internal/widget/EditableInputConnection.java
+++ b/core/java/com/android/internal/widget/EditableInputConnection.java
@@ -70,7 +70,7 @@ public class EditableInputConnection extends BaseInputConnection {
public boolean endBatchEdit() {
synchronized(this) {
if (mBatchEditNesting > 0) {
- // When the connection is reset by the InputMethodManager and finishComposingText
+ // When the connection is reset by the InputMethodManager and reportFinish
// is called, some endBatchEdit calls may still be asynchronously received from the
// IME. Do not take these into account, thus ensuring that this IC's final
// contribution to mTextView's nested batch edit count is zero.
@@ -83,6 +83,19 @@ public class EditableInputConnection extends BaseInputConnection {
}
@Override
+ protected void reportFinish() {
+ super.reportFinish();
+
+ synchronized(this) {
+ while (mBatchEditNesting > 0) {
+ endBatchEdit();
+ }
+ // Will prevent any further calls to begin or endBatchEdit
+ mBatchEditNesting = -1;
+ }
+ }
+
+ @Override
public boolean clearMetaKeyStates(int states) {
final Editable content = getEditable();
if (content == null) return false;
@@ -99,23 +112,6 @@ public class EditableInputConnection extends BaseInputConnection {
}
@Override
- public boolean finishComposingText() {
- final boolean superResult = super.finishComposingText();
- synchronized(this) {
- if (mBatchEditNesting < 0) {
- // The connection was already finished
- return false;
- }
- while (mBatchEditNesting > 0) {
- endBatchEdit();
- }
- // Will prevent any further calls to begin or endBatchEdit
- mBatchEditNesting = -1;
- }
- return superResult;
- }
-
- @Override
public boolean commitCompletion(CompletionInfo text) {
if (DEBUG) Log.v(TAG, "commitCompletion " + text);
mTextView.beginBatchEdit();