am 6fbe83be: [IL53] Fix a wrong test.

* commit '6fbe83be7af6b15df3ed915b408c8179ca01c0cd':
  [IL53] Fix a wrong test.
main
Jean Chalard 2014-01-09 22:52:30 -08:00 committed by Android Git Automerger
commit 1124cff216
1 changed files with 7 additions and 5 deletions

View File

@ -174,13 +174,15 @@ public final class RichInputConnection {
}
final int lengthOfTextBeforeCursor = mCommittedTextBeforeComposingText.length();
if (lengthOfTextBeforeCursor > newSelStart
|| (lengthOfTextBeforeCursor < Constants.EDITOR_CONTENTS_CACHE_SIZE
|| (newSelStart != lengthOfTextBeforeCursor
&& lengthOfTextBeforeCursor < Constants.EDITOR_CONTENTS_CACHE_SIZE
&& newSelStart < Constants.EDITOR_CONTENTS_CACHE_SIZE)) {
// newSelStart and newSelEnd may be lying -- when rotating the device (probably a
// framework bug). If we have less chars than we asked for, then we know how many chars
// we have, and if we got more than newSelStart says, then we know it was lying. In both
// cases the length is more reliable. Note that we only have to check newSelStart (not
// newSelEnd) since if newSelEnd is wrong, the newSelStart will be wrong as well.
// framework bug). If the values don't agree and we have less chars than we asked
// for, then we know how many chars we have. If we got more than newSelStart says, then
// we also know it was lying. In both cases the length is more reliable. Note that we
// only have to check newSelStart (not newSelEnd) since if newSelEnd is wrong, then
// newSelStart will be wrong as well.
mExpectedSelStart = lengthOfTextBeforeCursor;
mExpectedSelEnd = lengthOfTextBeforeCursor;
}