设置默认输入法
在 frameworks\base\core\res\res\values\config.xml 添加一个属性:
<!--leo add-->
<string name="config_default_input_method">com.Android.inputmethod.pinyin/.PinyinIME</string>
frameworks\base\services\Java\com\android\server\InputMethodManagerService.java
的方法buildInputMethodListLocked()里添加:
String defaultIme = Settings.Secure.getString(mContext
.getContentResolver(), Settings.Secure.DEFAULT_INPUT_METHOD);
//leo
if ( defaultIme == null )
{
final Resources res = mContext.getResources();
try
{
//frameworks\base\core\res\res\values\config.xml
String myIME = res.getString( com.android.internal.R.string.config_default_input_method );
if ( myIME != null && myIME.length() > 0 )
{
Settings.Secure.putString( mContext.getContentResolver(),
Settings.Secure.DEFAULT_INPUT_METHOD,
myIME );
}
}
catch ( Exception e )
{
}
}
下面的方法也可:
设置默认输入法为google拼音
\frameworks\base\packages\SettingsProvider\res\values\defaults.xml
<!-- leo add -->
<string name="config_default_input_method" translatable="false">com.android.inputmethod.pinyin/.PinyinIME</string>
\frameworks\base\packages\SettingsProvider\src\com\android\providers\settings\DatabaseHelper.java
private void loadSecureSettings(SQLiteDatabase db)
//leo add
loadStringSetting( stmt, Settings.Secure.DEFAULT_INPUT_METHOD,
R.string.config_default_input_method );