dumpsys

android debug

Posted by LXG on September 27, 2018

dumpsys -l

服务名 类名 功能 详细信息
activity ActivityManagerService AMS相关信息  
package PackageManagerService PMS相关信息  
ethernet EthernetService 有线网  
device_policy DevicePolicyManagerService 设备管理器  
deviceidle DeviceIdleController 电池优化  
usb UsbService usb设备相关  
connectivity ConnectivityService 连接管理  
appops AppOpsService 应用权限管理 data/system/appops.xml

PMS


L2K:/ # dumpsys package -h
Package manager dump options:
  [-h] [-f] [--checkin] [cmd] ...
    --checkin: dump for a checkin
    -f: print details of intent filters                                       // dumpsys 指定信息
    -h: print this help
  cmd may be one of:
    l[ibraries]: list known shared libraries                                  // 共享库
    f[eatures]: list device features                                          // 设备feature
    k[eysets]: print known keysets                                            //
    r[esolvers] [activity|service|receiver|content]: dump intent resolvers    // IntentResolver
    perm[issions]: dump permissions                                           // 权限
    permission [name ...]: dump declaration and use of given permission       // 指定权限
    pref[erred]: print preferred package settings                             // 默认指定应用,例如默认短信
    preferred-xml [--full]: print preferred package settings as xml
    prov[iders]: dump content providers
    p[ackages]: dump installed packages
    s[hared-users]: dump shared user IDs                                      // share uid
    m[essages]: print collected runtime messages                              // 运行时的异常和警告信息
    v[erifiers]: print package verifier info
    d[omain-preferred-apps]: print domains preferred apps
    i[ntent-filter-verifiers]|ifv: print intent filter verifier info
    version: print database version info
    write: write current settings now
    installs: details about install sessions
    check-permission <permission> <package> [<user>]: does pkg hold perm?
    dexopt: dump dexopt state
    compiler-stats: dump compiler statistics
    <package.name>: info about given package

AMS


L2K:/ $ dumpsys activity -h
Activity manager dump options:
  [-a] [-c] [-p PACKAGE] [-h] [WHAT] ...
  WHAT may be one of:
    a[ctivities]: activity stack state                                    // ActivityStack
    r[recents]: recent activities state                                   // Recent activitys
    b[roadcasts] [PACKAGE_NAME] [history [-s]]: broadcast state           //
    broadcast-stats [PACKAGE_NAME]: aggregated broadcast statistics       //
    i[ntents] [PACKAGE_NAME]: pending intent state
    p[rocesses] [PACKAGE_NAME]: process state                             // 查看进程状态
    o[om]: out of memory management                                       // 查看进程 oom adj
    perm[issions]: URI permission grant state
    prov[iders] [COMP_SPEC ...]: content provider state
    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            // 查看某个应用的AMS服务端状态
    all: dump all activities
    top: dump the top activity                                            // 查看顶层的Activity的View树
  WHAT 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.                                 // 查看所有的AMS服务端状态
  -c: include client state.
  -p: limit output to given package.                                      // 查看指定包的服务端状态
  --checkin: output checkin format, resetting data.
  --C: output checkin format, not resetting data.

参考文章

dumpsys命令用法

阅读错误报告

官方教程