客户想要默认使用讯飞输入法。
首先我们内置讯飞输入法,网上下载最新的讯飞输入法即可,Android.mk如下
LOCAL_PATH := $(call my-dir)
include $(CLEAR_VARS)
LOCAL_MODULE := xunfeiInput
LOCAL_MODULE_TAGS := optional
LOCAL_SRC_FILES := xunfeiInput.apk
LOCAL_MODULE_CLASS := APPS
LOCAL_MODULE_SUFFIX := $(COMMON_ANDROID_PACKAGE_SUFFIX)
LOCAL_CERTIFICATE := PRESIGNED
LOCAL_DEX_PREOPT := false
LOCAL_ENFORCE_USES_LIBRARIES := false
include $(BUILD_PREBUILT)
我们定义如下属性
路径:vendor/mediatek/proprietary/packages/apps/SettingsProvider/res/values/defaults.xml
<string name="def_input_ime">com.iflytek.inputmethod/.FlyIME</string>
<string name="def_enable_input_ime">com.iflytek.inputmethod/.FlyIME</string>
接着我们在 loadSecureSettings 方法中设置默认输入法
路径:vendor/mediatek/proprietary/packages/apps/SettingsProvider/src/com/android/providers/settings/DatabaseHelper.java
//*/soda water.20240115. Default input method
loadStringSetting(stmt, Settings.Secure.DEFAULT_INPUT_METHOD,
R.string.def_input_ime);
loadStringSetting(stmt, Settings.Secure.ENABLED_INPUT_METHODS,
R.string.def_enable_input_ime);
//*/