当前位置:   article > 正文

adb shell settings(系统服务:settings)

adb shell settings

1 需求 

Settings.System 

Settings.Secure

Settings.Global 

  • global表
    • 开发者选项(Developer options)
      • adb shell settings get global development_settings_enabled
    • USB调试(USB debugging)
    • adb
      • adb shell settings get global adb_enabled
    • 飞行模式(Airplane mode)
      • adb shell settings get global airplane_mode_on
    • 数据开关
      • adb shell settings get global mobile_data
      • adb shell settings get global mobile_data1
    • Wi-Fi开关状态
      • adb shell settings get global wifi_on 0关1开
    • 蓝牙开关
      • adb shell settings get global bluetooth_on 0关1开
    • 开机向导完成
      • adb shell settings get global device_provisioned
  • system表
    • 自动息屏(Screen timeout)
      • adb shell settings get system screen_off_timeout
    • 自动调整屏幕亮度
      • adb shell settings get system screen_brightness_mode
    • 屏幕亮度(Brightness level)
      • adb shell settings get system screen_brightness
    • 屏幕自动翻转()
      • adb shell settings get system accelerometer_rotation
  • secure表
    • 位置信息
    • 获取android id
    • GPP默认值
    • 开机向导完成
      • adb shell settings get secure user_setup_complete

2 语法

  1. C:\>adb shell settings help
  2. Settings provider (settings) commands:
  3. help
  4. Print this help text.
  5. get [--user <USER_ID> | current] NAMESPACE KEY
  6. Retrieve the current value of KEY.
  7. put [--user <USER_ID> | current] NAMESPACE KEY VALUE [TAG] [default]
  8. Change the contents of KEY to VALUE.
  9. TAG to associate with the setting.
  10. {default} to set as the default, case-insensitive only for global/secure namespace
  11. delete [--user <USER_ID> | current] NAMESPACE KEY
  12. Delete the entry for KEY.
  13. reset [--user <USER_ID> | current] NAMESPACE {PACKAGE_NAME | RESET_MODE}
  14. Reset the global/secure table for a package with mode.
  15. RESET_MODE is one of {untrusted_defaults, untrusted_clear, trusted_defaults}, case-insensitive
  16. list [--user <USER_ID> | current] NAMESPACE
  17. Print all defined keys.
  18. NAMESPACE is one of {system, secure, global}, case-insensitive

3.X 示例:Developer options

adb shell settings get global development_settings_enabled


3.X 示例:USB调试

获取USB调试状态

adb shell settings get global adb_enabled

开启 USB调试

adb shell settings put global adb_enabled 1

关闭 USB调试

adb shell settings put global adb_enabled 0


3.X 示例:飞行模式 设置

方法一:

查看飞行模式状态

adb shell settings get global airplane_mode_on

打开飞行模式

adb shell settings put global airplane_mode_on 1

关闭飞行模式

adb shell settings put global airplane_mode_on 0

方法二:

adb shell am broadcast -a android.intent.action.AIRPLANE_MODE --ez state true/false

参考资料:

如何通过adb打开和关闭飞行模式_丨一念丨的博客-CSDN博客_adb 飞行模式


3.X 示例:自动息屏 设置(2147483647

获取当前息屏时间

adb shell settings get system screen_off_timeout

修改自动息屏时间

adb shell settings put system screen_off_timeout 2147483647


3.X 屏幕自动调整亮度

查询 自动调整亮度 状态

adb shell settings get system screen_brightness_mode

开启 自动调整亮度

adb shell settings put system screen_brightness_mode 1

关闭 自动调整亮度

adb shell settings put system screen_brightness_mode 0


3.X 屏幕亮度 设置(0-255)

查询 当前 屏幕亮度值

adb shell settings get system screen_brightness

设置 屏幕亮度值

adb shell settings put system screen_brightness 255


3.X 屏幕旋转

查看 屏幕旋转 当前状态

adb shell settings get system accelerometer_rotation

启动 自动旋转

adb shell settings put system accelerometer_rotation 1

关闭 自动旋转

adb shell settings put system accelerometer_rotation 0


3.X 示例:位置信息

打开 位置信息 设置页面

adb shell am start -a android.settings.LOCATION_SOURCE_SETTINGS

查看定位状态

adb shell settings get secure location_providers_allowed

开启定位

adb shell settings put secure location_providers_allowed +gps

adb shell settings put secure location_providers_allowed +network

关闭定位

adb shell settings put secure location_providers_allowed -gps

adb shell settings put secure location_providers_allowed -network


3.X 示例:获取android_id

adb shell settings get secure android_id


3.X 示例:获取GPP默认值

1111


3.X 示例:开机向导完成

adb shell settings get secure user_setup_complete


4 参考资料

Settings.System  |  Android Developers 

Settings.Secure  |  Android Developers 

Settings.Global  |  Android Developers

adb 命令打开系统设置界面_WCanTouch的博客-CSDN博客_adb 打开设置

Android程序获取adb状态,adb 控制手机开关/获取手机状态常用命令_风迭的博客-CSDN博客

adb操作系统开关命令_鱼啊鱼啊鱼啊的博客-CSDN博客_adb 锁屏命令

adb 操控系统命令开关:WIFI,GPS,蓝牙等_一地灬i毛的博客-CSDN博客_adb 打开gps



声明:本文内容由网友自发贡献,不代表【wpsshop博客】立场,版权归原作者所有,本站不承担相应法律责任。如您发现有侵权的内容,请联系我们。转载请注明出处:https://www.wpsshop.cn/w/笔触狂放9/article/detail/323518
推荐阅读
相关标签
  

闽ICP备14008679号