Android11 移除添加语言中的Suggested选项
Android11 移除添加语言中的Suggested选项
有个需求就是移除 语言中的Suggested选项中的中文选项,不是移除中文语言
从设置里跟踪到此文件
frameworks/base/core/java/com/android/internal/app/LocaleStore.java
因为没有找到具体配置的地方, 所以修改如下:
@UnsupportedAppUsage
public static void fillCache(Context context) {
if (sFullyInitialized) {
return;
}
Set<String> simCountries = getSimCountries(context);
final boolean isInDeveloperMode = Settings.Global.getInt(context.getContentResolver(),
Settings.Global.DEVELOPMENT_SETTINGS_ENABLED, 0) != 0;
for (String localeId : LocalePicker.getSupportedLocales(context)) {
if (localeId.isEmpty()) {
throw new IllformedLocaleException("Bad locale entry in locale_config.xml");
}
LocaleInfo li = new LocaleInfo(localeId);
if (LocaleList.isPseudoLocale(li.getLocale())) {
if (isInDeveloperMode) {
li.setTranslated(true);
li.mIsPseudo = true;
li.mSuggestionFlags |= LocaleInfo.SUGGESTION_TYPE_SIM;
} else {
// Do not display pseudolocales unless in development mode.
continue;
}
}
if (simCountries.contains(li.getLocale().getCountry())) {
li.mSuggestionFlags |= LocaleInfo.SUGGESTION_TYPE_SIM;
}
+ if (simCountries.contains("CN")) {// 判断如果是中文
+ li.mSuggestionFlags = LocaleInfo.SUGGESTION_TYPE_NONE;//设置为非suggest
+ }
sLocaleCache.put(li.getId(), li);
本文地址:https://blog.csdn.net/hmily0917/article/details/109649383
上一篇: @ResponseBody注解
下一篇: 移动端笔记