Make LocaleUtils#getLanguageFromLocaleString() work again
This is a follow up CL to our previous CL [1], which aimed to remove the code duplicate without changing the behavior but ended up introducing an unexpected behavior change, which is actually caught as test failures. In short, the legacy "subtypeLocale" uses a non-standard text format, which cannot be parsed with Locale#forLanguageTag(). Note that subtypes have already accept BCP 47 LanguageTags [2], that's where Locale#forLanguageTag() should be used. Anyway, with this commit LocaleUtils#getLanguageFromLocaleString() starts working correctly again. Futher cleanups will be coming at Bug 321064051. [1]: I67ec553f8cfc21b1916a5a32783630ea43f2d407 d24bd53f [2]: I6db107ad2afc7709167f7c4e5d24bd589ac8bd70 868d19b9 Bug: 303302694 Bug: 321064051 Fix: 320780830 Test: atest FrameworksServicesTests:com.android.server.inputmethod.InputMethodSubtypeSwitchingControllerTest Test: atest FrameworksServicesTests:com.android.server.inputmethod.InputMethodUtilsTest Test: atest FrameworksServicesTests:com.android.server.inputmethod.LocaleUtilsTest Change-Id: Ifdbc565455cd4ff3edf47221949e8c16f3a457c2
Loading
Please register or sign in to comment