Operation statistical method and device of Android application, electronic equipment and storage medium
By monitoring the changes in the running status of the main process of Android applications and recording statistical information in memory, the problems of intricate Android application statistics and high energy consumption in the existing technology are solved, and accurate statistics of the application and low energy consumption are achieved.
Patent Information
- Application Number
- CN202310704230.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2023-06-13
- Publication Date
- 2024-12-20
AI Technical Summary
The current statistics on the running of Android applications are not rigorous enough, the statistics consume high energy, and it is impossible to accurately count the number of applications started and applications without visible interfaces.
By monitoring the changes in the running status of the main process of Android applications, recording and maintaining information in the cache table in memory, counting the number of applications opened, and eliminating the time-consuming and power-consuming operations of active reading of large files and data statistics.
Accurate statistics of Android applications are realized, energy consumption and storage load of data processing are reduced, and statistical rigor and efficiency are improved.
Smart Images

Figure CN119166445A_ABST
Abstract
Description
Technical Field
[0001] The embodiments of the present invention relate to the technical field of operating systems, and in particular to an operation statistics method, device, electronic device and storage medium for Android applications. Background Art
[0002] In electronic devices equipped with operating systems, collecting usage statistics of applications installed on the electronic devices is an important prerequisite for electronic devices to achieve power consumption management, device operation status monitoring, user usage behavior monitoring and recommendations.
[0003] In electronic devices based on the Android system, the usage statistics service UsageStatsManager that comes with the Android system can be used to obtain the usage history information of the application for usage statistics. However, this statistical method strictly counts the number of times the application is used, rather than the number of times the application is started, and only the usage of applications with visible interfaces is counted. Moreover, when using the application usage statistics service UsageStatsManager to obtain the usage history information of the application, it is actually reading a local file, and this local file may store the application usage history for a long time. After a long period of accumulation, the file is large, and the performance consumed by reading the file is also increased. The accuracy and energy economy of the statistics of the data recorded in this way are deteriorated. On the whole, the existing operation statistics of Android applications are not rigorous enough, and the energy consumption of statistics is high. Summary of the invention
[0004] The present invention provides an Android application operation statistics method, device, electronic device and storage medium to solve the technical problems that the existing Android application operation statistics are not rigorous enough and the energy consumption of statistics is high.
[0005] In a first aspect, an embodiment of the present invention provides an operation statistics method for an Android application, the operation statistics method comprising:
[0006] Monitor the running status changes of the main process of the Android application;
[0007] When the main process is monitored to enter the execution state, the identification information of the main process is obtained, and the record status of the identification information in the pre-allocated cache table in the memory is confirmed;
[0008] When the identification information is recorded in the cache table, the running state change continues to be monitored; when the identification information is not recorded in the cache table, a new record of the running information of the main process is created in the cache table, and the number of times the Android application is opened is counted;
[0009] When the main process is detected to have entered the termination state, the identification information of the main process is obtained, and the running information of the corresponding record is deleted from the cache table according to the identification information.
[0010] In a second aspect, an embodiment of the present invention further provides an Android application operation statistics device, the operation statistics device comprising:
[0011] The process status monitoring unit is used to monitor the running status changes of the main process of the Android application;
[0012] An information record confirmation unit, used to obtain the identification information of the main process when monitoring that the main process enters the execution state, and confirm the record status of the identification information in the cache table pre-allocated in the memory;
[0013] The running statistics processing unit is used to continue to monitor the running state change when the identification information is recorded in the cache table; when the identification information is not recorded in the cache table, a new record of the running information of the main process is created in the cache table, and the number of times the Android application is opened is counted;
[0014] The information record deletion unit is used to obtain the identification information of the main process when monitoring that the main process enters the termination state, and delete the corresponding recorded running information from the cache table according to the identification information.
[0015] In a third aspect, an embodiment of the present invention further provides an electronic device, including:
[0016] one or more processors;
[0017] a memory for storing one or more computer programs;
[0018] When one or more computer programs are executed by one or more processors, the electronic device implements the operation statistics method of the Android application as in the first aspect.
[0019] In a fourth aspect, an embodiment of the present invention further provides a computer-readable storage medium having a computer program stored thereon, which, when executed by a processor, implements the operation statistics method of an Android application as in the first aspect.
[0020] In the above-mentioned operation statistics method, device, electronic device and storage medium of the Android application, the operation status changes of the main process of the Android application are monitored; when the main process is monitored to enter the execution state, the identification information of the main process is obtained, and the record status of the identification information in the pre-allocated cache table in the memory is confirmed; when the identification information is recorded in the cache table, the operation status changes are continued to be monitored; when the identification information is not recorded in the cache table, a new record of the operation information of the main process is created in the cache table, and the number of times the Android application is opened is counted; when the main process is monitored to enter the termination state, the identification information of the main process is obtained, and the corresponding recorded operation information is deleted from the cache table according to the identification information. By monitoring the changes in the operation status of the main process, the records of the corresponding information are increased, decreased or maintained in the cache table in the memory, and the accurate statistics of the number of operations are made accordingly. In this process, the time-consuming and power-consuming operations of actively reading and counting data of large files are eliminated, and the amount of information records and statistical data of the number of operations in the cache table is maintained is small, the data processing speed is fast, and the energy consumption required to complete the statistics is low. BRIEF DESCRIPTION OF THE DRAWINGS
[0021] Figure 1 A method flow chart of an Android application operation statistics method provided by an embodiment of the present invention.
[0022] Figure 2 A schematic diagram of the structure of an Android application operation statistics device provided by an embodiment of the present invention.
[0023] Figure 3 A schematic diagram of the structure of an electronic device provided by an embodiment of the present invention. DETAILED DESCRIPTION
[0024] The present invention will be further described in detail below in conjunction with the accompanying drawings and embodiments. It is to be understood that the specific embodiments described herein are used to explain the present invention, rather than to limit the present invention. It should also be noted that, for ease of description, only the parts related to the present invention, rather than all structures, are shown in the accompanying drawings.
[0025] It should be noted that the present application specification does not enumerate all optional implementation modes. After reading the present application specification, those skilled in the art should be able to understand that as long as the technical features do not contradict each other, any combination of the technical features can constitute an optional implementation mode.
[0026] In electronic devices based on the Android system, a scheduled task is usually started (for example, every 30 minutes), and the application usage statistics service UsageStatsManager is called regularly to obtain the application usage history information. The usage behavior is confirmed according to the event type in the usage history information. For example, the move to the foreground event MOVE_TO_FOREGROUND can indicate that an application window starts to display and enters the execution state; the move to the background event MOVE_TO_BACKGROUND can indicate that an application window ends the foreground display and enters the background running state. For example, when a social application interface is opened from the desktop of an electronic device to make it visible to the user, the social application is moved to the foreground event; when the social application interface is displayed and the shopping application interface is jumped to, there will be a move to the background event for the social application and a move to the foreground event for the shopping application.
[0027] Based on the above processing, it can be found that when using the application usage statistics service UsageStatsManager that comes with the Android system to obtain the application usage history information, it is actually reading a local file, and this local file may store all the usage history information since the electronic device began to be used. After continuous accumulation, this local file becomes larger and larger. The larger the file, the greater the performance consumed by reading the file. In the specific data processing process, based on the event type, only the number of times the application is used can be obtained, rather than the number of cold starts of the application, that is, the number of times the application interface enters the visible state is obtained, rather than the number of times the main process corresponding to the application begins to exist. For example, after the electronic device is turned on, an Android application is opened from the desktop. If the corresponding main process has not ended, it jumps to other Android applications and then switches back. According to the prior art, it will be counted as opened twice, but in fact, the main process of the Android application is only started once. In addition, based on the statistics of historical usage record information, if an incremental method is used, the event of moving to the foreground and the event of moving to the background of an application may appear in the interval of two incremental acquisition data. At this time, the statistics will find some dirty data, resulting in incorrect statistical data. If the full acquisition method is adopted, calculation and reporting must be performed every time. As the historical usage record information increases, the performance consumption of the electronic device will increase during calculation, and the load on the background server that stores the reported data will also increase. Moreover, statistics based on event types can only be performed on Android applications with visible interfaces, and statistics cannot be performed on Android applications without visible interfaces (such as some system services). Based on the above analysis, it can be found that the existing statistical methods have problems in both statistical rigor and energy consumption control.
[0028] In response to the above technical problems, an embodiment of the present invention provides an Android application operation statistics method, which monitors the changes in the operation status of the main process, increases, decreases or maintains the records of corresponding information in the cache table in the memory, and makes accurate statistics of the number of operations accordingly. In this process, the time-consuming and power-consuming operations of actively reading and counting data of large files are eliminated, and the amount of information records and running number statistics maintained in the cache table is small, the data processing speed is fast, and the energy consumption required to complete the statistics is low.
[0029] The following describes in detail the embodiments of the present invention.
[0030] Figure 1 This is a method flow chart of an Android application operation statistics method provided by an embodiment of the present invention, and the Android application operation statistics method is implemented by an electronic device. Figure 1 The operation statistics method of the Android application includes steps S110 to S140.
[0031] Step S110: monitoring the running status change of the main process of the Android application.
[0032] In electronic devices based on the Android system (hereinafter referred to as electronic devices), the Android system comes with a service that provides feedback on the status of processes related to Android applications, namely the ActivityManagerService service. Through this service, you can request information about the corresponding process when the Android application is in use or completely closed, and monitor the running status changes of processes related to the Android application. An Android application may have multiple processes in an operating cycle, among which the main process is the basis for the existence and operation of other processes. Different types of processes have different identification or naming specifications. In this solution, in order to improve the accuracy of statistics, only the running status changes of the main process of the Android application in the electronic device are monitored. Specifically, it can be to monitor only the running status changes of the main process, or it can be to monitor the running status changes of all processes and then filter out the running status changes of the main process.
[0033] Monitoring the running status changes through the ActivityManagerService service can be achieved through a customized process monitoring interface, such as a customized interface of IProcessObserver.aidl, which is designed according to the interface specification of the ActivityManagerService service and installed in the electronic device. When the electronic device is turned on, it will broadcast to the Android application through the corresponding interface according to the pre-configuration, and the Android application will listen to the power-on broadcast event in response. The customized process monitoring interface is an Android application. When listening to the power-on broadcast event of the Android device, it completes registration with the ActivityManagerService service of the Android system. During the operation of the electronic device after it is turned on, the customized process monitoring interface can monitor the running status changes of the main process of the Android application from the ActivityManagerService service when the running status of the process changes. Specifically, the corresponding process information can be called back by the ActivityManagerService service, that is, the actual information obtained by monitoring the running status changes is the process information of the running status change.
[0034] The callback event corresponding to the customized process monitoring interface can define the corresponding event interface method name according to the type of specific running state change and / or the type of application corresponding to the process. For example, the callback event of process execution may be a callback event with an interface and a callback event without an interface. For the callback event with an interface, the event interface method name is such as onForegroudActiviesChanged, and for the callback event without an interface, the event interface method name is such as onForegoundServicesChanged. For the callback event of process termination, the event interface method name is such as onProcessDied. In the embodiment of the present invention, entering the execution state refers to the process state change corresponding to an Android application entering the use state. Specifically, it can be the state of opening the Android application through the desktop icon or other shortcuts to start using it without any process running, or it can be the state of resuming the use state after switching to the background running state. Process termination refers to an Android application that, in the current state where there are processes running, ends all processes of the Android application in batches through system tools or through human-computer interaction operations. There may be multiple actual running state changes of the process. In the embodiment of the present invention, it is necessary to monitor the running state changes of entering the execution state and the termination state.
[0035] Step S120: when monitoring that the main process enters the execution state, obtaining the identification information of the main process, and confirming the record status of the identification information in the cache table pre-allocated in the memory.
[0036] When monitoring the change of running status, callback events for the opening and termination of all processes may be received, while in the actual processing process, only the execution and termination of the main process may be processed. After receiving the callback event, it can be confirmed whether it is a callback event of the main process according to the identification or naming rules as described above. The callback event includes the identification information of the relevant process, which may specifically include the process identification and the user identification. In this scheme, the operation statistics of the Android application are performed based on the process identification and the user identification, and the specific statistics are realized by the cache table pre-allocated in the memory. In an embodiment of the present invention, the content recorded in the cache table can be understood as one or more tags, each tag only records the basic identification information of a main process, and the data volume of a single identification information is very small. Even if there are many applications opened in the electronic device during use, resulting in a large number of processes, it still only occupies a small storage space in the memory. The specific statistical result of the number of openings is only one number, the data processing amount in the entire statistical process is very small, the data calculation amount can even be ignored, and the speed of reading directly from the memory is very fast, thereby improving the processing efficiency as a whole and reducing the energy consumption required for statistics.
[0037] Step S130: When the identification information is recorded in the cache table, continue to monitor the running state change; when the identification information is not recorded in the cache table, create a new record of the running information of the main process in the cache table, and count the number of times the Android application is opened.
[0038] As mentioned above, in different situations of entering the execution state, if the Android application re-displays the corresponding window from the background state to enter the use state, the corresponding identification information has been cached when the Android application was previously opened. The current use state is actually just the continuation of the last opening of the Android application. There is no need to update the number of openings, and continue to monitor the change of the running state. If the Android application is opened from the desktop through the application icon to enter the use state without the existence of the corresponding process, then this time entering the execution state is an independent opening operation. When it is opened, the corresponding identification information is not recorded in the cache table. A new record of the running information of the main process is created in the cache table, and the number of openings of the Android application is counted once. Of course, it is also necessary to continue to monitor the change of the running state. In fact, when the electronic device is turned on, as long as this solution is implemented, the monitoring of the change of the running state needs to be maintained. In an embodiment of the present invention, when the running state of the main process changes, whether there is a record of the corresponding running information in the cache table, the corresponding statistical processing is performed, so that accurate statistics can be achieved in the case of a small amount of data processing, and rigorous statistical results can be obtained with low energy consumption.
[0039] When recording specific running information, in addition to the identification information, the package name of the Android application can also be associated and recorded. That is, when the identification information is not recorded in the cache table, the package name of the application is obtained through the getRunningAppProcesses interface of the Android system according to the process ID and user ID; the process ID, user ID and package name are associated and saved in the cache table. Accurate recording of information can be achieved by associating and saving the process ID, user ID and package name.
[0040] While counting the number of times an Android application is opened, the number of times it is used can also be counted. Regardless of the previous running state of the Android application, as long as the main process of the Android application enters the execution state, it is counted as a use state, corresponding to the processing process in the cache table. When the identification information is recorded in the cache table, the number of times an Android application is used is counted while continuing to monitor the change of the running state; while counting the number of times an Android application is opened, the number of times an Android application is used is counted. By counting the number of times an Android application is opened with the same statistical strategy as the number of times an Android application is opened, accurate statistics can be achieved in the case of small amounts of data processing, and rigorous statistical results can be obtained with low energy consumption.
[0041] Step S140: when it is monitored that the main process enters the termination state, the identification information of the main process is obtained, and the running information of the corresponding record is deleted from the cache table according to the identification information.
[0042] The main process enters the termination state, which is equivalent to an Android application no longer running and no corresponding process exists, which means that the usage cycle of the Android application after one opening ends here, and the next post-opening process will follow, and the corresponding statistics of the number of openings will be added based on steps S110-S130.
[0043] When implementing this solution, more information can be recorded in the cache table, including the cumulative result of the usage time of each execution state, so as to realize real-time statistics based on the main process of the Android application. In the specific operation information, the version and name information of the Android application can also be recorded. It should be understood that if the statistical results are saved in the cache table, the statistical results recorded therein need to be saved before deleting the operation information in the cache table each time; of course, the statistical results can also be updated in real time to the record file specified in the non-volatile storage unit, and can be directly deleted when deleting the cache table.
[0044] In the above-mentioned operation statistics method of Android application, the operation status changes of the main process of Android application are monitored; when the main process is monitored to enter the execution state, the identification information of the main process is obtained, and the record status of the identification information in the pre-allocated cache table in the memory is confirmed; when the identification information is recorded in the cache table, the operation status changes are continued to be monitored; when the identification information is not recorded in the cache table, a new record of the operation information of the main process is created in the cache table, and the number of times the Android application is opened is counted; when the main process is monitored to enter the termination state, the identification information of the main process is obtained, and the corresponding recorded operation information is deleted from the cache table according to the identification information. By monitoring the changes in the operation status of the main process, the records of the corresponding information are increased, decreased or maintained in the cache table in the memory, and the accurate statistics of the number of operations are made accordingly. In this process, the time-consuming and power-consuming operations of actively reading and counting data of large files are eliminated, and the amount of information records and the statistical data of the number of operations in the cache table is maintained is small, the data processing speed is fast, and the energy consumption required to complete the statistics is low.
[0045] Figure 3 A schematic diagram of the structure of the running statistics device of Android application provided by the embodiment of the present invention. Figure 3 The operation statistics device of the Android application includes a process status monitoring unit 210, an information record confirmation unit 220, an operation statistics processing unit 230 and an information record deletion unit 240.
[0046] Among them, the process status monitoring unit 210 is used to monitor the running status changes of the main process of the Android application; the information record confirmation unit 220 is used to obtain the identification information of the main process when it monitors that the main process enters the execution state, and confirm the record status of the identification information in the cache table pre-allocated in the memory; the operation statistics processing unit 230 is used to continue to monitor the running status changes when the identification information is recorded in the cache table; when the identification information is not recorded in the cache table, a new record of the running information of the main process is created in the cache table, and the number of times the Android application is opened is counted; the information record deletion unit 240 is used to obtain the identification information of the main process when it monitors that the main process enters the termination state, and delete the corresponding recorded running information from the cache table according to the identification information.
[0047] Based on the above embodiment, the operation statistics device further includes:
[0048] The monitoring interface registration unit is used to register a custom process monitoring interface with the ActivityManagerService service of the Android system when monitoring the boot broadcast event of the Android device;
[0049] Accordingly, the process status monitoring unit 210 includes:
[0050] The interface monitoring module is used to monitor the running status changes of the main process of the Android application from the ActivityManagerService service through the process monitoring interface.
[0051] Based on the above embodiment, the identification information includes a process identification and a user identification.
[0052] Based on the above embodiment, the running statistics unit 230 includes:
[0053] The package name acquisition module is used to obtain the package name of the application through the getRunningAppProcesses interface of the Android system according to the process ID and user ID when there is no record of the identification information in the cache table;
[0054] The information cache module is used to associate the process ID, user ID and package name and save them in the cache table.
[0055] Based on the above embodiment, when the identification information is recorded in the cache table, the number of times the Android application is used is counted while continuing to monitor the running status change; the number of times the Android application is opened is counted while the number of times the Android application is used is counted.
[0056] The Android application operation statistics device provided in the embodiment of the present invention is included in an electronic device and can be used to execute any Android application operation statistics method provided in the above embodiments, and has corresponding functions and beneficial effects.
[0057] It is worth noting that in the embodiment of the operation statistics device of the above-mentioned Android application, the various units and modules included are only divided according to functional logic, but are not limited to the above-mentioned division, as long as the corresponding functions can be realized; in addition, the specific names of the functional units are only for the convenience of distinguishing each other, and are not used to limit the scope of protection of the present invention.
[0058] Figure 3 FIG. 1 is a schematic diagram of the structure of an electronic device provided by an embodiment of the present invention. Figure 3 As shown, the electronic device includes a processor 310 and a memory 320, and may also include an input device 330, an output device 340 and a communication device 350; the number of the processor 310 in the electronic device may be one or more, Figure 3 A processor 310 is taken as an example; the processor 310, the memory 320, the input device 330, the output device 340 and the communication device 350 in the electronic device can be connected via a bus or other means. Figure 3 The example of connecting through bus is taken in the following.
[0059] The memory 320, as a computer-readable storage medium, can be used to store software programs, computer executable programs and modules, such as program instructions / modules corresponding to the operation statistics method of the Android application in the embodiment of the present invention. The processor 310 executes various functional applications and data processing of the electronic device by running the software programs, instructions and modules stored in the memory 320, that is, implements the operation statistics method of the Android application mentioned above.
[0060] The memory 320 may mainly include a program storage area and a data storage area, wherein the program storage area may store an operating system and at least one application required for a function; the data storage area may store data created according to the use of the electronic device, etc. In addition, the memory 320 may include a high-speed random access memory, and may also include a non-volatile memory, such as at least one disk storage device, a flash memory device, or other non-volatile solid-state storage device. In some instances, the memory 320 may further include a memory remotely arranged relative to the processor 310, and these remotely arranged memories may be connected to the electronic device via a network. Examples of the above-mentioned network include, but are not limited to, the Internet, an intranet, a local area network, a mobile communication network, and combinations thereof.
[0061] The input device 330 may be used to receive input digital or character information and generate key signal input related to user settings and function control of the electronic device. The output device 340 may include a display device such as a display screen.
[0062] An embodiment of the present invention also provides a computer-readable storage medium on which a computer program is stored. When the computer program is executed by a processor, it is used to perform relevant operations in the operation statistics method of the Android application provided in any embodiment of the present application, and has corresponding functions and beneficial effects.
[0063] Those skilled in the art should understand that the embodiments of the present application may be provided as methods, systems, or computer program products.
[0064] Therefore, the present application may take the form of a complete hardware embodiment, a complete software embodiment, or an embodiment combining software and hardware. Moreover, the present application may take the form of a computer program product implemented on one or more computer-usable storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) containing computer-usable program code. The present application is described with reference to the flowcharts and / or block diagrams of the methods, devices (systems), and computer program products according to the embodiments of the present application. It should be understood that each process and / or box in the flowchart and / or block diagram, as well as the combination of the processes and / or boxes in the flowchart and / or block diagram, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, a special-purpose computer, an embedded processor, or other programmable data processing device to produce a machine, so that the instructions executed by the processor of the computer or other programmable data processing device generate instructions for implementing the functions in the process. Figure 1 A process or multiple processes and / or boxes Figure 1 These computer program instructions can also be stored in a computer-readable memory that can guide a computer or other programmable data processing device to work in a specific way, so that the instructions stored in the computer-readable memory produce a product including an instruction device, which implements the functions specified in the process. Figure 1 A process or multiple processes and / or boxes Figure 1 These computer program instructions can also be loaded onto a computer or other programmable data processing device, so that a series of operation steps are executed on the computer or other programmable device to produce a computer-implemented process, so that the instructions executed on the computer or other programmable device provide for implementing the process in the process. Figure 1 A process or multiple processes and / or boxes Figure 1 The steps for the functions specified in one or more boxes.
[0065] In a typical configuration, a computing device includes one or more processors (CPU), input / output interfaces, network interfaces, and memory. The memory may include non-permanent memory in a computer-readable medium, random access memory (RAM) and / or non-volatile memory in the form of read-only memory (ROM) or flash RAM. The memory is an example of a computer-readable medium.
[0066] Computer readable media include permanent and non-permanent, removable and non-removable media that can be implemented by any method or technology to store information. Information can be computer readable instructions, data structures, program modules or other data. Examples of computer storage media include, but are not limited to, phase change memory (PRAM), static random access memory (SRAM), dynamic random access memory (DRAM), other types of random access memory (RAM), read-only memory (ROM), electrically erasable programmable read-only memory (EEPROM), flash memory or other memory technology, compact disk read-only memory (CD-ROM), digital versatile disk (DVD) or other optical storage, magnetic cassettes, magnetic tape magnetic disk storage or other magnetic storage devices or any other non-transmission media that can be used to store information that can be accessed by a computing device. As defined herein, computer readable media does not include temporary computer readable media (transitory media), such as modulated data signals and carrier waves.
[0067] It should also be noted that the terms "include", "comprises" or any other variations thereof are intended to cover non-exclusive inclusion, so that a process, method, commodity or device including a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, commodity or device. In the absence of more restrictions, the elements defined by the sentence "comprises a ..." do not exclude the existence of other identical elements in the process, method, commodity or device including the elements.
[0068] Note that the above are only preferred embodiments of the present invention and the technical principles used. Those skilled in the art will understand that the present invention is not limited to the specific embodiments herein, and that various obvious changes, readjustments and substitutions can be made by those skilled in the art without departing from the scope of protection of the present invention. Therefore, although the present invention has been described in more detail through the above embodiments, the present invention is not limited to the above embodiments, and may include more other equivalent embodiments without departing from the concept of the present invention, and the scope of the present invention is determined by the scope of the appended claims.
Claims
1. A running statistics method for an Android application, characterized in that: include: Monitor the running status changes of the main process of the Android application; When monitoring that the main process enters the execution state, obtaining the identification information of the main process, and confirming the record status of the identification information in the cache table pre-allocated in the memory; When the identification information is recorded in the cache table, continue to monitor the running status change; when the identification information is not recorded in the cache table, create a new record of the running information of the main process in the cache table, and count the number of times the Android application is opened; When it is monitored that the main process enters a termination state, the identification information of the main process is obtained, and the running information of the corresponding record is deleted from the cache table according to the identification information.
2. The operation statistics method according to claim 1, characterized in that: Before monitoring the running state change of the main process of the Android application, the method further includes: When monitoring the boot broadcast event of the Android device, register a custom process monitoring interface with the ActivityManagerService service of the Android system; Correspondingly, monitoring the running state change of the main process of the Android application includes: The ActivityManagerService service monitors the running status changes of the main process of the Android application through the process monitoring interface.
3. The operation statistics method according to claim 1 or 2, characterized in that: The identification information includes a process identification and a user identification.
4. The operation statistics method according to claim 3, characterized in that: When the identification information is not recorded in the cache table, creating a new record of the running information of the main process in the cache table includes: When the identification information is not recorded in the cache table, the package name of the application is obtained through the getRunningAppProcesses interface of the Android system according to the process identification and the user identification; The process identifier, user identifier and package name are associated and saved in the cache table.
5. The operation statistics method according to claim 1, characterized in that: When the identification information is recorded in the cache table, the number of times the Android application is used is counted while continuing to monitor the running status change; the number of times the Android application is opened is counted while the number of times the Android application is used is counted.
6. An Android application operation statistics device, characterized in that: include: The process status monitoring unit is used to monitor the running status changes of the main process of the Android application; An information record confirmation unit, configured to obtain identification information of the main process when monitoring that the main process enters an execution state, and confirm a record status of the identification information in a cache table pre-allocated in a memory; A running statistics processing unit, configured to continue to monitor the running status change when the identification information is recorded in the cache table; and to create a new record of the running information of the main process in the cache table when the identification information is not recorded in the cache table, and to count the number of times the Android application is opened; The information record deletion unit is used to obtain the identification information of the main process when monitoring that the main process enters the termination state, and delete the corresponding recorded operation information from the cache table according to the identification information.
7. The operation statistics device according to claim 6, characterized in that: Also includes: The monitoring interface registration unit is used to register a custom process monitoring interface with the ActivityManagerService service of the Android system when monitoring the boot broadcast event of the Android device; Accordingly, the process status monitoring unit includes: The interface monitoring module is used to monitor the running state changes of the main process of the Android application from the ActivityManagerService service through the process monitoring interface.
8. The operation statistics device according to claim 6 or 7, characterized in that: The identification information includes a process identification and a user identification.
9. An electronic device, characterized in that: include: one or more processors; a memory for storing one or more computer programs; When one or more computer programs are executed by one or more processors, the electronic device implements the operation statistics method of the Android application as described in any one of claims 1-6.
10. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores a computer program, which, when executed by a processor, implements the operation statistics method of an Android application as described in any one of claims 1 to 5.
