Commit Graph

156 Commits (9ebba46c775f37abeb0451602cb323fd45adf33b)

Author SHA1 Message Date
Tom Ouyang c32389ce11 Merge "Small optimization to eliminate a >0 check in RichInputConnection." into jb-ub-latinimegoogle 2015-06-24 19:44:37 +00:00
Tom Ouyang 96640a110b Small optimization to eliminate a >0 check in RichInputConnection.
Change-Id: Ibdf97726008c1f94c970461196ba445ce328a8cb
2015-06-24 12:00:04 -07:00
Dan Zivkovic 563d7935a9 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
2015-06-24 11:57:59 -07:00
Tom Ouyang 912016b69f 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
2015-06-23 10:34:44 -07:00
Dan Zivkovic 73aaf68337 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
2015-06-22 17:36:53 -07:00
Dan Zivkovic 0232e73dfa 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
2015-06-19 12:06:18 -07:00
Mohammadinamul Sheik db96122787 Fix the NPE on selection string on unlearnWord
Bug: 20150386
Change-Id: I2ed69aba7b1fdaba1e2ac07b8218a265dfe23e09
2015-04-13 16:30:22 -07:00
Tom Ouyang 3952078a91 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
2015-04-09 11:45:55 -07:00
Dan Zivkovic 6bb7011559 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
2015-04-07 11:18:58 -07:00
Dan Zivkovic edd94a449e 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
2015-02-26 11:10:37 -08:00
Dan Zivkovic 5254c01d4c Fix master build.
For some reason, we can't import android.os package in our Constants.

Change-Id: I357ed72d13c5039a83c6e2489cdf5ef74d0ffea8
2015-02-11 13:32:13 -08:00
Dan Zivkovic 12d80ebead Remove shortcut support from LatinIME.
Note this change does not affect the native decoder interface.

Change-Id: I73b7dc008a5acaf75a31a36a2d332b5afabd82d0
2015-02-11 13:02:41 -08:00
Mohammadinamul Sheik 0f7d881dc7 Move decoder specific constants to DecoderSpecificConstants.java
Change-Id: Ie4d325b3152e1e7e424b8b436e222e194e4d9da0
2015-02-05 13:27:36 -08:00
Dan Zivkovic a6d2cf5ec7 Removing code from RichInputConnection.
Followup CL that removes some more unused methods and variables.

Change-Id: I4163c7cd017f59d1fd445adb6294fc89dcaafe6e
2015-02-04 16:47:56 -08:00
Dan Zivkovic f3c319fb8a 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
2015-02-04 16:35:18 -08:00
Dan Zivkovic c71e4d6534 Remnant of green [+] feature.
Change-Id: I059b1062e1d73b2fa439d9d4ee04ff0182795335
2015-02-04 11:57:16 -08:00
Jean Chalard 4beeb9253a Move StringUtils under common.
Bug: 18108776
Change-Id: Ia46a4102a0e86e71118ca5e641f9f531998e166b
2014-10-28 22:44:30 +09:00
Ken Wakasa 9342484e8d 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
2014-10-23 20:27:37 +09:00
Jean Chalard 4097a20b36 Fix a concurrency bug that ends up in a crash.
Bug: 18085768
Change-Id: I016bec997787839526ddfc521ebb99d0c7b05189
2014-10-23 12:36:42 +09:00
Tadashi G. Takaoka d3a4c51324 Fix Javadoc and null analysis related warnings
This CL also adds @SuppressWarning("unused" to java-overridable package.

Bug: 18003991
Change-Id: If70527e30654384705d7a814f5efd181d9f539e1
2014-10-23 09:58:42 +09:00
Tadashi G. Takaoka 5f00fe09e9 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
2014-10-21 19:28:37 +09:00
Jean Chalard 7d74594123 Fix an NPE.
Bug: 17958289
Change-Id: I5c9ea668ff75b38c7ddebd767c36a950835c0c9f
2014-10-14 11:42:43 +09:00
David Faden c92c883fdf Add calls to stub for API to consume gesture data.
Bug: 17400259
Change-Id: Ib3511afffe1d14662e7dd14611f384689516e664
2014-10-03 15:01:34 +09:00
Jean Chalard 38144047ea Make a better effort to detect a framework lie.
Bug: 17130496
Change-Id: I1a3631670c152d9b7667c9c4e08e14c48569eef5
2014-10-01 19:17:31 +09:00
Keisuke Kuroyanagi bb0eca5705 Rename PrevWordsInfo to NgramContext.
Bug: 14425059
Change-Id: Id06a71681fa8b5e589e29fba10fe5c1cfed66984
2014-09-29 10:52:18 +09:00
Yohei Yukawa eddfe51b38 resolved conflicts for merge of 233a2f21 to master
Change-Id: If391cc622367dfb4448c6a5c32b82111d352d86e
2014-09-18 18:27:45 +09:00
Yohei Yukawa 5896153f93 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
2014-09-18 16:06:35 +09:00
Jean Chalard 1cf2acd8de 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
2014-09-08 13:20:27 +00:00
Jean Chalard b41ee67194 Fix the sentence separator for Hindi.
Change-Id: I623e4ccbc324751eb67ec4bb777e2be5ae2a60d1
Bug: 17418371
2014-09-08 21:54:28 +09:00
Jean Chalard 914078fd91 Fix a bug where recorrection would stop on connectors
Bug: 16733686
Change-Id: I7a9f79a81e33a1f5bf5f3daf0b78d0f1e4447e7a
2014-09-08 21:47:01 +09:00
Yohei Yukawa 5d6ac77732 Follow up API signature change
This is a follow up CL for API signature change in
I772c48ff18918e48a81e807b48ff907614485c09

BUG: 17320996
Change-Id: Ic8b6162bda12bf74fae79af212c5d81c400eb9e8
2014-09-03 01:13:15 -07:00
Yohei Yukawa acce1aa59e 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
2014-08-27 15:59:52 -07:00
Yohei Yukawa 29200b0abe 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
2014-08-27 01:30:45 -07:00
Yohei Yukawa 4a71d2c480 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
2014-08-24 20:28:24 -07:00
Jean Chalard 9273f3832b [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
2014-08-06 11:38:11 +09:00
Keisuke Kuroyanagi bb843eb223 Move getPrevWordsInfoFromNthPreviousWord to PrevWordsInfoUtils.
Bug: 14425059
Change-Id: Id37022ac6c1545d6845abfbcdb7ed47f0e250eec
2014-07-07 13:07:57 +09:00
Jean Chalard 292deb632c [SD7] Actually check for script.
...also implement the check for Hebrew and Arabic.

Bug: 15840116
Change-Id: Ia6433d7d98038ade64c171be4fe4b3f094111fac
2014-07-01 15:01:22 +09:00
Jean Chalard b6695867a5 [SD6] Inline a constant and remove logic become useless
Bug: 15840116
Change-Id: I545cc9083aa4e2fd7cbbd1fbc02e1e382482db7c
2014-07-01 14:34:53 +09:00
Jean Chalard 20c89b1cf5 [SD5(2)] Remove useless args
Bug: 15840116
Change-Id: I1123426fbd9d420c1be64ccc917a5f870e70e6fa
2014-07-01 13:34:25 +09:00
Ken Wakasa 7eef5d3ff4 Revert "[SD5] Remove useless args"
This reverts commit 1d30023961 that broke the build.

Bug: 15840116
Change-Id: I0a5fa7dea2b418d19df24b2b31ed96bf192d45c0
2014-07-01 03:23:14 +00:00
Jean Chalard 1d30023961 [SD5] Remove useless args
Bug: 15840116
Change-Id: Ib3380cfc9d343c6f8953bba03af3801142bc3bdb
2014-06-30 21:58:55 +09:00
Ken Wakasa 92223c04de Merge "Revert "Move getPrevWordsInfoFromNthPreviousWord to StringUtlis."" 2014-06-26 23:14:58 +00:00
Ken Wakasa 4569a734ad Revert "Move getPrevWordsInfoFromNthPreviousWord to StringUtlis."
This reverts commit ba463c9a66 that broke the dicttool build.

Bug: 14425059
Change-Id: Ie1685587104d26e4416624747c97f6087c13388a
2014-06-27 15:07:07 +00:00
Keisuke Kuroyanagi ba463c9a66 Move getPrevWordsInfoFromNthPreviousWord to StringUtlis.
Bug: 14425059
Change-Id: I3eb24e840c165e43f68c2a60fccf9974affb57a6
2014-06-27 18:08:17 +09:00
Keisuke Kuroyanagi 1c2f1ada83 Find multiple previous word information to support n-gram.
Bug: 14425059

Change-Id: Ieace636334a9b2a094527341d4fcfc05958296c5
2014-06-27 17:59:21 +09:00
Keisuke Kuroyanagi 1a2f3c4433 Merge "Move getPrevWordsInfoFromNthPreviousWord to StringUtlis." 2014-06-26 23:14:30 +00:00
Keisuke Kuroyanagi 17c5a388d6 Merge "Find multiple previous word information to support n-gram." 2014-06-26 23:14:58 +00:00
Jean Chalard e530fffc2c Add a relevant suggestion to period-checkable requests
Bug: 15412461
Change-Id: Ibf37df4d31141a7e43b54d6342e7861eedb1c03b
2014-06-27 12:52:23 +09:00
Keisuke Kuroyanagi e708b1bc2e Make PrevWordsInfo have multiple words' information.
Bug: 14425059
Change-Id: I2bd6a872904a44b80f638a13d91a97559217cc1a
2014-06-25 14:14:37 +09:00
Jean Chalard 9fd9a68d87 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
2014-06-06 11:18:23 +09:00