Skip to content
Commit afcd19c7 authored by Tony Mak's avatar Tony Mak
Browse files

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
parent 8ce50255
Loading
Loading
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment