History log of /frameworks/base/core/tests/coretests/src/com/android/internal/inputmethod/InputMethodUtilsTest.java
Revision Date Author Comments (<<< Hide modified files) (Show modified files >>>)
af5cee8d2631255d9aa3cc1ebdaef998be307164 24-Jan-2017 Yohei Yukawa <yukawa@google.com> Remove a redundant param in getDefaultEnabledImes

With the previous CL [1], systemReady parameter in
InputMethodUtils.getDefaultEnabledImes() is guaranteed to be true.
Hence this CL removes that parameter. There should be no behavior change
in this CL.

[1]: I5b37c450db4b25b3e635b6d634293a34eec8b9d4
7924782c000733b2d7a180701b74988f0154adee

Test: adb shell am instrument -w -e class com.android.internal.inputmethod.InputMethodUtilsTest com.android.frameworks.coretests/android.support.test.runner.AndroidJUnitRunner
Bug: 32343335
Change-Id: Ia14d12a4e21d0e2e22bfe0bd8d496f48058c5525
/frameworks/base/core/tests/coretests/src/com/android/internal/inputmethod/InputMethodUtilsTest.java
23cbe85610f780134cc77dd4a54732a22ed6e86e 18-May-2016 Yohei Yukawa <yukawa@google.com> Move LocaleList to avoid layering violation.

Since LocaleList needs to depend on android.os.Parcelable, we cannot let
that class belong to "android.util" package, which causes layering
violation.

Bug: 28819696
Change-Id: Ia8de2ee9df3dd0a42b1fe84574439519b680fe18
/frameworks/base/core/tests/coretests/src/com/android/internal/inputmethod/InputMethodUtilsTest.java
238faad984786f0227fe6c0cf6ea2a5ecff3a4bc 11-Mar-2016 Yohei Yukawa <yukawa@google.com> Use LocaleUtils#filterByLanguage for non-keyboard subtypes.

With this CL, we expand the target of Bug 27129703 and Bug 27348943 to
non-keyboard subtypes.

Suppose there is a handwriting IME (mode == "handwriting") that supports
the following 5 subtypes.
- en-US
- en-GB
- fr
- sr-Cyrl
- sr-Latn

Also suppose the system languages are configured as follows.
1. sr-Latn-RS
2. ja-JP
3. fr-FR
4. en-GB
5. en-US

In this case we want to enable [sr-Latn, fr, en-GB] by default when
"use system language" is checked in the subtype enabler.

See previous commits [1][2] about how we addressed those issues for
keyboard subtypes.

[1]: Iaf179d60c12b9a98b4f097e2449471c4184e049b
e985c240e3feb62ea38d5b4e386be083ca0f215b
[2]: I8fc774154f5175abff2f16e8f12a4847bf5f5b7c
072a95a3094af2ced4f009ad62c4553c28e3f830

Bug: 27560993
Change-Id: I416b5671602c550805ed6267dd210968aa1de83c
/frameworks/base/core/tests/coretests/src/com/android/internal/inputmethod/InputMethodUtilsTest.java
80861ff1c0b3ca2c6cdf6fb4a224f3a015bd44bd 11-Mar-2016 Yohei Yukawa <yukawa@google.com> Make sure to compare subtype language with system language.

This CL addresses a regression introduced by a recent CL [1] that
non-keyboard subtypes are no longer implicitly enabled based on the
system language (a.k.a. "use system language" in the subtype enabler)
due to a type mismatch in comparison.

Here is the original logic:
if (language.equals(systemLanguage) && systemLocale.startsWith(locale))

And here is the logic replaced by [1]:
if (locale != null && locale.equals(systemLanguage)) {

The new logic is simply broken, because locale is a Locale object while
systemLanguage is a String object. It never matches.

With this CL we will compare the system language with the locale
language again, with several test cases that should have been included
in [1], as a temporary solution until we start relying on
LocaleUtils#filterByLanguage() for non-keyboard subtypes.

[1]: Iaf179d60c12b9a98b4f097e2449471c4184e049b
e985c240e3feb62ea38d5b4e386be083ca0f215b

Bug: 27560993
Change-Id: If2d1710174853180465832e6ecbbb91235b76210
/frameworks/base/core/tests/coretests/src/com/android/internal/inputmethod/InputMethodUtilsTest.java
42275bc8b32f342cad7778d28ade59eea12a983c 03-Mar-2016 Yohei Yukawa <yukawa@google.com> Fix a regression in InputMethodUtils.

It turns out that my previous CL [1] unexpectedly changed the behavior
of InputMethodUtils#getImplicitlyApplicableSubtypesLocked() in terms of
when "EnabledWhenDefaultIsNotAsciiCapable" extra value is taken into
account.

Suppose if an IME X has the following three subtypes:
A. locale: en_US
mode: handwriting
extraValue:
B. locale: hi
mode: keyboard
extraValue:
C. locale: en_US
mode: keyboard
extraValue: AsciiCapable
D. locale: zz
mode: keyboard
extraValue: AsciiCapable, EnabledWhenDefaultIsNotAsciiCapable

Given the above subtypes, here are results of what subtypes are enabled
by InputMethodUtils#getImplicitlyApplicableSubtypesLocked() I) before
the CL [1] and II) after the CL [1].

- system language: hi:
I: B, D
II: B, D
- system language: hi-IN:
I: B, D
II: B, D
- system language: en-US
I: A, C
II: A, C
- system language: en-GB
I: A, C
II: A, C
- system language: ja-JP
I: B
II: D

What my previous CL actually broke is the the last one, and it's broken
because we accidentally started using
"EnabledWhenDefaultIsNotAsciiCapable" even when there is no subtype that
matches to the requested language. Previously that attribute was used
if and only if 1) there is a subtype that matches the requested language
and 2) that subtype is not marked to be AsciiCapable.

If there there is no subtype that matches to the requested language,
what we had relied on is actually the result of
InputMethodUtils#findLastResortApplicableSubtypeLocked() called with
canIgnoreLocaleAsLastResort = true,
which means that we had just picked up the first keyboard subtype as the
last fallback candidate regardless of it's locale. This is why the
subtype B should be picked up in the last case where system language is
ja-JP.

This CL fixes the above unexpected behavior change regarding
"EnabledWhenDefaultIsNotAsciiCapable" so that the previous behavior can
be preserved.

[1] Iaf179d60c12b9a98b4f097e2449471c4184e049b
e985c240e3feb62ea38d5b4e386be083ca0f215b

Bug: 27129703
Bug: 27425459
Change-Id: Icd86cad955bf827a1eb41255f57fdf4ec315b93b
/frameworks/base/core/tests/coretests/src/com/android/internal/inputmethod/InputMethodUtilsTest.java
e985c240e3feb62ea38d5b4e386be083ca0f215b 25-Feb-2016 Yohei Yukawa <yukawa@google.com> Use LocaleList for implicitly enabled subtypes.

There are two major changes in this CL:

1. Now IMMS resets its internal state whenever the system locale list
is changed, rather than just checking the primary system locale.
2. For software keyboard subtypes,
InputMethodUtils#getImplicitlyApplicableSubtypesLocked() now takes
the entire system locale list into account when determining what
subtypes should be enabled by default when the user does not
explicitly enable one or more subtypes.

Bug: 27129703
Change-Id: Iaf179d60c12b9a98b4f097e2449471c4184e049b
/frameworks/base/core/tests/coretests/src/com/android/internal/inputmethod/InputMethodUtilsTest.java
fc843713bc3c5558a7288c02aabe2474264e4ca3 24-Feb-2016 Yohei Yukawa <yukawa@google.com> Mechanical refactoring in InputMethodUtilsTest.

This is a mechanical refactoring in InputMethodUtilsTest that changes
nothing.

Bug: 27129703
Change-Id: I21d3c5cc4cc3018fc844c18362035ebdc656dec1
/frameworks/base/core/tests/coretests/src/com/android/internal/inputmethod/InputMethodUtilsTest.java
622b44d00fdbddf6717fd8bc9515111fec71115b 11-Feb-2016 Yohei Yukawa <yukawa@google.com> Use Java7 diamond operator in InputMethodUtils.

This CL changes nothing except for deleting redundant type parameters by
using diamond operator.

No behavior change is intended.

Bug: 26279466
Change-Id: I276c7eb0136d373464ba6e997685d440beaca674
/frameworks/base/core/tests/coretests/src/com/android/internal/inputmethod/InputMethodUtilsTest.java
5d64399c51de861261267a937502c6a13c50a239 09-Feb-2016 Yohei Yukawa <yukawa@google.com> Use Context#createConfigurationContext().

Nothing is changed in the test expectations.
Major changes in this CL are:

1. To obtain a custom context with the given locale,
Context#createConfigurationContext() is the way to go.
Modifying any internal state of the resource that is owned by the
context is not supported at all.
2. As a preparation to test cases where multiple locales are specified
in the system settings, unit tests need to switch to
Confituration#setLocales(LocaleList).

Bug: 27076327
Change-Id: I6caa76627677c7625a1c42d76a275f67ae65a9b2
/frameworks/base/core/tests/coretests/src/com/android/internal/inputmethod/InputMethodUtilsTest.java
226c4bba676da8b84eb6506276053dfe2725a03b 04-Dec-2015 Yohei Yukawa <yukawa@google.com> Add a test for constructLocaleFromString(String).

This is a follow up CL for ed65bc0c62ca99a118057db7ad54c4ccc14d52d0 [1],
which fixed special handling of a fake language code "tl".

[1] Ica9cd2baac002c406f92331aadd7725d7424046a

Bug: 20696126
Change-Id: Ifc8bf2ff6bd617a215e4b68f6b2bf9b94e80db07
/frameworks/base/core/tests/coretests/src/com/android/internal/inputmethod/InputMethodUtilsTest.java
2a099bcd6fe974bad47363c214a7bb327484aff8 15-Aug-2015 Seigo Nonaka <nona@google.com> Move buildInputMethodsAndSubtypesString to InputMethodUtils

This CL is mechanical code moving and does not change any existing
behavior.

buildInputMethodsAndSubtypesString is introduced by
If0104151b3526da6ecc669adde3119a239ecafeb for addressing Bug 19822542.
This code moving is one of the TODOs in above change.

Bug: 22285167
Change-Id: Ie63cf593794c9062919887e04a64208a900b1b8b
/frameworks/base/core/tests/coretests/src/com/android/internal/inputmethod/InputMethodUtilsTest.java
290e4e471b325d4afca9e36d55b54d83254b2e29 18-Aug-2015 Seigo Nonaka <nona@google.com> Add @SmallTest for continuous tests.

The target unit test is introduced by
I01f5fafbbcfe3e3f5313829162ec011eaf2ad991 but it lacks @SmallTest
annotation which is necessary for continuous unit tests.

Bug: 22285167
Change-Id: I75235f26fe7a3baffbc60222bd9485ade85e13e8
/frameworks/base/core/tests/coretests/src/com/android/internal/inputmethod/InputMethodUtilsTest.java
2028ddaa5024dfc9844376f2032115aee360155a 06-Jul-2015 Seigo Nonaka <nona@google.com> Move parseInputMethodsAndSubtypesString to InputMethodUtils.

This CL is mechanical code moving and does not change any existing
semantics.

parseInputMethodsAndSubtypesString is introduced by
If0104151b3526da6ecc669adde3119a239ecafeb for addressing Bug 19822542.
This code moving is one of the TODOs in above change.

Bug: 22285167
Change-Id: I01f5fafbbcfe3e3f5313829162ec011eaf2ad991
/frameworks/base/core/tests/coretests/src/com/android/internal/inputmethod/InputMethodUtilsTest.java
35f743713dfeb4e9138fee0f7bb6a7ee1da53521 13-Aug-2015 Yohei Yukawa <yukawa@google.com> Move IME related unit tests under core/tests/coretests/.

This CL moves existing (non-CTS) unit tests used for input
method under core/tests/coretests/ to reduce the maintenance
cost.

Although some package names and import lines are updated
to be consistent with new file locations, test cases are
are kept to be the same.

Change-Id: I4efce90b232458212ac48292dc01b812a9e851e5
/frameworks/base/core/tests/coretests/src/com/android/internal/inputmethod/InputMethodUtilsTest.java