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
相关推荐
残影飞雪7 小时前
如何在 Debian 12 上安装 MySQL
mysql·adb·debian
纤瘦的鲸鱼2 天前
MySQL慢查询
android·adb
Anthony_2312 天前
MySQL的常用命令
运维·数据库·mysql·adb·docker
fatiaozhang95272 天前
中国移动云电脑一体机-创维LB2004_瑞芯微RK3566_2G+32G_开启ADB ROOT安卓固件-方法3
android·xml·adb·电脑·电视盒子·刷机固件
独行soc2 天前
2025年渗透测试面试题总结-60(题目+回答)
java·python·安全·web安全·adb·面试·渗透测试
·云扬·2 天前
MySQL 日志全解析:Binlog/Redo/Undo 等 5 类关键日志的配置、作用与最佳实践
android·mysql·adb
飞龙AI3 天前
adb devices 显示为空?USB Composite Device 异常问题
adb
TeleostNaCl4 天前
如何安装 Google 通用的驱动以便使用 ADB 和 Fastboot 调试(Bootloader)设备
android·经验分享·adb·android studio·android-studio·android runtime
练小杰5 天前
【Mysql-installer-community-8.0.26.0】Mysql 社区版(8.0.26.0) 在Window 系统的默认安装配置
数据库·sql·mysql·adb·配置文件·mysql安装·关系型数据库