今天给大家分享MTK平台系统编程与修改的另一个部分,分别是输入法校准、自动校准默认关、首字母大写默认开、按键声音默认关、Voice Control 移除系统中文,默认
英文,下面一个一个的介绍给大家
①Language & input> Android Keyboard>Auto Correction > Uncheck as Default(Off) 语言输入-安卓键盘-自动校准默认关
根据红色框关键词用命令行在settings下执行热词检索:
.../mnt/disk3/jsp/xxx8382$ find packages/apps/Settings/ -name "*.xml" | xargs grep "Very aggressive" -l
.../mnt/disk3/jsp/xxx8382$ find packages/ -name "*.xml" | xargs grep "Very aggressive" -l
packages/inputmethods/LatinIME/java/res/values/strings.xml
packages/inputmethods/LatinIME/java/res/values-en-rIN/strings.xml
packages/inputmethods/LatinIME/java/res/values-en-rGB/strings.xml
android5@ubuntu2015:/mnt/disk3/jsp/xxx8382$ find packages/ -name "*.xml" | xargs grep "auto_correction_threshold_mode_very_aggressive" -l
packages/inputmethods/LatinIME/java/res/values-es/strings.xml
packages/inputmethods/LatinIME/java/res/values-ms-rMY/strings.xml
packages/inputmethods/LatinIME/java/res/values-my/strings.xml
packages/inputmethods/LatinIME/java/res/values-ky-rKG/strings.xml
packages/inputmethods/LatinIME/java/res/values-hu/strings.xml
packages/inputmethods/LatinIME/java/res/values-ne-rNP/strings.xml
packages/inputmethods/LatinIME/java/res/values-pl/strings.xml
packages/inputmethods/LatinIME/java/res/values-lo-rLA/strings.xml
packages/inputmethods/LatinIME/java/res/values/strings.xml
packages/inputmethods/LatinIME/java/res/values/config-auto-correction-thresholds.xml
0
1
2
3
- @string/auto_correction_threshold_mode_index_off
- @string/auto_correction_threshold_mode_index_modest
- @string/auto_correction_threshold_mode_index_aggressive
- @string/auto_correction_threshold_mode_index_very_aggressive
- @string/auto_correction_threshold_mode_off
- @string/auto_correction_threshold_mode_modest
- @string/auto_correction_threshold_mode_aggressive
- @string/auto_correction_threshold_mode_very_aggressive
继续热词搜索追踪
jsp@ubuntu2015:/mnt/disk3/jsp/RMT8382$ find packages/ -name "*.xml" | xargs grep "auto_correction_threshold_modes" -l
packages/inputmethods/LatinIME/java/res/values/config-auto-correction-thresholds.xml
packages/inputmethods/LatinIME/java/res/xml/prefs_screen_correction.xml
就可以重新修改默认值,重新编译工程,刷机即可看到效果
重新刷机第一次开机之后的效果图:
②系统输入法自动大写默认开/输入法按键音效默认关/输入法拼写校准默认开-修改
热词检索命令
android5@ubuntu2015:/mnt/disk3/jsp/RMT8382$ find packages/ -name "*.xml" | xargs grep "按键音效" -l
packages/inputmethods/LatinIME/java/res/values-zh-rCN/strings.xml
android5@ubuntu2015:/mnt/disk3/jsp/RMT8382$ find packages/ -name "*.xml" | xargs grep "sound_on_keypress" -l
packages/inputmethods/LatinIME/java/res/values-es/strings.xml
packages/inputmethods/LatinIME/java/res/values-ms-rMY/strings.xml
packages/inputmethods/LatinIME/java/res/values-my/strings.xml
packages/inputmethods/LatinIME/java/res/values-ky-rKG/strings.xml
packages/inputmethods/LatinIME/java/res/values-hu/strings.xml
packages/inputmethods/LatinIME/java/res/values-ne-rNP/strings.xml
packages/inputmethods/LatinIME/java/res/values-pl/strings.xml
packages/inputmethods/LatinIME/java/res/values-lo-rLA/strings.xml
packages/inputmethods/LatinIME/java/res/values/strings.xml
packages/inputmethods/LatinIME/java/res/values-es-rUS/strings.xml
packages/inputmethods/LatinIME/java/res/values-bn/strings.xml
packages/inputmethods/LatinIME/java/res/values-tl/strings.xml
packages/inputmethods/LatinIME/java/res/xml/prefs_screen_preferences.xml
jsp@ubuntu2015:/mnt/disk3/jsp/xxx8382$ find packages/ -name "*.xml" | xargs grep "config_default_sound_enabled" -l
packages/inputmethods/LatinIME/java/res/values/config-per-form-factor.xml
#首字母大写开
#输入法按键音效关
#输入法拼写校准默认开
刷机第一次启动的效果:
③setting - voice control - language for voice control -Keep only english 设置-声音控制-语言只留英语去掉中文
定位到settings下检索关键字
jsp@ubuntu2015:/mnt/disk3/jsp/xxx8382$ find packages/apps/Settings/ -type f|xargs grep "繁體中文" -l
jsp@ubuntu2015:/mnt/disk3/jsp/xxx8382$ find ./ -type f|xargs grep "繁體中文" -l
得着不管是检索资料还是反编译apk等,都很实用
连接USB打开debugging,打开Eclipse → 打开 DDMS 点击设备 如下界面操作:
检索包名 com.mediatek.voicecommand
android5@ubuntu2015:/mnt/disk3/jsp/RMT8382$ find -name "*.xml"|xargs grep "com.mediatek.voicecommand" -l
./vendor/mediatek/proprietary/packages/apps/VoiceCommand/tests/AndroidManifest.xml
./vendor/mediatek/proprietary/packages/apps/VoiceCommand/res/xml/voice_ui_available_preference.xml
./vendor/mediatek/proprietary/packages/apps/VoiceCommand/res/xml/voiceprocessinfo.xml
./vendor/mediatek/proprietary/packages/apps/VoiceCommand/AndroidManifest.xml
得到如上结果,大大缩小我们要查找的范围,继续之前的检索
android5@ubuntu2015:/mnt/disk3/jsp/RMT8382$ find vendor/mediatek/proprietary/packages/apps/VoiceCommand -type f|xargs grep "繁體中文" -l
vendor/mediatek/proprietary/packages/apps/VoiceCommand/res/xml/voicelanguage.xml
得到 voicelanguage.xml 资源文件,继续下一步检索
android5@ubuntu2015:/mnt/disk3/jsp/RMT8382$ find -name "*.java"|xargs grep "voicelanguage" -l
./out/target/common/R/com/mediatek/voicecommand/R.java
./out/target/common/obj/APPS/VoiceCommand_intermediates/src/com/mediatek/voicecommand/R.java
android5@ubuntu2015:/mnt/disk3/jsp/RMT8382$ find vendor/mediatek/proprietary/packages/apps/VoiceCommand -name "*.java"|xargs grep "list" -l
vendor/mediatek/proprietary/packages/apps/VoiceCommand/tests/src/com/mediatek/voicecommand/tests/VoiceCommandTest.java
vendor/mediatek/proprietary/packages/apps/VoiceCommand/src/com/mediatek/voicecommand/ui/settings/VoiceUiSettings.java
vendor/mediatek/proprietary/packages/apps/VoiceCommand/src/com/mediatek/voicecommand/mgr/ConfigurationManager.java
vendor/mediatek/proprietary/packages/apps/VoiceCommand/src/com/mediatek/voicecommand/mgr/AppDataManager.java
vendor/mediatek/proprietary/packages/apps/VoiceCommand/src/com/mediatek/voicecommand/business/VoiceContacts.java
vendor/mediatek/proprietary/packages/apps/VoiceCommand/src/com/mediatek/voicecommand/business/VoiceWakeupMode.java
vendor/mediatek/proprietary/packages/apps/VoiceCommand/src/com/mediatek/voicecommand/service/VoiceCommandManagerStub.java
vendor/mediatek/proprietary/packages/apps/VoiceCommand/src/com/mediatek/voicecommand/cfg/ConfigurationXML.java
@Override
public boolean onPreferenceTreeClick(PreferenceScreen preferenceScreen,
Preference preference) {
if (KEY_VOICE_UI_LANGUAGE.equals(preference.getKey())) {// 这就是Preference 被点击之后跳转的选项,也就是Voice Control 选项
Intent intent = new Intent(
"com.mediatek.voicecommand.VOICE_CONTROL_LANGUAGE");
intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
startActivity(intent);
return true;
} else if
......
}
根据 Activity action 检索Acticity 名称
jsp@ubuntu2015:/mnt/disk3/jsp/xxx8382$ find vendor/mediatek/proprietary/packages/apps/VoiceCommand -name "*.xml"|xargs grep "com.mediatek.voicecommand.VOICE_CONTROL_LANGUAGE" -l
vendor/mediatek/proprietary/packages/apps/VoiceCommand/AndroidManifest.xml
@Override
public void onCreate(Bundle savedInstanceState) {
Xlog.d(TAG, "OnCreate VoiceUiAvailableLanguageFragment");
super.onCreate(savedInstanceState);
addPreferencesFromResource(R.xml.voice_ui_available_langs);
mVoiceConfigMgr = ConfigurationManager.getInstance(this);
if (mVoiceConfigMgr == null) {
Xlog.e(TAG, "ConfigurationManager is null");
return;
}
mAvailableLangs = mVoiceConfigMgr.getLanguageList(); // 继续查看 ConfigurationManager getLanguageList() 代码
// mDefaultLanguage = mVoiceConfigMgr.getCurrentLanguage();// 这里 mDefaultLanguage int 默认为 0
......
}
}
public String[] getLanguageList() {
int size = mLanguageList.size();
if (size == 0) {
return null;
}
String[] language = new String[size];
// Log.i(VoiceCommandManagerService.TAG, "mLanguageList = "+ size);
for (int i = 0; i < size; i++) {
language[i] = mLanguageList.get(i).mName;
}
return language;
}
/*
* ConfigurationManager for control configuration
*
* @param context
*/
private ConfigurationManager(Context context) {
......
mCurrentLanguageIndex = mConfigurationXML
.readVoiceLanguangeFromXml(mLanguageList);// 来自 ConfigurationXML 的 readVoiceLanguangeFromXml 函数
......
}
/**
* Read language info from res.
*
* @param languageList
* language list instance
*/
public int readVoiceLanguangeFromXml(
......
XmlPullParser parser = mContext.getResources().getXml(// 这里就是加载语言选项 xml 的地方,下面贴上 xml 内容
R.xml.voicelanguage);
if (parser == null) {
Log.e(TAG, "readVoiceLanguangeFromXml Got execption");
return curIndex;
}
......
}
@Override
public void onCreate(Bundle savedInstanceState) {
Xlog.d(TAG, "OnCreate VoiceUiAvailableLanguageFragment");
super.onCreate(savedInstanceState);
addPreferencesFromResource(R.xml.voice_ui_available_langs);
mVoiceConfigMgr = ConfigurationManager.getInstance(this);
if (mVoiceConfigMgr == null) {
Xlog.e(TAG, "ConfigurationManager is null");
return;
}
mAvailableLangs = mVoiceConfigMgr.getLanguageList();
// mDefaultLanguage = mVoiceConfigMgr.getCurrentLanguage();//注释此句代码,因为 mDefaultLanguage 默认为0,不再需要其他选项,自己默认为0
......
}
@Override
public boolean onPreferenceTreeClick(PreferenceScreen preferenceScreen,
Preference preference) {
if (preference instanceof RadioButtonPreference) {
// selectLanguage((RadioButtonPreference) preference); // 注释掉此句,不过不注释也不影响,只是多做了一些操作而已,都是多余的
Xlog.d(TAG, "default language changed to " + mAvailableLangs[mDefaultLanguage]);
finish();
}
return true;
}
selectLanguage 函数代码:
private void selectLanguage(RadioButtonPreference preference) {
if (mLastSelectedPref != null) {
if (mLastSelectedPref == preference) {
return;
}
mLastSelectedPref.setChecked(false);
}
mDefaultLanguage = Integer.parseInt(preference.getKey().toString());
Xlog.d(TAG, "set default language to " + mAvailableLangs[mDefaultLanguage]);
mVoiceConfigMgr.setCurrentLanguage(mDefaultLanguage);
preference.setChecked(true);
mLastSelectedPref = preference;
}
效果图: