android修改系统默认输入法

本文给出怎样修改android系统默认输入法

安卓修改配置默认输入法,并且在实体硬键盘存在情况下,默认弹起输入法软键盘。
frameworks/base下应用如下patch:

diff --git a/packages/SettingsProvider/res/values/defaults.xml b/packages/SettingsProvider/res/values/defaults.xml
old mode 100644
new mode 100755
index 81f63b0..83261f9
--- a/packages/SettingsProvider/res/values/defaults.xml
+++ b/packages/SettingsProvider/res/values/defaults.xml
@@ -160,6 +160,10 @@
     <!-- Default for Settings.System.POINTER_SPEED -->
     <integer name="def_pointer_speed">0</integer>
 
+    <bool name="def_show_ime_with_hard_keyboard">true</bool>
+    <string name="config_default_input_method" translatable="false">com.example.android.softkeyboard/.SoftKeyboard</string>
+    <string name="config_enabled_input_methods" translatable="false">com.example.android.softkeyboard/.SoftKeyboard</string>
+
     <!-- Default for DTMF tones enabled -->
     <bool name="def_dtmf_tones_enabled">true</bool>
     <!-- Default for UI touch sounds enabled -->
diff --git a/packages/SettingsProvider/src/com/android/providers/settings/DatabaseHelper.java b/packages/SettingsProvider/src/com/android/providers/settings/DatabaseHelper.java
old mode 100644
new mode 100755
index 5a14967..907ded8
--- a/packages/SettingsProvider/src/com/android/providers/settings/DatabaseHelper.java
+++ b/packages/SettingsProvider/src/com/android/providers/settings/DatabaseHelper.java
@@ -2459,6 +2459,15 @@ class DatabaseHelper extends SQLiteOpenHelper {
             loadBooleanSetting(stmt, Settings.Secure.MOUNT_UMS_PROMPT,
                     R.bool.def_mount_ums_prompt);
 
+            loadStringSetting(stmt, Settings.Secure.DEFAULT_INPUT_METHOD,
+                    R.string.config_default_input_method);
+
+            loadStringSetting(stmt, Settings.Secure.ENABLED_INPUT_METHODS,
+                    R.string.config_enabled_input_methods);
+
+            loadBooleanSetting(stmt, Settings.Secure.SHOW_IME_WITH_HARD_KEYBOARD,
+                    R.bool.def_show_ime_with_hard_keyboard);
+
             loadBooleanSetting(stmt, Settings.Secure.MOUNT_UMS_NOTIFY_ENABLED,
                     R.bool.def_mount_ums_notify_enabled);

posted @ 2018-06-14 16:21  mail181  阅读(72)  评论(0编辑  收藏  举报