ADB命令ING

http://www.cnblogs.com/pixy/p/4739040.html
http://www.cnblogs.com/pixy/p/4741532.html

adb kill-server
adb start-server
adb remount // 挂载
adb reboot // 重启
adb devices
adb logact -s “Camera3” // 查看tag为Camera3的Log信息
adb logact -> D:/test.txt // 把log信息传输到D:/test.txt 文件
adb logact | grep “Camera_JNI” // 查看log并过滤出含有Camera_JNI的Log信息
adb install -r D:/FmRadio.apk
adb install 错误描述
这里写图片描述

adb push D:/libmedia.so /system/lib // 把本地的D盘文件拷贝到安卓系统的 /system/lib 目录下 并赋权限644
chmod 644 /system/lib/libmedia.so

adb pull /system/lib/libmedia.so // 拉取 libmedia.so 到本地
adb shell getprop // 查看系统配置属性
adb shell service list //查询系统提供的服务 ps -A | grep servicemanager

adb shell  service list      // 查看系统提供的服务 这些服务都运行在 servicemanager进程中
62      wifip2p: [android.net.wifi.p2p.IWifiP2pManager]
63      wifiscanner: [android.net.wifi.IWifiScanner]
64      wifi: [android.net.wifi.IWifiManager]
138     wificond: []

IWifiManager wifiMgr = IWifiManager.Stub.asInterface(ServiceManager.getService(Context.WIFI_SERVICE));

ps -A | grep servicemanager         // 系统提供的服务都运行在这个进程中
USER           PID  PPID     VSZ    RSS WCHAN            ADDR S NAME
system         660     1   11612   2916 0                   0 S servicemanager

adb shell setprop // 设置宏

adb shell screenrecord /sdcard/demo.mp4 // 录制屏幕视频
adb shell dumpsys activity // 查看任务堆栈
adb shell dumpsys activity top // 能查看当前的 View Hierarchy 信息 Framgment信息
adb shell setprop ctl.start bootanim //查看启动动画
adb shell pm list packages -f ##输出所有已经安装的应用

adb shell pm list packages -3 ##查看系统预先安装的应用

adb shell screencap -p > screen.png // for linux 在本地捕获截屏
adb shell screencap -p | sed ‘s/\r$//’ > screen.png // for window 截图直接保存到电脑

adb shell netcfg // 查看手机当前网络情况

C:\Users\aaa>adb shell netcfg
ccmni1   DOWN                                   0.0.0.0/0   0x00000080 46:dd:73:53:c2:75
ccmni0   DOWN                                   0.0.0.0/0   0x00000080 7a:3b:dc:93:07:1c
ccmni2   DOWN                                   0.0.0.0/0   0x00000080 d6:d6:0b:ca:5f:2f
wlan0    UP                              192.168.31.238/24  0x00001043 64:cc:2e:de:40:c6
tunl0    DOWN                                   0.0.0.0/0   0x00000080 00:00:00:00:00:00
sit0     DOWN                                   0.0.0.0/0   0x00000080 00:00:00:00:00:00
p2p0     UP                                     0.0.0.0/0   0x00001003 66:cc:2e:de:40:c6
ifb1     DOWN                                   0.0.0.0/0   0x00000082 4e:93:7a:66:79:eb
ifb0     DOWN                                   0.0.0.0/0   0x00000082 96:62:37:8e:2c:69
lo       UP                                   127.0.0.1/8   0x00000049 00:00:00:00:00:00
ip6tnl0  DOWN                                   0.0.0.0/0   0x00000080 00:00:00:00:00:00
usbnet0  DOWN                                 10.0.2.15/24  0x00001002 1e:5e:3f:4c:ec:8f

//会有从开机之后详细的dumpsys,dumpstate和logcat信息,是一份完整的日志记录
adb bugreport // 期间完成测试 在完成进度100%会在 手机存储一个 bugreport_XXX_xxx.zip 文件

adb shell dumpsys cpuinfo //显示CPU使用信息
adb shell dumpsys activity //显示所有的activities的信息 能查看栈顶Activity
adb shell dumpsys window //显示键盘,窗口和它们的关系 能查看到当前获得焦点的窗口对象
adb shell dumpsys window | grep mCurrentFocus // 查看焦点窗口
adb shell dumpsys wifi //显示wifi信息 显示 wifi扫描状态相关信息
adb shell dumpsys meminfo // 查看内存使用情况
adb shell dumpsys meminfo surfaceflinger // 查看surfaceflinger进程内存使用情况
adb shell dumpsys battery // 查看电池信息

adb shell top -m 5 -t //按占用cpu大小列出5个进程列表

这个实践和上面的脚本类似,只是命令不一样我另外单独列出来,因为这个有时候很有用。
比如,我们要采集com.tianxia.test的内存使用情况,分析它是不是会内存泄露,脚步类似:

# !/system/bin/sh
#这个脚步比较粗糙,是这么个意思
file=/sdcard/cpu/mem_info.log
rm $file
until [ 1 -gt 10000 ]
do
echo -e "\n\n\n\n\n---------------">>$file
date >> $file
dumpsys meminfo com.tianxia.test >> $file
sleep 3
done

adb shell pm list packages -3 // 查看第三方应用

adb jdwp  显示有效地jdwp (java debug wire protocol) 进程

如果通过usb链接Android设备,通过adb devices 可以看见设备列表,但是使用不了,可以参考下面的命令
adb tcpip 5555
adb connect 192.168.0.101:5555

adb shell pm list permission-groups // 查看权限组合

adb shell pm path com.UCMobile // 查看包的apk路径 package:/data/app/com.UCMobile-1/base.apk

adb shell pm get-install-location  返回当前默认安装位置
  返回值:
    0  auto
    1  内部存储
    2  外部存储

adb shell pm set-install-location 0|1|2 修改默认安装位置

发送广播

adb shell am broadcast -a com.Android.test --es<string> test_string "this is test string" —ei<int> test_int 100 —ez<boolean> test_boolean true

adb shell am broadcast -a "Android.net.wifi.WIFI_STATE_CHANGED"  --ei "wifi_state" 0
adb shell am broadcast -a "Android.net.wifi.WIFI_STATE_CHANGED"  --ei "wifi_state" 1 
adb shell am broadcast -a "Android.net.wifi.WIFI_STATE_CHANGED"  --ei "wifi_state" 2 
adb shell am broadcast -a "Android.net.wifi.WIFI_STATE_CHANGED"  --ei "wifi_state" 3 
adb shell am broadcast -a "Android.net.wifi.WIFI_STATE_CHANGED"  --ei "wifi_state" 4 
 WifiManager.WIFI_STATE_DISABLED ==1
 WifiManager.WIFI_STATE_DISABLING ==0
 WifiManager. WIFI_STATE_ENABLED==3
 WifiManager. WIFI_STATE_ENABLING==2
 WifiManager. WIFI_STATE_UNKNOWN==4

adb devices // 一台电脑连接两手机时 分别 adb shell
List of devices attached
emulator-5554 device
SH0A6PL00243 device

adb -s emulator-5554 shell
adb -s SH0A6PL00243 shell

adb shell wm density 查看屏幕物理分辨率dpi

adb shell settings get global airplane_mode_on 获得飞行模式开关值
adb shell settings put global airplane_mode_on 0 // 设置飞行模式关闭
adb shell settings put global airplane_mode_on 1 // 设置飞行模式打开
adb shell svc wifi disable //关闭wifi
adb shell svc wifi enable //打开wifi
adb shell input keyevent KEYCODE_POWER // 模拟点击电源键
adb shell input keyevent 20 // KEYCODE_DPAD_LEFT
adb shell dumpsys input // 输入事件

adb shell pm list permissions // 权限列表

adb shell content query --uri content://media/internal/images/media // 查看image数据库
adb shell content query --uri content://media/internal/video/media // 查看video数据库
adb shell content query --uri content://media/internal/audio/media // 查看audio数据库
adb shell content query --uri content://media/internal/files // 查看文件系统数据库

adb shell iwpriv wlan0 version // root 权限下 查看固件版本
wlan0 version:Host SW:5.1.1.28U, FW:1.0.1.350.0, HW:HW_VERSION=40050000.

adb shell dumpsys netstats detail // 网络情况详细信息

adb shell dumpsys procstats --hours 3 // 最近三小时 进程情况

adb shell dumpsys battery unplug

adb shell dumpsys SurfaceFlinger --latency // 画面合成帧服务状态

adb shell dumpsys gfxinfo // 画面信息

adb shell dumpsys sensorservice enable // 传感器感应器

adb shell dumpsys wifi ipmanager // WIFI配置相关信息
adb shell getprop ro.hardware // 获取处理器信息
adb shell tcpdump // 获取 tcp Log

adb shell dumpsys activity---------------查看ActvityManagerService 所有信息
adb shell dumpsys activity activities----------查看Activity组件信息
adb shell dumpsys activity services-----------查看Service组件信息
adb shell dumpsys activity providers----------产看ContentProvider组件信息
adb shell dumpsys activity broadcasts--------查看BraodcastReceiver信息
adb shell dumpsys activity intents--------------查看Intent信息
adb shell dumpsys activity processes---------查看进程信息
adb shell dumpsys activity provider com.android.settings

adb shell dumpsys media.camera // 查看camera的信息

dumpsys media.camera
Camera module HAL API version: 0x100
Camera module API version: 0x203
Camera module name: MediaTek Camera Module
Camera module author: MediaTek
Number of camera devices: 2

Vendor tags left unimplemented.
Camera 0 static information:
  Facing: BACK
  Orientation: 90
  Device version: 0x100
  Device is open. Client instance dump:
Client[0] (0xab84d238) PID: 28843
Latest set parameters:
CameraParameters::dump: mMap.size = 192
        3dnr-mode: on
        3dnr-mode-values: on,off
        afeng-max-focus-step: 1023
        afeng-min-focus-step: 0
        aflamp-mode: off
        aflamp-mode-values: off,on,auto
        antibanding: 50hz
        antibanding-values: off,50hz,60hz,auto
        auto-exposure-lock: false
        auto-exposure-lock-supported: true
        auto-whitebalance-lock: false
        auto-whitebalance-lock-supported: true
        brightness: middle
        brightness-values: low,middle,high
        brightness_value: 0
        burst-num: 1
        camera-service-mute: true
        cap-mode: normal
        cap-mode-values: normal,face_beauty,continuousshot,smileshot,bestshot,autorama,mav,asd,motiontrack
        capfname: /sdcard/DCIM/cap00
        contrast: middle
        contrast-values: low,middle,high
        cshot-indicator: true
        cshot-indicator-supported: true
        dynamic-frame-rate: true
        dynamic-frame-rate-supported: true
        edge: middle
        edge-values: low,middle,high
        effect: none
        effect-values: none,mono,negative,sepia,aqua,whiteboard,blackboard,posterize,nashville,hefe,valencia,xproll,lofi,sierra,walden
        eng-mfll-e: false
        eng-mfll-s: true
        eng-s-shad-t: 0
        eng-shad-t: 0
        exposure-compensation: 0
        exposure-compensation-step: 0.3333
        exposure-meter: center
        exposure-meter-values: center,average,spot
        face-beauty: false
        face-beauty-supported: true
        fb-enlarge-eye: 0
        fb-enlarge-eye-max: 4
        fb-enlarge-eye-min: -4
        fb-extreme-beauty: true
        fb-extreme-beauty-supported: true
        fb-face-pos: -2000:-2000
        fb-sharp: 0
        fb-sharp-max: 12
        fb-sharp-max-values: 12
        fb-sharp-min: -12
        fb-sharp-min-values: -12
        fb-skin-color: 0
        fb-skin-color-max: 12
        fb-skin-color-max-values: 12
        fb-skin-color-min: -12
        fb-skin-color-min-values: -12
        fb-slim-face: 0
        fb-slim-face-max: 12
        fb-slim-face-max-values: 12
        fb-slim-face-min: -12
        fb-slim-face-min-values: -12
        fb-smooth-level: 0
        fb-smooth-level-max: 12
        fb-smooth-level-max-values: 12
        fb-smooth-level-min: -12
        fb-smooth-level-min-values: -12
        fb-touch-pos: -2000:-2000
        feature-max-fps: 24@VFB+EIS
        flash-duty-max: 1
        flash-duty-min: 0
        flash-duty-value: -1
        flash-mode: off
        flash-mode-values: off,on,auto,red-eye,torch
        flash-on: 1
        flash-step-max: 0
        flash-step-min: 0
        focal-length: 3.5
        focus-areas: (0,0,0,0,0)
        focus-distances: 0.95,1.9,Infinity
        focus-fs-fi: 0
        focus-fs-fi-max: 65535
        focus-fs-fi-min: 0
        focus-mode: continuous-picture
        focus-mode-values: auto,macro,infinity,continuous-picture,continuous-video,manual,fullscan
        gesture-shot: false
        gesture-shot-supported: true
        horizontal-view-angle: 63
        hsvr-prv-fps: 30
        hsvr-prv-fps-values: 0,30,0,0
        hsvr-prv-size: 1280x720
        hsvr-prv-size-values: 0x0,1280x720,0x0,0x0
        hsvr-size-fps: 1280x720x120
        hsvr-size-fps-values: 720x480x120,1280x720x120,1280x736x120
        hue: middle
        hue-values: low,middle,high
        iso-speed: auto
        iso-speed-values: auto,100,200,400,800,1600
        jpeg-quality: 87
        jpeg-thumbnail-height: 240
        jpeg-thumbnail-quality: 67
        jpeg-thumbnail-size-values: 0x0,160x128,256x144,320x240
        jpeg-thumbnail-width: 320
        m-sr-g: 0
        m-ss: 0
        max-exposure-compensation: 9
        max-num-detected-faces-hw: 15
        max-num-detected-faces-sw: 0
        max-num-focus-areas: 1
        max-num-metering-areas: 9
        max-num-ot: 1
        max-zoom: 57
        metering-areas: (0,0,0,0,0)
        mfb: off
        mfb-values: off,mfll,ais
        mi-hdr: false
        min-exposure-compensation: -9
        mnr-e: 0
        mnr-s: true
        mtk-123-shad-s: true
        mtk-awb-s: true
        mtk-cam-mode: 1
        mtk-shad-s: true
        native-pip: false
        native-pip-supported: true
        night-anti-motion: false
        night-shot: true
        picture-format: jpeg
        picture-format-values: jpeg
        picture-size: 4160x3120
        picture-size-values: 320x240,640x480,1024x768,1280x720,1280x768,1280x960,1600x1200,1920x1088,2048x1536,2560x1440,2560x1920,3264x2448,3264x1840,3328x1872,2880x1728,3328x2496,3600x2160,4096x2304,4096x3072,4160x3120,4160x2336,4208x2368
        pip-fps-zsd-off: 30
        pip-fps-zsd-on: 24
        preferred-preview-size-for-video: 1920x1088
        preview-format: yuv420sp
        preview-format-values: yuv420sp,yuv420p,yuv420i-yyuvyy-3plane
        preview-fps-range: 5000,60000
        preview-fps-range-values: (5000,60000)
        preview-frame-rate: 120
        preview-frame-rate-values: 10,20,15,24,30,60,120
        preview-size: 1440x1080
        preview-size-values: 176x144,320x240,352x288,480x320,480x368,640x480,720x480,800x480,800x600,864x480,960x540,1280x720,1440x1080,1920x1080,1920x1088,1920x1440,2560x1440,2224x1668
        recording-hint: false
        rotation: 90
        saturation: middle
        saturation-values: low,middle,high
        scene-mode: auto
        scene-mode-values: auto,portrait,landscape,night,night-portrait,theatre,beach,snow,sunset,steadyphoto,fireworks,sports,party,candlelight,hdr,normal
        sen-mode-s: 0
        sensor-type: 252
        smooth-zoom-supported: true
        snapshot-picture-flip: 0
        sr-awb-s: true
        sr-shad-s: true
        stereo-capture-frame-rate: 15
        stereo-depth-af: off
        stereo-depth-af-values: off
        stereo-distance-measurement: off
        stereo-distance-measurement-values: off
        stereo-image-refocus: off
        stereo-image-refocus-values: off
        stereo-preview-frame-rate: 15
        sv1-s: 3
        sv2-s: 3
        vdr-cc2m-s: true
        vdr-r: 0
        vdr-r2m-s: true
        vdr-r4k2k-s: true
        vertical-view-angle: 50
        vfb-supported: true
        vfb-supported-values: true
        video-frame-format: yuv420p
        video-size: 640x480
        video-size-values: 176x144,320x240,352x288,480x320,640x480,864x480,1280x720,1920x1080,720x480,1280x736,1920x1088
        video-snapshot-supported: true
        video-stabilization: false
        video-stabilization-supported: true
        vrd-mfr-e: true
        vrd-mfr-high: 30
        vrd-mfr-low: 15
        vrd-mfr-max: 30
        vrd-mfr-min: 15
        vrd-mfr-s: true
        watermark: off
        whitebalance: auto
        whitebalance-values: auto,incandescent,fluorescent,warm-fluorescent,daylight,cloudy-daylight,twilight,shade
        xiaomi-still-beautify-values: i:0
        xiaomi-time-watermark: off
        zoom: 0
        zoom-ratios: 100,102,104,107,114,117,120,123,125,128,131,135,138,141,144,148,151,155,159,162,166,170,174,178,182,186,190,195,200,204,209,214,219,224,235,240,246,251,257,263,270,276,282,289,296,303,310,317,324,332,340,348,356,364,373,381,390,400
        zoom-supported: true
        zsd-mode: on
        zsd-mode-values: off,on


debug.camera.hal.dumpsys=
Camera 1 static information:
  Facing: FRONT
  Orientation: 270
  Device version: 0x100
  Device is closed, no client instance

Camera traces (0):
  No camera traces collected.

adb shell dumpsys media.audio_flinger //audio

Clients:
  pid: 290
Notification Clients:
  pid: 290
  pid: 1110
  pid: 1929
  pid: 2266
  pid: 2737
Global session refs:
  session   pid count
       72  1929     1
Hardware status: 0
Standby Time mSec: 3000

Output thread 0xf3866008:
  Normal frame count: 1024
  Last write occurred (msecs): 83234532
  Total writes: 3209
  Delayed writes: 0
  Blocked in write: no
  Suspend count: 0
  Sink buffer : 0xab7e6e00
  Mixer buffer: 0xab7eae20
  Effect buffer: 0xab7ece40
  Fast track availMask=0xfe
  I/O handle: 2
  TID: 1269
  Standby: yes
  Sample rate: 44100
  HAL frame count: 1024
  HAL buffer size: 8192 bytes
  Channel Count: 2
  Channel Mask: 0x00000003 (front-left, front-right)
  Format: 0x3 (pcm32)
  Frame size: 8
  Pending config events: none
  AudioMixer tracks: 0x00000000
  FastMixer not initialized
  Stream volumes in dB: 0:-16, 1:-inf, 2:-inf, 3:-inf, 4:0, 5:-inf, 6:0, 7:0, 8:-inf, 9:-inf, 10:-12, 11:0
  Normal mixer raw underrun counters: partial=0 empty=0
  0 Tracks
  1 Effect Chains
    1 effects for session 0
        In buffer   Out buffer   Active tracks:
        0xab7ece40  0xab7ece40   0
        Effect ID 9:
                Session Status State Engine:
                00000   000    003   0xab914768
                Descriptor:
                - UUID: E069D9E0-8329-11DF-9168-0002A5D5C51B
                - TYPE: F46B26A0-DDDD-11DB-8AFD-0002A5D5C51B
                - apiVersion: 00020000
                - flags: 03C40208 (conn. mode: insert, insert pref: first, volume mgmt: none, device indication: requires updates, input mode: not set, output mode: not set, mode indication: required, offloadable)
                - name: DiracSound
                - implementor: Dirac Audio Effect
                - Input configuration:
                        Frames  Smp rate Channels Format Buffer
                        01024   44100    00000003      1 (pcm16) 0xab7ece40
                - Output configuration:
                        Buffer     Frames  Smp rate Channels Format
                        0xab7ece40 01024   44100    00000003 1 (pcm16)
                1 Clients:
                          Pid Priority Ctrl Locked client server
                          290    -2147483648  yes    yes      0      0

adb shell pm list features // 安卓feature

feature:reqGlEsVersion=0x30000
feature:android.hardware.audio.output
feature:android.hardware.bluetooth
feature:android.hardware.bluetooth_le
feature:android.hardware.camera
feature:android.hardware.camera.any
feature:android.hardware.camera.autofocus
feature:android.hardware.camera.flash
feature:android.hardware.camera.front
feature:android.hardware.consumerir
feature:android.hardware.ethernet
feature:android.hardware.faketouch
feature:android.hardware.location
feature:android.hardware.location.gps
feature:android.hardware.location.network
feature:android.hardware.microphone
feature:android.hardware.screen.landscape
feature:android.hardware.screen.portrait
feature:android.hardware.sensor.accelerometer
feature:android.hardware.sensor.compass
feature:android.hardware.sensor.gyroscope
feature:android.hardware.sensor.light
feature:android.hardware.sensor.proximity
feature:android.hardware.telephony
feature:android.hardware.telephony.gsm
feature:android.hardware.touchscreen
feature:android.hardware.touchscreen.multitouch
feature:android.hardware.touchscreen.multitouch.distinct
feature:android.hardware.touchscreen.multitouch.jazzhand
feature:android.hardware.usb.accessory
feature:android.hardware.usb.host
feature:android.hardware.wifi
feature:android.hardware.wifi.direct
feature:android.software.app_widgets
feature:android.software.backup
feature:android.software.connectionservice
feature:android.software.device_admin
feature:android.software.home_screen
feature:android.software.input_methods
feature:android.software.live_wallpaper
feature:android.software.managed_users
feature:android.software.print
feature:android.software.sip
feature:android.software.sip.voip
feature:android.software.voice_recognizers
feature:android.software.webview
feature:com.securespaces.android.feature.encryption
feature:com.securespaces.android.feature.hidden_space
feature:com.securespaces.android.feature.notification_badges
feature:com.securespaces.android.platform.full
feature:com.securespaces.android.platform.v34
feature:com.securespaces.android.platform.v35
feature:com.securespaces.android.platform.v40
feature:com.securespaces.android.platform.v41
feature:com.securespaces.android.platform.v42
feature:com.securespaces.android.platform.v43
feature:com.securespaces.android.platform.v44
feature:com.securespaces.android.sdk10
feature:com.securespaces.android.sdk11
feature:com.securespaces.android.sdk12
feature:com.securespaces.android.sdk13
feature:com.securespaces.android.sdk14
feature:com.securespaces.android.sdk15
feature:com.securespaces.android.sdk16
feature:com.securespaces.android.sdk17
  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值