1、旋转屏幕
第一种方案:
adb shell content insert --uri content://settings/system --bind name:s:user_rotation --bind value:i:3
其中最后 一个数字 为 0,1,2,3,用于控制旋转角度
第二种方案:
➜ test adb shell
nanopc-t4:/ $ wm rotation 90
nanopc-t4:/ $ wm rotation 270
nanopc-t4:/ $ wm rotation 90
nanopc-t4:/ $ wm rotation 0
2、返回按键
adb shell input keyevent 4
3、打开/关闭应用
打开应用:
adb shell am start com.android.settings/.HWSettings
关闭应用:
adb shell am force-stop com.android.settings
4、android7.1打开adb wifi
1.配置build.prop
# adb pull /system/build.prop
#添加
service.adb.tcp.port=5555
persist.service.adb.enable=1
重启Android设备即可.
2.连接设备
# adb connect 192.168.1.32:5555
5、edittext输入文本
adb shell input text 11111222222233333
6、清理数据
adb shell pm clear 包名
7、设置默认桌面
adb shell cmd package set-home-activity "baidu.robobus.my2/.MainActivity"
8、播放音乐
am start -n com.android.music/com.android.music.MediaPlaybackActivity -d /sdcard/Music/dongxi.mp3
9、查看运行时权限列表
adb shell pm list permissions -d -g
10、 查看设备CPU架构
adb shell getprop ro.product.cpu.abi
11、查看cpu、gpu温度
CPU温度:
adb shell cat /sys/class/thermal/thermal_zone0/temp
GPU温度:
adb shell cat /sys/class/thermal/thermal_zone1/temp
12、设置android系统时间
命令格式:date MMddHHmmyyyy.ss set
举例:
adb shell
date 100814192024.22 set
参考:https://www.cnblogs.com/tc310/p/10922464.html
13 UI相关
// 显示当前的window
adb shell dumpsys window | grep -E 'mCurrentFocus|mFocusedApp'