Android Debugging Using — dumpsys

How to use $ dumpsys and what information it can provide for debugging

Narendra Harny
Make Android

--

The dumpsys command in the Android Open Source Project (AOSP) is a tool that provides detailed information about system services and other aspects of the Android system. It allows developers and users to access information about various system components, view system state, and diagnose issues. For example, you can use dumpsys to get information about battery, memory usage, connectivity, and more. It’s a powerful tool for debugging and analyzing the Android system.

Photo by James Wainscoat on Unsplash

The dumpsys command in Android works by interacting with the system’s service manager and various system services. When you run dumpsys followed by a specific service name or a category, it triggers the corresponding service to provide a detailed dump of its current state.

For example:

adb shell

dumpsys activity

Part of output to understand:

ACTIVITY MANAGER LAST ANR (dumpsys activity lastanr)
<no ANR has occurred since boot>

ACTIVITY MANAGER STARTER (dumpsys activity starter)
mLastHomeActivityStartResult=0
mLastHomeActivityStartRecord:
packageName=com.google.android.apps.nexuslauncher processName=com.google.android.apps.nexuslauncher
launchedFromUid=0 launchedFromPackage=null launchedFromFeature=null userId=0
app=ProcessRecord{f5a3e4d 1343:com.google.android.apps.nexuslauncher/u0a135}
Intent { act=android.intent.action.MAIN cat=[android.intent.category.SECONDARY_HOME] flg=0x10000100 pkg=com.google.android.apps.nexuslauncher cmp=com.google.android.apps.nexuslauncher/com.android.launcher3.secondarydisplay.SecondaryDisplayLauncher (has extras) }
rootOfTask=true task=Task{f942907 #22 type=home A=10135:com.google.android.apps.nexuslauncher}
taskAffinity=10135:com.google.android.apps.nexuslauncher
mActivityComponent=com.google.android.apps.nexuslauncher/com.android.launcher3.secondarydisplay.SecondaryDisplayLauncher
baseDir=/system_ext/priv-app/NexusLauncherRelease/NexusLauncherRelease.apk
dataDir=/data/user/0/com.google.android.apps.nexuslauncher
stateNotNeeded=false componentSpecified=false mActivityType=home
compat={560dpi} labelRes=0x7f130068 icon=0x7f080276 theme=0x7f140012

You can check the full output with this command, I am trying to highlight the crucial details “ACTIVITY MANAGER LAST ANR” and “ACTIVITY MANAGER STARTER”, so these details can be very crucial for resolving the very critical issues in the Android subsystem.

One more instance to understand:

emu64xa:/ $ dumpsys package com.android.inputdevices | grep userId
userId=1000
userId=1000

Dumpsys command provides a bulk of details and different services dump different details as per AOSP source implementation so it is based on the issue of what to filter and debug the process.

Here is the list of all the services which dumsys support!

emu64xa:/ $ dumpsys -l
Currently running services:
DockObserver
SurfaceFlinger
SurfaceFlingerAIDL
accessibility
account
activity
activity_task
adb
alarm
ambient_context
android.frameworks.stats.IStats/default
android.hardware.camera.provider.ICameraProvider/internal/0
android.hardware.drm.IDrmFactory/clearkey
android.hardware.drm.IDrmFactory/widevine
android.hardware.identity.IIdentityCredentialStore/default
android.hardware.light.ILights/default
android.hardware.power.IPower/default
android.hardware.radio.config.IRadioConfig/default
android.hardware.radio.data.IRadioData/slot1
android.hardware.radio.messaging.IRadioMessaging/slot1
android.hardware.radio.modem.IRadioModem/slot1
android.hardware.radio.network.IRadioNetwork/slot1
android.hardware.radio.sim.IRadioSim/slot1
android.hardware.radio.voice.IRadioVoice/slot1
android.hardware.rebootescrow.IRebootEscrow/default
android.hardware.security.keymint.IKeyMintDevice/default
android.hardware.security.keymint.IRemotelyProvisionedComponent/default
android.hardware.security.secureclock.ISecureClock/default
android.hardware.security.sharedsecret.ISharedSecret/default
android.hardware.vibrator.IVibrator/default
android.hardware.vibrator.IVibratorManager/default
android.hardware.wifi.supplicant.ISupplicant/default
android.security.apc
android.security.authorization
android.security.compat
android.security.identity
android.security.legacykeystore
android.security.maintenance
android.security.metrics
android.security.remoteprovisioning
android.security.remoteprovisioning.IRemotelyProvisionedKeyPool
android.system.keystore2.IKeystoreService/default
android.system.suspend.ISystemSuspend/default
app_binding
app_hibernation
app_integrity
app_prediction
app_search
appops
appwidget
attestation_verification
audio
auth
autofill
backup
battery
batteryproperties
batterystats
binder_calls_stats
biometric
blob_store
bluetooth_manager
bugreport
cacheinfo
carrier_config
clipboard
cloudsearch
color_display
companiondevice
connectivity
connectivity_native
connmetrics
consumer_ir
content
content_capture
content_suggestions
country_detector
cpuinfo
crossprofileapps
dataloader_manager
dbinfo
device_config
device_identifiers
device_policy
device_state
deviceidle
devicestoragemonitor
diskstats
display
domain_verification
dreams
drm.drmManager
dropbox
dynamic_system
emergency_affordance
external_vibrator_service
file_integrity
fingerprint
font
game
gfxinfo
gpu
graphicsstats
hardware_properties
imms
incidentcompanion
incremental
input
input_method
inputflinger
ions
iphonesubinfo
ipsec
isms
isub
jobscheduler
launcherapps
legacy_permission
lights
locale
location
location_time_zone_manager
lock_settings
logcat
looper_stats
manager
media.audio_flinger
media.audio_policy
media.camera
media.camera.proxy
media.extractor
media.metrics
media.player
media.resource_manager
media.resource_observer
media_communication
media_metrics
media_projection
media_resource_monitor
media_router
media_session
meminfo
memtrack.proxy
midi
mount
music_recognition
nearby
netd_listener
netpolicy
netstats
network_management
network_score
network_stack
network_time_update_service
network_watchlist
notification
otadexopt
overlay
pac_proxy
package
package_native
people
performance_hint
permission
permission_checker
permissionmgr
phone
pinner
platform_compat
platform_compat_native
power
powerstats
print
processinfo
procstats
reboot_readiness
recovery
resources
restrictions
role
rollback
runtime
safety_center
scheduling_policy
sdk_sandbox
search
search_ui
sec_key_att_app_id_provider
secure_element
selection_toolbar
sensor_privacy
sensorservice
serial
servicediscovery
settings
shortcut
simphonebook
slice
smartspace
soundtrigger
soundtrigger_middleware
speech_recognition
stats
statsbootstrap
statscompanion
statsmanager
statusbar
storaged
storaged_pri
storagestats
system_config
system_server_dumper
system_update
tare
telecom
telephony.registry
telephony_ims
testharness
tethering
textclassification
textservices
texttospeech
thermalservice
time_detector
time_zone_detector
tracing.proxy
translation
transparency
trust
uimode
updatelock
uri_grants
usagestats
usb
user
vcn_management
vibrator_manager
virtualdevice
voiceinteraction
vpn_management
wallpaper
wallpaper_effects_generation
webviewupdate
wifi
wifinl80211
wifip2p
wifiscanner
window
emu64xa:/ $

You can use the dumpsys for debugging, I am open to answering or discussing any query you have related to any service mentioned above so please let me know in the comments.

Thanks for Reading!

Please comment with questions and suggestions!! If this blog is helpful for you then, Please hit the clap! Follow on Medium, Please Follow and subscribe to Make Android for prompt updates on Android platform-related blogs.

Thank you!

--

--

Narendra Harny
Make Android

Connect on https://medium.com/make-android | Write On, Android AOSP & Applications | Python | DevOps | Java | C++ | Kotlin | Shell | Linux | Android Auto | IVI