Android Shell控制手机
参考链接
开关飞行模式
settings put global airplane_mode_on 1; am broadcast -a android.intent.action.AIRPLANE_MODE --ez state true
settings put global airplane_mode_on 0; am broadcast -a android.intent.action.AIRPLANE_MODE --ez state false
开关移动数据
svc data enable
svc data disable
停止当前下载
am force-stop com.android.providers.downloads
pm clear com.android.providers.downloads
关闭某个 App
am force-stop com.xxx.yyy
重启系统界面
pkill -l TERM -f com.android.systemui
重启及重启到 recovery
svc power reboot
svc power reboot recovery
截图保存
screencap -p /sdcard/screengrab.jpg
打开 URL 地址
am start -a android.intent.action.VIEW -d http://www.google.com
开关 NFC
需要区分 Android 系统版本:
- Android 4.4 以上:
# Disable NFC
service call nfc 5
# Enable NFC
service call nfc 6
- Android 4.0.1 - Android 4.3.1:
# Disable NFC
service call nfc 4
# Enable NFC
service call nfc 5
- Android 2.3.4 - Android 2.3.7:
# Disable NFC
service call nfc 18
# Enable NFC
service call nfc 19
- Android 2.3.3:
# Disable NFC
service call nfc 20
# Enable NFC
service call nfc 21
- Android 2.3.2:
# Disable NFC
service call nfc 13
# Enable NFC
service call nfc 14
开关 GPS
settings put secure location_providers_allowed +gps
settings put secure location_providers_allowed -gps
开关网络定位
settings put secure location_providers_allowed +network
settings put secure location_providers_allowed -network
打开电源菜单
sendevent /dev/input/event0 1 116 108 && sendevent /dev/input/event0 0 0 0
显示窗口和 Activity
dumpsys window windows
dumpsys activity activities