Fix System language option missing and locale region missing issue

- Taking app package name into LocalePickerWithRegion
- Using toLanguageTag() instead of getLanguage() to prevent locale
 region missing

Bug: 226278910
Bug: 226280740
Change-Id: Ieac42616192065abc0cf82db023e4e50f1ca562d
Test: To be verified
This commit is contained in:
Calvin Pan
2022-03-23 04:43:00 +00:00
parent 22f532e6f3
commit c117a89a53

View File

@@ -62,7 +62,7 @@ public class AppLocalePickerActivity extends SettingsBaseActivity
// Create Locale picker part.
final LocalePickerWithRegion selector = LocalePickerWithRegion.createLanguagePicker(
this, AppLocalePickerActivity.this, false /* translate only */);
this, AppLocalePickerActivity.this, false /* translate only */, mPackageName);
// LocalePickerWithRegion use android.app.ListFragment. Thus, it can not user
// getSupportFragmentManager() to add this into container.
getFragmentManager()
@@ -101,7 +101,7 @@ public class AppLocalePickerActivity extends SettingsBaseActivity
if (localeInfo == null || localeInfo.getLocale() == null) {
setAppDefaultLocale("");
} else {
setAppDefaultLocale(localeInfo.getLocale().getLanguage());
setAppDefaultLocale(localeInfo.getLocale().toLanguageTag());
}
finish();
}