1. 程式人生 > >Android 7.1.2替換原生輸入法

Android 7.1.2替換原生輸入法

高通平臺,原生輸入法沒有中文輸入,給國內做產品所以所以替換原生輸入法,使用谷歌拼音,具體修改步驟如下: 1.、/framework/base/packages/SettingsProvider/res/values/defaults.xml 原始:

<string name="def_input_method" translatable ="false"></string>

<string name="def_enable_input_methods" translatable="false"></string>

修改後: ```

 <string name="def_input_method" translatable ="false">com.google.android.inputmethod.pinyin/.PinYinIMe</string>
   
    <string name="def_enable_input_methods" translatable="false">com.google.android.inputmethod.pinyin/.PinYinIMe</string>
2. /framework/base/packages/SettingsProvider/src/com/android/providers/settings/DatabaseHelper.java
    
     void loadSecureSettings(SQLiteDatabase db){
        ...
        //ybf

    ++        loadStringSetting(stmt,Settings.Secure.ENABLED_INPUT_METHODS,R,string.def_input_method);
    ++        loadStringSetting(stmt,Settings.Secure.DEFAUNT_INPUT_METHOD,R,string.def_input_method);
    }
3./framework/base/services/core/java/com/android/server/InputMethodManagerService.java
@Overrode
    public void onReceiver(Context context,Intent intent){
    synchronized(mMethodMap){
    -- //fby   resetStateIfCurrentLocaleChangedLocked();
    }
}