Skip to content

系统设置

rev1si0n edited this page Oct 1, 2023 · 1 revision

该功能用于设置/读取安卓系统设置,你可以通过此功能设置屏幕亮度,开关开发者模式等功能。

settings = d.stub("Settings")

# 如果你对以下 screen_brightness 等字符串表示疑惑,请查看下列文档。有些常量
# 在不同版本的安卓可能并不兼容,以及部分厂商会有自定义的变量,需要注意。

# https://developer.android.com/reference/android/provider/Settings.System
# https://developer.android.com/reference/android/provider/Settings.Secure
# https://developer.android.com/reference/android/provider/Settings.Global

# 你可以使用如下代码将系统屏幕的亮度设置为手动
settings.put_system("screen_brightness_mode", "0")

# 示例:获取并修改屏幕亮度为 5 (0-255)
settings.get_system("screen_brightness")
settings.put_system("screen_brightness", "5")

# 示例:关闭开发者选项
settings.get_global("development_settings_enabled")
settings.put_global("development_settings_enabled", "0")

# 示例
settings.get_secure("screensaver_enabled")
settings.put_secure("screensaver_enabled", "0)
Clone this wiki locally