diff options
author | 2014-10-01 10:27:00 +0000 | |
---|---|---|
committer | 2014-10-01 10:27:00 +0000 | |
commit | 391f046d894983cde18b6fba23537d89687a8b96 (patch) | |
tree | 500ba0f0b761cd58cfbcbbac666558f9b7faadc0 /java/src/com/android/inputmethod/latin/inputlogic | |
parent | 4108bc2efedb3c895f0f6f3ee45b39dba5644e42 (diff) | |
parent | eff21b653f6ddfdd9b931aaacd0d15b53b57e84f (diff) | |
download | latinime-391f046d894983cde18b6fba23537d89687a8b96.tar.gz latinime-391f046d894983cde18b6fba23537d89687a8b96.tar.xz latinime-391f046d894983cde18b6fba23537d89687a8b96.zip |
am eff21b65: Merge "Make a better effort to detect a framework lie."
* commit 'eff21b653f6ddfdd9b931aaacd0d15b53b57e84f':
Make a better effort to detect a framework lie.
Diffstat (limited to 'java/src/com/android/inputmethod/latin/inputlogic')
-rw-r--r-- | java/src/com/android/inputmethod/latin/inputlogic/InputLogic.java | 26 |
1 files changed, 14 insertions, 12 deletions
diff --git a/java/src/com/android/inputmethod/latin/inputlogic/InputLogic.java b/java/src/com/android/inputmethod/latin/inputlogic/InputLogic.java index 48c8afa2a..834b89e46 100644 --- a/java/src/com/android/inputmethod/latin/inputlogic/InputLogic.java +++ b/java/src/com/android/inputmethod/latin/inputlogic/InputLogic.java @@ -1127,19 +1127,21 @@ public final class InputLogic { StatsUtils.onBackspaceSelectedText(numCharsDeleted); } else { // There is no selection, just delete one character. - if (Constants.NOT_A_CURSOR_POSITION == mConnection.getExpectedSelectionEnd()) { - // This should never happen. - Log.e(TAG, "Backspace when we don't know the selection position"); - } - if (inputTransaction.mSettingsValues.isBeforeJellyBean() || - inputTransaction.mSettingsValues.mInputAttributes.isTypeNull()) { - // There are two possible reasons to send a key event: either the field has + if (inputTransaction.mSettingsValues.isBeforeJellyBean() + || inputTransaction.mSettingsValues.mInputAttributes.isTypeNull() + || Constants.NOT_A_CURSOR_POSITION + == mConnection.getExpectedSelectionEnd()) { + // There are three possible reasons to send a key event: either the field has // type TYPE_NULL, in which case the keyboard should send events, or we are - // running in backward compatibility mode. Before Jelly bean, the keyboard - // would simulate a hardware keyboard event on pressing enter or delete. This - // is bad for many reasons (there are race conditions with commits) but some - // applications are relying on this behavior so we continue to support it for - // older apps, so we retain this behavior if the app has target SDK < JellyBean. + // running in backward compatibility mode, or we don't know the cursor position. + // Before Jelly bean, the keyboard would simulate a hardware keyboard event on + // pressing enter or delete. This is bad for many reasons (there are race + // conditions with commits) but some applications are relying on this behavior + // so we continue to support it for older apps, so we retain this behavior if + // the app has target SDK < JellyBean. + // As for the case where we don't know the cursor position, it can happen + // because of bugs in the framework. But the framework should know, so the next + // best thing is to leave it to whatever it thinks is best. sendDownUpKeyEvent(KeyEvent.KEYCODE_DEL); int totalDeletedLength = 1; if (mDeleteCount > Constants.DELETE_ACCELERATE_AT) { |