From f9b806e5e9814728bf649a90872a6d17a0bbcbbf Mon Sep 17 00:00:00 2001 From: Yohei Yukawa Date: Sat, 21 Feb 2015 03:06:51 +0900 Subject: [PATCH] Stop using InputMethodUtils.isValidSystemDefaultIme This is a follow up CL for a recent attempt to minimize the number of default enabled IMEs. - part1: I831502db502f4073c9c2f50ce7705a4e45e2e1e3 - part2: Ife93d909fb8a24471c425c903e2b7048826e17a3 - part3: I6571d464a46453934f0a8f5e79018a67a9a3c845 - part4: I871ccda787eb0f1099ba3574356c1da4b33681f3 In the above changes, InputMethodUtils.isValidSystemDefaultIme was deprecated in favor of InputMethodUtils.isSystemImeThatHasSubtypeOf. With this CL, InputMethodUtils.isValidSystemDefaultIme is not used by the setting app anymore and we can remove that method from InputMethodUtils finally. This is a pure code refactoring with preserving the current logic. Hence no behavior change is intended. Change-Id: Ie96b0d17745735db63eebe6fe1654f32d9b9a170 --- .../inputmethod/InputMethodSettingValuesWrapper.java | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/com/android/settings/inputmethod/InputMethodSettingValuesWrapper.java b/src/com/android/settings/inputmethod/InputMethodSettingValuesWrapper.java index ada476e15c2..8f10bdf0ca7 100644 --- a/src/com/android/settings/inputmethod/InputMethodSettingValuesWrapper.java +++ b/src/com/android/settings/inputmethod/InputMethodSettingValuesWrapper.java @@ -186,13 +186,16 @@ class InputMethodSettingValuesWrapper { if (imi.isAuxiliaryIme()) { return false; } - if (InputMethodUtils.isValidSystemDefaultIme(true /* isSystemReady */, imi, context)) { + final Locale systemLocale = context.getResources().getConfiguration().locale; + if (InputMethodUtils.isSystemImeThatHasSubtypeOf(imi, context, + true /* checkDefaultAttribute */, systemLocale, false /* checkCountry */, + InputMethodUtils.SUBTYPE_MODE_ANY)) { return true; } if (mAsciiCapableEnabledImis.isEmpty()) { Log.w(TAG, "ascii capable subtype enabled imi not found. Fall back to English" + " Keyboard subtype."); - return InputMethodUtils.containsSubtypeOf(imi, Locale.ENGLISH.getLanguage(), + return InputMethodUtils.containsSubtypeOf(imi, Locale.ENGLISH, false /* checkCountry */, InputMethodUtils.SUBTYPE_MODE_KEYBOARD); } return mAsciiCapableEnabledImis.contains(imi);