ADB shell的dumpsys命令-查看android组件信息详解

hanjinping 2017-09-06

基本使用命令:dumpsys activity -h

Activity manager dump options:[-a][-c][-p package][-h][cmd]...//这个是后面可以跟的参数
  cmd may be one of://这个代表可以跟的命令
    a[ctivities]: activity stack state //activity的栈信息
    r[recents]: recent activities state//最新的acivity的信息
    b[roadcasts][PACKAGE_NAME][history [-s]]: broadcast state//broadcastsde 相关信息
    i[ntents][PACKAGE_NAME]: pending intent state//intent的信息
    p[rocesses][PACKAGE_NAME]: process state//进程相关的信息
    o[om]:out of memory management//内存溢出
    prov[iders][COMP_SPEC ...]: content provider state//provider信息
    provider [COMP_SPEC]: provider client-side state
    s[ervices][COMP_SPEC ...]: service state
    as[sociations]: tracked app associations
    service [COMP_SPEC]: service client-side state
    package[PACKAGE_NAME]: all state related to given package
    all:dump all activities //输出所有的activity信息
    top:dump the top activity//输出当前栈顶的activity信息
    write: write all pending state to storage
    track-associations: enable association tracking
    untrack-associations: disable and clear association tracking
  cmd may also be a COMP_SPEC to dump activities.
  COMP_SPEC may be a component name (com.foo/.myApp),
    a partial substring in a component name, a
    hex object identifier.-a: include all available server state.-c: include client state.-p: limit output to given package.

常见的命令使用介绍

1.dumpsys activity top

拿到一个新的app,我们经常定位当前的焦点activoty的名字。
这个命令就可以显示,而且还可以显示包含的fragment‘的信息、

2.dumpsys activity | grep run

过滤目前的所有的activity栈信息。

3.dumpsys activity -p 包名

过滤一个包的信息。

相关推荐