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
相关推荐
·云扬·9 小时前
MySQL单机多实例部署两种实用方法详解
数据库·mysql·adb
墨瑾轩10 小时前
MySQL索引创建不锁表:90%的DBA都踩过的3个坑!
mysql·adb·dba
kabcko14 小时前
CentOS安装Mysql
mysql·adb·centos
Antoine-zxt15 小时前
MySQL宕机日志迷局破解指南:从前台启动到精准排错
数据库·mysql·adb
大海绵啤酒肚16 小时前
WordPress部署新玩法:利用NFS存储在Kubernetes中实现数据持久化
adb·容器·kubernetes
wadesir17 小时前
Linux MySQL Sysbench一键部署与压测实战教程
linux·mysql·adb
Rainman博17 小时前
修改adb shell下$前的提示名称
adb
oMcLin2 天前
如何在 RHEL 8 系统上实现高可用 MySQL 集群,保障电商平台的 24 小时稳定运行
android·mysql·adb
·云扬·2 天前
MySQL Group Replication(MGR)集群部署实战:基于InnoDB Cluster与MySQL Router
数据库·mysql·adb
液态不合群2 天前
读写分离面临的问题及其解决方案
android·adb