[RK3399] [안드로이드7.1.1] 안드로이드-> 입력법: 기본 입력법 및 입력법 관련 설정

20970 단어 Android
테스트 플랫폼
Platform: RK3399 OS: Android 7.1.1
요구 사항
  • 항상 플로피 키보드
  • 기본 입력법 설정
  • 솔루션
    1. 항상 플로피 키보드를 꺼냅니다. 시스템은 기본적으로 물리적 키보드를 연결할 때 가상 키보드가 꺼지지 않습니다.
    diff --git a/frameworks/base/packages/SettingsProvider/res/values/defaults.xml b/frameworks/base/packages/SettingsProvider/res/values/defaults.xml
    index 08570fe..141825a 100644
    --- a/frameworks/base/packages/SettingsProvider/res/values/defaults.xml
    +++ b/frameworks/base/packages/SettingsProvider/res/values/defaults.xml
    @@ -159,7 +159,7 @@
         <!-- Default for Settings.Secure.MULTI_PRESS_TIMEOUT -->
         <integer name="def_multi_press_timeout_millis">300</integer>
     
    -    <!-- Default for Settings.Secure.SHOW_IME_WITH_HARD_KEYBOARD -->
    +    <!-- x Default for Settings.Secure.SHOW_IME_WITH_HARD_KEYBOARD -->
         <bool name="def_show_ime_with_hard_keyboard">true</bool>
     
         <!-- Default for Settings.System.POINTER_SPEED -->
    diff --git a/frameworks/base/packages/SettingsProvider/src/com/android/providers/settings/DatabaseHelper.java b/frameworks/base/packages/SettingsProvider/src/com/android/providers/settings/DatabaseHelper.java
    index 20b95b9..25225ab 100644
    --- a/frameworks/base/packages/SettingsProvider/src/com/android/providers/settings/DatabaseHelper.java
    +++ b/frameworks/base/packages/SettingsProvider/src/com/android/providers/settings/DatabaseHelper.java
    @@ -2454,6 +2454,9 @@ class DatabaseHelper extends SQLiteOpenHelper {
        private void loadSecureSettings(SQLiteDatabase db) {
            SQLiteStatement stmt = null;
            try {
                stmt = db.compileStatement("INSERT OR IGNORE INTO secure(name,value)"
                        + " VALUES(?,?);");
     
    +            loadBooleanSetting(stmt, Settings.Secure.def_show_ime_with_hard_keyboard,
    +                    R.bool.def_show_ime_with_hard_keyboard);
    +            
                 loadStringSetting(stmt, Settings.Secure.LOCATION_PROVIDERS_ALLOWED,
                         R.string.def_location_providers_allowed);
    
    

    2. 기본 입력기 설정
    기본 입력법을 설정하려면 먼저 기계에 해당하는 입력법을 설치하고 기본값으로 설정한 다음adb에 연결하여 아래 명령을 입력하십시오
    $ adb shell settings get secure enabled_input_methods
    com.android.inputmethod.latin/.LatinIME:com.iflytek.inputmethod.google/com.iflytek.inputmethod.FlyIME:com.google.android.inputmethod.pinyin/.PinyinIME
    $ adb shell settings get secure default_input_method
    com.iflytek.inputmethod.google/com.iflytek.inputmethod.FlyIME
    

    활성화된 입력법과 기본 입력법을 가져오고SettingProvider에 다음 코드를 추가합니다
    diff --git a/frameworks/base/packages/SettingsProvider/res/values/custom_defaults.xml b/frameworks/base/packages/SettingsProvider/res/values/custom_defaults.xml
    index a2e0012..88d7fba 100644
    --- a/frameworks/base/packages/SettingsProvider/res/values/custom_defaults.xml
    +++ b/frameworks/base/packages/SettingsProvider/res/values/custom_defaults.xml
    @@ -7,4 +7,8 @@
     
         <!--if true while show rotation in SystenUI and Settings-DisplaySettings -->
         <bool name="def_enable_rotation_by_user">true</bool>
    +
    +    <string name="enabled_input_methods" translatable="false">com.android.inputmethod.latin/.LatinIME:com.iflytek.inputmethod.google/com.iflytek.inputmethod.FlyIME:com.google.android.inputmethod.pinyin/.PinyinIME</string>
    +
    +    <string name="def_input_method" translatable="false">com.iflytek.inputmethod.google/com.iflytek.inputmethod.FlyIME</string>
     </resources>
    
    diff --git a/frameworks/base/packages/SettingsProvider/src/com/android/providers/settings/DatabaseHelper.java b/frameworks/base/packages/SettingsProvider/src/com/android/providers/settings/DatabaseHelper.java
    index 20b95b9..25225ab 100644
    --- a/frameworks/base/packages/SettingsProvider/src/com/android/providers/settings/DatabaseHelper.java
    +++ b/frameworks/base/packages/SettingsProvider/src/com/android/providers/settings/DatabaseHelper.java
    @@ -2454,6 +2454,9 @@ class DatabaseHelper extends SQLiteOpenHelper {
        private void loadSecureSettings(SQLiteDatabase db) {
            SQLiteStatement stmt = null;
            try {
                stmt = db.compileStatement("INSERT OR IGNORE INTO secure(name,value)"
                        + " VALUES(?,?);");
     
    +            loadStringSetting(stmt, Settings.Secure.ENABLED_INPUT_METHODS,
    +                    R.string.enabled_input_methods);
    +            loadStringSetting(stmt, Settings.Secure.DEFAULT_INPUT_METHOD,
    +                    R.string.def_input_method);
    
    
                 loadStringSetting(stmt, Settings.Secure.LOCATION_PROVIDERS_ALLOWED,
                         R.string.def_location_providers_allowed);
    
    

    좋은 웹페이지 즐겨찾기