问题平台描述
郑重声明:本人原创博文,都是实战,均经过实际项目验证出货的
转载请标明出处:攻城狮2015
Platform: Rockchip
CPU:rk3229
OS:Android 7.1.2
Kernel: 3.10
问题描述
国内客户,觉得安卓自带的输入法不好用,又或者不能输入中文,会需求修改默认输入法,sogou,baidu等
解决方法
下面以去除百度输入法为安卓默认输入法为例,如果其他需要替换别的输入法,逆向即可
xml
--- a/device/rockchip/rk322x/rk322x_box/preinstall_del/sougou/Android.mk
+++ /dev/null
@@ -1,6 +0,0 @@
-LOCAL_PATH := $(my-dir)
-LOCAL_PATH := $(my-dir)
-include $(CLEAR_VARS)
-LOCAL_APK_NAME := sougou
-LOCAL_POST_PROCESS_COMMAND := $(shell mkdir -p $(TARGET_OUT_VENDOR)/bundled_uninstall_back-app/$(LOCAL_APK_NAME) && cp $(LOCAL_PATH)/$(LOCAL_APK_NAME).apk $(TARGET_OUT_VENDOR)/bundled_uninstall_back-app/$(LOCAL_APK_NAME)/)
xml
添加preinstallApk
diff --git a/device/rockchip/rk322x/rk322x_box/preinstall_del/sougou/lib/arm/libchiperencoder_v1_2.so b/device/rockchip/rk322x/rk322x_box/preinstall_del/sougou/lib/arm/libchiperencoder_v1_2.so
deleted file mode 100644
index 2fbea139ad..0000000000
Binary files a/device/rockchip/rk322x/rk322x_box/preinstall_del/sougou/lib/arm/libchiperencoder_v1_2.so and /dev/null differ
diff --git a/device/rockchip/rk322x/rk322x_box/preinstall_del/sougou/lib/arm/librabjni-1.so b/device/rockchip/rk322x/rk322x_box/preinstall_del/sougou/lib/arm/librabjni-1.so
deleted file mode 100644
index 2edadb5445..0000000000
Binary files a/device/rockchip/rk322x/rk322x_box/preinstall_del/sougou/lib/arm/librabjni-1.so and /dev/null differ
diff --git a/device/rockchip/rk322x/rk322x_box/preinstall_del/sougou/lib/arm/libshare_v2.so b/device/rockchip/rk322x/rk322x_box/preinstall_del/sougou/lib/arm/libshare_v2.so
deleted file mode 100644
index 536593f69a..0000000000
Binary files a/device/rockchip/rk322x/rk322x_box/preinstall_del/sougou/lib/arm/libshare_v2.so and /dev/null differ
diff --git a/device/rockchip/rk322x/rk322x_box/preinstall_del/sougou/lib/arm/libtmfe30.so b/device/rockchip/rk322x/rk322x_box/preinstall_del/sougou/lib/arm/libtmfe30.so
deleted file mode 100644
index f406f18629..0000000000
Binary files a/device/rockchip/rk322x/rk322x_box/preinstall_del/sougou/lib/arm/libtmfe30.so and /dev/null differ
diff --git a/device/rockchip/rk322x/rk322x_box/preinstall_del/sougou/sougou.apk b/device/rockchip/rk322x/rk322x_box/preinstall_del/sougou/sougou.apk
2.framework修改
xml
+++ b/frameworks/base/core/java/com/android/internal/inputmethod/InputMethodUtils.java
@@ -1083,8 +1083,7 @@ public class InputMethodUtils {
// At the initial boot, the settings for input methods are not set,
// so we need to enable IME in that case.
public void enableAllIMEsIfThereIsNoEnabledIME() {
- //if (TextUtils.isEmpty(getEnabledInputMethodsStr())) {
- if (!TextUtils.isEmpty(getEnabledInputMethodsStr())) {
+ if (TextUtils.isEmpty(getEnabledInputMethodsStr())) {
StringBuilder sb = new StringBuilder();
final int N = mMethodList.size();
for (int i = 0; i < N; i++) {
+++ b/frameworks/base/core/res/res/values/config.xml
@@ -2086,7 +2086,7 @@
And the disabled_until_used state for an IME is released by InputMethodManagerService
when the IME is selected as an enabled IME. -->
<string-array name="config_disabledUntilUsedPreinstalledImes" translatable="false">
- <item>com.baidu.input_baidutv</item>
+ <item>com.android.inputmethod.latin</item>
</string-array>
<!-- The list of carrier applications which should be disabled until used.
@@ -2711,10 +2711,5 @@
If review is not required, permissions are reviewed before the app
is installed. -->
<bool name="config_permissionReviewRequired">false</bool>
-
- <!--add begin-->
- <string name="config_default_input_method" translatable="false">com.baidu.input_baidutv/.ImeService</string>
- <string name="def_enabled_input_methods" translatable="false">com.baidu.input_baidutv/.ImeService</string>
- <!--add end-->
+++ b/frameworks/base/packages/SettingsProvider/res/values/defaults.xml
@@ -205,11 +205,6 @@
<!-- Default for Settings.Global.DEVICE_NAME $1=MANUFACTURER $2=MODEL-->
<string name="def_device_name">%1$s %2$s</string>
-
- <string name="def_input_method" translatable="false">com.baidu.input_baidutv/.ImeService</string>
- <string name="enabled_input_methods" translatable="false">com.baidu.input_baidutv/.ImeService</string>
- <string name="config_default_input_method" translatable="false">com.baidu.input_baidutv/.ImeService</string>
- <string name="def_enabled_input_methods" translatable="false">com.baidu.input_baidutv/.ImeService</string>
+++ b/frameworks/base/packages/SettingsProvider/src/com/android/providers/settings/DatabaseHelper.java
@@ -2402,8 +2402,8 @@ class DatabaseHelper extends SQLiteOpenHelper {
loadStringSetting(stmt, Settings.System.TIME_12_24, R.string.def_time_12_24);
//add begin
- loadStringSetting(stmt, Settings.Secure.DEFAULT_INPUT_METHOD,R.string.config_default_input_method);
- loadStringSetting(stmt, Settings.Secure.ENABLED_INPUT_METHODS,R.string.def_enabled_input_methods);
+ //loadStringSetting(stmt, Settings.Secure.DEFAULT_INPUT_METHOD,R.string.config_default_input_method);
+ //loadStringSetting(stmt, Settings.Secure.ENABLED_INPUT_METHODS,R.string.def_enabled_input_methods);
//add end
/*
* IMPORTANT: Do not add any more upgrade steps here as the global,
@@ -2547,8 +2547,8 @@ class DatabaseHelper extends SQLiteOpenHelper {
//add begin
- loadStringSetting(stmt, Settings.Secure.DEFAULT_INPUT_METHOD,R.string.config_default_input_method);
- loadStringSetting(stmt, Settings.Secure.ENABLED_INPUT_METHODS,R.string.def_enabled_input_methods);
+ //loadStringSetting(stmt, Settings.Secure.DEFAULT_INPUT_METHOD,R.string.config_default_input_method);
+ //loadStringSetting(stmt, Settings.Secure.ENABLED_INPUT_METHODS,R.string.def_enabled_input_methods);
//add end
+++ b/frameworks/base/services/core/java/com/android/server/InputMethodManagerService.java
@@ -3084,7 +3084,7 @@ public class InputMethodManagerService extends IInputMethodManager.Stub
}
// TODO: The following code should find better place to live.
-/* if (!resetDefaultEnabledIme) {
+ if (!resetDefaultEnabledIme) {
boolean enabledImeFound = false;
final List<InputMethodInfo> enabledImes = mSettings.getEnabledInputMethodListLocked();
final int N = enabledImes.size();
@@ -3101,7 +3101,7 @@ public class InputMethodManagerService extends IInputMethodManager.Stub
resetSelectedInputMethodAndSubtypeLocked("");
}
}
-*/
+
郑重声明:本人原创博文,都是实战,均经过实际项目验证出货的
转载请标明出处:攻城狮2015
有需要可以加VX