History log of /packages/inputmethods/LatinIME/java/src/com/android/inputmethod/latin/RichInputConnection.java
Revision Date Author Comments (<<< Hide modified files) (Show modified files >>>)
c32389ce113e9fb76131d2db655f26e16e31f160 24-Jun-2015 Tom Ouyang <ouyang@google.com> Merge "Small optimization to eliminate a >0 check in RichInputConnection." into jb-ub-latinimegoogle
96640a110b97bbb48bc45ef4671d3927952e6cba 24-Jun-2015 Tom Ouyang <ouyang@google.com> Small optimization to eliminate a >0 check in RichInputConnection.

Change-Id: Ibdf97726008c1f94c970461196ba445ce328a8cb
/packages/inputmethods/LatinIME/java/src/com/android/inputmethod/latin/RichInputConnection.java
563d7935a9e53100f6ee0ec41aff931fa28558ba 24-Jun-2015 Dan Zivkovic <zivkovic@google.com> Extend laggy connection timeout for initial load.

The initial reloadTextCache() operation needs to read 1k characters, and it
could be slow on low-end devices. Also, the initial load is not blocking key
strokes, so it can take a little longer.

Bug 22062102.

Change-Id: I134424e8910c0d6131c311a862bdc87eccd3af44
/packages/inputmethods/LatinIME/java/src/com/android/inputmethod/latin/RichInputConnection.java
912016b69f1c0e26ec58ee9d17c8ac7e5711d70d 22-Jun-2015 Tom Ouyang <ouyang@google.com> Workaround for preserving responsiveness on a slow InputConnection.

1. Add mechanism to detect a slow or non-resonsive InputConnection (IC)
2. When IC slowness is detected, skip certain IC calls that are known
to be expensive (e.g., getTextAfterCursor).
3. Similarly, disables learning / unlearning on a slow IC.
4. IC slowness flag is reset when starting input on a new TextView or
when a fixed amount of time has passed.

Note: These are mostly temporary workarounds. The permanent solution is
to refactor RichInputConnection so that it is less sensitive to IC
slowness in general.

Bug: 21926256
Change-Id: I383fab0516d3f3a8e0f71e5d760a8336a7730f7c
/packages/inputmethods/LatinIME/java/src/com/android/inputmethod/latin/RichInputConnection.java
73aaf6833780c1915dd4ab7d3f0f55e3af130f99 23-Jun-2015 Dan Zivkovic <zivkovic@google.com> Detection and logging of slow input connections.

Also adds a hook to log using StatsUtils.
Proto change is coming in a separate CL.

Bug 22010482.

Change-Id: I08065fc7a5cd116e50ff84cb14bbbc44c4f14bc7
/packages/inputmethods/LatinIME/java/src/com/android/inputmethod/latin/RichInputConnection.java
0232e73dfa5e7cadf3f0698407fe6aecd97f3227 19-Jun-2015 Dan Zivkovic <zivkovic@google.com> Cleanup before fixing getTextAfterCursor().

We never delete text after the cursor, so constrain the API accordingly.
Define the number of characters to read before and after.
Set them to reasonable values.
The next CL will start caching text after the cursor.

Bug 21926256.

Change-Id: Idd58daf68614de4a69344aa3c8a4323720c5d3a0
/packages/inputmethods/LatinIME/java/src/com/android/inputmethod/latin/RichInputConnection.java
db96122787a57632136566e2448c21aa96879955 14-Apr-2015 Mohammadinamul Sheik <inamul@google.com> Fix the NPE on selection string on unlearnWord

Bug: 20150386
Change-Id: I2ed69aba7b1fdaba1e2ac07b8218a265dfe23e09
/packages/inputmethods/LatinIME/java/src/com/android/inputmethod/latin/RichInputConnection.java
3952078a919caf9a44d271642122c413dbd487f9 09-Apr-2015 Tom Ouyang <ouyang@google.com> Extract fewer characters in getWordRangeAtCursor().

Use LOOKBACK_CHARACTER_NUM = 80 instead of the previous
EDITOR_CONTENTS_CACHE_SIZE = 1024 (which was overkill).

This speeds up many InputLogic operations.

Bug: 19987461
Change-Id: I62b6a589f87e5daab33376b3e48f1c615a66dcfb
/packages/inputmethods/LatinIME/java/src/com/android/inputmethod/latin/RichInputConnection.java
6bb701155931fbf3f96aaea1c8c7b0ba4b521b3f 07-Apr-2015 Dan Zivkovic <zivkovic@google.com> Read less data from the input connection.

Currently, we read 256 (max word size) * 5 (max N-gram size + 1) characters
from the input connection when building our context. This is overkill. We
don't need more than 80 characters, regardless of which decoder we use.

Bug 19987461.

Change-Id: Ie3a321cf2482adbacd8006d9d86e6601097c15ed
/packages/inputmethods/LatinIME/java/src/com/android/inputmethod/latin/RichInputConnection.java
edd94a449e293c07779ac50e98aca3ad92910d92 26-Feb-2015 Dan Zivkovic <zivkovic@google.com> Ignore the Emoji key when not connected.

When the LatinIME does not have an active InputConnection, it will not try
to toggle the Emoji keyboard.

Bug 19513415.

Change-Id: I31f928cd7db1cddd771c548cd3dc42f8af64d0e2
/packages/inputmethods/LatinIME/java/src/com/android/inputmethod/latin/RichInputConnection.java
5254c01d4cc024527479d4dc5fab2ed2516c395c 11-Feb-2015 Dan Zivkovic <zivkovic@google.com> Fix master build.

For some reason, we can't import android.os package in our Constants.

Change-Id: I357ed72d13c5039a83c6e2489cdf5ef74d0ffea8
/packages/inputmethods/LatinIME/java/src/com/android/inputmethod/latin/RichInputConnection.java
12d80ebead6a1d7f704a5a3af3b6fe3313ceab05 10-Feb-2015 Dan Zivkovic <zivkovic@google.com> Remove shortcut support from LatinIME.

Note this change does not affect the native decoder interface.

Change-Id: I73b7dc008a5acaf75a31a36a2d332b5afabd82d0
/packages/inputmethods/LatinIME/java/src/com/android/inputmethod/latin/RichInputConnection.java
0f7d881dc72132dfd75c8b4fe61a69fc5cdcd460 05-Feb-2015 Mohammadinamul Sheik <inamul@google.com> Move decoder specific constants to DecoderSpecificConstants.java

Change-Id: Ie4d325b3152e1e7e424b8b436e222e194e4d9da0
/packages/inputmethods/LatinIME/java/src/com/android/inputmethod/latin/RichInputConnection.java
a6d2cf5ec71fdba86455ff8281a121f32a3248e3 05-Feb-2015 Dan Zivkovic <zivkovic@google.com> Removing code from RichInputConnection.

Followup CL that removes some more unused methods and variables.

Change-Id: I4163c7cd017f59d1fd445adb6294fc89dcaafe6e
/packages/inputmethods/LatinIME/java/src/com/android/inputmethod/latin/RichInputConnection.java
f3c319fb8ac29448c491af95261a4ce01b64a59c 05-Feb-2015 Dan Zivkovic <zivkovic@google.com> Selections spans should not split surrogate pair.

When committing a span after a revert, the offset logic was such that it
split a surrogate unicode pair used to express an emoji.
Checking the last character of the span lets us avoid this problem.

Fix for bug 19255233.

Change-Id: I07d18d9002b5075f7925319dd05962011656c311
/packages/inputmethods/LatinIME/java/src/com/android/inputmethod/latin/RichInputConnection.java
c71e4d65343bf782d80ce508786befa6ee3261cf 04-Feb-2015 Dan Zivkovic <zivkovic@google.com> Remnant of green [+] feature.

Change-Id: I059b1062e1d73b2fa439d9d4ee04ff0182795335
/packages/inputmethods/LatinIME/java/src/com/android/inputmethod/latin/RichInputConnection.java
4beeb9253a06482299e0c67467531d30436a02fc 28-Oct-2014 Jean Chalard <jchalard@google.com> Move StringUtils under common.

Bug: 18108776
Change-Id: Ia46a4102a0e86e71118ca5e641f9f531998e166b
/packages/inputmethods/LatinIME/java/src/com/android/inputmethod/latin/RichInputConnection.java
9342484e8d573a40f470b6a593df31c602fa4076 23-Oct-2014 Ken Wakasa <kwakasa@google.com> Move Constants.java to the latin.common package

Our intention is to have classes of latinime-common under the common
package as much as we can.

Change-Id: I76efbbbe7bebf1a4aa943715cdff64f91675e20d
/packages/inputmethods/LatinIME/java/src/com/android/inputmethod/latin/RichInputConnection.java
4097a20b36c7a6678f2b7486d587b7c43852c2e1 22-Oct-2014 Jean Chalard <jchalard@google.com> Fix a concurrency bug that ends up in a crash.

Bug: 18085768
Change-Id: I016bec997787839526ddfc521ebb99d0c7b05189
/packages/inputmethods/LatinIME/java/src/com/android/inputmethod/latin/RichInputConnection.java
d3a4c5132422b189c8dbb94dbbe84a9b9761b0a8 22-Oct-2014 Tadashi G. Takaoka <takaoka@google.com> Fix Javadoc and null analysis related warnings

This CL also adds @SuppressWarning("unused" to java-overridable package.

Bug: 18003991
Change-Id: If70527e30654384705d7a814f5efd181d9f539e1
/packages/inputmethods/LatinIME/java/src/com/android/inputmethod/latin/RichInputConnection.java
5f00fe09e9a611b647592188316e5999465df4d3 20-Oct-2014 Tadashi G. Takaoka <takaoka@google.com> Fix some compiler warnings

This CL fixes the following compiler warnings.

- Indirect access to static member
- Access to a non-accessible member of an enclosing type
- Parameter assignment
- Method can be static
- Local variable declaration hides another field or variable
- Value of local variable is not used
- Unused import
- Unused private member
- Unnecessary 'else' statement
- Unnecessary declaration of throw exception
- Redundant type arguments
- Missing '@Override' annotation
- Unused '@SuppressWarning' annotations

Bug: 18003991
Change-Id: Icfebe753e53a2cc621848f769d6a3d7ce501ebc7
/packages/inputmethods/LatinIME/java/src/com/android/inputmethod/latin/RichInputConnection.java
7d74594123bd9ee3a09f54d509bff27af5f6cca8 14-Oct-2014 Jean Chalard <jchalard@google.com> Fix an NPE.

Bug: 17958289
Change-Id: I5c9ea668ff75b38c7ddebd767c36a950835c0c9f
/packages/inputmethods/LatinIME/java/src/com/android/inputmethod/latin/RichInputConnection.java
c92c883fdf2287b49392692fa2e8d109dc26f785 04-Sep-2014 David Faden <dfaden@google.com> Add calls to stub for API to consume gesture data.

Bug: 17400259
Change-Id: Ib3511afffe1d14662e7dd14611f384689516e664
/packages/inputmethods/LatinIME/java/src/com/android/inputmethod/latin/RichInputConnection.java
38144047ea3985c9345e7fbe6bb3aafbeaea5f06 01-Oct-2014 Jean Chalard <jchalard@google.com> Make a better effort to detect a framework lie.

Bug: 17130496
Change-Id: I1a3631670c152d9b7667c9c4e08e14c48569eef5
/packages/inputmethods/LatinIME/java/src/com/android/inputmethod/latin/RichInputConnection.java
bb0eca57054758ef17b032d2654c1fc5f6b32101 29-Sep-2014 Keisuke Kuroyanagi <ksk@google.com> Rename PrevWordsInfo to NgramContext.

Bug: 14425059
Change-Id: Id06a71681fa8b5e589e29fba10fe5c1cfed66984
/packages/inputmethods/LatinIME/java/src/com/android/inputmethod/latin/RichInputConnection.java
eddfe51b38755e0068e3c322868c5e209f212f6f 18-Sep-2014 Yohei Yukawa <yukawa@google.com> resolved conflicts for merge of 233a2f21 to master

Change-Id: If391cc622367dfb4448c6a5c32b82111d352d86e
5896153f931ac876ad667d73d7703289a63e9bf5 14-Sep-2014 Yohei Yukawa <yukawa@google.com> Use Add-To-Dictionary indicator only

With this CL, the previously used commit indicator was reverted.
Instead we use the add-to-dictionary indicator only at the moment.

This CL also fixes the indicator position in bidi context.

BUG: 17335734
Change-Id: I5f7cf173ddc30876e2b01320acaff8ba4265edf6
/packages/inputmethods/LatinIME/java/src/com/android/inputmethod/latin/RichInputConnection.java
1cf2acd8de53e1b6fa156af065330c687ccdcb86 08-Sep-2014 Jean Chalard <jchalard@google.com> am 61e7afa6: am 0eaa25e0: am 914078fd: Fix a bug where recorrection would stop on connectors

* commit '61e7afa6fa98939f9dcb9f7a2ebb5678a51d4201':
Fix a bug where recorrection would stop on connectors
b41ee671944aee97163c1567d7407fc3bd7507a3 08-Sep-2014 Jean Chalard <jchalard@google.com> Fix the sentence separator for Hindi.

Change-Id: I623e4ccbc324751eb67ec4bb777e2be5ae2a60d1
Bug: 17418371
/packages/inputmethods/LatinIME/java/src/com/android/inputmethod/latin/RichInputConnection.java
914078fd9198aeb3d7ffa034562321d688d588f7 03-Sep-2014 Jean Chalard <jchalard@google.com> Fix a bug where recorrection would stop on connectors

Bug: 16733686
Change-Id: I7a9f79a81e33a1f5bf5f3daf0b78d0f1e4447e7a
/packages/inputmethods/LatinIME/java/src/com/android/inputmethod/latin/RichInputConnection.java
5d6ac77732b6fe29489deecc297d771642150a2b 03-Sep-2014 Yohei Yukawa <yukawa@google.com> Follow up API signature change

This is a follow up CL for API signature change in
I772c48ff18918e48a81e807b48ff907614485c09

BUG: 17320996
Change-Id: Ic8b6162bda12bf74fae79af212c5d81c400eb9e8
/packages/inputmethods/LatinIME/java/src/com/android/inputmethod/latin/RichInputConnection.java
acce1aa59eac6816fe3ce1fcb014666fc71a40f1 27-Aug-2014 Yohei Yukawa <yukawa@google.com> Make sure to obtain the IC before requesting CursorAnchorInfo

RichInputConnection#requestUpdateCursorAnchorInfo must make
sure to obtain the input connection before calling methods
of it.

BUG: 17299587
Change-Id: I8e0cd473a4cc32583cd47634c227d702f7c69c6c
/packages/inputmethods/LatinIME/java/src/com/android/inputmethod/latin/RichInputConnection.java
29200b0abe1d65aa2f9ddefd247ab91563d666f8 27-Aug-2014 Yohei Yukawa <yukawa@google.com> Set the text bgcolor only when CursorAnchorInfo is available

When CursorAnchorInfo is unavailable, we shouldn't try to show
the commit indicator and set the text highlight color.

With this CL, RichInputConnection can be used to track if the
application responded that it does support CursorAnchorInfo or
not. This result will be taken into consideration when
InputLogic needs to determine whether the commit indicator
should be displayed or not.

Change-Id: I945d70eeb02a7a5f3d9b22459b23d7028508910f
/packages/inputmethods/LatinIME/java/src/com/android/inputmethod/latin/RichInputConnection.java
4a71d2c48021351e10bd61d5ee007533651da627 25-Aug-2014 Yohei Yukawa <yukawa@google.com> Allow to add/remove background color to/from the committed text

This is a groundwork for subsequent CLs where we need to
add/remove background color to/from the commited text.

In this CL, we use Spanned#SPAN_COMPOSING so that we can easily
remove such a background color by calling
InputConnection#finishComposingText. To make this operation easy
and realiable, we need to track whether we have specified the
background color to the commited text or not at one place. Here
we use RichInputConnection for this purpose.

Change-Id: I5f9bc4425c5d1b80a719a20e5baf336729ec08d2
/packages/inputmethods/LatinIME/java/src/com/android/inputmethod/latin/RichInputConnection.java
9273f3832b51f5d23d86df624600381ed6d6585f 05-Aug-2014 Jean Chalard <jchalard@google.com> [HS3] Fix a bug on ICS

There is a bug in ICS where the input connection won't take
any writing commands after rotation until the cursor moves.
This fixes it by wiggling the cursor position once before trying
to do anything.

Bug: 16810766
Change-Id: Ib14c70bd0550420cecfa86dea501d13a1a91e296
/packages/inputmethods/LatinIME/java/src/com/android/inputmethod/latin/RichInputConnection.java
bb843eb223ce0f8fb1088ed3393a4165123ddb1f 07-Jul-2014 Keisuke Kuroyanagi <ksk@google.com> Move getPrevWordsInfoFromNthPreviousWord to PrevWordsInfoUtils.

Bug: 14425059
Change-Id: Id37022ac6c1545d6845abfbcdb7ed47f0e250eec
/packages/inputmethods/LatinIME/java/src/com/android/inputmethod/latin/RichInputConnection.java
292deb632cbab232334190e68d29184094d6d51b 27-Jun-2014 Jean Chalard <jchalard@google.com> [SD7] Actually check for script.

...also implement the check for Hebrew and Arabic.

Bug: 15840116
Change-Id: Ia6433d7d98038ade64c171be4fe4b3f094111fac
/packages/inputmethods/LatinIME/java/src/com/android/inputmethod/latin/RichInputConnection.java
b6695867a5fe6af999d23c669e2e6a6182457bba 27-Jun-2014 Jean Chalard <jchalard@google.com> [SD6] Inline a constant and remove logic become useless

Bug: 15840116
Change-Id: I545cc9083aa4e2fd7cbbd1fbc02e1e382482db7c
/packages/inputmethods/LatinIME/java/src/com/android/inputmethod/latin/RichInputConnection.java
20c89b1cf5e30026844922d312163ffcd1c20b26 27-Jun-2014 Jean Chalard <jchalard@google.com> [SD5(2)] Remove useless args

Bug: 15840116
Change-Id: I1123426fbd9d420c1be64ccc917a5f870e70e6fa
/packages/inputmethods/LatinIME/java/src/com/android/inputmethod/latin/RichInputConnection.java
7eef5d3ff4a0456335943e6a7494f540a7291017 01-Jul-2014 Ken Wakasa <kwakasa@google.com> Revert "[SD5] Remove useless args"

This reverts commit 1d300239612591879d535c20ade1f2712048170e that broke the build.

Bug: 15840116
Change-Id: I0a5fa7dea2b418d19df24b2b31ed96bf192d45c0
/packages/inputmethods/LatinIME/java/src/com/android/inputmethod/latin/RichInputConnection.java
1d300239612591879d535c20ade1f2712048170e 27-Jun-2014 Jean Chalard <jchalard@google.com> [SD5] Remove useless args

Bug: 15840116
Change-Id: Ib3380cfc9d343c6f8953bba03af3801142bc3bdb
/packages/inputmethods/LatinIME/java/src/com/android/inputmethod/latin/RichInputConnection.java
92223c04deaf9d915ade4da70d8b707591fd3b4c 27-Jun-2014 Ken Wakasa <kwakasa@google.com> Merge "Revert "Move getPrevWordsInfoFromNthPreviousWord to StringUtlis.""
4569a734adffe1d12a4a1e8ff751608c1e4b2faf 27-Jun-2014 Ken Wakasa <kwakasa@google.com> Revert "Move getPrevWordsInfoFromNthPreviousWord to StringUtlis."

This reverts commit ba463c9a66f75e8d00f4658e32b763eb54215231 that broke the dicttool build.

Bug: 14425059
Change-Id: Ie1685587104d26e4416624747c97f6087c13388a
/packages/inputmethods/LatinIME/java/src/com/android/inputmethod/latin/RichInputConnection.java
ba463c9a66f75e8d00f4658e32b763eb54215231 27-Jun-2014 Keisuke Kuroyanagi <ksk@google.com> Move getPrevWordsInfoFromNthPreviousWord to StringUtlis.

Bug: 14425059
Change-Id: I3eb24e840c165e43f68c2a60fccf9974affb57a6
/packages/inputmethods/LatinIME/java/src/com/android/inputmethod/latin/RichInputConnection.java
1c2f1ada8305e36defa8572da687a4596bf083ea 27-Jun-2014 Keisuke Kuroyanagi <ksk@google.com> Find multiple previous word information to support n-gram.

Bug: 14425059

Change-Id: Ieace636334a9b2a094527341d4fcfc05958296c5
/packages/inputmethods/LatinIME/java/src/com/android/inputmethod/latin/RichInputConnection.java
1a2f3c4433d154c07c5017066c5dfe0f0070d520 27-Jun-2014 Keisuke Kuroyanagi <ksk@google.com> Merge "Move getPrevWordsInfoFromNthPreviousWord to StringUtlis."
17c5a388d6ada4dc395b52e56f8b18d63eebb863 27-Jun-2014 Keisuke Kuroyanagi <ksk@google.com> Merge "Find multiple previous word information to support n-gram."
e530fffc2c3655ba588454503cbaa7eacba4bffe 26-Jun-2014 Jean Chalard <jchalard@google.com> Add a relevant suggestion to period-checkable requests

Bug: 15412461
Change-Id: Ibf37df4d31141a7e43b54d6342e7861eedb1c03b
/packages/inputmethods/LatinIME/java/src/com/android/inputmethod/latin/RichInputConnection.java
e708b1bc2e11285ad404133b8de21719ce08acb5 25-Jun-2014 Keisuke Kuroyanagi <ksk@google.com> Make PrevWordsInfo have multiple words' information.

Bug: 14425059
Change-Id: I2bd6a872904a44b80f638a13d91a97559217cc1a
/packages/inputmethods/LatinIME/java/src/com/android/inputmethod/latin/RichInputConnection.java
9fd9a68d8797ed500d07d5e149cd4da50be2df15 05-Jun-2014 Jean Chalard <jchalard@google.com> 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
/packages/inputmethods/LatinIME/java/src/com/android/inputmethod/latin/RichInputConnection.java
8f71fab2ed619e34222a172a5004d7f91b4520a6 30-May-2014 Keisuke Kuroyanagi <ksk@google.com> Make prevWord = null if the next word starts from a connector.

This fixes PunctuationTests#
testAutoCorrectionWithSingleQuotesAround.

Bug: 14119293
Bug: 15334309

Change-Id: I604c21a21e89a5fc431fd56ab7b6ad03f4736b01
/packages/inputmethods/LatinIME/java/src/com/android/inputmethod/latin/RichInputConnection.java
bbf556e8e1f2b522c555e05ec06c4efefed16e02 28-May-2014 Tadashi G. Takaoka <takaoka@google.com> Remove researcher logger

This CL must be checked in together with I5cc76807e3.

Bug: 15318007
Change-Id: I61423c3377ddc299fb332e742d6626c2e47145bb
/packages/inputmethods/LatinIME/java/src/com/android/inputmethod/latin/RichInputConnection.java
a790c5b68324da41428aeb68594d43ca5632f66d 23-May-2014 Keisuke Kuroyanagi <ksk@google.com> Introduce EMPTY_PREV_WORDS_INFO and BEGINNING_OF_SENTENCE.

Bug: 14119293
Change-Id: I5020e5f0aa64bc3e97b3a3c2c07a60c8b765ed64
/packages/inputmethods/LatinIME/java/src/com/android/inputmethod/latin/RichInputConnection.java
17f326b7458c2bde2569e283a96e703755485328 21-May-2014 Keisuke Kuroyanagi <ksk@google.com> Add beginning of sentence information in PrevWordsInfo.

Bug: 14119293
Bug: 14425059
Change-Id: I65320920e840082b0b697bb621676716d0933e0c
/packages/inputmethods/LatinIME/java/src/com/android/inputmethod/latin/RichInputConnection.java
72b67f65411cf07cb8cb2d52e859f46d9d5b91d4 05-Mar-2014 Jean Chalard <jchalard@google.com> Rework the logic that tells if the cursor touches words

Bug: 13312942
Change-Id: I6be6a558bbc6c88508150f9c25cadbd0240ff88e
/packages/inputmethods/LatinIME/java/src/com/android/inputmethod/latin/RichInputConnection.java
e93a7232d17caffdca2ab3f62881ab0ae31f1cd5 10-Mar-2014 Jean Chalard <jchalard@google.com> Don't reset the value needed before it's used

Nice recipe for failure

Bug: 13387534
Change-Id: Ida1978449c1997587b2ec0955c5c94fcef336121
/packages/inputmethods/LatinIME/java/src/com/android/inputmethod/latin/RichInputConnection.java
f19745728e7231ffc8d7774b32821f31473ce1be 24-Feb-2014 Jean Chalard <jchalard@google.com> Never pass negative values to setSelection.

Bug: 13136079
Change-Id: Ieae6bafbd5339a033f0f342ba9af7dcc4ce209fa
/packages/inputmethods/LatinIME/java/src/com/android/inputmethod/latin/RichInputConnection.java
3b4c1d30565c06a7f5a4c362002862e8bcb61f01 20-Feb-2014 Jean Chalard <jchalard@google.com> Change a heuristic and add a log.

The heuristic in RichInputConnection makes little sense
when textLength > mExpectedSelStart but we have
more than 1024 characters of text. If there are that many,
it's about 100% sure that 1024 is not the correct cursor
position. With no good guess, we'll just continue trusting
the app, even though we know it's lying : at least it will
make the problem visible to the app author.

Also, there have been a lot of confusion about initialSelStart
and initialSelEnd. The keyboard should log them so that
it helps us and editor authors debug more easily these
common problems.

Issue #65170 in AOSP and
Bug: 12772035
Change-Id: I6665a16c9f2832d33ee323f033bb38bcc092a3b4
/packages/inputmethods/LatinIME/java/src/com/android/inputmethod/latin/RichInputConnection.java
3c84eb8822e56378eac4ed32591e254597bd1eaf 19-Feb-2014 Jean Chalard <jchalard@google.com> Don't distrust the cursor pos so much as to bug on IPC delay

When the cursor is moved by the user, the RichInputConnection
is told about it. However, to work around a framework bug, it
also looks at how many characters are in the buffer before the
cursor, and if that's more than the value it's been passed, it
deduces that's a framework bug and there are at least as many
characters as seen before the cursor, so it puts the expected
cursor position there.

When you move the cursor, TextView calls onUpdateSelection,
and when you move it fast, you'll get rapid-fire calls to
onUpdateSelection. This is fine, the RIC is equipped to
deal with that.

However, these calls take some time to make it to the IME. In
this instance, when the first call gets through and the IME
calls TextView (synchronously) for text before the cursor, the
cursor has already moved in the app, and TextView returns more
characters than the cursor position was declared to be in this
instance, so the RIC sets that as the expected cursor position.
Sure enough, a split second later, the second call to
onUpdateSelection arrives, with the new cursor position set
where the RIC had found it too early. The RIC takes that as an
"expected" cursor move, and the input does not get reset.

Luckily, we have a way out. As far as we know, the framework bug
only manifests itself upon rotation, which means we should only
have to adjust for it in onStartInputView. Doing it in
onUpdateSelection is too zealous (and probably too distrustful of
the app to send the correct cursor positions).

So we should just take care of the rotation case (by calling
tryFixLyingCursorPosition in onStartInputView) and remove the
compensating code in resetCachesUponCursorMoves.

Bug: 12982502
Change-Id: Ic3c1408a1ec45deaea63b01d98376a79ae567d77
/packages/inputmethods/LatinIME/java/src/com/android/inputmethod/latin/RichInputConnection.java
be8ad77ebb5d78db18a2ca1992e5e73d2b5e158a 20-Feb-2014 Jean Chalard <jchalard@google.com> Comments improvements

Typo fixes and clarifications

Change-Id: I0f7e0b6e665232bb995172fff10521c7f17599eb
/packages/inputmethods/LatinIME/java/src/com/android/inputmethod/latin/RichInputConnection.java
fe92c174ea08f9f593432f0ab20961700de9e027 18-Feb-2014 Jean Chalard <jchalard@google.com> Fix a bug where the cache would be out of sync

During recorrection, the cursor position when calling
commitText is not necessarily at the end of the
composing text.
Besides, RichInputConnection assumes the cursor is
always after any composing text. This is not correct,
but in the practice, it seems all code paths work.
We should fix this in the future.

Bug: 13060691
Change-Id: I15f71fff62d36e80cf6e4a022c5e78af634b199d
/packages/inputmethods/LatinIME/java/src/com/android/inputmethod/latin/RichInputConnection.java
7a7aeffcdcf1f25abdc3923e81fa19c2258fa9e9 17-Feb-2014 Jean Chalard <jchalard@google.com> Don't resume suggestion on links.

Bug: 11447084
Change-Id: I5bd558b9dd85d1505aa918f44e8ac3e52ec42d97
/packages/inputmethods/LatinIME/java/src/com/android/inputmethod/latin/RichInputConnection.java
c7ef305bbc119b820fd619d3ed205198d4f98c3f 17-Jan-2014 Jean Chalard <jchalard@google.com> Try to figure out whether d.quotes open or close.

Bug: 8911672
Change-Id: I5d5635949530a67f95e5208986907251b7bce903
/packages/inputmethods/LatinIME/java/src/com/android/inputmethod/latin/RichInputConnection.java
c93cf1c398fbea8bde4b568dae1fbe2f8d9b4180 20-Jan-2014 Tadashi G. Takaoka <takaoka@google.com> Use sorted int[] to represent word separators

Change-Id: I4103541d99fe59bfcf12379a1298a0a690497846
/packages/inputmethods/LatinIME/java/src/com/android/inputmethod/latin/RichInputConnection.java
6a18af634eda872daad858acbddae2a15452952e 17-Jan-2014 Tadashi G. Takaoka <takaoka@google.com> Refactor RichInputConnection a bit

Change-Id: I866488a47ca04ca587e805663dfd597bb7b1ebce
/packages/inputmethods/LatinIME/java/src/com/android/inputmethod/latin/RichInputConnection.java
ecf46df22683b997311ba77b34b33dffa8be43c0 09-Jan-2014 Jean Chalard <jchalard@google.com> [IL54] Add a mirror method to fix the cursor pos estimate

This just mirrors what InputLogic#tryFixLyingCursorPosition
is doing. That method will go away in the next change.

Change-Id: Ifa2827dbc1f1d20e2c642d6f2d23514a01ed9203
/packages/inputmethods/LatinIME/java/src/com/android/inputmethod/latin/RichInputConnection.java
6fbe83be7af6b15df3ed915b408c8179ca01c0cd 09-Jan-2014 Jean Chalard <jchalard@google.com> [IL53] Fix a wrong test.

This test was intended only for cases without a selection, and as
a safety net for cases where the app would pretend the cursor
is at N but we can get P chars from the editor where P > N.

When there is a selection, this is wrong. In the practice it works
because these values are not used in this case, but it's still wrong.

The case where P > N is arguable, but actually I see little reason
to trust the getTextBeforeCursor() method more than the
onUpdate selection method. Plus in the practice, I don't think
we are aware of any app with this bug, and it's probably not a
great idea to be too robust about this as it may encourage wrong
values sent to onUpdateSelection.

Change-Id: I42f2065d7aee668074e6b8e40b259da7e88e16e1
/packages/inputmethods/LatinIME/java/src/com/android/inputmethod/latin/RichInputConnection.java
494e2d6c17cdbf27615a2fbc02b12d2562bf7cd3 09-Jan-2014 Tadashi G. Takaoka <takaoka@google.com> Passing SpacingAndPunctuations to RichInputConnection.getNthPreviousWords

Change-Id: I174c50f509ed6998b755e1a712e7f6c0f82f4425
/packages/inputmethods/LatinIME/java/src/com/android/inputmethod/latin/RichInputConnection.java
0a75cf51afbdc79ccb2c6eabaf06a0aa26263af5 09-Jan-2014 Tadashi G. Takaoka <takaoka@google.com> Passing SpacingAndPunctuations to CapsModeUtils.getCapsMode

Change-Id: I0b06e8cc75a403f7061864c5b7f3f6a2cacd60eb
/packages/inputmethods/LatinIME/java/src/com/android/inputmethod/latin/RichInputConnection.java
e5cdcaff658f5366621115a728cb683eab5fda0a 08-Jan-2014 Jean Chalard <jchalard@google.com> Fix a race condition, take 2.

Don't use absolute cursor positions when making edits,
this leads to race conditions.
This is a bit ugly and will need to be fixed soon. Plans are
underway to clean this up.

Bug: 12390573
Change-Id: I69c09fc41b979880d0800c55a710e39373287cff
/packages/inputmethods/LatinIME/java/src/com/android/inputmethod/latin/RichInputConnection.java
a247264dc6eb8e9715c67ef831ffc21123dcf237 08-Jan-2014 Jean Chalard <jchalard@google.com> Revert "Fix a race condition, take 2."

Conflicts prevent this to be cherry-picked.

This reverts commit dd3d697a6e6713d82020dd63cbf78e4f87664484.

Change-Id: Ib97fae2234633b4bb27d611f48a79060db9ab16f
/packages/inputmethods/LatinIME/java/src/com/android/inputmethod/latin/RichInputConnection.java
dd3d697a6e6713d82020dd63cbf78e4f87664484 08-Jan-2014 Jean Chalard <jchalard@google.com> Fix a race condition, take 2.

Don't use absolute cursor positions when making edits,
this leads to race conditions.
This is a bit ugly and will need to be fixed soon. Plans are
underway to clean this up.

Bug: 12390573
Change-Id: Ib42d4149343c642b1b5c1937b424e8afdbd4cc1f
/packages/inputmethods/LatinIME/java/src/com/android/inputmethod/latin/RichInputConnection.java
1e50c681af56dd77d97a1e6d463f1e3023c1a69b 25-Dec-2013 Jean Chalard <jchalard@google.com> [IL52] Remove a useless method.

This old method doesn't even re-read the old suggestions. It used to
recompute them without the coordinates.
Re-using the recorrection code, which is much more advanced, is
the right thing to do here.

Also, refining the test. It's no use trying to resume suggestion
if we don't have a suggestion strip, since we aren't going to
auto-correct anything anyway.

Not the motivation for this change, but this also fixes
Bug: 11620256
Change-Id: Id49efa32e293c49837c61fdc752c86bbac1d2c88
/packages/inputmethods/LatinIME/java/src/com/android/inputmethod/latin/RichInputConnection.java
2fa3693c264a4c150ac307d9bb7f6f8f18cc4ffc 13-Dec-2013 Ken Wakasa <kwakasa@google.com> Reset to 9bd6dac4708ad94fd0257c53e977df62b152e20c

The bulk merge from -bayo to klp-dev should not have been merged to master.

Change-Id: I527a03a76f5247e4939a672f27c314dc11cbb854
/packages/inputmethods/LatinIME/java/src/com/android/inputmethod/latin/RichInputConnection.java
3a9b2430a56cb2d774070bd8ecd661d0dfb82484 13-Nov-2013 Jean Chalard <jchalard@google.com> Fix many small nits.

...the interaction of which results in a very bad bug.

Bug: 11648854
Change-Id: I774489e384388f187e72b9ac091ab387c5e1a79a
/packages/inputmethods/LatinIME/java/src/com/android/inputmethod/latin/RichInputConnection.java
8a1675379e03bd7830d35212fd987346927068a9 22-Oct-2013 Jean Chalard <jchalard@google.com> Stopgap solution for a crash.

This returns the wrong string, but since it's used for getting the
previous word for bigrams, it only results in slightly worse
suggestions quality.

Bug: 11273655
Change-Id: I6ce5de2f76effc453ca691a654ab6bf17445b9e7
/packages/inputmethods/LatinIME/java/src/com/android/inputmethod/latin/RichInputConnection.java
10581e68af1de7d0b5d2c88927ad7bbad7dad600 08-Oct-2013 Jean Chalard <jchalard@google.com> Make the sentence separator a resource.

This will help handing correctly the armenian full stop.

Bug: 10082781
Change-Id: Id7bb219ebd89daba203216eab362d1cc26a65a36
/packages/inputmethods/LatinIME/java/src/com/android/inputmethod/latin/RichInputConnection.java
f56b82f80961a511765df206eee36229cbee6ed8 25-Sep-2013 Ken Wakasa <kwakasa@google.com> Fix the offdevice regression test build

Followup to If4e44eca3cdc5bb02cf2e0c8c44ecd4bf27fae57

bug: 10622489
Change-Id: If98b2c75725f8692f0c2b41c33e448086404479b
/packages/inputmethods/LatinIME/java/src/com/android/inputmethod/latin/RichInputConnection.java
3d68b066626d7e58cbe2853cd186b1ad75b90259 12-Sep-2013 Jean Chalard <jchalard@google.com> Copy only the spans we are interested in.

The PARAGRAPH type of span is dangerous, as concatenating
CharSequences that contain it may crash. We also don't use
other spans than SuggestionSpans, so we don't copy them.

Bug: 10622489
Change-Id: If4e44eca3cdc5bb02cf2e0c8c44ecd4bf27fae57
/packages/inputmethods/LatinIME/java/src/com/android/inputmethod/latin/RichInputConnection.java
f1d8aa46f9172c2d8864d0d2161aa8220d036cc9 20-Sep-2013 Jean Chalard <jchalard@google.com> Detect cases where rotation messes with initialization

...and do a best effort to fix it.

Bug: 10323080
Bug: 10252066
Change-Id: Icb3c9fe85005406bdfce0b7bb143ba0a910a0ddb
/packages/inputmethods/LatinIME/java/src/com/android/inputmethod/latin/RichInputConnection.java
8f02f1a118d36a1c4143b62f7e20727b2d2bf363 20-Sep-2013 Jean Chalard <jchalard@google.com> Fix a bug where null would be converted to "null"

It's unclear what the concrete effects of this are, but they are not
very strong. This only happens in corner cases, when the input
connection is not active - while rotating, for example.

Change-Id: I1d22459a6e94a8ecccb53cfcbc2d301b1d502204
/packages/inputmethods/LatinIME/java/src/com/android/inputmethod/latin/RichInputConnection.java
6c94a18a2847bfa0943c8154a459bd00dc961f2c 22-Aug-2013 Kurt Partridge <kep@google.com> Fix cursor state bug

InputConnection#finishComposingText() should not change the position of the cursor,
so neither should it change its internal expectation of the cursor's position.

Change-Id: Ib3d39a5743cd1e8e356f438b04a5c30279430b2a
/packages/inputmethods/LatinIME/java/src/com/android/inputmethod/latin/RichInputConnection.java
522d13c302e360cd4984b9164a9fc81bdc64feac 07-Aug-2013 Jean Chalard <jchalard@google.com> Have double-space-to-period cancel leave a single space

Bug: 8911898
Change-Id: Ifb4bb63c14dc960d0a53f1511908830093cca012
/packages/inputmethods/LatinIME/java/src/com/android/inputmethod/latin/RichInputConnection.java
aa108f1d7fbc8a2f92860a58b759c98ed5b804cf 30-Jul-2013 Jean Chalard <jchalard@google.com> Clarify the expected cursor position in RichInputConnection.

Change-Id: I4d36a23567415c3a293a588b51b46006256c148f
/packages/inputmethods/LatinIME/java/src/com/android/inputmethod/latin/RichInputConnection.java
0a064a5d88c5cdc03f8ef13a2f7b6b506b9cbdfa 26-Jul-2013 Jean Chalard <jchalard@google.com> Small optimization

Bug: 8864306
Change-Id: Ic8eecd64eff6a1150a90b9f5ec9ebbc5f1d2a6a9
/packages/inputmethods/LatinIME/java/src/com/android/inputmethod/latin/RichInputConnection.java
8c6537edbd9e80b2d7169ecd31b1f0efbd1f9f20 26-Jul-2013 Jean Chalard <jchalard@google.com> Use cached data for getTextBeforeCursor.

Bug: 8864306
Change-Id: Ia146f711f1de4336d7e3363208ab92eba856f5e1
/packages/inputmethods/LatinIME/java/src/com/android/inputmethod/latin/RichInputConnection.java
38e9802690bbb96a00762ce5d172c5a37716fe1d 26-Jul-2013 Jean Chalard <jchalard@google.com> Merge "Revert "Very simple refactoring""
c6a07e16a5801189aabfe6a2efabb61914763204 26-Jul-2013 Jean Chalard <jchalard@google.com> Revert "Very simple refactoring"

This reverts commit f712dc9a4f17ee4a6916b0f477e89d1bc34a4d70.
It turns out this refactoring is not useful after all.

Change-Id: I0145c907b3cc5ac9a30a59abcd719cb546c9bd3a
/packages/inputmethods/LatinIME/java/src/com/android/inputmethod/latin/RichInputConnection.java
0dd23544ffec1ae50c4b56fced22b47e7772f5ed 26-Jul-2013 Jean Chalard <jchalard@google.com> Merge "Very simple refactoring"
ffcbbaf12788a9fc9398607a548e552d7d2bf05e 25-Jul-2013 Satoshi Kataoka <satok@google.com> Refactor on UserHistoryDictionary

Bug: 9429906
Change-Id: I576a91643bdaf5017cc826ac2e07a74a9a275d60
/packages/inputmethods/LatinIME/java/src/com/android/inputmethod/latin/RichInputConnection.java
f712dc9a4f17ee4a6916b0f477e89d1bc34a4d70 25-Jul-2013 Jean Chalard <jchalard@google.com> Very simple refactoring

Bug: 8864306
Change-Id: I5c9b118cb6a8eb59efc52d5534b10fcab93182d6
/packages/inputmethods/LatinIME/java/src/com/android/inputmethod/latin/RichInputConnection.java
a7d2fc6befa1b16883200a653fc01deb4d94944d 21-Jul-2013 Ken Wakasa <kwakasa@google.com> Move settings related classes to "settings"

Change-Id: Id170dbfe2dcfc93130b7be4a84615940403ec37f
/packages/inputmethods/LatinIME/java/src/com/android/inputmethod/latin/RichInputConnection.java
f87e8f7ec1efb93398d909c67468d716b0248fe7 02-Jul-2013 Tadashi G. Takaoka <takaoka@google.com> Handling key repeat by emulating key press and code input

This change also eliminates a reference of
AudioAndHapticFeedbackManager from KeyboardSwitcher and MainKeyboard.

Bug: 6522943
Change-Id: Iac42ec8ff00c66deb76a660ffc07477923a58959
/packages/inputmethods/LatinIME/java/src/com/android/inputmethod/latin/RichInputConnection.java
675bcf191c3cdb5ba5af70efb9357ffceb389c2e 25-Jun-2013 Jean Chalard <jchalard@google.com> Move Range out of RichInputConnection and rename it.

Range has grown a bit too big to stay an internal class.

Change-Id: Ic3fbc48a5d10776eedd7559c4d696e5926b88288
/packages/inputmethods/LatinIME/java/src/com/android/inputmethod/latin/RichInputConnection.java
2f7f6257b66fc1ed19b600f3d55902fd0de2e338 24-Jun-2013 Jean Chalard <jchalard@google.com> Ignore spans that are not the right size.

Bug: 8839763
Bug: 8862327
Change-Id: I5d49c86edcbc0fc1b2b147856437cfbadd678377
/packages/inputmethods/LatinIME/java/src/com/android/inputmethod/latin/RichInputConnection.java
7fcf304c974d52a816b3375f22e714798fe308e5 26-Jun-2013 Jean Chalard <jchalard@google.com> Fixing follow-up to I548d899b

I548d899b introduced a new method to fix a sync miss between
the cursor position and the cached cursor position, but did not
take into account that it should also update the cached text
before and after the cursor in this case and that there was
already a method for doing this.

Change-Id: I31bd741893207c822827304e77791b1159774e1a
/packages/inputmethods/LatinIME/java/src/com/android/inputmethod/latin/RichInputConnection.java
03118a276014cd44d44d0d46f4f39622765e8e0c 25-Jun-2013 Ken Wakasa <kwakasa@google.com> Cleanup under the utils package

Change-Id: If2f7bd1346cc5085bf57645830f0faac44d017e4
/packages/inputmethods/LatinIME/java/src/com/android/inputmethod/latin/RichInputConnection.java
10585620bdfad418f6c093ab4bfd8efaa2d84abf 25-Jun-2013 Jean Chalard <jchalard@google.com> Merge "Fix a bug in the cached cursor pos, and simplify selection handling"
bc1813186df823e4e1a5aabceb3198674387061e 24-Jun-2013 Ken Wakasa <kwakasa@google.com> Merge "Move util classes to the latin/utils directory"
e28eba5074664d5716b8e58b8d0a235746b261eb 23-Jun-2013 Ken Wakasa <kwakasa@google.com> Move util classes to the latin/utils directory

Change-Id: I1c5b27c8edf231680edb8d96f63b9d04cfc6a6fa
/packages/inputmethods/LatinIME/java/src/com/android/inputmethod/latin/RichInputConnection.java
e8c4b99e5665c6c19793df6c2490ee4bf281bf63 20-Jun-2013 Jean Chalard <jchalard@google.com> Refactor text range to be able to get spans larger than the word

This changes how the Range class stores its data, but not its
functionality. It also improves encapsulation a bit.

Bug: 8839763
Bug: 8862327
Change-Id: I5bd583b3fc96a99b93a2632882d8fd587c03ab76
/packages/inputmethods/LatinIME/java/src/com/android/inputmethod/latin/RichInputConnection.java
e5dee0af4ae991988919b2c5b80c10a94b26884e 21-Jun-2013 Jean Chalard <jchalard@google.com> Fix a bug in the cached cursor pos, and simplify selection handling

The documentation for setComposingRegion states explicitly
that it does not move the cursor. This is just a bug.
This does not have any ill effects right now, but it will have
in later changes if not fixed.

As for the selection handling, the specific test that this code
removes used to serve a purpose, but it does not any more because
the code using the value has been much sanitized. Now the variable
can just take the obvious value, and become so self-explanatory
that the comments are unnecessary.

Change-Id: I548d899b38776bd3ab5f5361aab0d89d98f12e73
/packages/inputmethods/LatinIME/java/src/com/android/inputmethod/latin/RichInputConnection.java
9f9cc032773a528b4eb6e036db0c37ff45385cce 08-May-2013 Jean Chalard <jchalard@google.com> Optimizations and safeguards.

- Don't call finishComposingText when useless.
- Add safeguards against calling setComposingRegion when the
data returned by the editor is inconsistent.
- Cancel pending recorrection messages when new messages arrive.

Bug: 8842941
Bug: 8845001
Change-Id: I939701033cf5c2bbd85871ecf83e329021ddeb91
/packages/inputmethods/LatinIME/java/src/com/android/inputmethod/latin/RichInputConnection.java
73ec85b8ad3102ce1c7e6013be73afe83475e589 15-Apr-2013 Jean Chalard <jchalard@google.com> Don't insert automatic spaces when text looks like a URL

This is about as ad-hoc as it gets, but then again, what we want
is probably as ad-hoc as it gets.
All URL boxes I know of double as search bars, and not adding
automatic spaces there sucks (e.g. in Chrome URL bar).
And in other boxes actually you don't want to add a space if
it looks like a URL. QSB isn't even a search box, and it behaves
like this.

So I think this is actually the right answer to the problem.

Bug: 7062925
Change-Id: Ib09472b34644fd5bf2dc84bb97cedeeba28bcd02
/packages/inputmethods/LatinIME/java/src/com/android/inputmethod/latin/RichInputConnection.java
2995abe7aadd483aa57a9b088740d46ac07bbe46 03-Dec-2012 Jean Chalard <jchalard@google.com> Have Latin IME re-capitalize a selected string

Upon pressing Shift, if there is currently a selected string, have
Latin IME change its capitalization.
This does not yet have the keyboard mode follow the mode - the change
is complicated enough as is.

Bug: 7657025
Change-Id: I54fe8485f44e04efd72c71ac9feee5ce21ba06f2
/packages/inputmethods/LatinIME/java/src/com/android/inputmethod/latin/RichInputConnection.java
91bcf5eb5dcf1f2ff66cfda90832db21bce7e330 12-Apr-2013 Jean Chalard <jchalard@google.com> Merge "Restart suggestions when the cursor moves."
02ce3dc2d11aba2b521f85223af1f870207b81dc 10-Apr-2013 Jean Chalard <jchalard@google.com> Fix a bug with bad application completions

Bug: 8561056
Change-Id: I91fb0ac76dabfc841bafc0e2c0ea9f63e6f604f9
/packages/inputmethods/LatinIME/java/src/com/android/inputmethod/latin/RichInputConnection.java
6a114fa700d3ca73c608e1291b74bbbdd5a1a7b7 10-Apr-2013 Jean Chalard <jchalard@google.com> Restart suggestions when the cursor moves.

This uses the old suggestions. It does not try to recompute
new suggestions if there are no old suggestions yet: this is
coming in a later change.
If there are no suggestions, this shows the word itself
as a suggestion.

Bug: 8084810
Change-Id: I4c2e25df0ff3673be1825f57a0c19a9d23d47a48
/packages/inputmethods/LatinIME/java/src/com/android/inputmethod/latin/RichInputConnection.java
740da0d8d0b29297fba75f4b63ccff28fc1f4a14 29-Mar-2013 Jean Chalard <jchalard@google.com> Fix an NPE

Also remove an unused method and make 2 private variables
final.

Bug: 8461093
Change-Id: I676d93fda28e82eb5a6978f2e7ad5a0add2cbecf
/packages/inputmethods/LatinIME/java/src/com/android/inputmethod/latin/RichInputConnection.java
9c3860ce461c3791891bf667edc77fe798c8d332 18-Mar-2013 Ken Wakasa <kwakasa@google.com> Rename ProductionFlag.IS_EXPERIMENTAL to USES_DEVELOPMENT_ONLY_DIAGNOSTICS

bug: 8393568
Change-Id: Ie5edf44a3627aca9416145aff56bf05bbf2a05f3
/packages/inputmethods/LatinIME/java/src/com/android/inputmethod/latin/RichInputConnection.java
ce6bcdd1a547c9874f05a08074cafdfea16196d6 12-Feb-2013 Tadashi G. Takaoka <takaoka@google.com> Separate caps mode related utils to CapsModeUtils

Change-Id: I32700c434b296bb3fd39e040c2dda1fe90667daf
/packages/inputmethods/LatinIME/java/src/com/android/inputmethod/latin/RichInputConnection.java
8aa9963a895f9dd5bb1bc92ab2e4f461e058f87a 21-Jan-2013 Tadashi G. Takaoka <takaoka@google.com> Fix Apache license comment

Change-Id: Ic56167f952a7f4449da366e1e81610e72c966086
/packages/inputmethods/LatinIME/java/src/com/android/inputmethod/latin/RichInputConnection.java
ae3b96b26ef86a9f342b4aeb2047abdaac5e57a5 11-Jan-2013 Jean Chalard <jchalard@google.com> Simplify the space-before and space-after logic.

Bug: 7889078
Bug: 7268000
Change-Id: I6c77b8c9e60ef69f02526b407124d2f5d02818ee
/packages/inputmethods/LatinIME/java/src/com/android/inputmethod/latin/RichInputConnection.java
3b95eaf70b0a11b1c6e0c52361fe738b4a4b2ace 24-Dec-2012 Kurt Partridge <kep@google.com> [Rlog50] capture bigrams properly even with deletions

multi-project commit with Ia4ec213e8356897807cb6a278fccdbaa945732f0

Change-Id: Ib3fe886dc889954a31586ab81d00a21d8d55efd2
/packages/inputmethods/LatinIME/java/src/com/android/inputmethod/latin/RichInputConnection.java
9bad176ebe4f6520db188b5498efbbf7e5fc2c4f 08-Jan-2013 Kurt Partridge <kep@google.com> Merge "[Rlog32] ResearchLogger segment motion data around gestures correctly"
99f31896454eff3789e00949dcce83f6914fe3f4 31-Aug-2012 Kurt Partridge <kep@google.com> [Rlog32] ResearchLogger segment motion data around gestures correctly

multi-project commit with I684ba5fed8c653777942e6b0366113ca40dfa37c

Change-Id: Id3804e6cfa97b4cdde212b8eebc413f76fa4772c
/packages/inputmethods/LatinIME/java/src/com/android/inputmethod/latin/RichInputConnection.java
b6ca354431367b625daf9fff5fbe4b1f5ef996ab 06-Jan-2013 Ken Wakasa <kwakasa@google.com> Small code cleanups

Multi-project commit with I249d5fbe

Change-Id: Ia28c4e970992aa1299a30e604eaa5d096655c3a5
/packages/inputmethods/LatinIME/java/src/com/android/inputmethod/latin/RichInputConnection.java
0abc48218ee90b1d8df77dfa131ce05fbaba7121 27-Dec-2012 Jean Chalard <jchalard@google.com> Rename some confusing variables

Change-Id: Ib0de800599ae7f12c86270a627616d5b52366414
/packages/inputmethods/LatinIME/java/src/com/android/inputmethod/latin/RichInputConnection.java
5bde3a61633556afb16481680daefc7cabbf5890 27-Dec-2012 Jean Chalard <jchalard@google.com> Fix an old bug in getting a word from the connected view.

In this test, it's impossible that start < 0 so the test is useless.
I'm not sure what the cursor test was for, but it's very old code, and
it seems the assumption was either misled or doesn't hold any more:
testing for the absolute cursor position against the length of the
word against the cursor makes no sense.

The net result of this was that when the cursor index got large
enough, resuming suggestion would not work any more.

Bug: 7586467
Change-Id: I3462082374fe9579bec7698f4d424de6ff5f2ded
/packages/inputmethods/LatinIME/java/src/com/android/inputmethod/latin/RichInputConnection.java
f763dc5915d394378bdcdc90cc0b238e66926b8b 28-Aug-2012 Kurt Partridge <kep@google.com> [Rlog24] ResearchLogger detect word boundaries in callers above commitText

multi project commit with I5847d4aba97a7224ae170a7153811c5a11816449

Change-Id: Ie6fbf6f19f0193451fe6f3ddf9d4ef1637a35db1
/packages/inputmethods/LatinIME/java/src/com/android/inputmethod/latin/RichInputConnection.java
c5da4365fbe6ff23a8db381ee7de6fa43fd7086b 18-Dec-2012 Kurt Partridge <kep@google.com> Merge "[Rlog2] ResearchLogging fix multi-space logging"
3370dc82370f5397bafdaeba395e3dfc8b8adf3a 10-Aug-2012 Kurt Partridge <kep@google.com> [Rlog2] ResearchLogging fix multi-space logging

multi-space logging should look like single-space logging, missing a few minor log statements
(SuggestionUpdates, SetComposingText)

multi-project commit with I2af842348c2f2b8f7271ac5b63def245e83df24d

Change-Id: Icd3187c0d0377255f82787afffea657c14345803
/packages/inputmethods/LatinIME/java/src/com/android/inputmethod/latin/RichInputConnection.java
96b22200beb98fd1a6288f4cf53e38611a09cdd0 17-Dec-2012 Ken Wakasa <kwakasa@google.com> Privatize a few constants in BinaryDictionary.java

Change-Id: I7defaf1f577fd67e678cac83ff935e8181dd0a48
/packages/inputmethods/LatinIME/java/src/com/android/inputmethod/latin/RichInputConnection.java
8c15e91344a5e97ca069200070745c4384f40750 15-Dec-2012 Ken Wakasa <kwakasa@google.com> resolved conflicts for merge of d48d6fee to master

Change-Id: I21141956135debe737453dba87617671b1716d0a
18d688c94bb8e1e26de2d12445cb3096c6126f75 13-Dec-2012 Jean Chalard <jchalard@google.com> Use the amended user dictionary word for insertion

When the user edits a word before adding it to the user
dictionary, the keyboard should replace whatever was
committed before with the amended version.

Bug: 7725834
Change-Id: I1a417be6c5a86d6a96bc2c76aca314ad8f1202a9
/packages/inputmethods/LatinIME/java/src/com/android/inputmethod/latin/RichInputConnection.java
2da886651874b2588f18f800417ba858ac93d88b 06-Dec-2012 Jean Chalard <jchalard@google.com> Remove a couple Eclipse and Android Lint warnings

Change-Id: I0c29c5d2abcbf80759b996d34b534deb083cd7d3
/packages/inputmethods/LatinIME/java/src/com/android/inputmethod/latin/RichInputConnection.java
3a9f84a197887ef9ab44c925f79863a707e6bffc 16-Nov-2012 Jean Chalard <jchalard@google.com> am 8c470f16: am 5dee6e69: am 187e683a: Merge "Fix a bug with some text fields" into jb-mr1.1-dev

* commit '8c470f16db291e257ac538bd0ac2a9354d34010c':
Fix a bug with some text fields
00c0010ccf2de188743cb8f7364b8ba8b9faf7f8 13-Nov-2012 Jean Chalard <jchalard@google.com> Fix a bug with some text fields

Not sure when this happens exactly, but it is possible that
InputConnection#getTextBeforeCursor returns null. This
happens for example upon rotating the screen with the
composing field empty in Gmail.
In this case, StringBuilder#append will convert the null
pointer into the string "null", which is sure better than a
crash, but can have a number of bad side-effects, like
auto-caps not working.

Bug: 7533034
Change-Id: Ia1cfab432c13a12ff1c2f013c59bac05a587f553
/packages/inputmethods/LatinIME/java/src/com/android/inputmethod/latin/RichInputConnection.java
240871ecafde7834ebb4270cd7758fc904a5f3a7 29-Oct-2012 Tadashi G. Takaoka <takaoka@google.com> Move code point constants from Keyboard to Constants class

Change-Id: Iee01d4d2b916d0b584531104ac865ae6e6370a3d
/packages/inputmethods/LatinIME/java/src/com/android/inputmethod/latin/RichInputConnection.java
bc464e2952e102219f0b977fc1e9140ad5bd03e4 03-Oct-2012 Tadashi G. Takaoka <takaoka@google.com> Replace useless CharSequence to String

Change-Id: Idc478f901185ee1b4912acc82d0cbc54fee4e991
/packages/inputmethods/LatinIME/java/src/com/android/inputmethod/latin/RichInputConnection.java
e91d495c53a2606962159cfddada2b7a5e206c4c 16-Oct-2012 Jean Chalard <jchalard@google.com> Have "no whitespace before cursor" upon gesture trigger phantom space

Bug: 7359291
Bug: 7357758
Bug: 7197651
Change-Id: Ia805a87e922739ae0a06978a3bf00d91c94b6c51
/packages/inputmethods/LatinIME/java/src/com/android/inputmethod/latin/RichInputConnection.java
574b80aacee95df26e85e6b78876a73d7076a672 01-Oct-2012 Jean Chalard <jchalard@google.com> Remove debug prints.

Bug: 7226098
Change-Id: Ibacb740022a6af56c9d555d6797dd402a89f6ca4
/packages/inputmethods/LatinIME/java/src/com/android/inputmethod/latin/RichInputConnection.java
a28a05e971cc242b338331a3b78276fa95188d19 27-Sep-2012 Tadashi G. Takaoka <takaoka@google.com> Cleanup: Make some classes as final

Change-Id: I6009b3c1950ba32b7f1e205a3db2307fe0cd688e
/packages/inputmethods/LatinIME/java/src/com/android/inputmethod/latin/RichInputConnection.java
d461bfd6601dfb6d4a4f78be0ff129597af895ff 14-Sep-2012 Jean Chalard <jchalard@google.com> Support the gesture + phantom space case (A13)

Bug: 6950087
Change-Id: I198699f6e687ac74c35b9edfe469dce880d9ecaf
/packages/inputmethods/LatinIME/java/src/com/android/inputmethod/latin/RichInputConnection.java
90a91272447fd64bc54e06f08f45b11c45930767 14-Sep-2012 Jean Chalard <jchalard@google.com> Take space state into account for caps (A11)

Bug: 6950087
Change-Id: I8a1bca24db64b4dd54db8ac74d90cf43cbdddab6
/packages/inputmethods/LatinIME/java/src/com/android/inputmethod/latin/RichInputConnection.java
252da38fcd1a40b8c308d6754d644064032094f9 14-Sep-2012 Jean Chalard <jchalard@google.com> Take locale into account for caps (A10)

Bug: 4967874
Change-Id: Ic7ce7b2de088308fa00865c81246c84c605db1e5
/packages/inputmethods/LatinIME/java/src/com/android/inputmethod/latin/RichInputConnection.java
d7fdc730c302c182cc34dd03018b4185df912727 13-Sep-2012 Jean Chalard <jchalard@google.com> Merge "Simplify a call, and add comments (A2)" into jb-mr1-dev
3d54e1c1eccf58e184c065ebe78f0f467cd04606 13-Sep-2012 Jean Chalard <jchalard@google.com> Simplify a call, and add comments (A2)

Since the function has to be modified heavily but does a lot
of non-trivial work, add a wealth of comments explaining what
it does and why so as to facilitate understanding the changes
to come.

Bug: 4967874
Change-Id: I6c21aea15f161d807035f279dfb7d1b98b3e9144
/packages/inputmethods/LatinIME/java/src/com/android/inputmethod/latin/RichInputConnection.java
2427f578c8fafa85f3f9f74c00384f785e489bcf 13-Sep-2012 Jean Chalard <jchalard@google.com> Merge "Import TextUtils.getCapsMode to fix it internally (A1)" into jb-mr1-dev
9d1c73ffd88cd1bfef3de048b0b3a9a7dfbcfa70 10-Sep-2012 Jean Chalard <jchalard@google.com> Import TextUtils.getCapsMode to fix it internally (A1)

This should have on effect at all on behavior,
except an increase in performance.

Bug: 4967874
Bug: 6950087
Change-Id: Ie2b51efefe84ca767f5dc8e3b80bfef7e1faab3d
/packages/inputmethods/LatinIME/java/src/com/android/inputmethod/latin/RichInputConnection.java
5ed88457bf9ef3305d4a5aa4ac05b513433ad0dd 11-Sep-2012 Jean Chalard <jchalard@google.com> Make onUpdateSelection much more resilient to race conditions.

This is pretty much as strong as it gets. It should be
impossible to get false positives and nearly impossible to
get true negatives with this new code.

Bug: 6981089
Change-Id: Ia32ab62f89c5943f0be169b979abab652e67bf5b
/packages/inputmethods/LatinIME/java/src/com/android/inputmethod/latin/RichInputConnection.java
28d765ed901bfd1e736056db1cd807c13ef88c35 10-Sep-2012 Jean Chalard <jchalard@google.com> Make Latin IME aware of its surrounding text.

This is a preparatory change for
Bug: 4967874
Bug: 6617760
Bug: 6950087

Change-Id: I3abf8e45c0d02c42491421f108370220134b9602
/packages/inputmethods/LatinIME/java/src/com/android/inputmethod/latin/RichInputConnection.java
94e7f4bef970431f509a806d1b92b19fc3b5ce7d 02-Aug-2012 Kurt Partridge <kep@google.com> ResearchLogger log RichInputConnection

Move many ResearchLogger data collection points to RichInputConnection.
By collecting data here, developers do not have to remember to keep the
ResearchLog consistent with calls to the RichInputConnection.

In addition, some unnecessary log points were removed, and the ResearchLogger
is now independent of LatinImeLogger.

multi-project change with I05496cfd762e9a41c42c50099143f1efc0a3d8a2

Bug: 6188932
Change-Id: I424abb2e437901262a9620255493916b7c3ff74b
/packages/inputmethods/LatinIME/java/src/com/android/inputmethod/latin/RichInputConnection.java
35c11842a78e272ac4f61bfc58b96826c833f104 20-Aug-2012 Kurt Partridge <kep@google.com> Revert "ResearchLogger log RichInputConnection"

This reverts commit 1964ffb3f43f0ada429d13b41bd22b90a97fa9fc

Change-Id: Ie43e7ac828faa91e1824a255bb3ecf6c8222d4e8
/packages/inputmethods/LatinIME/java/src/com/android/inputmethod/latin/RichInputConnection.java
1964ffb3f43f0ada429d13b41bd22b90a97fa9fc 02-Aug-2012 Kurt Partridge <kep@google.com> ResearchLogger log RichInputConnection

Move many ResearchLogger data collection points to RichInputConnection.
By collecting data here, developers do not have to remember to keep the
ResearchLog consistent with calls to the RichInputConnection.

In addition, some unnecessary log points were removed, and the ResearchLogger
is now independent of LatinImeLogger.

multi-project change with Ib71f841044ec1072610ab5638a5edfce29b7c05b

DO NOT MERGE

Bug: 6188932
Change-Id: I9ec7500a5b18bfe1a5a5bb1e5bf21c43351fc59e
/packages/inputmethods/LatinIME/java/src/com/android/inputmethod/latin/RichInputConnection.java
6b966160ac8570271547bf63217efa5e228d4acc 20-Jul-2012 Kurt Partridge <kep@google.com> ResearchLog refactor

- new package: com.android.inputmethod.research

multi-project commit with Ic0a5744f3160d13218addd589890623c0d120ffc

Bug: 6188932

Change-Id: Icf8d4a40a5725401799be6e209a640d99a5f34c4
/packages/inputmethods/LatinIME/java/src/com/android/inputmethod/latin/RichInputConnection.java
d579f1aefc8d02254db297ffd6d8f9dbdcab0637 05-Jul-2012 Jean Chalard <jchalard@google.com> Consolidate methods that do the same thing (A74)

Change-Id: I6e7c3aba2b40ecefa483c9680978bc806368e96e
/packages/inputmethods/LatinIME/java/src/com/android/inputmethod/latin/RichInputConnection.java
f254e3fec7744dc1eb2cc09ac157986c3b2b5408 04-Jul-2012 Jean Chalard <jchalard@google.com> Fix a bug where the caps mode would not be changed

Bug: 6766059
Change-Id: I378f9d35c4904c4f373260bda5863235d833eb31
/packages/inputmethods/LatinIME/java/src/com/android/inputmethod/latin/RichInputConnection.java
c3ebf1a43a6202c9992773722ff1eed7088b9a91 25-Jun-2012 Jean Chalard <jchalard@google.com> Refactoring and groundwork to fix a bug with older apps

This has a good, although small, impact on performance : it removes
a two-way IPC call in a most frequent case, while possibly adding
one in a rather unfrequent and less critical case.

Also, this fixes a bug with surrogate pairs. This specific branch
of code now correctly handles surrogate pairs.
Aside from this, it should have no impact on behavior.

However, since it does delay access to the previous character in
the text view by a two-way IPC call, it actually goes a long way
toward fixing bug#6668226. It is not really a fix and the race
condition still exists, but this change makes it much, much
harder to hit.

Bug: 6668226
Change-Id: Id11cc6a0b7488d6bd392227cafdcf3a8d4c62f6c
/packages/inputmethods/LatinIME/java/src/com/android/inputmethod/latin/RichInputConnection.java
9d71748ba48dbc8793f3e1ecddf5fd31b8e59613 08-Jun-2012 Jean Chalard <jchalard@google.com> Fix an occurrence of nested batch edits.

This is harmless, but against policy.
Also, rework the checking code to be more readable, give more
information, and be called for all relevant methods - and not
for informative methods, which are not required to be in a
batch edit.

Change-Id: I03fa8b2e7d68a6a133f86be8a214671750c29256
/packages/inputmethods/LatinIME/java/src/com/android/inputmethod/latin/RichInputConnection.java
2010aad741bc1a7266913bcb8b8348d6e401c95b 08-Jun-2012 Jean Chalard <jchalard@google.com> Move two methods in a more appropriate place

Change-Id: I512b04e23490413a44b1ca0517102fe2d9138df3
/packages/inputmethods/LatinIME/java/src/com/android/inputmethod/latin/RichInputConnection.java
a32eb2721390d5964c83c787ad30fd3f61b936b0 08-Jun-2012 Jean Chalard <jchalard@google.com> Move an editing method to the RichInputConnection

Change-Id: Ie143ad008ca8deb1c5034cb80ec1cb28a6b0682d
/packages/inputmethods/LatinIME/java/src/com/android/inputmethod/latin/RichInputConnection.java
747cf0435a7e978dfd43c30bd931b56146c3d852 08-Jun-2012 Jean Chalard <jchalard@google.com> Move two editing utility methods to RichInputConnection

Change-Id: If8d03bea1b6369cb3043da6321048d052995d664
/packages/inputmethods/LatinIME/java/src/com/android/inputmethod/latin/RichInputConnection.java
bbbdab12be748cdc2158f0e04bbb5478052ecd89 08-Jun-2012 Jean Chalard <jchalard@google.com> Move some editing methods to RichInputConnection.

Change-Id: I8527776a4bd8236a85bb77f9791f9b76977ad181
/packages/inputmethods/LatinIME/java/src/com/android/inputmethod/latin/RichInputConnection.java
02308bec632a5df23325c916bffec5def16b22b4 08-Jun-2012 Jean Chalard <jchalard@google.com> Merge RichInputConnection with EditingUtils

Change-Id: I9982ff325bef56694402caef28a77683c52ccd71
/packages/inputmethods/LatinIME/java/src/com/android/inputmethod/latin/RichInputConnection.java
5475b38328171a0841ae18074bd45380ec567e90 08-Jun-2012 Jean Chalard <jchalard@google.com> Make a wrapper for the input connection.

The goal is to simplify the code in LatinIME.java as well as having
a handy place to put debug calls to see interaction with TextView.

Change-Id: I255227e7e7343e0c2f3dcd1f185e5020d6186732
/packages/inputmethods/LatinIME/java/src/com/android/inputmethod/latin/RichInputConnection.java