dumpsys
Diagnose Android system services status
SYNOPSIS
adb shell dumpsys [options] [service]
PARAMETERS
options
Various options to modify the output format or content, such as `-c` (client-side dumping), `-l` (list all services), `-n` (Native crash reporting), or `--pid
service
The name of the system service to dump information from. Common services include activity, battery, cpuinfo, meminfo, package, window, and wifi. Leaving this argument blank will produce an output that contains information of all available service data.
DESCRIPTION
The `dumpsys` command is a powerful diagnostic tool in Android, primarily used by developers to inspect the state of system services and gather debugging information. It allows you to query various system components and services running on an Android device, providing detailed snapshots of their internal states, configurations, and recent activities. The output can be very verbose and requires careful analysis to extract relevant insights. It's a crucial part of the Android debugging workflow, enabling identification of performance bottlenecks, memory leaks, and other system-level issues. dumpsys is executed via the Android Debug Bridge (adb) from a connected computer. The vast amount of data returned allows you to examine everything from battery stats and memory usage to detailed information about active processes and installed packages. The command is heavily used to troubleshoot issues on real devices as it shows information that logs may not capture. A key advantage of dumpsys is its ability to provide context, for instance, viewing memory usage in conjunction with service states to determine if a particular service is responsible for memory leaks. It is a powerful troubleshooting utility for android development.
Using dumpsys without proper context will not yield proper information; it requires the user to understand the component they are inspecting to determine if the data being produced is erroneous.
CAVEATS
The output format of `dumpsys` can change between Android versions. The output is very verbose and requires careful parsing to extract relevant information. Requires adb and access to the Android device or emulator.
COMMON USAGE EXAMPLES
dumpsys activity: Shows information about activities, tasks, and intents.
dumpsys battery: Displays battery status and usage statistics.
dumpsys meminfo: Provides memory usage details for the entire system or a specific process.
dumpsys package: Lists installed packages and their permissions.
dumpsys wifi: Shows WiFi connection status and configuration. You can also filter your outputs by piping to grep, i.e. adb shell dumpsys meminfo | grep com.example.
SECURITY IMPLICATIONS
The dumpsys command reveals a lot of sensitive data regarding the device. Avoid running it in untrusted enviroments. Some outputs may contain personal information like network names, accounts, and other sensitive data.
HISTORY
The `dumpsys` command has been a core part of the Android platform since its early days, evolving alongside the system to provide deeper insights into increasingly complex system components. Its development is tightly coupled with the evolution of Android's architecture and debugging needs. The command predates Android 1.0 as it served as the primary method for diagnosing issues. It is crucial for both android framework and app developers.