Use of the Android dumpsys command
The dumpsys tool provided by Android can be used to view information and status of applications and system services in mobile phones, after the mobile phone connects to the computer, you can directly execute the adb shell dumpsys command to view all supported services, but this output is too much, you can use dumpsys | grep "dump of service" to display only information about the main Service. The usage of this command is recorded here for future use.
1. All command input supported by dumpsys:
adb shell dumpsys | grep DUMP
Or
adb shell dumpsys | grep "DUMP OF SERVICE"
All the dumpsys parameters supported by the current mobile phone are listed:
DUMP OF SERVICE Exynos.HWCService:DUMP OF SERVICE SurfaceFlinger:DUMP OF SERVICE access_control:DUMP OF SERVICE accessibility:DUMP OF SERVICE account:DUMP OF SERVICE activity:DUMP OF SERVICE alarm:DUMP OF SERVICE android.security.keystore:DUMP OF SERVICE appops:DUMP OF SERVICE appwidget:DUMP OF SERVICE audio:DUMP OF SERVICE backup:DUMP OF SERVICE battery:DUMP OF SERVICE batterypropreg:DUMP OF SERVICE batterystats:DUMP OF SERVICE bluetooth_manager:DUMP OF SERVICE blurglassinfo:DUMP OF SERVICE clipboard:DUMP OF SERVICE com.meizu.nfc.NxpExt:DUMP OF SERVICE commontime_management:DUMP OF SERVICE connectivity:DUMP OF SERVICE consumer_ir:DUMP OF SERVICE content:DUMP OF SERVICE country_detector:DUMP OF SERVICE cpuinfo:DUMP OF SERVICE dbinfo:DUMP OF SERVICE deivce_states:DUMP OF SERVICE device_policy:DUMP OF SERVICE devicestoragemonitor:DUMP OF SERVICE diskstats:DUMP OF SERVICE display:DUMP OF SERVICE dreams:DUMP OF SERVICE drm.drmManager:DUMP OF SERVICE dropbox:DUMP OF SERVICE entropy:DUMP OF SERVICE gesture_manager:DUMP OF SERVICE gfxinfo:DUMP OF SERVICE hardware:DUMP OF SERVICE input:DUMP OF SERVICE input_method:DUMP OF SERVICE iphonesubinfo:DUMP OF SERVICE isms:DUMP OF SERVICE location:DUMP OF SERVICE lock_settings:DUMP OF SERVICE media.audio_flinger:DUMP OF SERVICE media.audio_policy:DUMP OF SERVICE media.camera:DUMP OF SERVICE media.player:DUMP OF SERVICE media_router:DUMP OF SERVICE meizu.camera:DUMP OF SERVICE meminfo:DUMP OF SERVICE mount:DUMP OF SERVICE netpolicy:DUMP OF SERVICE netstats:DUMP OF SERVICE network_management:DUMP OF SERVICE nfc:DUMP OF SERVICE notification:DUMP OF SERVICE package:DUMP OF SERVICE permission:DUMP OF SERVICE phone:DUMP OF SERVICE phone_ext:DUMP OF SERVICE power:DUMP OF SERVICE pppoe:DUMP OF SERVICE print:DUMP OF SERVICE procstats:DUMP OF SERVICE samba_client:DUMP OF SERVICE samba_server:DUMP OF SERVICE samplingprofiler:DUMP OF SERVICE scheduling_policy:DUMP OF SERVICE search:DUMP OF SERVICE secloader:DUMP OF SERVICE secloader2:DUMP OF SERVICE secsystemserver:DUMP OF SERVICE sensorservice:DUMP OF SERVICE serial:DUMP OF SERVICE servicediscovery:DUMP OF SERVICE simphonebook:DUMP OF SERVICE sip:DUMP OF SERVICE statusbar:DUMP OF SERVICE telephony.registry:DUMP OF SERVICE textservices:DUMP OF SERVICE uimode:DUMP OF SERVICE updatelock:DUMP OF SERVICE usagestats:DUMP OF SERVICE usb:DUMP OF SERVICE user:DUMP OF SERVICE vibrator:DUMP OF SERVICE voicesense:DUMP OF SERVICE wallpaper:DUMP OF SERVICE wifi:DUMP OF SERVICE wifip2p:DUMP OF SERVICE window:
2. How to view the help information of specific commands
From the above we can see that there are a lot OF services, and the words after the "dump of Service" keyword can be directly viewed through dumpsys + words, there is a general way to view help for each specific use.
View the help of each command. The following uses activity as an example:
adb shell dumpsys activity -hActivity manager dump options: [-a] [-c] [-h] [cmd] ... cmd may be one of: a[ctivities]: activity stack 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 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 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.
In this way, you can clearly understand how to use each name and how to view the information of the corresponding output content.
3. Some Common commands
Adb shell dumpsys activity: displays information about the activity, including the task stack;
Adb shell dumpsys SurfaceFlinger: view all levels of information drawn by the UI
Adb shell dumpsys window: displays the relationship between the keyboard, window, and them.
Adb shell dumpsys statusbar: displays status bar Information
Adb shell dumpsys usagestats: number and time of startup of each application
Adb shell dumpsys battery: battery Information
Adb shell dumpsys diskstats: disk Information
Adb shell dumpsys alarm: displays Alarm information
Adb shell dumpsys wifi: displays wifi Information
4. References:
Http://www.open-open.com/lib/view/open1405061994872.html
Https://source.android.com/devices/tech/input/dumpsys.html