Loading
Optimize filterByLanguage by caching locale objects
According to traceview, most of the time spent in filterByLanguage is calling getLocaleObject to create java.util.Locale objects. The solution is to cache the object to save the cost. Note that both mSubtypeLangugageTag and mSubtypeLocale are final, so it is fine to cache the locale object. Test: bit FrameworksCoreTests:android.view.inputmethod.InputMethodSubtypeTest Test: bit FrameworksCoreTests:com.android.internal.inputmethod.LocaleUtilsTest Test: Try to switch user back and forth, and tap a textview to show IME. Bug: 37647204 Fix: 37647213 Change-Id: Ib6ff7e97b17fc547c8109af8177f05fc3ea41b08