adb控制设备状态

屏幕设置

屏幕亮度

python 复制代码
# 当前屏幕亮度
adb shell settings get system screen_brightness

# 更改屏幕亮度
 adb shell settings put system screen_brightness

屏幕休眠时间

python 复制代码
# 当前屏幕休眠时间
adb shell settings get system screen_off_timeout

#更改屏幕休眠时间
adb shell settings put system screen_off_timeout 10000

蓝牙

获取蓝牙状态

python 复制代码
# 1是开,0是关
adb shell settings get global bluetooth_on

# enabled:true是开,enabled: false是关
adb shell dumpsys bluetooth_manager | findstr enabled

设置蓝牙状态

python 复制代码
# 开启蓝牙
adb shell settings put global bluetooth_on 1
# 关闭蓝牙
adb shell settings put global bluetooth_on 0

# 这个方法重启才会生效
adb shell svc bluetooth enable
adb shell svc bluetooth disable

# 出现弹窗,点击允许后开启蓝牙
adb shell am start -a android.bluetooth.adapter.action.REQUEST_ENABLE

# 进入蓝牙界面,根据实际再点击页面
adb shell am start -a android.settings.BLUETOOTH_SETTINGS

# 调用appium的广播,会出现弹窗需点击
adb shell am broadcast -a io.appium.settings.bluetooth --es setstatus enable

WiFi和热点

获取网络状态

python 复制代码
# windows系统用findstr,linux系统用grep
adb shell ps | findstr wifi
python 复制代码
# 有wpa_supplicant就表示wifi开启,有hostapd就表示热点开启
wifi            626      1   13992   3280 0                   0 S android.hardware.wifi@1.0-service
wifi           1016      1   15264   2944 0                   0 S wificond
wifi           4961      1   23880   7944 0                   0 S wpa_supplicant
wifi           5027      1   13384   4936 0                   0 S hostapd

设置WiFi状态

python 复制代码
# 打开WiFi
adb shell svc wifi enable  

#关闭WiFi
adb shell svc wifi disable  

设置热点状态

python 复制代码
# 进入热点界面,根据实际再点击页面
adb shell am start -n com.android.settings/.TetherSettings
相关推荐
川石课堂软件测试15 小时前
涨薪技术|Kubernetes(k8s)之Service服务
功能测试·adb·docker·云原生·容器·kubernetes·单元测试
马剑威(威哥爱编程)2 天前
C语言操作MySQL从入门到精通
c语言·mysql·adb
笑远2 天前
MySQL 主主复制与 Redis 环境安装部署
redis·mysql·adb
m0_748257184 天前
MySQL root用户密码忘记怎么办(Reset root account password)
数据库·mysql·adb
m0_748236835 天前
Linux系统离线部署MySQL详细教程(带每步骤图文教程)
linux·mysql·adb
@孤随5 天前
《MySQL三大核心日志解析:Undo Log/Redo Log/Bin Log对比与实践指南》
android·mysql·adb
ekskef_sef6 天前
Linux下MySQL的简单使用
linux·mysql·adb
峥嵘life7 天前
Android14 串口控制是能wifi adb实现简介
android·adb
杨俊杰-YJ7 天前
一、MySQL备份恢复
android·mysql·adb
m0_672656547 天前
万字详解 MySQL MGR 高可用集群搭建
android·mysql·adb