Fix incorrect region
Bug: 388426025 Test: UI verification Flag: com.android.settings.flags.regional_preferences_api_enabled Change-Id: I62df2e3d2111ee45aece7a6af81edc561fe72b07
This commit is contained in:
@@ -111,7 +111,7 @@ public class LocalePickerWithRegionActivity extends SettingsBaseActivity
|
||||
@Override
|
||||
public void onLocaleSelected(LocaleStore.LocaleInfo locale) {
|
||||
if (Flags.regionalPreferencesApiEnabled()) {
|
||||
if (sameLanguageAndScript(locale.getLocale(), Locale.getDefault())) {
|
||||
if (sameLanguageAndScript(locale.getLocale(), LocaleList.getDefault().get(0))) {
|
||||
Bundle args = new Bundle();
|
||||
args.putInt(ARG_DIALOG_TYPE, DIALOG_CHANGE_LOCALE_REGION);
|
||||
args.putSerializable(ARG_TARGET_LOCALE, locale);
|
||||
|
@@ -18,6 +18,7 @@ package com.android.settings.regionalpreferences;
|
||||
|
||||
import android.content.Context;
|
||||
import android.os.Bundle;
|
||||
import android.os.LocaleList;
|
||||
import android.util.Log;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
@@ -91,7 +92,7 @@ public abstract class RegionPickerBaseListPreferenceController extends BasePrefe
|
||||
? getSuggestedLocaleList()
|
||||
: getSupportedLocaleList();
|
||||
if (getPreferenceCategoryKey().contains(KEY_SUGGESTED)) {
|
||||
Locale systemLocale = Locale.getDefault();
|
||||
Locale systemLocale = LocaleList.getDefault().get(0);
|
||||
LocaleStore.LocaleInfo localeInfo = LocaleStore.getLocaleInfo(systemLocale);
|
||||
result.add(localeInfo);
|
||||
}
|
||||
@@ -105,7 +106,7 @@ public abstract class RegionPickerBaseListPreferenceController extends BasePrefe
|
||||
mPreferenceCategory.addPreference(pref);
|
||||
pref.setTitle(locale.getFullCountryNameNative());
|
||||
pref.setKey(locale.toString());
|
||||
if (locale.getLocale().equals(Locale.getDefault())) {
|
||||
if (locale.getLocale().equals(LocaleList.getDefault().get(0))) {
|
||||
pref.setChecked(true);
|
||||
} else {
|
||||
pref.setChecked(false);
|
||||
|
@@ -19,6 +19,7 @@ package com.android.settings.regionalpreferences;
|
||||
import android.app.settings.SettingsEnums;
|
||||
import android.content.Context;
|
||||
import android.os.Bundle;
|
||||
import android.os.LocaleList;
|
||||
import android.provider.Settings;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
@@ -83,7 +84,7 @@ public class RegionPickerFragment extends DashboardFragment{
|
||||
|
||||
private List<AbstractPreferenceController> buildPreferenceControllers(
|
||||
@NonNull Context context) {
|
||||
Locale parentLocale = LocaleStore.getLocaleInfo(Locale.getDefault()).getParent();
|
||||
Locale parentLocale = LocaleStore.getLocaleInfo(LocaleList.getDefault().get(0)).getParent();
|
||||
LocaleStore.LocaleInfo parentLocaleInfo = LocaleStore.getLocaleInfo(parentLocale);
|
||||
SystemRegionSuggestedListPreferenceController mSuggestedListPreferenceController =
|
||||
new SystemRegionSuggestedListPreferenceController(
|
||||
|
@@ -17,6 +17,7 @@
|
||||
package com.android.settings.regionalpreferences;
|
||||
|
||||
import android.content.Context;
|
||||
import android.os.LocaleList;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.preference.Preference;
|
||||
@@ -26,8 +27,6 @@ import com.android.internal.app.LocaleStore;
|
||||
import com.android.settings.core.BasePreferenceController;
|
||||
import com.android.settings.flags.Flags;
|
||||
|
||||
import java.util.Locale;
|
||||
|
||||
/** A controller for the entry of region picker page */
|
||||
public class RegionPreferenceController extends BasePreferenceController {
|
||||
|
||||
@@ -39,7 +38,8 @@ public class RegionPreferenceController extends BasePreferenceController {
|
||||
public void displayPreference(@NonNull PreferenceScreen screen) {
|
||||
super.displayPreference(screen);
|
||||
Preference preference = screen.findPreference(getPreferenceKey());
|
||||
LocaleStore.LocaleInfo localeInfo = LocaleStore.getLocaleInfo(Locale.getDefault());
|
||||
LocaleStore.LocaleInfo localeInfo = LocaleStore.getLocaleInfo(
|
||||
LocaleList.getDefault().get(0));
|
||||
preference.setSummary(localeInfo.getFullCountryNameNative());
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user