ADB 命令

2018-11-30  本文已影响0人  zsg555666

1、查看MAC地址:adb shell cat /sys/class/net/wlan0/address
2、CPU信息:adb shell cat /proc/cpuinfo
3、查看wifi密码:adb shell cat /data/misc/wifi/*.conf
4、通过wifi连接adb: adb connect 172.27.96.5:5555

5、恢复出厂设置:adb shell am broadcast -a android.intent.action.MASTER_CLEAR
需要先adb root
android 8.0版本后改为:adb shell am broadcast -a android.intent.action.FACTORY_RESET android

adb源码分析: https://blog.csdn.net/viewsky11/article/details/53889143

6、关机: adb shell reboot -p

7、端口转发:adb forward tcp:1150 tcp:1160


image.png

8、adb授权过程:

9、通过包名查看apk文件的位置:adb shell pm path com.zsg.launcher
输出:package:/system/app/Launcher.apk

10、状态栏、导航栏控制

11、获取当前设备支持的features。Get Android System Available Features

adb shell pm list features:

feature:android.hardware.nfc
feature:android.hardware.nfc.any
feature:android.hardware.nfc.hce
feature:android.hardware.nfc.hcef
feature:android.hardware.bluetooth_le
feature:android.hardware.camera
feature:android.hardware.camera.any
feature:android.hardware.camera.front
feature:android.hardware.faketouch
feature:android.hardware.location
feature:android.hardware.location.network
feature:android.hardware.microphone
feature:android.hardware.sensor.light
feature:android.hardware.sensor.proximity
feature:android.hardware.sensor.stepcounter
feature:android.hardware.sensor.stepdetector
feature:android.hardware.touchscreen
feature:android.hardware.usb.accessory
feature:android.hardware.usb.host
feature:android.hardware.wifi
feature:android.hardware.wifi.direct
feature:android.software.activities_on_secondary_displays
feature:android.software.adoptable_storage
feature:android.software.app_widgets
feature:android.software.autofill
feature:android.software.backup
feature:android.software.cts
feature:android.software.device_id_attestation
feature:android.software.webview
//使用系统接口获取:
FeatureInfo[] features = getPackageManager().getSystemAvailableFeatures();

boolean b = getPackageManager().hasSystemFeature(featureName)
boolean hasCamera = pm.hsaSystemFeature(PackageManager.FEATURE_CAMERA); //是否支持相机
boolean b = getPackageManager().hasSystemFeature(PackageManager.FEATURE_WATCH)
上一篇 下一篇

猜你喜欢

热点阅读