美文网首页
ADB 命令

ADB 命令

作者: zsg555666 | 来源:发表于2018-11-30 12:23 被阅读0次

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授权过程:

  • 执行adb shell后,adb.exe会将当前PC的公钥(或者公钥的hash值之类的fingerprint)发送给android设备,公钥保存在~/.android/目录中的adbkey与adbkey.pub
  • 如果android已经保存了PC的公钥,则能成功匹配,进行认证,建立adb连接
  • 如果android没有保存PC的公钥,则弹出提示框提示是否允许这台机器进行adb连接,当点击了允许授权之后,android就会保存这台PC的adbkey.pub公钥,目录为/data/misc/adb/adb_keys

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

10、状态栏、导航栏控制

  • 全隐藏:adb shell settings put global policy_control immersive.full=*
  • 隐藏状态栏:adb shell settings put global policy_control immersive.status=*
  • 隐藏导航栏:adb shell settings put global policy_control immersive.navigation=*
  • 单独控制app不隐藏,设置com.zsg.test不隐藏,其他程序隐藏:
    adb shell settings put global policy_control immersive.full=apps,-com.zsg.test
  • 恢复正常模式:adb shell settings put global policy_control null

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)

相关文章

  • adb命令大全

    adb命令与adb shell命令的区别? adb命令是PC端adb程序自带的命令 adb shell 命令是调用...

  • adb与adb shell命令使用

    adb命令与adb shell命令的区别?adb命令是PC端adb程序自带的命令adb shell 命令是调用An...

  • ADB常用命令总结

    总结一下常用的adb命令和adb shell 命令,adb 命令是 adb 这个程序自带的一些命令,而 adb s...

  • adb、emulator、android指令

    adb命令大全adb命令pm工具讲解 adb 指令 常用 安装:adb install [文件路径] 卸载:adb...

  • Android-adb-常用命令

    一.介绍 二.adb命令 三.adb shell命令(输入adb shell进入Linux命令环境,以下命令省略a...

  • adb命令 - adb forward交互流程

    adb命令 - adb forward交互流程 命令:adb forward tcp:6100 tcp:7100 ...

  • Android adb 使用详解(一)

    adb 源码 adb 命令 以下命令需要指定手机时, 添加-s [deviceNAme] 参数 基本命令 adb ...

  • adb shell logcat 命令

    adb shell logcat 命令 Tags: adb_shell adb shell logcat命令映射为...

  • ADB常用指令

    adb devices adb remount 录制屏幕之screenrecord命令 命令格式: adb she...

  • android 常用命令

    1、adb命令 命令含义adb connect ip:5555adb远程连接adb install apk安装ap...

网友评论

      本文标题:ADB 命令

      本文链接:https://www.haomeiwen.com/subject/tszccqtx.html