Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 824a153f authored by Zoey Chen's avatar Zoey Chen
Browse files

[Settings] Only add the selected locale to localelist

Bug: 402360613
Test: manual
Test: atest SettingsRoboTests:com.android.settings.localepicker.SystemLocaleAllListPreferenceControllerTest
Test: atest SettingsRoboTests:com.android.settings.localepicker.SystemLocaleSuggestedListPreferenceControllerTest
Flag: EXEMPT bugfix
Change-Id: Ibd522277d8a6bd7ce123bc65bd25f07f9c7c624d
parent deebcef3
Loading
Loading
Loading
Loading
+1 −4
Original line number Original line Diff line number Diff line
@@ -262,13 +262,10 @@ public abstract class LocalePickerBaseListPreferenceController extends
        boolean shouldShowLocaleEditor = shouldShowLocaleEditor(localeInfo);
        boolean shouldShowLocaleEditor = shouldShowLocaleEditor(localeInfo);
        if (shouldShowLocaleEditor) {
        if (shouldShowLocaleEditor) {
            List<LocaleStore.LocaleInfo> feedItemList = getUserLocaleList();
            List<LocaleStore.LocaleInfo> feedItemList = getUserLocaleList();
            for (LocaleStore.LocaleInfo locale : mLocaleList) {
            feedItemList.add(localeInfo);
                feedItemList.add(locale);
            }
            LocaleList localeList = new LocaleList(feedItemList.stream()
            LocaleList localeList = new LocaleList(feedItemList.stream()
                    .map(LocaleStore.LocaleInfo::getLocale)
                    .map(LocaleStore.LocaleInfo::getLocale)
                    .toArray(Locale[]::new));
                    .toArray(Locale[]::new));

            LocaleList.setDefault(localeList);
            LocaleList.setDefault(localeList);
            LocalePicker.updateLocales(localeList);
            LocalePicker.updateLocales(localeList);
            mMetricsFeatureProvider.action(mContext, SettingsEnums.ACTION_ADD_LANGUAGE);
            mMetricsFeatureProvider.action(mContext, SettingsEnums.ACTION_ADD_LANGUAGE);