1. 程式人生 > 其它 >ADB命令橫豎屏切換、關閉開啟wifi

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