summaryrefslogtreecommitdiffstats
path: root/core/tests/inputmethodtests
Commit message (Collapse)AuthorAgeFilesLines
* Check system locale when picking up an initial SpellChecker.Yohei Yukawa2015-06-261-0/+99
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Since Ia25e7b4f308778891929e31b8cbd741f6848cce4, the TSMS has picked up the first found spell checker no matter regardless of the system locale. The primary goal of this CL is to introduce a low-risk fix for the situation where two or more spell checker services are pre-installed but they are well different from each other in terms of supported languages. Solving the problem in more ambiguous and complicated situation is beyond the goal of this CL. With this CL, we still pick up the first found spell checker but also require the spell checker supports a certain locale. We will try several locales starting with the system locale to some fallback locales until we find one appropriate spell checker. If no spell checker is picked up in this process, we simply pick up the first one as we have done. Examples about what locales will be checked are: A. System locale: en_US 1. en_US 2. en_GB 3. en B. System locale: en 1. en 2. en_US 3. en_GB C. System locale: en_IN 1. en_IN 2. en_US 3. en_GB 4. en D. System locale: ja_JP 1. ja_JP 2. ja 3. en_US 4. en_GB 5. en E. System locale: fil_PH 1. fil_PH 2. fil 3. en_US 4. en_GB 5. en F. System locale: th_TH_TH 1. th_TH_TH 2. th_TH 3. th 4. en_US 5. en_GB 6. en Bug: 22042994 Change-Id: I094f1c33430f7904a1dac6167431d6df64a07212
* Convert subtypes whose locale is "tl" to "fil".Yohei Yukawa2015-06-021-0/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | On Android, "tl" is a historic hack for what should really be "fil". Now that we properly support 3-letter language codes, we should be using "fil" throughout. Given this historical usage, IMEs that really want to support Tagalog (and not Filipino) should use the ISO-639-3 code for Tagalog, which is "tgl". For backward compatibility reasons, this CL uses the similar approach to I26e3aa0333aa3c76c80a3c1c9090cc2b368c8e10. InputMethodSubtype.getLocale() continues to return the "locale" string parameter passed to the constructor as is, but in the Android framework we do normalizations/conversions whenever we need a valid ISO-639-3 code. In I26e3aa0333aa3c76c80a3c1c9090cc2b368c8e10, we rely on the conversion in the Locale constructor. In this CL, we do replace "tl" with "fil" by ourselves. This CL also adds InputMethodSubtype#getLocaleObject() a hidden API so that we can start relying on the Locale object at least in the framework. This CL is based on the investigation by Narayan Kamath and his patch. Bug: 20696126 Change-Id: I94f203bddceb9c87710cb187cc3cc0ee6d9092a5
* Normalize deprecated 2-letter language code when necessary.Yohei Yukawa2015-02-211-4/+2
| | | | | | | | | | | This is a follow up CL for I7d932e60311b80c05be8f02c9e803f18da0e0054, which revealed that we could not use deprecated 2-letter code like "in" to query subtype which has new language codes like "id". This CL addresses the above issue by normalizing the language code with Locale#Locale(String, String) before comparing one to another. Change-Id: I26e3aa0333aa3c76c80a3c1c9090cc2b368c8e10
* Add tests for Ibb9eb9f65323795d139 and I6571d464a46453934f0Yohei Yukawa2015-02-201-32/+488
| | | | | | | | | | | | | | | | | This CL adds several unit tests for following CLs, both of which enabled InputMethodUtils (and dependent IMF logic) to handle 3 letter language codes and conversion from deprecated two-letter codes to new ones correctly. - Ibb9eb9f65323795d139b16d76b7e7e36a4e0568c - I6571d464a46453934f0a8f5e79018a67a9a3c845 As described in tests, the input method framework has already been able to recognize 3 letter language codes. However, there remain inconsistencies when we use deprecated 2-letter code to query subtype like "in" but the subtype has new language codes like "id". Subsequent CLs are supposed to address remaining issues. bug: 10090157 Change-Id: I7d932e60311b80c05be8f02c9e803f18da0e0054
* Minimize the number of default enabled IMEs part 4Yohei Yukawa2014-11-061-70/+111
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This is a follow up CL for recent attempt to minimize the number of default enabled IMEs. - part1: I831502db502f4073c9c2f50ce7705a4e45e2e1e3 - part2: Ife93d909fb8a24471c425c903e2b7048826e17a3 - part3: I6571d464a46453934f0a8f5e79018a67a9a3c845 It turned out that the changes made in part2 and part3 are a bit overkill, and users will see no software keyboards in some particular situations. The problem we missed in the previous CLs is the fact that InputMethodInfo#isDefault is indeed a locale-dependent value, hence it may vary depending on the system locale. Existing unittests also failed to abstract such locale-dependent nature. In order to addresses that regression, the selection logic is a bit widely reorganized in this CL. Now the logic is implemented as a series of fallback rules. Also, unit tests are updated to be able to 1) test the order of the enabled IMEs, and 2) emulate the locale-dependent behavior of InputMethodInfo#isDefault to enrich test cases. BUG: 17347871 BUG: 18192576 Change-Id: I871ccda787eb0f1099ba3574356c1da4b33681f3
* Minimize the number of default enabled IMEs part 3Yohei Yukawa2014-09-151-11/+8
| | | | | | | | | | | | | | | | | | | | | With this CL, the behavior of getDefaultEnabledImes() changes as follows: - Previously system IMEs are always enabled by default as long as it is a software keyboard that supports En_* subtype. With this CL, getDefaultEnabledImes() relies on the locale returned from getFallbackLocaleForDefaultIme() instead of calling isSystemImeThatHasEnglishKeyboardSubtype() to minimize the number of enabled IMEs. - Previously default enabled system IMEs are chosen in a country-agnostic way. As a result, "en_IN" is enabled even when the system locale is "en_US". With this CL, the system first tries to find IMEs with taking the coutnry into account, and use the country-agnostic way when and only when fallback logic is required. BUG: 17347871 Change-Id: I6571d464a46453934f0a8f5e79018a67a9a3c845
* Minimize the number of default enabled IMEs part 2Yohei Yukawa2014-09-141-19/+8
| | | | | | | | | | | | | Previously the system tried to enable at least one auxiliary IME even when the system is not ready. However, this doesn't make much sense because the user should be able to set up their phone without auxiliary IMEs. Also, IMEs enabled before the system becomes ready are kept to be enabled after the system becomes ready. Thus, we should minimize the number of enabled IMEs until the system becomes ready. BUG: 17347871 Change-Id: Ife93d909fb8a24471c425c903e2b7048826e17a3
* Enrich test cases when enabling default IMEs part 4Yohei Yukawa2014-09-131-229/+203
| | | | | | | | | | | | This is another groundwork for subsequent fixes. Notable changes in test cases are: - simplified test cases for voice IMEs. - added more test cases for keyboard IMEs. - introduced assertDefaultEnabledImes() to reduce code duplicate. BUG: 17347871 Change-Id: I8cf61cfa18ac425a2cccc7823474c3f06dc0fa1e
* Enrich test cases when enabling default IMEs part 3Yohei Yukawa2014-09-121-10/+133
| | | | | | | | | | | | This is another groundwork for subsequent fixes. Notable changes in test cases are: - A dummy Hinglish IME ("en_US" + "hi") is added - Added test cases where system locale is "en_GB", "en_IN", and "hi" as well as "en_US". BUG: 17347871 Change-Id: Iacf0f47c4dbc147f8153df50ba58fc4da4dacd29
* Enrich test cases when enabling default IMEs part 2Yohei Yukawa2014-09-111-30/+58
| | | | | | | | | | | | | This is another groundwork for subsequent fixes. Notable changes in test cases are: - isSystemReady == false is now coverted. - tests can run even when the system locale of test environment is different from "en_US" BUG: 17347871 Change-Id: I9434270735d3b37d8b788d41250b23d7950aaeed
* Enrich test cases when enabling default IMEsYohei Yukawa2014-09-111-14/+34
| | | | | | | | | | | | | This is another groundwork for subsequent fixes. Notable changes in test cases are: - isAsciiCapable is now annotated accordingly. - "dummy.keyboard0" now has several subtypes like "en_GB", "en_IN", "hi", "hi_ZZ" like the AOSP LatinIME. BUG: 17347871 Change-Id: Ide698ed11c2539ba5862e6b37ea63ed19f8ce566
* Use public APIs to instantiate InputMethodSubtypeYohei Yukawa2014-09-101-2/+10
| | | | | | | | | | | | | | | | This is a groundwork for subsequent CLs that are supposed to improve default input method selection logics. Historically we have had a @hide constructor of InputMethodSubtype. However, this contructor is a bit obsolete because we can not specify some parameters that were added in recent platform releases. We should use InputMethodSubtypeBuilder instead. BUG: 17347871 Change-Id: I72ad79682a58344e14380eb20e26edf98aee37cd
* Follow up API signature changes of CursorAnchorInfo part 2Yohei Yukawa2014-09-091-18/+18
| | | | | | | | | | | | | This is another follow up CL for Ic8c6fab58c01206872a34e7e. Ib2371849d32bb44da9ef59f05e648a476e03699a didn't cover following renamings. This CL fixes them. - #getCharacterRect -> #getCharacterBounds - #getCharacterRectFlags -> #getCharacterBoundsFlags BUG: 17365414 Change-Id: I120795da3f25f1e2fa71f455f92e3cd1c036c1d5
* Follow up API signature changes of CursorAnchorInfoYohei Yukawa2014-09-082-91/+79
| | | | | | | | | This is a follow up CL for Ia8cbb9f6b41cd9509fc0147fd68763dfde and Ic8c6fab58c01206872a34e7ee604cdda1581364d. BUG: 17365414 BUG: 17200900 Change-Id: Ib2371849d32bb44da9ef59f05e648a476e03699a
* Stop assuming language part in locale string is up to 2-letterYohei Yukawa2014-07-261-0/+29
| | | | | | | | | | | | | With this CL, InputMethodSubtypeSwitchingController stop assuming that language part in locale string is up to 2-letter. this CL is not so risky because InputMethodSubtypeSwitchingController have used language part for nothing but sorting subtypes to determine the initial rotation order of IME switching. BUG: 16502987 Change-Id: Ib159ece0b7aa04f8fd7abc96c9a6e0832a4b7cd2
* Consolidate test cases for InputMethodSubtypeYohei Yukawa2014-07-111-15/+48
| | | | | | | | | | | | We have accepted any arbitrary text as a locale string when instantiating InputMethodSubtype object. As a consequence, some existing code might assume that InputMethodSubtype never canonicalize/normalize the given locale string. This CL add a test case for such scenario. Change-Id: Ie08d6e149e22a60d6c4d40049a3e6afeee87dc44
* Add simple InputMethodSubtypeTestYohei Yukawa2014-07-112-1/+69
| | | | Change-Id: I87105c4935adfca249378e667161d2998cf77840
* Polish new IME API for L: CursorAnchorInfoYohei Yukawa2014-07-102-88/+216
| | | | | | | | | | | | | | 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
* Fix inconsistencies in CursorAnchorInfo#equalsYohei Yukawa2014-07-101-6/+149
| | | | | | | | | | | | | | | | | | 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
* Require coordinate transformation matrix if necessaryYohei Yukawa2014-07-021-3/+49
| | | | | | | | | | | | | | | 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
* Fix test failures due to unexpected overload resolutionYohei Yukawa2014-06-271-4/+5
| | | | | | | | | | 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
* am f09cb58d: Merge "Rename CursorAnchorInfoBuilder with Builder" into ↵Yohei Yukawa2014-06-121-5/+4
|\ | | | | | | | | | | | | lmp-preview-dev * commit 'f09cb58d5f528665e6e96d8740eeeeab4167e357': Rename CursorAnchorInfoBuilder with Builder
| * Rename CursorAnchorInfoBuilder with BuilderYohei Yukawa2014-06-101-5/+4
| | | | | | | | | | | | | | | | Inner Builder class should not inherit full class name of outer class. BUG: 15516230 Change-Id: I2d56edebb0c85639db57ca5b2aadb22c67fc5926
* | Reenable DynamicRotationList for language-switching-aware IMEsYohei Yukawa2014-06-021-4/+26
| | | | | | | | | | | | | | | | | | | | | | | | | | | | 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
* | Switch back to StaticRotationList from DynamicRotationListYohei Yukawa2014-05-271-1/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | 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
* | Implement dynamic IME rotation based on user actionYohei Yukawa2014-05-271-21/+90
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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
* | Consolidate the language-switching logicYohei Yukawa2014-05-231-119/+120
|/ | | | | | | | | | | | | | | | | | | | 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
* Remove unnecessary internal lockYohei Yukawa2014-05-221-14/+14
| | | | | | | | | | | | | | | | | | | | | 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
* Style fix and dead code removalYohei Yukawa2014-05-211-6/+6
| | | | | | | | This CL does not change the existing behavior. Smarter language switching will be coverted by subsequent CLs. BUG: 7043015 Change-Id: I281a33191d44be448492c2b74760cb8680719124
* Make a copy of Matrix in CursorAnchorInfoBuilderYohei Yukawa2014-05-151-0/+28
| | | | | | | | | | | | 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
* Enable CursorAnchorInfo to contain composing stringYohei Yukawa2014-05-141-12/+14
| | | | | | | | | | | | | | 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
* Introduce new API for floating window supportYohei Yukawa2014-05-093-1/+398
| | | | | | | | This CL introduces a new API IMM#updateCursorAnchorInfo for floating window support. BUG: 14579622 Change-Id: I61dec2f8fa671ba891da1d4af08975750e3acb04
* Take supportsSwitchingToNextInputMethod into considertaionYohei Yukawa2014-05-011-12/+12
| | | | | | | | | | | | | | | | | 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
* Add unit tests for InputMethodSubtypeSwitchingControllerYohei Yukawa2014-05-012-1/+206
| | | | | | | | | | | 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
* Introduce InputMethodSubtypeArray for memory efficient IPCsYohei Yukawa2014-03-062-1/+78
| | | | | | | | | | | | | | | | | | | | | | | | | | 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
* Make sure InputMethodInfo implements Parcelable transitivelyYohei Yukawa2014-03-031-12/+18
| | | | | | | | | | 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
* Add unit test for InputMethodInfoYohei Yukawa2014-02-271-0/+54
| | | | | | | | This CL adds a unit test to make sure that InputMethodInfo implements Parcelable correctly. BUG: 12954290 Change-Id: I0abe8c266b4b035bf8ef4688d11069b355fabe9f
* Do not turn on imes unexpectedly with unit testsSatoshi Kataoka2013-01-284-0/+230
Bug: 7872918 Change-Id: Ie1d74c9fac27de140e7aa85f2eaefcb89aa06ea7