【rk3229 android7.1.2 替换默认输入法】

问题平台描述

郑重声明:本人原创博文,都是实战,均经过实际项目验证出货的
转载请标明出处:攻城狮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

相关推荐
Winston Wood5 分钟前
Perfetto学习大全
android·性能优化·perfetto
Dnelic-3 小时前
【单元测试】【Android】JUnit 4 和 JUnit 5 的差异记录
android·junit·单元测试·android studio·自学笔记
Eastsea.Chen5 小时前
MTK Android12 user版本MtkLogger
android·framework
长亭外的少年13 小时前
Kotlin 编译失败问题及解决方案:从守护进程到 Gradle 配置
android·开发语言·kotlin
建群新人小猿15 小时前
会员等级经验问题
android·开发语言·前端·javascript·php
1024小神16 小时前
tauri2.0版本开发苹果ios和安卓android应用,环境搭建和最后编译为apk
android·ios·tauri
兰琛16 小时前
20241121 android中树结构列表(使用recyclerView实现)
android·gitee
Y多了个想法17 小时前
RK3568 android11 适配敦泰触摸屏 FocalTech-ft5526
android·rk3568·触摸屏·tp·敦泰·focaltech·ft5526
NotesChapter18 小时前
Android吸顶效果,并有着ViewPager左右切换
android
_祝你今天愉快19 小时前
分析android :The binary version of its metadata is 1.8.0, expected version is 1.5.
android