ADB命令横竖屏切换、关闭打开wifi

禁用自动旋转
adb shell content insert --uri content://settings/system --bind name:s:accelerometer_rotation --bind value:i:0

旋转屏幕
adb shell content insert --uri content://settings/system --bind name:s:user_rotation --bind value:i:1
i后面跟的不同的值代表旋转为不同的方向,取值范围为0,1,2,3

#!bin/bash
i=0
adb shell content insert --uri content://settings/system --bind name:s:accelerometer_rotation --bind value:i:0
while [ "$i" -lt 100 ]; do
echo "$i"
adb  shell content insert --uri content://settings/system --bind name:s:user_rotation --bind value:i:1
sleep 0.5
adb  shell content insert --uri content://settings/system --bind name:s:user_rotation --bind value:i:0
i=$(($i+1))
sleep 0.5
done

 

ADB命令关闭打开wifi

#!bin/bash

#开关wifi次数验证
i=1
while true
do
adb shell svc wifi disable
sleep 1
adb shell svc wifi enable
sleep 1
echo "开关次数" $i
((i=$i+1))

done

或者

#!bin/bash

i=1
while true
do
adb shell < open-wifi.txt
echo "开关次数" $i
((i=$i+1))
done

#open-wifi.txt文档写

su
svc wifi disable
sleep 5
svc wifi enable
sleep 5

posted @ 2021-08-25 11:49  勇~勇  阅读(2466)  评论(0编辑  收藏  举报