• 首先要确认是否有默认值:
    在reboot(重启)之后开关状态仍旧保存或者是在reset(恢复出厂设置)之后开关状态恢复到默认的,才能找到默认值

    • /frameworks/base/packages/SettingsProvider/src/com/android/providers/settings/DatabaseHelper.java
      该文件中对状态值进行存储
    • /frameworks/base/packages/SettingsProvider/res/values/defaults.xml
      定义了开关状态的默认值
    • /frameworks/base/core/java/android/provider/Settings.java
      定义了各开关状态默认值存储时对应的key
  • 关闭所有系统提示音
    frameworks/base/packages/SettingsProvider/res/values/defaults.xml:

    <integer name="def_lockscreen_sounds_enabled">0</integer>
    <!-- Default for UI touch sounds enabled -->
    <bool name="def_sound_effects_enabled">false</bool>
    <!-- Default for DTMF tones enabled -->
    <bool name="def_dtmf_tones_enabled">true</bool>
    <integer name="def_power_sounds_enabled">0</integer>
  • 禁止锁屏:
    https://intgyl.com/post/5df7c306.html
    frameworks/base/packages/SettingsProvider/res/values/defaults.xml:

    <bool name="def_lockscreen_disabled">true</bool>
  • 隐藏状态栏:
    frameworks/base/packages/SettingsProvider/res/values/custom_defaults.xml:

  • 关闭自动同步时间:
    frameworks/base/packages/SettingsProvider/res/values/defaults.xml
    <bool name="def_auto_time">false</bool>
    <bool name="def_auto_time_zone">false</bool>
  • 虚拟键盘与实体键盘共存:
    设置->语言和输入法->实体键盘->显示虚拟键盘(打开), 改为true
    /frameworks/base/packages/SettingsProvider/res/values/defaults.xml:
    <!-- Default for Settings.Secure.SHOW_IME_WITH_HARD_KEYBOARD -->
    <bool name="def_show_ime_with_hard_keyboard">false</bool>
  • 默认亮度:
    frameworks\base\packages\SettingsProvider\res\values\defaults.xml:
    <integer name="def_screen_brightness">102</integer>
    <integer name="def_screen_off_timeout"> 60000</integer>
    <integer name="def_sleep_timeout">-1</integer>