From d15f6e8c98f673dc38100e2fe3e359f46f7358a4 Mon Sep 17 00:00:00 2001 From: Jean Chalard Date: Tue, 14 Oct 2014 15:11:39 +0900 Subject: Performance fix for multiple language subtypes The code would iterate all enabled subtypes each time getCurrentSubtype() is called, which is really quite frequent. Bug: 11230254 Change-Id: I91feb36de6eca84967e848fc585aae04b350be89 --- .../android/inputmethod/latin/RichInputMethodManager.java | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) (limited to 'java/src/com/android/inputmethod/latin/RichInputMethodManager.java') diff --git a/java/src/com/android/inputmethod/latin/RichInputMethodManager.java b/java/src/com/android/inputmethod/latin/RichInputMethodManager.java index b4ec8d674..3fcae58f1 100644 --- a/java/src/com/android/inputmethod/latin/RichInputMethodManager.java +++ b/java/src/com/android/inputmethod/latin/RichInputMethodManager.java @@ -299,13 +299,13 @@ public class RichInputMethodManager { return INDEX_NOT_FOUND; } - public RichInputMethodSubtype getCurrentInputMethodSubtype( - final RichInputMethodSubtype defaultSubtype) { - final InputMethodSubtype currentSubtype = mImmWrapper.mImm.getCurrentInputMethodSubtype(); - if (currentSubtype == null) { - return defaultSubtype; - } - return AdditionalFeaturesSettingUtils.getRichInputMethodSubtype(this, currentSubtype); + public InputMethodSubtype getCurrentRawSubtype() { + return mImmWrapper.mImm.getCurrentInputMethodSubtype(); + } + + public RichInputMethodSubtype createCurrentRichInputMethodSubtype( + final InputMethodSubtype rawSubtype) { + return AdditionalFeaturesSettingUtils.createRichInputMethodSubtype(this, rawSubtype); } public boolean hasMultipleEnabledIMEsOrSubtypes(final boolean shouldIncludeAuxiliarySubtypes) { -- cgit v1.2.3-83-g751a