21 Commits

Author SHA1 Message Date
Yohei Yukawa
0b01e7fc58 Polish new IME API for L: CursorAnchorInfo
This CL allows application authors and input method authors to
communicate with each other more precisely on the visibility of
insertion marker and composing characters. Now we can describe
the situation where the coordinates of them are available but
they are overlapped by other UI elements.

This change is based on feedbacks from internal customers of
this preview API.

Change-Id: I82eba0e844a6f8b99ba11a68fad272399034cc24
BUG: 16118303
2014-07-10 20:23:26 +09:00
Yohei Yukawa
eea0b8b051 Fix inconsistencies in CursorAnchorInfo#equals
This CL addresses some inconsistencies found in
CursorAnchorInfo#equals.

- #mComposingText is now taken into consideration when
  compared with other instances.
- NaN is now treated as if it was just a number in
  CursorAnchorInfo#equals if and only if NaN is used in
  -- #mInsertionMarkerHorizontal
  -- #mInsertionMarkerTop
  -- #mInsertionMarkerBaseline
  -- #mInsertionMarkerBottom.
  This is useful if we want to use NaN as a marker to
  indicate that no value is specified.

Change-Id: Ibff31bc34b9d488731b294ad38240c567a06b627
2014-07-10 03:06:04 +00:00
Yohei Yukawa
b5268dcc17 Require coordinate transformation matrix if necessary
With this CL, CursorAnchorInfo.Builder#build() raises
IllegalArgumentException when an application author attempts to
instantiate CursorAnchorInfo without the coordinate
transformation matrix but with specifying some positional
parameters such as composing character rectangle.

Since any other positional members in CursorAnchorInfo are
supposed to be specified in local coordinates, the application
author must provide the coordinate transformation matrix for
such positional data.

Change-Id: I2b0fd0f146a2b95fe4fa1324837d8cfee667208c
2014-07-02 16:03:16 +09:00
Yohei Yukawa
9a9c112737 Fix test failures due to unexpected overload resolution
Starting with Ie04e8a27050849fee1c93ef14b9944acc70fafe4,
CursorAnchorInfo#getComposingText() returns CharSequence rather
than String.  This causes unexpected overload resolution,
which results in test failures.

BUG: 15088391
Change-Id: I51e2b23573e92be7e5b1dcca6402e85364408215
2014-06-27 17:13:32 +09:00
Yohei Yukawa
2a97b54f49 am f09cb58d: Merge "Rename CursorAnchorInfoBuilder with Builder" into lmp-preview-dev
* commit 'f09cb58d5f528665e6e96d8740eeeeab4167e357':
  Rename CursorAnchorInfoBuilder with Builder
2014-06-12 19:58:02 +00:00
Yohei Yukawa
c46b5f04aa Rename CursorAnchorInfoBuilder with Builder
Inner Builder class should not inherit full class name of outer
class.

BUG: 15516230
Change-Id: I2d56edebb0c85639db57ca5b2aadb22c67fc5926
2014-06-10 14:19:28 +09:00
Yohei Yukawa
07bd732034 Reenable DynamicRotationList for language-switching-aware IMEs
In order to reenable DynamicRotationList for
language-switching-aware IMEs, this CL reverts
I84291fd4a7d6192b3bd0c366c49 with fixing a bug that the dynamic
rotation state is reset even when the list of input methods is
not changed.

With this CL, the dynamic rotation state is preserved when the
enabled input methods is not changed actually.

BUG: 7043015
Change-Id: I506828c7a363e79f1c767eeb28f0d3746ff1cb0d
2014-06-02 19:20:36 +09:00
Yohei Yukawa
529001f067 Switch back to StaticRotationList from DynamicRotationList
Ic005b94379f9d847ea, which introduced DynamicRotationList for
smarter input method rotation, is suspected to be causing a
strange behavior that InputMethodManager#switchToNextInputMethod
is choosing unexected/disabled IME/subtype.

With this CL, we switch back to StaticRotationList until the root
cause is addressed.

BUG: 7043015
Change-Id: I95fc8b28536cea6d09ea325e0caee14007cfc0a7
2014-05-27 20:32:34 +09:00
Yohei Yukawa
a9bda77427 Implement dynamic IME rotation based on user action
With this CL, the IME rotation order will be updated dynamically
based on user actions on IMEs. Currently only onCommitText is
took into considered.

Imagine that we have the following rotation order.
  [A, B, C, D, E]
If a user action for C is observed, the rotation order will be
updated as follows:
  [C, A, B, D, E]
Then another user action for D updates the rotation order as
follows:
  [D, C, A, B, E]

BUG: 7043015
Change-Id: Ic005b94379f9d847ea87046473ed77d8018d930e
2014-05-27 01:32:30 +09:00
Yohei Yukawa
9b29d04565 Consolidate the language-switching logic
This CL does not change the existing behavior.
In I84291fd4a7d6192b, the IME rotation group is logically
devided into two groups, one is for IMEs that are declared as
supportsSwitchingToNextInputMethod == true, and the other is
IMEs that are not declared so. The problem is that the logic
was implemented with a single ime/subtype list where these two
kinds of IMEs are completely mixed. This makes the code
unnecessarily complex.
With this CL, these two rotation groups are actually managed
as two different collections separately. This allows us to
simplify the rotation logic as well as its test cases.
This CL is also a groundwork to implement smarter
language-switching logic that is applied to
language-switching-aware IMEs only.

BUG: 7043015
Change-Id: I7f08ec299ec41d614e2cd3912320687db1576e80
2014-05-23 18:02:42 +09:00
Yohei Yukawa
5a647b69be Remove unnecessary internal lock
Previously, InputMethodSubtypeSwitchingController has relied on
its own internal lock for #getNextInputMethod and
class has to be invalidated whenever
InputMethodManagerService#mMethodMap is updated, any method of
InputMethodSubtypeSwitchingController should be called under
the global lock of InputMethodManagerService#mMethodMap.

As a consequence, we can conclude that
InputMethodSubtypeSwitchingController does not need its own
internal lock.

This CL also adds additional synchronization blocks into
the constructor of InputMethodManagerService to address the
existing inconsistency that methods with *Locked suffix are
called without the lock actually.

BUG: 7043015
Change-Id: I9d4d3d7232c984432185c10c13fb726a6158cac8
2014-05-22 18:18:02 +09:00
Yohei Yukawa
4013940b62 Style fix and dead code removal
This CL does not change the existing behavior.
Smarter language switching will be coverted by subsequent CLs.

BUG: 7043015
Change-Id: I281a33191d44be448492c2b74760cb8680719124
2014-05-21 22:56:40 +09:00
Yohei Yukawa
419b1b0498 Make a copy of Matrix in CursorAnchorInfoBuilder
This CL fixes a bug that CursorAnchorInfoBuilder does't make a
copy if the Matrix specified with #setMatrix.

Without this fix, IMM#updateCursorAnchorInfo could fail to detect
duplicated events when the same instances of
CursorAnchorInfoBuilder and Matrix are reused to optimize
performance.

Change-Id: I50c50a12a06d3cda4dec445b171b61ceb78da21a
2014-05-15 16:10:04 +09:00
Yohei Yukawa
81f4cb3f85 Enable CursorAnchorInfo to contain composing string
This CL adds one more functionality to CursorAnchorInfo
that enables applications to associate the composition
string with its positional information. This is useful
for an IME to handle CursorAnchorInfo asynchronously.

This is also useful for the framework to detect if
the application is unnecessarily calling
IMM#updateCursorAnchroInfo with duplicate event.

BUG: 14579622
Change-Id: Ie75c17b523dad33e97b08c15f5f5267573ce2063
2014-05-14 19:28:59 +09:00
Yohei Yukawa
c2ddd60236 Introduce new API for floating window support
This CL introduces a new API IMM#updateCursorAnchorInfo for
floating window support.

BUG: 14579622
Change-Id: I61dec2f8fa671ba891da1d4af08975750e3acb04
2014-05-09 19:17:15 +09:00
Yohei Yukawa
a1223cfe6f Take supportsSwitchingToNextInputMethod into considertaion
With this CL, InputMethodManager#switchToNextInputMethod starts
behaving as if there are two rotation groups: one is for the new
input methods that are declared with
supportsSwitchingToNextInputMethod set to true to indicate they
have some language switching UI, and the other is for the other
input methods to preserve the existing behavior.

In addition to the above change, this CL also fixes the behavior
of InputMethodManager#shouldOfferSwitchingToNextInputMethod()
so as to return true if and only if the former rotation group
consists of two or more input methods, as originally designed.

BUG: 12981505
Change-Id: I84291fd4a7d6192b3bd0c366c49586e79135584f
2014-05-01 22:52:16 +09:00
Yohei Yukawa
d1da115298 Add unit tests for InputMethodSubtypeSwitchingController
This CL adds unit tests for InputMethodSubtypeSwitchingController
as a ground work to make it aware of
supportsSwitchingToNextInputMethod in a subsequent CL.

This CL never changes existing behavior.

BUG: 12981505
Change-Id: I3b2c46c47c7686b811fa248ad549f20875367425
2014-05-01 19:13:25 +09:00
Yohei Yukawa
f06569561f Introduce InputMethodSubtypeArray for memory efficient IPCs
This CL introduces InputMethodSubtypeArray which compresses
multiple instances of InputMethodSubtype to reduce the risk
of TransactionTooLargeException during IPCs.

There are some IMEs which rapidly adding new subtypes into
their supported language list. One problem here is that each
instance of InputMethodInfo internally owns the list of
supported subtypes. Basically it requires additional
200 ~ 300 bytes for each subtype when InputMethodInfo is
transffered via IPCs. We should keep the size less than
100 KB in typical scenario.

With this CL, the list of InputMethodSubtype is marshalled
with GZIP compression. Approximately one InputMethodInfo is
marshalled within 10 KB even when it has 100 subtypes.

No negative performance impact is observed so far. The cost of
decompression seems to be compensated by another optimization
in this CL. Actually marshalling cost is reduced with this CL
by caching the compressed data on demand.

BUG: 12954290
Change-Id: Ibb2940fcc02f3b3b51ba6bbe127d646fd7de7c45
2014-03-06 11:25:57 +09:00
Yohei Yukawa
c18cd393f6 Make sure InputMethodInfo implements Parcelable transitively
This CL adds one more test to make sure InputMethodInfo
implements Parcelable correctly. This test makes sure that
one can marshall and unmarshall again from an unmarshalled
copy of InputMethodInfo.

BUG: 12954290
Change-Id: I5aa1552a8089fe0bac54513ba224e5bfc494be97
2014-03-03 14:14:10 +09:00
Yohei Yukawa
589800485d Add unit test for InputMethodInfo
This CL adds a unit test to make sure that InputMethodInfo
implements Parcelable correctly.

BUG: 12954290
Change-Id: I0abe8c266b4b035bf8ef4688d11069b355fabe9f
2014-02-27 17:32:48 +09:00
Satoshi Kataoka
f1367b7e90 Do not turn on imes unexpectedly with unit tests
Bug: 7872918

Change-Id: Ie1d74c9fac27de140e7aa85f2eaefcb89aa06ea7
2013-01-28 19:25:55 +09:00