Binder service monitoring method and device, electronic equipment and storage medium

By obtaining the service identification of the Binder driver process and storing the interaction data, the real-time and targeted problem of service status monitoring in Binder communication is solved, the development and debugging capabilities are improved, and the system load problem is avoided.

CN118689727AInactive Publication Date: 2024-09-24REALME MOBILE TELECOMM SHENZHEN CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202310310238.3
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2023-03-21
Publication Date
2024-09-24
Estimated Expiration
Not applicable · inactive patent

AI Technical Summary

Technical Problem

The existing service status monitoring in Binder communication relies on the system's own debug node. The data is not real-time and targeted, and frequent service interaction data storage will cause the system to be overloaded and affect performance.

Method used

By obtaining the service identifier of the current service that accesses the Binder driver process, and responding to the fact that the service identifier exists in the set of service identifiers to be monitored, the interaction data of the current service is stored in a predetermined monitoring record file to achieve real-time and targeted monitoring of the service. monitor.

Benefits of technology

Without affecting the user experience, real-time monitoring and data storage of Binder services are realized, which improves the ability of developers and debuggers to monitor service status and avoids system performance damage.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118689727A
    Figure CN118689727A
Patent Text Reader

Abstract

The invention discloses a Binder service monitoring method and device, electronic equipment and a storage medium, and the method comprises the steps: obtaining a service identifier of a current service accessing a Binder driving process; and in response to the fact that the service identifier of the current service exists in the to-be-monitored service identifier set, storing interaction data of the current service in a predetermined monitoring record file. By means of the method, the Binder service can be monitored in real time in a targeted mode.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the technical field of electronic equipment, and in particular to a Binder service monitoring method, device, electronic equipment and storage medium. Background Art

[0002] In the Android operating system, data transmission is often required between applications and services, which can generally be carried out in the form of inter-process communication. For example, the data can be transmitted through the Binder mechanism to obtain the other party's data.

[0003] However, currently, the status monitoring of services in Binder communication is mainly carried out through the debug node that comes with the system, but the node data is only a snapshot of a certain point, and the data is real-time and lacks specificity. Summary of the invention

[0004] The first aspect of the present application provides a Binder service monitoring method, including: obtaining a service identifier of a current service accessing a Binder driver process; in response to the service identifier of the current service being present in a set of service identifiers to be monitored, storing interaction data of the current service in a predetermined monitoring record file.

[0005] The second aspect of the present application provides a Binder service monitoring device, including: an acquisition module, used to obtain the service identifier of the current service accessing the Binder driver process; a response module, used to store the interaction data of the current service in a predetermined monitoring record file in response to the service identifier of the current service being present in the set of service identifiers to be monitored.

[0006] A third aspect of the present application provides an electronic device, which includes a memory and a processor coupled to each other, the memory is used to store program data, and the processor is used to execute the program data to implement the aforementioned method.

[0007] A fourth aspect of the present application provides a computer-readable storage medium, in which program data is stored. When the program data is executed by a processor, it is used to implement the aforementioned method.

[0008] The beneficial effect of the present application is as follows: different from the prior art, the present application obtains the service identifier of the current service accessing the Binder driver process, and then, in response to the service identifier of the current service existing in the set of service identifiers to be monitored, stores the interaction data of the current service in a predetermined monitoring record file. When the current service accesses the Binder driver process, the interaction data of the current service can be stored, and the services corresponding to the set of service identifiers to be monitored can be monitored in a targeted manner. BRIEF DESCRIPTION OF THE DRAWINGS

[0009] In order to more clearly illustrate the technical solutions in this application, the following briefly introduces the drawings required in the description of the embodiments. Obviously, the drawings described below are only some embodiments of this application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without creative work. Among them:

[0010] Figure 1 This is a schematic diagram of the principle of the Binder communication mechanism;

[0011] Figure 2 It is a schematic diagram of the principle of inter-process communication;

[0012] Figure 3 This is a flow chart of an embodiment of the Binder service monitoring method of the present application;

[0013] Figure 4 It is a flowchart of another embodiment of the Binder service monitoring method of the present application;

[0014] Figure 5 yes Figure 4 A schematic diagram of a flow chart of an implementation method of step S22;

[0015] Figure 6 yes Figure 5 A schematic diagram of a flow chart of an embodiment of step S221;

[0016] Figure 7 yes Figure 4 A schematic diagram of a flow chart of an implementation method of step S24;

[0017] Figure 8 yes Figure 7 A schematic diagram of a flow chart of an implementation method of step S242;

[0018] Fig. 9 It is a flow chart of the main structure of the monitoring service in the Binder service monitoring method of this application;

[0019] Fig.10 It is a schematic structural block diagram of an embodiment of the Binder service monitoring device of the present application;

[0020] Fig.11 It is a schematic block diagram of the structure of an embodiment of the electronic device of the present application;

[0021] Fig.12 It is a schematic block diagram of the structure of an embodiment of a computer-readable storage medium of the present application. DETAILED DESCRIPTION

[0022] Reference to "embodiments" in this application means that a particular feature, structure, or characteristic described in conjunction with the embodiments may be included in at least one embodiment of the present application. The appearance of the phrase in various locations in the specification does not necessarily refer to the same embodiment, nor is it an independent or alternative embodiment that is mutually exclusive with other embodiments. It is explicitly and implicitly understood by those skilled in the art that the embodiments described herein may be combined with other embodiments.

[0023] The terms "first" and "second" in this application are only used for descriptive purposes and cannot be understood as indicating or implying relative importance or implicitly indicating the number of indicated technical features. Thus, the features defined as "first" and "second" can explicitly or implicitly include at least one of the features. In the description of this application, the meaning of "multiple" is at least two, such as two, three, etc., unless otherwise clearly and specifically defined. In addition, the terms "including" and "having" and any of their variations are intended to cover non-exclusive inclusions. For example, a process, method, system, product or device that includes a series of steps or units is not limited to the listed steps or units, but optionally also includes steps or units that are not listed, or optionally also includes other steps or units inherent to these processes, methods, products or devices.

[0024] The following will be combined with the drawings in the embodiments of the present application to clearly and completely describe the technical solutions in the embodiments of the present application. Obviously, the described embodiments are only part of the embodiments of the present application, not all of the embodiments. Based on the embodiments in the present application, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of this application.

[0025] See also Figure 1 to Figure 2 , Figure 1 This is a schematic diagram of the principle of the Binder communication mechanism. Figure 2 It is a schematic diagram of the principle of inter-process communication.

[0026] Binder communication adopts C / S architecture. From the perspective of components, it includes Client (client or application end), Server (server end), ServiceManager (service management) and Binder driver, among which ServiceManager is used to manage various services in the system. Client process is the process that uses the service; Server process is the process that provides the service; the role of ServiceManager process is to convert the character-based Binder name into a reference to the Binder in the Client, so that the Client can obtain a reference to the Binder entity in the Server through the Binder name; Binder driver is responsible for the establishment of Binder communication between processes, the transfer of Binder between processes, Binder reference count management, the transfer and interaction of data packets between processes, and a series of underlying support.

[0027] like Figure 1 As shown in the figure, each Android process can only run in the virtual address space owned by its own process. For example, for a 4GB virtual address space, 3GB is user space and 1GB is kernel space. Of course, the size of the kernel space can be adjusted through parameter configuration. For user space, different processes cannot share each other, but kernel space can be shared. When the client process communicates with the server process, it uses the kernel memory space that can be shared between processes to complete the underlying communication work. The client and server processes often use ioctl (a function in a device driver that manages the I / O channel of the device) and other methods to interact with the kernel space driver.

[0028] like Figure 2 As shown in the figure, the communication process based on the Binder mechanism mainly includes the following three processes:

[0029] Registering a service (addService): The Server process must first register the Service to the ServiceManager. In this process: the Server is the client and the ServiceManager is the server.

[0030] Get Service (getService): Before the Client process uses a Service, it must first obtain the corresponding Service from the ServiceManager. In this process: Client is the client and ServiceManager is the server.

[0031] Using the service: The client establishes a communication channel with the server process where the service is located based on the service information obtained, and then can directly interact with the service. In this process: the client is the client and the server is the service end.

[0032] Understandably, Figure 2 The interactions between Client, Server, and ServiceManager are all represented by dotted lines because they do not interact directly with each other, but interact with the Binder driver to achieve IPC communication. The Binder driver is located in the kernel space, and the Client, Server, and ServiceManager are located in the user space. The Binder driver and ServiceManager can be regarded as the basic architecture of the Android platform, while the Client and Server are the application layer of Android. Developers only need to customize the Client and Server ends, and they can directly perform IPC communication with the help of the basic platform architecture of Android.

[0033] Based on the principle of the above Binder mechanism, we know that the client and the server can be any two processes, applications or services. For example, it can be communication between applications or between applications and services.

[0034] The Binder service monitoring method provided in this embodiment is mainly applied to the service usage process in the above-mentioned communication process based on the Binder mechanism, but is not limited thereto.

[0035] At present, the status monitoring of services in Binder communication is mainly carried out through the system's own debug node ( / dev / Binderfs / Binder_logs / state), but the node data is only a snapshot of a certain point, and the data is real-time and lacks pertinence. In addition, since Binder is used very frequently, there is currently no design to store the interactive data of the service, otherwise, a large amount of data needs to be stored, which will cause the entire system to be very heavily loaded, thereby affecting system performance. The difference is that this application can apply the Binder service monitoring method to at least one of the development scenario and the background debugging scenario, so as to enhance the real-time and targeted monitoring of the status of the service in Binder by developers or debuggers. In addition, since it is not a user usage scenario, it will not affect the user experience.

[0036] See also Figure 3 , Figure 3It is a flow chart of an embodiment of the Binder service monitoring method of the present application. Among them, the execution subject of the present application is a mobile phone, a tablet computer, a laptop computer, a desktop computer, a smart wearable device, a smart home appliance and other electronic devices, and the operating system of the electronic device can be an Android system.

[0037] The method may include the following steps:

[0038] Step S11: Obtain the service identifier of the current service accessing the Binder driver process.

[0039] In the Binder communication mechanism, each service corresponds to a unique service identifier, which is used to uniquely identify the service. Binder driver is the Binder driver process.

[0040] In one embodiment, the service identifier can be a handle identifier, which is a unique identifier of the service in the ServiceManager. Specifically, the Binder system determines the BBinder corresponding to the BpBinder through the handler. Among them, BpBinder is a proxy class used by the client to interact with the Server, and p means Proxy. BBinder is the opposite end of the proxy, and it is the destination end of the proxy interaction. If Proxy represents the client, then BBinder represents the server. BpBinder and BBinder are one-to-one corresponding, and BpBinder can identify the corresponding BBinder through the handle value.

[0041] In one example, the Binder system includes multiple services (eg, n, where n is a positive integer), namely, service 1 to service N, and their corresponding handle identifiers are shown in the following table:

[0042] Table 1 Correspondence between service names and handle identifiers

[0043]

[0044]

[0045] Among them, the handle identifier corresponding to each service is different.

[0046] If the handle value of BpBinder is 0, then the BpBinder is the Binder reference of the servicemanager. If the handle value of BpBinder is not 0, the handle value is the handle of different Services, which associates each Service.

[0047] In an application scenario, when a service accesses the Binder driver based on a service identifier, the Binder driver can obtain the service identifier of the service. Specifically, the service identifier of the service can be obtained when the Binder driver detects that a service is performing a transaction operation or other similar operations. Among them, the transaction operation is an operation performed by calling the Binder_transaction() function. The Binder_transaction() function is mainly used to find the relevant information of the target process, and then copy the data to the physical memory block mapped by the target process at one time, and then record the tasks to be processed, wake up the target thread; and the calling thread goes to sleep, and then after the target process gets the data for processing, wake up the calling thread and return the processing result. Among them, when the Binder driver detects a transaction operation, it determines that a service is accessing the Binder driver.

[0048] Among them, the Binder driver can be monitored in the Binder_open(), Binder_ioctl(), Binder_mmap() interface or associated interface. Among them, Binder_open() is used to call the creation of Binder_proc objects in the Binder driver, Binder_ioctl() mainly performs read and write operations, and Binder_mmap can associate virtual memory with specified physical memory.

[0049] Taking Binder_ioctl as an example, since most Binder operations are IO operations (i.e. input and output operations), almost all Binder operations must go through ioctl to complete an IO operation, so if the service accesses the Binder driver, it can be monitored in the Binder_ioctl interface.

[0050] Optionally, the service identifier may also be other identifiers that can uniquely identify the service, which is not limited here. The service identifier may be composed of numbers, characters, strings, and the like.

[0051] In an application scenario, when there are multiple services accessing the Binder driver process at one time, the service identifier corresponding to each service can be obtained respectively.

[0052] Step S12: In response to the service identifier of the current service being in the set of service identifiers to be monitored, storing the interaction data of the current service in a predetermined monitoring record file.

[0053] In some implementations, the interaction data to be stored may be customized, for example, only the interaction data corresponding to the target interaction behavior may be stored.

[0054] The service identifiers to be monitored centrally store the service identifiers of several services to be monitored. The services to be monitored include AMS (ActivityManagerService, Activity Management Service), WMS (Window Manager Service, Window Management Service), PMS (Power Manager Service, Power Management Service) and other services. AMS, PMS and WMS are all threads running in the systemserver process.

[0055] Optionally, the set of service identifiers to be monitored may be preset, for example, pre-set in the electronic device by a developer, and the preset set of service identifiers to be monitored may be modified during subsequent use. Alternatively, it may be set during use, for example, when a developer needs to debug an electronic device, the set of service identifiers to be monitored may be formed using the service identifiers of the service to be monitored.

[0056] Optionally, the set of service identifiers to be monitored may be stored in the form of a list or text, or may be directly recorded in a program, which is not limited here.

[0057] Among them, the interaction data is the relevant data of the mutual behavior of the services, for example, it may include access time (such as timestamp information), access frequency, service response time, access source (for example, the UID, PID, code parameters of the source), etc., where UID is the user ID, PID is the process ID, and each Binder service usually provides multiple service interfaces. The code parameter is used to number and distinguish the service interfaces.

[0058] If the service identifier of the current service exists in the set of service identifiers to be monitored, it means that the current service belongs to the service to be monitored, so the interaction data of the current service can be stored in the predetermined monitoring record file, so as to be viewed by printing data later. On the contrary, if the service identifier of the current service does not exist in the set of service identifiers to be monitored, it means that the current service does not belong to the service to be monitored, and the interaction data of the current service may not be stored in the predetermined monitoring record file.

[0059] In this embodiment, the Binder driver process may specifically obtain the service identifier of the current service accessing the Binder driver process, and then in response to the service identifier of the current service existing in the service identifier set to be monitored, store the interaction data of the current service in a predetermined monitoring record file.

[0060] The above scheme obtains the service identifier of the current service that accesses the Binder driver process, and then stores the interaction data of the current service in a predetermined monitoring record file in response to the service identifier of the current service existing in the set of service identifiers to be monitored. When the current service accesses the Binder driver process, the interaction data of the current service can be stored, and the services corresponding to the set of service identifiers to be monitored can be monitored in a targeted manner.

[0061] See also Figure 4 , Figure 4 is a flowchart of another embodiment of the Binder service monitoring method of the present application, Figure 5 yes Figure 4 A schematic diagram of a flow chart of an implementation method of step S22 in FIG. Figure 6 yes Figure 5 The flowchart of step S221 in the embodiment is as follows, Figure 7 yes Figure 4 A schematic flow chart of an implementation method of step S24 in FIG. Figure 8 yes Figure 7 FIG. 5 is a flow chart of an implementation method of step S242 in FIG.

[0062] The method may include the following steps:

[0063] Step S21: Obtain the service identifier of the current service accessing the Binder driver process.

[0064] For the description of this step, please refer to the aforementioned embodiment and will not be repeated here.

[0065] It can be understood that there is no definite order between step S21 and steps S22 and S23.

[0066] Step S22: Obtain the service identifier corresponding to each service to be monitored to form a set of service identifiers to be monitored.

[0067] In some implementations, step S22 may include sub-steps S221 and S222.

[0068] Step S221: Obtain a configuration file containing the service to be monitored.

[0069] Wherein, the configuration file includes the name of the service to be monitored or other content that can uniquely identify the service. In some implementations, the configuration file can be a json file, or a jsonl file, a jsonlines file, or an XML file, etc.

[0070] Optionally, the configuration file may be pre-configured or manually configured during application. For example, the developer may select the services to be monitored from the displayed services or manually input the services to be monitored, and then the electronic device may automatically generate the corresponding configuration file based on the user input.

[0071] In some embodiments, step S221 may include sub-steps S2211 and S2212.

[0072] Step S2211: Determine whether the configuration file containing the service to be monitored has been loaded.

[0073] Among them, the instructions and data required for the program to run normally must be in the memory, and the process of loading these required data is called loading. That is, it can be determined whether the configuration file containing the service to be monitored already exists in the memory.

[0074] Step S2212: In response to the configuration file being loaded, obtaining the configuration file including the service to be monitored.

[0075] In response to the configuration file not being loaded, a message indicating that the configuration file has not been loaded is outputted to prompt the developer to load the configuration file, or to prompt the developer that a problem occurred during the loading of the configuration file, resulting in the configuration file not being loaded successfully.

[0076] Step S222: Obtain the service identifier corresponding to each service to be monitored in the configuration file from the system service management process to form a set of service identifiers to be monitored.

[0077] Among them, the system service management process (ServiceManager) manages the correspondence between all services and service identifiers in the Binder. Therefore, the service identifier corresponding to each service to be monitored in the configuration file can be found from the system service management process to form a set of service identifiers to be monitored.

[0078] Specifically, the service list in the ServiceManager stores all services in the Binder and their corresponding handle identifiers.

[0079] In some implementations, Binder communication not only accesses services through ServiceManager, but also can access services in other ways. Therefore, not only can the service identifier corresponding to each service to be monitored in the configuration file be obtained from the system service management process, but also the service identifier corresponding to each service to be monitored in the configuration file can be obtained from other processes. There is no limitation here.

[0080] Step S23: Send the service identifier set to be monitored to the Binder driver process.

[0081] Since the service identifier of the current service accessing the Binder driver process is obtained based on the Binder driver process, and the Binder driver process executes the judgment step that the service identifier of the current service exists in the service identifier set to be monitored, after obtaining the service identifier set to be monitored from the ServiceManager, the service identifier set to be monitored is transmitted to the Binder driver process for subsequent processing.

[0082] In some embodiments, before step S23, it may also include: determining whether the service identification set to be monitored is empty; in response to the service identification set to be monitored being not empty, executing to send the service identification set to be monitored to the Binder driver process. Specifically, the service identification set to be monitored being not empty indicates that the service identification set to be monitored contains at least one service identification corresponding to the service to be monitored, and the service identification set to be monitored being empty indicates that the service identification set to be monitored does not contain the service identification corresponding to the service to be monitored. It is understandable that when the service identification set to be monitored does not contain the service identification corresponding to the service to be monitored, it is meaningless even if the service identification set to be monitored is sent to the Binder driver process. In addition, if in response to the service identification set to be monitored being empty, the service identification set to be monitored is output to be empty to prompt the developer.

[0083] Specifically, the set of service identifiers to be monitored can be passed to a global array customized by the Binder driver process through a system call. This global array is used to drive the switch for monitoring points, that is, to drive the Binder driver to start monitoring, such as starting to record the interaction data of the service to be monitored.

[0084] Step S24: In response to the service identifier of the current service being in the set of service identifiers to be monitored, storing the interaction data of the current service in a predetermined monitoring record file.

[0085] In some embodiments, step S24 may include sub-steps S241 and S242.

[0086] Step S241: In response to the service identifier of the current service being in the set of service identifiers to be monitored, the interaction data of the current service is stored in a structure of the Binder driver process, wherein the structure is used to store the interaction data of all services to be monitored in the set of service identifiers to be monitored.

[0087] Among them, a structure is a data set consisting of a series of data of the same or different types. A structure is a collection of elements of different types (elements can be atomic types such as integers, floating-point types, characters, or structures, arrays, etc.).

[0088] Step S242: Write the interaction data in the structure into the monitoring record file.

[0089] Specifically, the Binder driver can call the writing thread to write the interaction data in the structure into the monitoring record file.

[0090] In some implementations, step S242 may include sub-steps S2421 - S2423 .

[0091] Step S2421: copy the interaction data from the structure.

[0092] Step S2422: sort the interaction data using the service identifier as an index.

[0093] The sorted interaction data is associated with the service identifier, and based on the service identifier, the interaction data corresponding to the service identifier can be obtained.

[0094] In some implementations, organizing the interaction data may further include: searching for the application package name corresponding to the UID in the interaction data, and then associating the UID with the application package name and storing it as the interaction data. Since developers cannot directly identify the application corresponding to the UID, converting the UID into an application package name is more intuitive.

[0095] In some embodiments, after the interaction data is sorted, the following may be included: sorting the interaction data, for example, the interaction data may be sorted according to at least one of the service identifier and the time cluster. Specifically, the interaction data may be sorted initially according to the order (1 to n) of the service identifier, and then the interaction data corresponding to each service identifier may be sorted according to the timestamp information. Alternatively, the interaction data may be sorted initially according to the timestamp information, and then the interaction data corresponding to each timestamp may be sorted according to the service identifier.

[0096] Step S2423: Write the sorted interaction data into the monitoring record file.

[0097] It can be understood that the steps of collating the interaction data and writing the interaction data into the monitoring record file are not driven by Binder, but are executed by an independent writing thread, which implements multi-threaded processing and avoids the processing affecting the transmission efficiency of Binder itself.

[0098] In some application scenarios, the interaction data in the monitoring record file can also be used as a data source for service usage habits and as a learning object for big data processing. By analyzing the interaction data, corresponding execution instructions can be generated to achieve intelligent adjustment of the interaction status of the Binder service based on the interaction data. For example, if an application has a high frequency of access to a service, the application's access to the service can be restricted.

[0099] See also Fig. 9 , Fig. 9It is a flow chart of the main structure of the monitoring service in the Binder service monitoring method of this application.

[0100] Among them, the monitoring service includes the monitoring main thread, the Binder driver process, the writing thread, etc. The monitoring main thread is used to start loading the configuration file, and then access the ServiceManager to obtain the service identification set to be monitored corresponding to the configuration file, and then pass the service identification set to be monitored into the global array in the Binder driver to enable the Binder driver to start monitoring. When the Binder driver obtains the service identification of the current service accessing the Binder driver, and in response to the service identification of the current service existing in the service identification set to be monitored, the interaction data of the current service is stored in the structure of the Binder driver process to wake up the writing thread to write the interaction data in the structure into the monitoring record file, wherein the interaction data can also be sorted before writing into the monitoring record file.

[0101] Through the above scheme, this application realizes the operation carrier with a customized monitoring service based on Framework as the main body, which can effectively and without omission record the comprehensive interaction information of one or several services. This information can be used to determine the behavior habits of a service in the system, so that service developers can identify and deal with some potential impacts on usage efficiency and usage risks in a targeted manner, thereby improving the overall robustness and execution efficiency of the system.

[0102] Among them, the above solution monitors the Binder service, mainly realizing the interception of read and write services by the Binder driver, that is, the specific monitoring location is in the Binder driver. The role of ServiceManager is to extract the service identifier corresponding to the service in the configuration file. Later, in the debugging stage, developers can obtain the log information corresponding to the target service and target interaction behavior through debug. The Framework only sets the monitoring switch (i.e. loading the configuration file) and data collection (i.e. obtaining the service identifier from the ServiceManager) to control the calling logic of the Binder driver system.

[0103] In some embodiments, the application scenario of the present application may not be limited to the debugging scenario before the device leaves the factory. The monitoring service corresponding to the present application may also be configured in the device, which is not enabled in the user usage scenario and is only enabled when the device has problems and needs debugging. This is equivalent to presetting a set of debug mechanisms in the device.

[0104] See also Fig.10 , Fig.10 It is a structural schematic block diagram of an embodiment of the Binder service monitoring device of the present application.

[0105] The Binder service monitoring device 100 may include an acquisition module 110 and a response module 120, wherein the acquisition module 110 is used to obtain the service identifier of the current service accessing the Binder driver process; the response module 120 is used to store the interaction data of the current service in a predetermined monitoring record file in response to the service identifier of the current service being present in the set of service identifiers to be monitored.

[0106] In some embodiments, the response module 120 is also used to obtain the service identifier corresponding to each service to be monitored in response to the service identifier of the current service existing in the service identifier set to be monitored, before storing the interaction data of the current service in a predetermined monitoring record file, to form a service identifier set to be monitored; and send the service identifier set to be monitored to the Binder driver process.

[0107] In some implementations, the response module 120 is specifically configured to obtain a configuration file containing services to be monitored; obtain a service identifier corresponding to each service to be monitored in the configuration file from a system service management process to form a set of service identifiers to be monitored.

[0108] In some implementations, the response module 120 is specifically configured to determine whether the configuration file including the service to be monitored has been loaded; in response to the configuration file being loaded, the configuration file including the service to be monitored is acquired.

[0109] In some embodiments, the response module 120 is also used to determine whether the service identification set to be monitored is empty before sending the service identification set to the Binder driver process; in response to the service identification set to be monitored being not empty, the service identification set to be monitored is sent to the Binder driver process.

[0110] In some embodiments, the response module 120 is specifically used to store the interaction data of the current service in a structure of the Binder driver process in response to the service identifier of the current service being present in the set of service identifiers to be monitored, wherein the structure is used to store the interaction data of all monitored services in the set of service identifiers to be monitored; and write the interaction data in the structure into a monitoring record file.

[0111] In some implementations, the response module 120 is specifically used to copy the interaction data from the structure; organize the interaction data using the service identifier as an index; and write the organized interaction data into a monitoring record file.

[0112] In the embodiment of the present device, for the description of the steps executed by each module, please refer to the corresponding position in the above method embodiment, which will not be repeated here.

[0113] See also Fig.11 , Fig.11 It is a schematic structural block diagram of an embodiment of an electronic device of the present application.

[0114] The electronic device 200 includes a memory 210 and a processor 220 coupled to each other. The memory 210 is used to store program data, and the processor 220 is used to execute the program data to implement the steps in any of the above method embodiments.

[0115] The electronic device 200 may include, but is not limited to: personal computers (e.g., desktops, laptops, tablet computers, PDAs, etc.), mobile phones, servers, wearable devices, augmented reality (AR), virtual reality (VR) devices, televisions, etc., without limitation here.

[0116] Specifically, the processor 220 is used to control itself and the memory 210 to implement the steps in any of the above method embodiments. The processor 220 may also be referred to as a central processing unit (CPU). The processor 220 may be an integrated circuit chip having signal processing capabilities. The processor 220 may also be a general-purpose processor, a digital signal processor (DSP), an application-specific integrated circuit (ASIC), a field-programmable gate array (FPGA) or other programmable logic devices, discrete gates or transistor logic devices, discrete hardware components. The general-purpose processor may be a microprocessor or the processor may also be any conventional processor, etc. In addition, the processor 220 may be implemented by a plurality of integrated circuit chips.

[0117] See also Fig.12 , Fig.12 It is a schematic block diagram of the structure of an embodiment of a computer-readable storage medium of the present application.

[0118] The computer-readable storage medium 300 stores program data 310 , and when the program data 310 is executed by a processor, it is used to implement the steps in any of the above method embodiments.

[0119] The computer-readable storage medium 300 can be a medium that can store computer programs, such as a USB flash drive, a mobile hard disk, a read-only memory (ROM), a random access memory (RAM), a disk or an optical disk, or it can be a server that stores the computer program. The server can send the stored computer program to other devices for execution, or it can also execute the stored computer program itself.

[0120] As mentioned above, the term "and / or" in this application is only a description of the association relationship of associated objects, indicating that three relationships may exist. For example, A and / or B can represent the three situations that A exists alone, A and B exist at the same time, and B exists alone. In addition, the term "at least one" in this application represents any combination of at least two of any one or more of a plurality of. For example, including at least one of A, B, and C can represent including any one or more elements selected from the set consisting of A, B, and C.

[0121] In the several embodiments provided in the present application, it should be understood that the disclosed methods and devices can be implemented in other ways. For example, the device implementation described above is only schematic. For example, the division of modules or units is only a logical function division. There may be other division methods in actual implementation, such as multiple units or components can be combined or integrated into another system, or some features can be ignored or not executed. Another point is that the mutual coupling or direct coupling or communication connection shown or discussed can be through some interfaces, and the indirect coupling or communication connection of devices or units can be electrical, mechanical or other forms.

[0122] The units described as separate components may or may not be physically separated, and the components shown as units may or may not be physical units, that is, they may be located in one place or distributed on multiple network units. Some or all of the units may be selected according to actual needs to achieve the purpose of the present embodiment.

[0123] In addition, each functional unit in each embodiment of the present application may be integrated into one processing unit, or each unit may exist physically separately, or two or more units may be integrated into one unit. The above-mentioned integrated unit may be implemented in the form of hardware or in the form of software functional units.

[0124] If the integrated unit is implemented in the form of a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the present application is essentially or the part that contributes to the prior art or all or part of the technical solution can be embodied in the form of a software product, and the computer software product is stored in a storage medium, including a number of instructions to enable a computer device (which can be a personal computer, server, or network device, etc.) or a processor (processor) to perform all or part of the steps of each implementation method of the present application. The aforementioned storage medium includes: U disk, mobile hard disk, read-only memory (ROM, Read-Only Memory), random access memory (RAM, Random Access Memory), disk or optical disk and other media that can store program code.

[0125] The above descriptions are merely embodiments of the present application and are not intended to limit the patent scope of the present application. Any equivalent structure or equivalent process transformation made using the contents of the present application specification and drawings, or directly or indirectly applied in other related technical fields, are also included in the patent protection scope of the present application.

Claims

1. A Binder service monitoring method, characterized in that: include: Get the service ID of the current service that accesses the Binder driver process; In response to the service identifier of the current service being in the set of service identifiers to be monitored, the interaction data of the current service is stored in a predetermined monitoring record file.

2. The method according to claim 1, characterized in that In response to the service identifier of the current service being present in the set of service identifiers to be monitored, before storing the interaction data of the current service in a predetermined monitoring record file, the method includes: Obtain the service identifier corresponding to each service to be monitored to form a set of service identifiers to be monitored; The service identifier set to be monitored is sent to the Binder driver process.

3. The method according to claim 2, characterized in that The step of obtaining a service identifier corresponding to each service to be monitored to form a set of service identifiers to be monitored includes: Get the configuration file containing the service to be monitored; The service identifier corresponding to each service to be monitored in the configuration file is obtained from the system service management process to form a set of service identifiers to be monitored.

4. The method according to claim 3, characterized in that The step of obtaining a configuration file containing the service to be monitored includes: Determine whether the configuration file containing the service to be monitored has been loaded; In response to the configuration file being loaded, obtaining a configuration file including the service to be monitored.

5. The method according to claim 2, characterized in that Before sending the service identifier set to be monitored to the Binder driver process, the method further includes: Determine whether the set of service identifiers to be monitored is empty; In response to the to-be-monitored service identification set being not empty, the to-be-monitored service identification set is sent to a Binder driver process.

6. The method according to any one of claims 1 or 2, characterized in that: In response to the service identifier of the current service being present in the set of service identifiers to be monitored, storing the interaction data of the current service in a predetermined monitoring record file includes: In response to the service identifier of the current service being present in the set of service identifiers to be monitored, storing the interaction data of the current service in a structure of the Binder driver process, wherein the structure is used to store the interaction data of all services to be monitored in the set of service identifiers to be monitored; The interaction data in the structure is written into the monitoring record file.

7. The method according to claim 6, characterized in that The step of writing the interaction data in the structure into the monitoring record file includes: copying the interaction data from the structure; sorting the interaction data using the service identifier as an index; The sorted interaction data is written into the monitoring record file.

8. A Binder service monitoring device, characterized in that: include: The acquisition module is used to obtain the service identifier of the current service that accesses the Binder driver process; The response module is used for storing the interaction data of the current service into a predetermined monitoring record file in response to the service identifier of the current service existing in the set of service identifiers to be monitored.

9. An electronic device, characterized in that: The electronic device comprises a memory and a processor coupled to each other, the memory is used to store program data, and the processor is used to execute the program data to implement the method according to any one of claims 1 to 7.

10. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores program data, and when the program data is executed by a processor, it is used to implement the method according to any one of claims 1 to 7.