当前位置: 代码迷 >> 综合 >> android9.0设置默认输入法
  详细解决方案

android9.0设置默认输入法

热度:56   发布时间:2023-12-15 13:50:56

1、设置默认输入法

amlogic_t972/frameworks/base/services$ git diff core/java/com/android/server/InputMethodManagerService.java
diff --git a/services/core/java/com/android/server/InputMethodManagerService.java b/services/core/java/com/android/server/InputMethodManagerService.java
old mode 100644
new mode 100755
index 19170f8ff5b..84bb5e02c39
--- a/services/core/java/com/android/server/InputMethodManagerService.java
+++ b/services/core/java/com/android/server/InputMethodManagerService.java
@@ -3751,6 +3751,9 @@ public class InputMethodManagerService extends IInputMethodManager.Stub// TODO: Make sure that mSwitchingController and mSettings are sharing the// the same enabled IMEs list.mSwitchingController.resetCircularListLocked(mContext);
+               
+               Settings.Secure.putString(mContext.getContentResolver(),
+        Settings.Secure.DEFAULT_INPUT_METHOD, "com.sohu.inputmethod.sogou/.SogouIME");}

2、利用mk文件编译输入法
Android.mk

LOCAL_PATH := $(call my-dir)
################################true fasle#######################################
OWA_APKS_SogouInputIME:= true
#############################SogouInputIME######################################
ifeq ($(OWA_APKS_SogouInputIME), true) 
include $(CLEAR_VARS)
LOCAL_MODULE := SogouInputIME
LOCAL_MODULE_TAGS := optional
LOCAL_SRC_FILES := apk/SogouInputIME.apk
LOCAL_MODULE_CLASS := APPS
LOCAL_MODULE_SUFFIX := $(COMMON_ANDROID_PACKAGE_SUFFIX)
LOCAL_MULTILIB :=32
LOCAL_CERTIFICATE := PRESIGNED
include $(BUILD_PREBUILT)
endif

apk文件夹放SogouInputIME.apk
在这里插入图片描述
3、加入编译amlogic_t972\device\amlogic\x301\x301.mk

+PRODUCT_PACKAGES += SogouInputIME