|
发表于 2021-9-9 11:10:48
7347 浏览 0 回复
MT6737 Android7.0内置输入法(讯飞输入法)
本帖最后由 七个柚子多少钱 于 2022-9-27 11:11 编辑
1.内置输入法需要修改的源码
- frameworks/base/packages/SettingsProvider/res/values/defaults.xml
- frameworks/base/packages/SettingsProvider/src/com/android/providers/settings/DatabaseHelper.java
复制代码 2.各个输入法的ID
输入法的ID一定要使用正确,否则设置默认启用内置的输入法的时候就会出现很多坑
- 讯飞输入法:com.iflytek.inputmethod/.FlyIME
- 搜狗输入法:com.sohu.inputmethod.sogou/.SogouIME
- 百度输入法:com.baidu.input/.ImeService
- 谷歌输入法:com.google.android.inputmethod.pinyin/.PinyinIME
- 触宝输入法:com.cootek.smartinput5/.TouchPalIME
- 腾讯输入法:com.tencent.qqpinyin/.QQPYInputMethodService
复制代码 3.内置讯飞输入法为例
1.将讯飞输入法内置到系统 添加目录packages/apps/iFlytekInput/,分别放入讯飞输入法的apk和添加Android.mk
- +++ b/packages/apps/iFlytekInput/Android.mk
- @@ -0,0 +1,11 @@
- LOCAL_PATH:= $(call my-dir)
- include $(CLEAR_VARS)
- LOCAL_MODULE := iFlytekInput
- LOCAL_MODULE_TAGS := optional
- LOCAL_SRC_FILES := $(LOCAL_MODULE).apk
- LOCAL_MODULE_CLASS := APPS
- LOCAL_MODULE_SUFFIX := $(COMMON_ANDROID_PACKAGE_SUFFIX)
- #LOCAL_CERTIFICATE := platform
- LOCAL_CERTIFICATE := PRESIGNED
- #LOCAL_DEX_PREOPT := false
- include $(BUILD_PREBUILT)
复制代码- +++ b/device/mediatek/common/device.mk
- +PRODUCT_PACKAGES += iFlytekInput
复制代码
2.修改为默认输入法 - --- a/frameworks/base/packages/SettingsProvider/res/values/defaults.xml
- +++ b/frameworks/base/packages/SettingsProvider/res/values/defaults.xml
- @@ -216,4 +216,8 @@
- <!-- Default setting for ability to add users from the lock screen -->
- <bool name="def_add_users_from_lockscreen">false</bool>
- +
- + <string name="def_input_method" translatable="false">com.iflytek.inputmethod/.FlyIME</string>
- + <string name="def_enabled_input_methods" translatable="false">com.iflytek.inputmethod/.FlyIME</string>
复制代码- --- a/frameworks/base/packages/SettingsProvider/src/com/android/providers/settings/DatabaseHelper.java
- +++ b/frameworks/base/packages/SettingsProvider/src/com/android/providers/settings/DatabaseHelper.java
- @@ -2562,6 +2562,10 @@ class DatabaseHelper extends SQLiteOpenHelper {
- loadIntegerSetting(stmt, Settings.Secure.SLEEP_TIMEOUT,
- R.integer.def_sleep_timeout);
-
- + loadStringSetting(stmt, Settings.Secure.DEFAULT_INPUT_METHOD,R.string.def_input_method );
- + loadStringSetting(stmt, Settings.Secure.ENABLED_INPUT_METHODS,R.string.def_enabled_input_methods);
复制代码
3.删除系统自带的输入法 在android7.0需要删除系统默认的输入法,否则无法正常打开讯飞输入法;- rm -rf /packages/inputmethods/LatinIME/
复制代码
|
|
|
|
|
|
|
登录或注册
|