Brief introduction to the usage of dumpsys command in Android

On Android phones, you can enter the shell of Android system by using ADB shell command. In addition to some common standard commands, the shell also supports some other commands related to Android system. These commands can print the current status information of the system. Dumpsys is such a command.

Use the ADB shell to enter the command line, type dumpsys, and print out a lot of information. On my nexus 5 machine, it outputs up to 67000 lines. First, from the beginning of the printed information:

It can be seen that the command prints out the information of all running services of the system. You can see some of our common services. Activity represents activitymanagerservice, which is used to manage the four components of the application. Appops represents appopsmanagerservice, which is used to manage and configure permissions. Window represents windowmanagerservice, which is used to manage windows in the system, and account represents accountmanagerservice, which is used to manage account information in the system.

In the output information, the current detailed status information of each service is followed. Generally, there are more status information of each service. Here is a service information with less information:

Use horizontal line spacing between each service information.

During development, the most common use of dumpsys is to view the information of the activitymanagerservice service service. The following focuses on the analysis of activitymanagerservice. The information of the service starts from the following line:

We know that three of the four components of Android applications are driven by intent. Therefore, in the information of activitymanagerservice, there is a special part to record the current pending intent, which is called pending intent. The format is as follows:

You can get this information directly by typing dumpsys activity contents in the shell. Each intent to be processed is represented by a pendingintentrecord object in the activitymanagerservice, and the package name of the application will be displayed, and it will be specified whether the intent is used to send broadcast, start activity or start service.

The following information is the status information of the broadcast receiver in the system, starting from the following line:

Directly type umpsys activity broadcasts in the shell to get this information directly.

First, all registered broadcast recipients in the system will be listed in the following format:

After that, the historical broadcast at the front desk is listed in the following format:

Then there is the history broadcast in the background. The format is as follows:

The following is information about the provider in the following format:

Directly type dumpsys activity providers on the command line to get information about providers directly. According to the output information, in ativitymanagerservice, a provider component is represented by a contentproviderrecord object.

Service related information is as follows:

Directly type the dumpsys activity services command in the shell to get the service information directly.

The format of activity related information is as follows:

Directly type dumpsys activity activities in the shell to get information about activities.

Compared with other components, the management of activity is special. Activities are managed in the form of stacks. There are several tasks in each stack, and each task is composed of several activities.

The above briefly introduces the information related to the four components in the activitymanagerservice. The information in other services cannot be introduced one by one due to the large amount of information. Please check it by yourself.

Thank you for reading, hope to help you, thank you for your support to this site!

The content of this article comes from the network collection of netizens. It is used as a learning reference. The copyright belongs to the original author.
THE END
分享
二维码
< <上一篇
下一篇>>