在自动化测试过程中,有时可能会需要调节Android设备屏幕亮度的场景时,可借助adb命令来实现
1. 获取亮度是否为自动调节
adb shell settings get system screen_brightness_mode
# 输出:0(未开启), 1(已开启)123
2. 修改设备亮度为自动调节/ 取消自动调节
# 关闭
adb shell settings put system screen_brightness_mode 0
# 开启
adb shell settings put system screen_brightness_mode 112345
3. 获取当前手机屏幕亮度值
adb shell settings get system screen_brightness
# 输出:'90\n'
# 1234
4. 设置当前手机屏幕亮度
adb shell settings put system screen_brightness xxxx
# 如设置为1000
adb shell settings put system screen_brightness 1000
领取专属 10元无门槛券
私享最新 技术干货