From 27d301667be46fd5038e97f435c2d9f133894617 Mon Sep 17 00:00:00 2001 From: Adam Lesinski Date: Wed, 25 May 2016 16:45:14 -0700 Subject: [PATCH] Use app's best locale if they override LocaleList App's can technically override their configuration's Locale, which means we must choose the overriden locale as the best, and therefore set the LocaleList.setDefault() with that locale. Bug:28953437 Change-Id: I4b301fcd6bc426e37bb389d3a6f2b4a3c69ac33a --- core/java/android/app/ActivityThread.java | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/core/java/android/app/ActivityThread.java b/core/java/android/app/ActivityThread.java index 30753c1632ff3..7198146bee0f3 100644 --- a/core/java/android/app/ActivityThread.java +++ b/core/java/android/app/ActivityThread.java @@ -5007,8 +5007,11 @@ public final class ActivityThread { return; } } - throw new AssertionError("chosen locale " + bestLocale + " must be present in LocaleList: " - + newLocaleList.toLanguageTags()); + + // The app may have overridden the LocaleList with its own Locale + // (not present in the available list). Push the chosen Locale + // to the front of the list. + LocaleList.setDefault(new LocaleList(bestLocale, newLocaleList)); } private void handleBindApplication(AppBindData data) {