由于Android10 在SettingsProviderres应用中找不到默认定义的变量enabled_input_methods,所以我们需要自己重新自定义一下 代码路径: android/frameworks/base/packages/SettingsProviderres/values/defaults.xml android/frameworks/base/packages/SettingsProvidersrc/com/android/providers/settings/DatabaseHelper.java 1、在defaults.xml资源文件中添加输入法包名
<string name="sogou_input_method">com.sohu.inputmethod.sogou/.SogouIME</string>
<string name="enable_sogou_input_method">com.sohu.inputmethod.sogou/.SogouIME:com.android.inputmethod.latin/.LatinIME</string>
2、在DatabaseHelper.java中loadSecureSettings()方法中
private static final String INPUT_METHOD = SystemProperties.get("persist.sys.input_method","sogou");
if (INPUT_METHOD.equals("sogou")) {
loadStringSetting(stmt, Settings.Secure.ENABLED_INPUT_METHODS, R.string.enable_sogou_input_method);
loadStringSetting(stmt, Settings.Secure.DEFAULT_INPUT_METHOD, R.string.sogou_input_method);
}else {
loadStringSetting(stmt, Settings.Secure.ENABLED_INPUT_METHODS,
R.string.enabled_input_methods);
loadStringSetting(stmt, Settings.Secure.DEFAULT_INPUT_METHOD,
R.string.default_input_method);
}
|