Android dumpSys command usage summary

dumpsys command is a necessary skill for Android developers. It can dump various states of system services and plays a very important role in our development and debugging

1.dumpsys service list

Different Android system versions support different commands. You can view the dump service supported by the current mobile phone through the following commands

dumpsys -l

These service names may not show which service they call, so you can use the following command: service list.

130|root@generic_x86_64:/ # dumpsys -l
Currently running services:
  DockObserver
  SurfaceFlinger
  accessibility
  account
  activity
  alarm
  android.security.keystore
  appops
  appwidget
  assetatlas
  audio
  backup
  battery
  batteryproperties
  batterystats
  clipboard
  commontime_management
  connectivity
  consumer_ir
  content
  country_detector
  cpuinfo
  dbinfo
  device_policy
  devicestoragemonitor
  diskstats
  display
  dreams
  drm.drmManager
  dropbox
  entropy
  fingerprint
  gfxinfo
  hardware
  imms
  input
  input_method
  iphonesubinfo
  isms
  isub
  jobscheduler
  launcherapps
  location
  lock_settings
  media.audio_flinger
  media.audio_policy
  media.camera
  media.player
  media.sound_trigger_hw
  media_projection
  media_router
  media_session
  meminfo
  mount
  netpolicy
  netstats
  network_management
  network_score
  notification
  package
  permission
  phone
  power
  print
  procstats
  restrictions
  rttmanager
  samplingprofiler
  scheduling_policy
  search
  sensorservice
  serial
  servicediscovery
  simphonebook
  statusbar
  telecom
  telephony.registry
  textservices
  trust
  uimode
  updatelock
  usagestats
  usb
  user
  vibrator
  voiceinteraction
  wallpaper
  webviewupdate
  wifi
  wifip2p
  wifiscanner
  window

The above is the list of services supported by dumpsys in the current system. You can view the usage of each service through dumpsys [service name] - h #

For example, let's look at the usage of dumpsys activity

dumpsys activity -h

root@generic_x86_64:/ # dumpsys activity -h
Activity manager dump options:
  [-a] [-c] [-p package] [-h] [cmd] ...
  cmd may be one of:
    a[ctivities]: activity stack state
    r[recents]: recent activities state
    b[roadcasts] [PACKAGE_NAME] [history [-s]]: broadcast state
    i[ntents] [PACKAGE_NAME]: pending intent state
    p[rocesses] [PACKAGE_NAME]: process state
    o[om]: out of memory management
    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
    all: dump all activities
    top: dump the top 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.

2.dumpsys activity

View the Service status of the current APP

dumpsys activity s{package name

View the broadcast status of the current APP

dumpsys activity b package name

View the process status of the current APP

dumpsys activity p package name

View the Activity status of the current APP

dumpsys activity a package name

Dumpsys activity outputs the corresponding contents according to the following different parameters. When it is not followed by any parameters, dumpsys activity is equivalent to outputting the following 8 commands in sequence:

dumpsys activity intents
dumpsys activity broadcasts //radio broadcast
dumpsys activity providers  //provider
dumpsys activity permissions
dumpsys activity services  //service
dumpsys activity recents
dumpsys activity activities //activity
dumpsys activity processes

 

3.dumpSys service correspondence table

service name Class name function
activity ActivityManagerService AMS related information
package PackageManagerService PMS related information
window WindowManagerService WMS related information
input InputManagerService IMS related information
power PowerManagerService PMS related information
batterystats BatterystatsService Battery statistics
battery BatteryService Battery information
alarm AlarmManagerService Alarm information
dropbox DropboxManagerService Commissioning related
procstats ProcessStatsService Process statistics
cpuinfo CpuBinder CPU
meminfo MemBinder Memory
gfxinfo GraphicsBinder image
dbinfo DbBinder database
service name function
SurfaceFlinger Image correlation
appops app usage
permission jurisdiction
processinfo Process service
batteryproperties Battery related
audio View sound information
netstats View network statistics
diskstats View space free status
jobscheduler View task schedule
wifi wifi information
diskstats Disk condition
usagestats User usage
devicestoragemonitor Equipment information
... ...

 

 

 

Tags: Java Android

Posted by stemp on Mon, 23 May 2022 21:45:47 +0300