1. 程式人生 > >android預設的設定修改

android預設的設定修改

1.修改預設latinime輸入法地區設定:

packages/inputmethods/LatinIME/java/res/xml/method.xml

泰語:

    <subtype android:icon="@drawable/ic_ime_switcher_dark"
            android:label="@string/subtype_generic"
            android:subtypeId="0x1f94d5d4"
            android:imeSubtypeLocale="th"
            android:imeSubtypeMode="keyboard"
            android:imeSubtypeExtraValue="KeyboardLayoutSet=thai,EmojiCapable"
            android:isAsciiCapable="false"
    />

frameworks/base/packages/SettingsProvider/src/com/android/providers/settings/DatabaseHelper.java

+           loadSetting(stmt, Settings.Secure.DEFAULT_INPUT_METHOD, "com.android.inputmethod.latin/.LatinIME");
+           loadSetting(stmt, Settings.Secure.ENABLED_INPUT_METHODS,"com.android.inputmethod.latin/.LatinIME;529847764;-921088104");
+            loadSetting(stmt, Settings.Secure.SELECTED_INPUT_METHOD_SUBTYPE, "529847764");


// 俄語

   <subtype android:icon="@drawable/ic_ime_switcher_dark"
            android:label="@string/subtype_generic"
            android:subtypeId="0x763a8752"
            android:imeSubtypeLocale="ru"
            android:imeSubtypeMode="keyboard"
            android:imeSubtypeExtraValue="SupportTouchPositionCorrection,EmojiCapable"
            android:isAsciiCapable="false"
    />

frameworks/base/packages/SettingsProvider/src/com/android/providers/settings/DatabaseHelper.java

 +           loadSetting(stmt, Settings.Secure.DEFAULT_INPUT_METHOD, "com.android.inputmethod.latin/.LatinIME");
+           loadSetting(stmt, Settings.Secure.ENABLED_INPUT_METHODS,"com.android.inputmethod.latin/.LatinIME;1983547218;-921088104");
+            loadSetting(stmt, Settings.Secure.SELECTED_INPUT_METHOD_SUBTYPE, "1983547218"); 

2.修改wifi-direct名稱

frameworks/opt/net/wifi/service/java/com/android/server/wifi/p2p/WifiP2pServiceImpl.java

-            return "Android_" + id.substring(0,4);
-        }

+//            return "Android_" + id.substring(0,4);
+             return Settings.Global.getString(context.getContentResolver(), Settings.Global.DEVICE_NAME); /*samjiang loged*/
+       }

3.Android 7.1.2修改預設輸入法

packages/SettingsProvider/src/com/android/providers/settings/DatabaseHelper.java

+           loadStringSetting(stmt, Settings.Secure.DEFAULT_INPUT_METHOD,
+                       R.string.def_input_method);
+           loadStringSetting(stmt, Settings.Secure.ENABLED_INPUT_METHODS,
+                       R.string.def_enabled_input_methods);

packages/SettingsProvider/res/values/defaults.xml

+    <!--Setting default IME config-->
+    <string name="def_input_method" translatable="false">com.android.inputmethod.latin/.LatinIME</string>
+    <string name="def_enabled_input_methods" translatable="false">com.android.inputmethod.latin/.LatinIME</string>

4.修改預設字型大小

core/java/android/content/res/Configuration.java

     public void setToDefaults() {
-        fontScale = 1;
+        fontScale = 1;    /*samjiang loged*/
+       //fontScale = 1.15f;

5.新增不進入休眠的操作

private void updatePowerStateLocked() {

   +         if (SystemProperties.getBoolean("ro.platform.no.sleep", false))
    +        {
    +        Log.d(TAG,"system would not enter sleep!!!");
     +       }
      +      else
       +    {
        +    updateSuspendBlockerLocked();   //samjiang loged
       +    }