[Panlingual] Add outside entry.

- video: https://screencast.googleplex.com/cast/NjIxODkzNzYyMjU5MzUzNnwwMWMxYjI1Ny1hMw

Bug: 207743479
Test: local
Change-Id: Iab3ba4d14f581aed7b737521ccba4f62e1c04998
This commit is contained in:
tom hsu
2021-12-08 16:27:47 +08:00
parent a86e838b02
commit 26b0bd7f19
5 changed files with 163 additions and 4 deletions

View File

@@ -270,9 +270,14 @@ public class AppLocaleDetails extends AppInfoBase implements RadioButtonPreferen
/** Gets per app's default locale */
public static Locale getAppDefaultLocale(Context context, String packageName) {
LocaleManager localeManager = context.getSystemService(LocaleManager.class);
LocaleList localeList = (localeManager == null)
? new LocaleList() : localeManager.getApplicationLocales(packageName);
return localeList.isEmpty() ? null : localeList.get(0);
try {
LocaleList localeList = (localeManager == null)
? new LocaleList() : localeManager.getApplicationLocales(packageName);
return localeList.isEmpty() ? null : localeList.get(0);
} catch (IllegalArgumentException e) {
Log.w(TAG, "package name : " + packageName + " is not correct. " + e);
}
return null;
}
/** Sets per app's default language to system. */