[Settings] Add a flag to control show new System language picker UI or not

Bug: 394542699
Test: manual
Test: atest SettingsRoboTests:com.android.settings.localepicker.LocaleListEditorTest
Flag: EXEMPT refactor
Change-Id: I694e92cb7f61d208c36cb4b40aa3182cd838d5bb
This commit is contained in:
Zoey Chen
2025-01-22 08:39:00 +00:00
parent ceaa16575a
commit 997cd29458
5 changed files with 43 additions and 19 deletions

View File

@@ -75,9 +75,6 @@ public abstract class LocalePickerBaseListPreferenceController extends
public LocalePickerBaseListPreferenceController(@NonNull Context context,
@NonNull String preferenceKey) {
super(context, preferenceKey);
mLocaleList = getLocaleCollectorController(context).getSupportedLocaleList(null,
false, false);
mLocaleOptions = new ArrayList<>(mLocaleList.size());
mPreferences = new ArrayMap<>();
mMetricsFeatureProvider = FeatureFactory.getFeatureFactory().getMetricsFeatureProvider();
}
@@ -246,7 +243,7 @@ public abstract class LocalePickerBaseListPreferenceController extends
private void setupLocaleList() {
mLocaleList = getLocaleCollectorController(mContext).getSupportedLocaleList(
mParentLocale, false, mIsCountryMode);
mLocaleOptions.clear();
mLocaleOptions = new ArrayList<>(mLocaleList.size());
}
private List<LocaleStore.LocaleInfo> getSortedLocaleList(
@@ -262,7 +259,9 @@ public abstract class LocalePickerBaseListPreferenceController extends
boolean shouldShowLocaleEditor = shouldShowLocaleEditor(localeInfo);
if (shouldShowLocaleEditor) {
List<LocaleStore.LocaleInfo> feedItemList = getUserLocaleList();
feedItemList.add(localeInfo);
for (LocaleStore.LocaleInfo locale : mLocaleList) {
feedItemList.add(locale);
}
LocaleList localeList = new LocaleList(feedItemList.stream()
.map(LocaleStore.LocaleInfo::getLocale)
.toArray(Locale[]::new));