am 8a2537e0: Merge "Update personalized dict only when single subtype is used."
* commit '8a2537e0ae324466c201573845b681bbab2e625e': Update personalized dict only when single subtype is used.main
commit
76a5035b28
|
@ -523,7 +523,11 @@ public class LatinIME extends InputMethodService implements KeyboardActionListen
|
||||||
suggest.close();
|
suggest.close();
|
||||||
}
|
}
|
||||||
if (currentSettingsValues.mUsePersonalizedDicts) {
|
if (currentSettingsValues.mUsePersonalizedDicts) {
|
||||||
PersonalizationDictionarySessionRegistrar.init(this);
|
if (mSubtypeSwitcher.isSystemLocaleSameAsLocaleOfAllEnabledSubtypes()) {
|
||||||
|
PersonalizationDictionarySessionRegistrar.init(this);
|
||||||
|
} else {
|
||||||
|
PersonalizationDictionarySessionRegistrar.close(this);
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
PersonalizationHelper.removeAllPersonalizedDictionaries(this);
|
PersonalizationHelper.removeAllPersonalizedDictionaries(this);
|
||||||
PersonalizationDictionarySessionRegistrar.resetAll(this);
|
PersonalizationDictionarySessionRegistrar.resetAll(this);
|
||||||
|
@ -595,7 +599,7 @@ public class LatinIME extends InputMethodService implements KeyboardActionListen
|
||||||
ResearchLogger.getInstance().onDestroy();
|
ResearchLogger.getInstance().onDestroy();
|
||||||
}
|
}
|
||||||
unregisterReceiver(mDictionaryPackInstallReceiver);
|
unregisterReceiver(mDictionaryPackInstallReceiver);
|
||||||
PersonalizationDictionarySessionRegistrar.onDestroy(this);
|
PersonalizationDictionarySessionRegistrar.close(this);
|
||||||
LatinImeLogger.commit();
|
LatinImeLogger.commit();
|
||||||
LatinImeLogger.onDestroy();
|
LatinImeLogger.onDestroy();
|
||||||
super.onDestroy();
|
super.onDestroy();
|
||||||
|
|
|
@ -273,6 +273,18 @@ public final class SubtypeSwitcher {
|
||||||
return mNeedsToDisplayLanguage.getValue();
|
return mNeedsToDisplayLanguage.getValue();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public boolean isSystemLocaleSameAsLocaleOfAllEnabledSubtypes() {
|
||||||
|
final Locale systemLocale = mResources.getConfiguration().locale;
|
||||||
|
final List<InputMethodSubtype> enabledSubtypesOfThisIme =
|
||||||
|
mRichImm.getMyEnabledInputMethodSubtypeList(true);
|
||||||
|
for (final InputMethodSubtype subtype : enabledSubtypesOfThisIme) {
|
||||||
|
if (!systemLocale.equals(SubtypeLocaleUtils.getSubtypeLocale(subtype))) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
private static InputMethodSubtype sForcedSubtypeForTesting = null;
|
private static InputMethodSubtype sForcedSubtypeForTesting = null;
|
||||||
@UsedForTesting
|
@UsedForTesting
|
||||||
void forceSubtype(final InputMethodSubtype subtype) {
|
void forceSubtype(final InputMethodSubtype subtype) {
|
||||||
|
|
|
@ -35,6 +35,6 @@ public class PersonalizationDictionarySessionRegistrar {
|
||||||
public static void resetAll(final Context context) {
|
public static void resetAll(final Context context) {
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void onDestroy(final Context context) {
|
public static void close(final Context context) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue