【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

相关推荐
拭心8 小时前
Google 提供的 Android 端上大模型组件:MediaPipe LLM 介绍
android
带电的小王11 小时前
WhisperKit: Android 端测试 Whisper -- Android手机(Qualcomm GPU)部署音频大模型
android·智能手机·whisper·qualcomm
梦想平凡11 小时前
PHP 微信棋牌开发全解析:高级教程
android·数据库·oracle
元争栈道11 小时前
webview和H5来实现的android短视频(短剧)音视频播放依赖控件
android·音视频
阿甘知识库12 小时前
宝塔面板跨服务器数据同步教程:双机备份零停机
android·运维·服务器·备份·同步·宝塔面板·建站
元争栈道13 小时前
webview+H5来实现的android短视频(短剧)音视频播放依赖控件资源
android·音视频
MuYe13 小时前
Android Hook - 动态加载so库
android
居居飒14 小时前
Android学习(四)-Kotlin编程语言-for循环
android·学习·kotlin
Henry_He16 小时前
桌面列表小部件不能点击的问题分析
android
工程师老罗17 小时前
Android笔试面试题AI答之Android基础(1)
android