Demystifying ADB Shell’s “dumpsys” Command and Its Benefits for Android Development

Demystifying ADB Shell's "dumpsys" Command and Its Benefits for Android Development

22 April 2024 Stephan Petzl Leave a comment Tech-Help

The Android Debug Bridge (ADB) shell is a versatile command-line tool that allows developers to communicate with an emulator instance or connected Android device. One of the most powerful commands within the ADB shell is dumpsys. This command provides a wealth of information about the device’s status and the performance of system services.

Understanding the “dumpsys” Command

dumpsys is an Android tool that runs on the device and dumps diagnostic information about the status of system services. The output of dumpsys includes a plethora of details about the device’s internal workings, which can be invaluable for debugging and optimization tasks.

Benefits of “dumpsys”:

  • Provides a simple string representation of system information.
  • Enables the monitoring of CPU, RAM, Battery, and storage stats for performance analysis.

Retrieving Information with “dumpsys”

Executing dumpsys alone will display information for all system services, which can be overwhelming. To narrow down the output, you can specify a particular service. For example:

adb shell dumpsys battery

Will display battery status, health, level, voltage, temperature, and technology.

Similarly, you can retrieve information about the device’s WiFi connection:

adb shell dumpsys wifi

This will provide details about the device’s WiFi status, current connection, signal strength, and more.

To view CPU utilization details:

adb shell dumpsys cpuinfo

This command gives you an insight into the CPU load and usage by different processes.

For memory usage information specific to your application, use:

adb shell dumpsys meminfo 'your.package.name'

This provides detailed memory usage statistics for your app, including native, dalvik (Java heap), and private dirty memory.

How to Access a Full List of “dumpsys” Commands

To discover all the available “subcommands” or services that you can inspect with dumpsys, you can use the following command:

adb shell dumpsys | grep "DUMP OF SERVICE"

This will list all the services for which dumpsys can provide information.

Repeato: Streamlining Testing with No-code Automation

While dumpsys provides valuable insights for manual debugging and performance analysis, automating testing processes can save time and reduce errors. Here’s where Repeato, our no-code test automation tool, can help.

Repeato enables you to create, run, and maintain automated tests for iOS and Android apps without the need for coding. Its fast editing and execution capabilities, coupled with computer vision and AI, make it suitable for all sorts of app frameworks, including React Native, Flutter, and Unity.

Moreover, Repeato comes with ADB on board, allowing you to execute ADB commands within test scenarios, streamlining your testing workflow even further.

Whether you’re dealing with launching Android applications via ADB, managing ADB shell with multiple connected devices, or extracting APK files, Repeato’s integration of ADB commands can enhance your testing process.

Like this article? there’s more where that came from!