CN117453513A - Log acquisition method and related equipment - Google Patents

Log acquisition method and related equipment Download PDF

Info

Publication number
CN117453513A
CN117453513A CN202311770171.8A CN202311770171A CN117453513A CN 117453513 A CN117453513 A CN 117453513A CN 202311770171 A CN202311770171 A CN 202311770171A CN 117453513 A CN117453513 A CN 117453513A
Authority
CN
China
Prior art keywords
target
data
application
service module
application program
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
CN202311770171.8A
Other languages
Chinese (zh)
Inventor
刘铁
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Honor Device Co Ltd
Original Assignee
Honor Device Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Honor Device Co Ltd filed Critical Honor Device Co Ltd
Priority to CN202311770171.8A priority Critical patent/CN117453513A/en
Publication of CN117453513A publication Critical patent/CN117453513A/en
Pending legal-status Critical Current

Links

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F11/00Error detection; Error correction; Monitoring
    • G06F11/30Monitoring
    • G06F11/34Recording or statistical evaluation of computer activity, e.g. of down time, of input/output operation ; Recording or statistical evaluation of user activity, e.g. usability assessment
    • G06F11/3466Performance evaluation by tracing or monitoring
    • G06F11/3476Data logging
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F18/00Pattern recognition
    • G06F18/20Analysing

Abstract

The application provides a log acquisition method and related equipment. In the method, aiming at a target fault of a third-party application program, the electronic equipment acquires target first type data by utilizing a diagnosis service module of an operating system and sends the target first type data to the third-party application program. Wherein the target first type data is unstructured log data recording the running status of the third party application program. The method can enable the application program to process the target fault and improve the success rate of solving the fault, is beneficial to the optimization of the third party application program, improves the optimization efficiency, and improves the user experience. In some embodiments, in response to the operation of opening the enhanced function switch by the user, the method is used for transmitting the target first type data, so that the situation that the central processing unit is occupied due to the fact that the first type data are transmitted without permission of the user can be reduced, and user experience is improved.

Description

Log acquisition method and related equipment
Technical Field
The present disclosure relates to the field of terminal technologies, and in particular, to a log obtaining method and related devices.
Background
When an application program runs in the electronic equipment, faults such as performance faults (such as no response of the application program, application killing, application breakdown and the like), stability faults (such as overtime of application starting, frame loss of animation and the like) or power consumption faults (such as abnormal power consumption) and the like can be generated, so that the user experience is affected.
Because the application program is at the upper layer of the operating system, the fault cannot be directly diagnosed in the electronic equipment and the information related to the fault is collected, so that the fault cannot be positioned and the solution of the fault cannot be determined.
Disclosure of Invention
The application provides a log obtaining method and related equipment, which can improve user experience.
In a first aspect, a log obtaining method is applied to an electronic device, where the electronic device includes a diagnostic service module and a first application program, the first application program is a third party application program, and the diagnostic service module belongs to an operating system of the electronic device, and the method includes: the method comprises the steps that a diagnosis service module is used for obtaining target diagnosis data, the target diagnosis data are used for processing target faults of a first application program, the target diagnosis data comprise target first type data, and the target first type data are unstructured log data for recording the running conditions of the first application program; the diagnostic service module is utilized to send the target diagnostic data to the first application.
According to the scheme, the application program can process the target fault, optimization of the third-party application program is facilitated, the optimization efficiency is improved, and therefore user experience is improved. Compared with the mode of providing log data of a period of time before and after the occurrence time point of the target fault, the target first type data can be used for a third party application program to comprehensively acquire data related to the occurrence of the target fault, so that the success rate of solving the fault is improved.
Wherein the first type of data is unstructured log data. The first type of data records the operating conditions of the application. Wherein recording log data of the running condition of the first application program includes: the trace information of the process by which the application invokes the system interface to complete the service and/or data related to faults occurring during the running of the application.
It can be understood that the diagnosis service module of the operating system provides the data for processing the target fault for the first application program, so that the application program can accurately process the target fault, thereby being beneficial to the optimization of the third party application program, improving the optimization efficiency and improving the user experience.
It can be further appreciated that, compared to the manner of providing log data of a period of time before and after the occurrence time point of the target fault, the target first type data can be provided for the third party application program to comprehensively obtain the data related to the occurrence of the target fault, thereby improving the success rate of solving the fault.
In one possible embodiment, the target first type of data comprises: tracking information of a process of calling an interface of an operating system by the first application program for completing the service, and/or data related to a fault occurring during the running of the first application program, wherein the occurring fault comprises a target fault.
Illustratively, the target fault comprises a performance fault, and the target first type of data comprises: the first application invokes trace information of the process of the interface of the operating system to complete the service.
For example, in the present application, the first application invokes trace information, trace (trace) files, of a process of an interface of an operating system to complete a service.
Illustratively, the target failure includes a stability failure, and the target first type of data includes data related to a failure occurring during the running of the first application.
For example, in the present application, the data related to the failure occurring during the running of the first application includes at least one of: an application unresponsive (application not responding, ANR) file, an application crash (crash) file, or a tombstone file.
It can be appreciated that the data size of these three types of files is small (in the order of several Kilobytes (KB)), even if the data is transmitted without receiving an instruction from an application or a user, the occupation of the central processing unit (central processing unit, CPU) is very small, so that the process of the application can be affected as little as possible while the optimization efficiency of the first application is improved, and the user experience is improved as much as possible.
In one possible embodiment, the target diagnostic data further comprises target second type data, the target second type data comprising: the method comprises the steps of extracting the obtained structured data related to the target fault based on the target first type data and the structured data used for indicating the type of the target fault.
It can be appreciated that by providing the third party application with the target second type data obtained by preprocessing the target first type data, so that the third party application can process the target fault by combining the two types of data, the fault solving efficiency of the third party application can be improved (especially in the case that the target fault is not related to the business rule of the third party application).
The second type of data in the application comprises data related to faults of the application, which are extracted by the diagnosis service based on the first type of data, and data obtained by performing qualitative analysis on the faults of the application. Wherein the data from the qualitative analysis comprises: for example, to determine which fault type (e.g., performance fault, stability fault, etc.) the fault belongs to, e.g., the cause of the fault, etc. For example, after the operating system monitors that the application fails, the operating system may locate data related to the failure (for example, data before and after the time point of the failure) in the first type of data based on the time of the failure and analyze the cause of the failure.
In one implementation manner, for the situation that the target fault is not related to the business rule applied by the third party, in general, in the target fault diagnosis information provided by the diagnosis service module, the type information of the target fault is correctly diagnosed, and the structured data related to the target fault is also correctly collected, so that the success rate of solving the fault can be further improved by acquiring the first type data of the target by the application program.
In another implementation manner, for the situation that the target fault is related to the business rule applied by the third party, if the fault cannot be solved according to the target fault diagnosis information provided by the diagnosis service module, the application program can solve the target fault according to the target first type data after acquiring the target first type data, so that the success rate of solving the fault is improved. A related example is given below for further explanation.
Illustratively, the first application is a payment application, and the failure of the payment application is a loss of frames of the payment interface animation during payment by the user. The payment process involves multiple payment interfaces (e.g., interfaces including a user confirming payment, a user selecting a payment method, a user waiting for a successful payment, etc.). Because the operating system cannot acquire the business rule of the first application program, the extracted structured data related to the frame loss of the animation and the type for indicating the frame loss of the animation may not be accurate enough, and the success rate of the first application program for solving the frame loss of the animation according to the second type data may be affected. However, the target first type of data records the behavior of the electronic device when presenting each payment interface (or the procedure of calling the system interface when the payment application program completes the service of each payment interface). After the payment application program acquires the target first type data, the situation of which payment interface has animation frame loss and calling the system interface when the payment application program finishes the service of the payment interface can be accurately known, so that a targeted solution is provided.
Illustratively, the first application is a video application, and the failure of the video application is an application crash during use of the video application by the user. The user may be involved in a number of operations (e.g., including a user searching for video, a user selecting video, a user shifting video while viewing video, etc.). Because the operating system cannot acquire the business rule of the first application program, the extracted structured data related to the application crash and the type for indicating the application crash may not be accurate enough, and the success rate of the first application program for solving the application crash according to the second type data may be affected. The target first type of data records the behavior of the electronic device in presenting the video application in response to each operation of the user (or the procedure of calling the system interface by the video application in order to complete the service in response to each operation of the user). After the video application program acquires the target first type data, the situation that the video application program calls the system interface when detecting which operation of the user is crashed and the service triggered by the operation is completed can be accurately known, so that a targeted solution is provided.
Thus, in the above-described scheme, the target second type data is generated by using the diagnostic service module according to the target first type data, or is obtained by using the diagnostic service module from other modules in the operating system. Since the operating system cannot acquire the business rules of the application, in the case where the target fault is related to the business rules of the third party application, it may not be possible to accurately diagnose the target fault and extract (and optionally analyze) the data related to the target fault. Therefore, the beneficial effects of the scheme are more remarkable under the condition that the target fault is not related to the business rule applied by the third party.
In one possible embodiment, the electronic device does not obtain root rights.
It will be appreciated that in current commercial versions of electronic devices, unstructured logs are generally not available to third party applications. According to the scheme, the function is opened in the electronic equipment in the commercial version, so that the third-party application program is facilitated to obtain more fault data, the application program is better optimized, and better experience is brought to a user.
In one possible embodiment, sending, with the diagnostic service module, the target diagnostic data to the first application includes:
Invoking an android interface definition language (android interface definition language, AIDL) interface of the diagnostic service module using the first application program, invoking target first type data from the diagnostic service module; and calling an interface in a binary archive (AAR) file of the first application program by using the diagnosis service module, and sending a return value to the first application program, wherein the return value comprises target first type data, and the AAR file is integrated in the first application program.
Preferably, the return value may be transmitted by a file provider (file provider) manner. Alternatively, it is also possible to use other means, such as: shared memory), socket (socket), etc.
Optionally, the first application is used to call an interface in the AAR file, and the AAR file calls an AIDL interface of the diagnostic service module, so that the first application is used to indirectly call the AIDL interface of the diagnostic service module.
In one possible embodiment, sending, with the diagnostic service module, the target diagnostic data to the first application includes: transmitting target fault diagnosis information to the first application program by using the diagnosis service module; transmitting, by the diagnostic service module, a target identifier to the first application, the target identifier being used to identify an address of target first type data of the first application; the target first type data is obtained from the diagnostic service module based on the target identifier using the first application.
It can be understood that the first application program obtains the target first type data through the target identifier, so that information leakage among different application programs can be reduced (for example, the target first type data of one application program is sent to another application program), and accuracy and safety of transmitting the target first type data are improved.
In one possible embodiment, with a first application, obtaining target first type data from a diagnostic service based on a target identifier includes: retrieving, by the first application program via the interface, target first type data from the diagnostic service module based on the target identifier; a return value is sent to the first application using the diagnostic service module, the return value including the target first type data.
In one possible embodiment, sending, with the diagnostic service module, the target identifier to the first application includes: performing directional authorization on part of third-party application programs in the plurality of third-party application programs by utilizing a diagnosis service module, wherein the part of third-party application programs comprises a first application program; and respectively sending authorization identifiers to part of the third-party application programs by using the diagnosis service module, wherein the authorization identifiers are in one-to-one correspondence with the part of the third-party application programs, each authorization identifier is respectively used for indicating the address of the unstructured diagnosis file of the corresponding third-party application program, and the authorization identifiers comprise target identifiers.
It can be appreciated that by means of directional authorization, the security performance of the transmission is further improved, and other application programs are further prevented from acquiring logs of the first application program.
Illustratively, the diagnostic service module is utilized to call an interface in the AAR file of the first application program to perform directional authorization on the first application program; and calling an interface in the AAR file of the first application program by using the diagnosis service module, and sending the target identifier to the first application program.
In one possible embodiment, the electronic device further includes a second application, the second application being a system application, the second application including an enhanced functionality switch, sending target diagnostic data to the first application using the diagnostic service module, comprising: detecting an operation of opening the enhanced function switch by a user by using a second application program; monitoring the opening state of the enhanced function switch by using the diagnosis service module; in response to the open state, the target first type data is sent to the first application using the diagnostic service module.
According to the scheme, whether the diagnosis service transmits the target first type data or not is determined according to the operation of opening the enhanced function switch by the user, whether the first type data is uploaded or not can be selected by the user (namely, the target first type data is provided for the first application program under the condition that the user allows the first type data to be acquired), the condition that the CPU is occupied due to the fact that the first type data is transmitted under the condition that the user allows the first type data to be not passed can be reduced, and user experience is guaranteed.
The enhanced functionality switch is illustratively a control in the second application for turning on or off the enhanced functionality of the diagnostic service module. The enhanced function of the diagnostic service module may be understood as a function of the diagnostic service module providing the first application with the first type of data, or a function of the third party application being able to acquire the first type of data itself.
In one possible implementation manner of the above solution, the method 200 is applicable to all the first type data referred to in the present application, that is, the target first type data may be any one or more of an ANR file, a crash file, a tombstone file, and a trace file.
In another possible implementation manner of the foregoing solution, preferably, in the method 200, the target first type data is a trace file. That is, the enhanced function switch is in an off state, and the diagnostic service module cannot send the trace file of the first application to the first application, and can send any one or more of the ANR file, the crash file, and the tombstone file of the first application. That is, the enhanced functionality switch does not limit the transmission of the first type of data that can be other than trace files.
It can be appreciated that the data size of the trace file (on the order of tens to hundreds of Megabytes (MB)) is much larger than the data size of other unstructured files (on the order of several KB), and the trace file is transmitted with the user allowed to transmit, so that the process of dragging the first application program and the situation of occupying the CPU caused by transmitting the trace file can be reduced, thereby improving the user experience.
In one possible embodiment, the method further comprises: responsive to a user operation, displaying an interface of the second application, the interface including a control for selecting an open-closed state of the enhanced function switch; and responding to the operation of the user on the control, starting a function of the diagnosis service module for providing target diagnosis data for the first application program.
Illustratively, the user may click on an icon of the second application, enter an interface of the second application, and then click on a control to open the enhanced functionality switch. Alternatively, the user may open the enhanced functionality switch of the second application in other ways. For example, the enhanced functionality switch of the second application is opened by a smart voice assistant application, or by clicking a shortcut control of a drop down menu bar. The present application is not limited thereto.
In one possible embodiment, the method further comprises: transmitting a subscription message to the diagnostic service module by using the first application program, wherein the subscription message is used for subscribing to target diagnostic data of the target fault, and the subscription message comprises information for indicating the first type of data;
obtaining target diagnostic data with a diagnostic service module, comprising: acquiring target first-type data according to information for indicating the first-type data by using a diagnosis service module;
transmitting, with the diagnostic service module, target diagnostic data to the first application, comprising: in response to the subscription message, the target first type data is sent to the first application using the diagnostic service module.
According to the scheme, whether the diagnostic service sends the first type data or not is indicated through the subscription message of the first application program, whether the application selects to upload the target first type data or not (namely, the target first type data is provided for the first application program under the condition that the first application program requires to acquire the first type data) can be realized, so that the application program is given greater authority in the electronic equipment of the commercial version, the failure solving efficiency of the application program is improved, and the user experience is improved.
In one possible embodiment, with a first application, obtaining target first type data from a diagnostic service module based on a target identifier includes: judging whether to acquire target first type data from the diagnosis service module according to the current service scene by using the first application program; in the event that the amount of data transmission required for the current traffic scenario is less than or equal to a threshold, a target first type of data is obtained from the diagnostic service module based on the target identifier using the first application.
It can be appreciated that, in order to ensure stability and reliability of service data transmission of the first application program (for example, to reduce the situation that the diagnostic service module sends the first type of data to the first application program and occupies the CPU of the electronic device, and affects stability and reliability of service data transmission in the current service scenario), a timing for acquiring the target first type of data is selected according to the service scenario. When the requirement on the data transmission amount of the current service scene is low, the target first type data is acquired, and the stability and the reliability of service data transmission can be ensured as much as possible.
Illustratively, the target fault comprises a performance fault, and the target first type of data comprises: the first application invokes trace information of the process of the interface of the operating system to complete the service.
For example, in the present application, the first application invokes trace information, trace file, of a process of an interface of the operating system to complete a service.
It can be appreciated that, compared to the data amount (in the order of several KB) of other first type data, the data amount (in the order of tens to hundreds of Megabytes (MB)) of the trace file is much larger, and the trace file is transmitted under the condition that the first application indicates to transmit the trace file, so that the process of dragging the first application due to transmitting the trace file and the situation of occupying the CPU can be reduced, and the user experience is improved.
In other implementations, the amount of data transferred may be replaced with or include other conditions of judgment, such as power consumption or heat dissipation.
In one possible embodiment, the method further comprises: and sending the target diagnosis data to a cloud server of the first application program by using the first application program.
Compared with a mode based on USB transmission, the scheme is more convenient and timely; the cost is lower than the way the platform of information sharing is built together.
Illustratively, the target diagnostic data is uploaded to the cloud server by the application logic portion of the first application.
It can be appreciated that, at present, the electronic device provides data (such as data related to faults) to the research and development end personnel of the first application program, and one implementation manner is to connect the electronic device with the computer in a non-commercial version through a universal serial bus (universal serial bus, USB), and the electronic device transmits unstructured log data to the computer for processing by the research and development end personnel of the first application program; another implementation is for the vendor of the electronic device and the vendor of the first application to co-build a platform for information sharing through which structured log data is provided to a research and development end personnel of the first application.
In one possible embodiment, in the event of a failure of one or more third party applications, obtaining the target diagnostic data using the diagnostic service module includes: obtaining, with a diagnostic service module, first type data for one or more third party applications, the one or more third party applications including the first application;
target first type data of the first application program is screened from the first type data.
According to the scheme, the diagnosis service module screens out the data related to the first application program, so that the accuracy and the safety of data transmission can be further ensured.
In a second aspect, the present application provides an electronic device comprising one or more processors and one or more memories; wherein the one or more memories are coupled to the one or more processors, the one or more memories being operable to store computer program code comprising computer instructions that, when executed by the one or more processors, cause the electronic device to perform the method as described in the first aspect and any possible implementation of the first aspect.
In a third aspect, embodiments of the present application provide a chip system for application to an electronic device, the chip system comprising one or more processors for invoking computer instructions to cause the electronic device to perform a method as described in the first aspect and any possible implementation of the first aspect.
In a fourth aspect, the present application provides a computer readable storage medium comprising instructions which, when run on an electronic device, cause the electronic device to perform a method as described in the first aspect and any possible implementation of the first aspect.
In a fifth aspect, the present application provides a computer program product comprising instructions which, when run on an electronic device, cause the electronic device to perform a method as described in the first aspect and any possible implementation of the first aspect.
It will be appreciated that the electronic device provided in the second aspect, the chip system provided in the third aspect, the computer storage medium provided in the fourth aspect, and the computer program product provided in the fifth aspect are all configured to perform the method provided in the present application. Therefore, the advantages achieved by the method can be referred to as the advantages of the corresponding method, and will not be described herein.
Drawings
Fig. 1 is a schematic diagram of a method 100 for log acquisition according to an embodiment of the present application;
fig. 2 is a schematic diagram of a first implementation of S102 provided in an embodiment of the present application;
FIG. 3 is a schematic diagram of another implementation of the method 100, namely the method 100', provided in an embodiment of the present application;
Fig. 4 is a schematic diagram of a method 200 for log acquisition provided in an embodiment of the present application;
FIGS. 5A-5E are schematic diagrams illustrating an example of a user opening an enhanced function switch provided in an embodiment of the present application;
fig. 6 is a schematic diagram of a software system of an electronic device according to an embodiment of the present application;
fig. 7 is a hardware system of an electronic device according to an embodiment of the present application.
Detailed Description
For the purpose of making the objects, technical solutions and advantages of the present application more apparent, embodiments of the present application will be described in further detail below with reference to the accompanying drawings.
Before describing embodiments of the present application, terminology involved in the embodiments of the present application is described below.
1. The application mainly relates to faults of application programs, which comprise: performance failure and stability failure.
Performance failures may be understood as failures that affect the proper operation of an application, such as an application program not responding, an application being killed, an application crashing, etc.
Stability failures can be understood as failures that affect the running effects (e.g., smoothness of running, speed of running) of an application, such as application start-up timeouts, lost frames of an animation, etc.
2. The log data referred to in the present application mainly includes two types of log data, a first type of data and a second type of data.
(1) The first type of data is unstructured log data. The first type of data records the operating conditions of the application. Wherein recording log data of the running condition of the first application program includes: the trace information of the process by which the application invokes the system interface to complete the service and/or data related to faults occurring during the running of the application.
For example, the first type of data in this application includes: ANR files, crash files, tombstone files, and trace files.
The ANR file is an error log file generated by the android system when the application program does not respond. The ANR file will typically contain a timestamp, stack trace, thread information, etc. of the application where the ANR occurred, helping to locate and resolve stability failures for the application.
The crash file is used for recording data when the application program crashes; storing information about the state of the electronic device at the time of the crash; the method comprises the steps of time stamping, program and memory dump information; helping to locate and address stability failures of applications.
Wherein a tombstone file is a file that contains additional data related to the crash process. Specifically, the file contains the stack trace of all threads in the crash process (not just the thread that captured the signal), the complete memory map, and a list of all open file descriptors. the tombstone file helps locate and address stability failures of the application.
The trace file is a system trace file, and records the files of all process call relations in the system, and is mainly used for analyzing performance faults.
In this application, the first type of data may also be referred to as a diagnosis file or a fault diagnosis file, and the present application does not limit the name thereof.
(2) The second type of data is structured log data. The second type of data is obtained by organizing and recording the first type of data in a specific structure. Or, the data obtained by structuring the first type data is the second type data, wherein the structuring is to extract the key information in the first type data and store the key information in a structuring manner so as to facilitate the subsequent data analysis and query.
The second type of data referred to in the present application includes data related to a fault occurring in an application, which is extracted by a diagnostic service based on the first type of data, and data obtained by performing qualitative analysis on the fault occurring in the application. Wherein the data from the qualitative analysis comprises: for example, to determine which fault type (e.g., performance fault, stability fault, etc.) the fault belongs to, e.g., the cause of the fault, etc. For example, after the operating system monitors that the application fails, the operating system may locate data related to the failure (for example, data before and after the time point of the failure) in the first type of data based on the time of the failure and analyze the cause of the failure.
For example, the second type of data in this application includes: performance diagnostic information, stability diagnostic information, thermal fault diagnostic information, and power consumption class fault diagnostic information.
The performance diagnosis information comprises structural data which is extracted from the first type data and is related to the performance faults, and information for indicating that the type of the faults is the performance faults.
The stability diagnosis information comprises structural data which is extracted from the first type data and is related to the stability fault, and information for indicating that the type of the fault is the stability fault.
The power consumption diagnosis information comprises structural data which is extracted from the first type data and is related to power consumption faults, and information used for indicating that the type of the faults is the power consumption faults.
The thermal diagnosis information comprises structural data related to the thermal faults, which are extracted from the first type data, and information used for indicating that the type of the faults is the thermal faults.
In this application, the second type of data may also be referred to as fault diagnosis information or diagnosis information, and the present application does not limit the name thereof.
3. Application logic: program portions that determine how the actual business rules of the data are created, stored, and altered are encoded. The application logic is typically located in the core of the application program and is responsible for handling critical traffic such as data processing, algorithm computation, decision making, etc. For example, the application logic in the payment application is used to process payment traffic and the application logic in the video application is used to process video traffic.
4. The electronic devices related to the application are all commercial versions of electronic devices, namely electronic devices which are put into the market and can be purchased and used by common users. Commercial versions of electronic devices do not obtain super administrator (root) rights. In contrast to commercial versions, are non-commercial versions (e.g., public or test or internal versions, etc.). This version of the electronic device is not within the scope of the present application.
5. Binder threads are responsible for handling the sending and receiving of messages for interprocess communications. In the application, since the first application program and the diagnostic service run in a separate process, and data transmission and communication cannot be directly performed between the processes, the communication and data transmission between the first application program and the diagnostic service are realized by using a Binder thread.
6. AIDL is an interface definition language based on the Binder mechanism, and is mainly aimed at realizing inter-process communication.
7. Enhancement function switch: a switch for turning on or off the functionality of the diagnostic service module to provide the first type of data (preferably trace files) to the third party application. The enhanced function switch is turned on or off by a user control.
As described in the background art, since the application program is located at an upper layer of the operating system, it is not possible to directly diagnose the fault in the electronic device and collect information related to the fault, so that it is not possible to locate the fault and determine a solution of the fault. This greatly hinders the optimization of applications (especially third party applications), reduces the optimization efficiency of the applications, and also affects the user experience.
In the log obtaining method provided by the application, aiming at the target fault of the third-party application program, the electronic equipment obtains the target first type data by utilizing the diagnosis service module of the operating system and sends the target first type data to the third-party application program. Wherein the target first type data is unstructured log data recording the running status of the third party application program.
According to the scheme, the application program can process the target fault, optimization of the third-party application program is facilitated, the optimization efficiency is improved, and therefore user experience is improved. Compared with the mode of providing log data of a period of time before and after the occurrence time point of the target fault, the target first type data can be used for a third party application program to comprehensively acquire data related to the occurrence of the target fault, so that the success rate of solving the fault is improved.
In some embodiments, the target first type of data comprises: the third party application invokes trace information of the process of the system interface to complete the service.
It can be understood that after the third party application program obtains the tracking information, the third party application program can analyze and process the target fault related to the business rule of the third party application program (or the target fault generated when the third party application program realizes the business) in combination with the business rule, so as to optimize the application.
In some embodiments, the target first type of data comprises: data relating to a fault occurring during the running of the application, wherein the occurring fault comprises a target fault.
It can be appreciated that the third party application comprehensively acquires data related to the fault to handle the target fault and optimize its own application.
In some embodiments, the diagnostic service is further utilized to send target second type data to the third party application, the target second type data comprising: and extracting the obtained structured data related to the target fault based on the target first type data, and the structured data used for indicating the type of the target fault.
It can be appreciated that by providing the third party application with the target second type data obtained by preprocessing the target first type data, so that the third party application can process the target fault by combining the two types of data, the fault solving efficiency of the third party application can be improved (especially in the case that the target fault is not related to the business rule of the third party application).
It is also understood that the target second type of data is generated from the target first type of data using the diagnostic service module or is obtained from other modules in the operating system using the diagnostic service module. Since the operating system cannot acquire the business rules of the application, in the case where the target fault is related to the business rules of the third party application, it may not be possible to accurately diagnose the target fault and extract (and optionally analyze) the data related to the target fault. Therefore, the beneficial effects of the scheme are more remarkable under the condition that the target fault is not related to the business rule applied by the third party.
In some embodiments, the user may indicate whether the transfer of the target first type of data is allowed through an enhanced function switch of a system application in the electronic device. In response to a user's operation to open the enhanced function switch, the electronic device transmits the target first type of data.
That is, when the user allows the third-party application program to acquire the first type data, the diagnosis service is used for providing the first type data for the third-party application program, so that the condition that the CPU is occupied due to the fact that the first type data are transmitted without the permission of the user can be reduced, and the user experience is ensured.
Fig. 1 is a schematic diagram of a method 100 for log acquisition according to an embodiment of the present application.
As shown in fig. 1, the method 100 is performed by an electronic device, a software architecture of which includes an application layer and a system layer. The application program layer comprises a first application program, the first application program is a third party application program, and the system layer comprises a diagnosis service module.
S101, acquiring target diagnosis data by using a diagnosis service module.
The target diagnosis data is used for processing target faults generated by the first application program.
For example, the target diagnostic data includes target first type data, which is unstructured log data that records the operating conditions of the first application.
Wherein the target first type data is first type data of the first application. The first type of data may be referred to in the corresponding description of the "term" section above, and will not be repeated.
For example, the target first type data includes: tracking information of a process of calling an interface of the operating system by the first application program for completing a service, and/or data related to a fault occurring during the running process of the first application program, wherein the occurring fault comprises the target fault.
In a possible implementation manner, the electronic device does not obtain the root rights, that is, the electronic device is a commercial version of the electronic device, which may be referred to the description corresponding to the term portion above, and will not be repeated.
It will be appreciated that in current commercial versions of electronic devices, third party applications are generally not available for the first type of data. According to the scheme, the function is opened in the electronic equipment in the commercial version, so that the third-party application program is facilitated to obtain more fault data, the application program is better optimized, and better experience is brought to a user.
S102, sending target diagnosis data to the first application program by using the diagnosis service module, and correspondingly, receiving the target diagnosis data from the diagnosis service module by using the first application program.
For example, S102 may be one step, or S102 may include a plurality of steps, for example, one for transmitting the target failure diagnosis information and another for transmitting the target first type data.
It can be understood that the diagnosis service module of the operating system provides the data for processing the target fault for the first application program, so that the application program can accurately process the target fault, thereby being beneficial to the optimization of the third party application program, improving the optimization efficiency and improving the user experience.
It can be further appreciated that, compared to the manner of providing log data of a period of time before and after the occurrence time point of the target fault, the target first type data can be provided for the third party application program to comprehensively obtain the data related to the occurrence of the target fault, thereby improving the success rate of solving the fault.
According to the scheme, the application program can process the target fault, optimization of the third-party application program is facilitated, the optimization efficiency is improved, and therefore user experience is improved. Compared with the mode of providing log data of a period of time before and after the occurrence time point of the target fault, the target first type data can be used for a third party application program to comprehensively acquire data related to the occurrence of the target fault, so that the success rate of solving the fault is improved.
Illustratively, the first application and the diagnostic service module may communicate by way of a call interface.
As one example of S102, invoking an AIDL interface of a diagnostic service module with a first application, invoking target first type data from the diagnostic service module; the diagnostic service module is used to call an interface in an AAR file (e.g., a kit package) of the first application, and a return value is sent to the first application, wherein the return value includes the target first type data, and the AAR file is integrated in the first application.
Preferably, the return value may be transmitted by a file provider (file provider) manner. Alternatively, it is also possible to use other means, such as: shared memory), socket (socket), etc.
Optionally, the first application is used to call an interface in the AAR file, and the AAR file calls an AIDL interface of the diagnostic service module, so that the first application is used to indirectly call the AIDL interface of the diagnostic service module.
It can be appreciated that, in the present application, if the first application is to be used to communicate with the diagnostic service, the AIDL interface of the diagnostic service module may be indirectly invoked by the first application; if the diagnostic service module is to be utilized to communicate with the first application, the diagnostic service module may be utilized to invoke an interface in the AAR file of the first application. The present disclosure is generally described herein, and is not repeated herein, and is applicable to other embodiments provided in the present application.
Optionally, in the method 100, the target diagnostic data further includes target second type data, the target second type data including: the method comprises the steps of extracting the obtained structured data related to the target fault based on the target first type data and the structured data used for indicating the type of the target fault.
Wherein the target second type of data is second type of data of a second application. The second type of data may be referred to in the corresponding description in the "term" section above, and will not be repeated.
It can be appreciated that by providing the third party application with the target second type data obtained by preprocessing the target first type data, so that the third party application can process the target fault by combining the two types of data, the fault solving efficiency of the third party application can be improved (especially in the case that the target fault is not related to the business rule of the third party application).
In one implementation manner, for the situation that the target fault is not related to the business rule applied by the third party, in general, in the target fault diagnosis information provided by the diagnosis service module, the type information of the target fault is correctly diagnosed, and the structured data related to the target fault is also correctly collected, so that the success rate of solving the fault can be further improved by acquiring the first type data of the target by the application program.
In another implementation manner, for the situation that the target fault is related to the business rule applied by the third party, if the fault cannot be solved according to the target fault diagnosis information provided by the diagnosis service module, the application program can solve the target fault according to the target first type data after acquiring the target first type data, so that the success rate of solving the fault is improved. A related example is given below for further explanation.
Illustratively, the first application is a payment application, and the failure of the payment application is a loss of frames of the payment interface animation during payment by the user. The payment process involves multiple payment interfaces (e.g., interfaces including a user confirming payment, a user selecting a payment method, a user waiting for a successful payment, etc.). Because the operating system cannot acquire the business rule of the first application program, the extracted structured data related to the frame loss of the animation and the type for indicating the frame loss of the animation may not be accurate enough, and the success rate of the first application program for solving the frame loss of the animation according to the second type data may be affected. However, the target first type of data records the behavior of the electronic device when presenting each payment interface (or the procedure of calling the system interface when the payment application program completes the service of each payment interface). After the payment application program acquires the target first type data, the situation of which payment interface has animation frame loss and calling the system interface when the payment application program finishes the service of the payment interface can be accurately known, so that a targeted solution is provided.
Illustratively, the first application is a video application, and the failure of the video application is an application crash during use of the video application by the user. The user may be involved in a number of operations (e.g., including a user searching for video, a user selecting video, a user shifting video while viewing video, etc.). Because the operating system cannot acquire the business rule of the first application program, the extracted structured data related to the application crash and the type for indicating the application crash may not be accurate enough, and the success rate of the first application program for solving the application crash according to the second type data may be affected. The target first type of data records the behavior of the electronic device in presenting the video application in response to each operation of the user (or the procedure of calling the system interface by the video application in order to complete the service in response to each operation of the user). After the video application program acquires the target first type data, the situation that the video application program calls the system interface when detecting which operation of the user is crashed and the service triggered by the operation is completed can be accurately known, so that a targeted solution is provided.
Thus, in the above-described scheme, the target second type data is generated by using the diagnostic service module according to the target first type data, or is obtained by using the diagnostic service module from other modules in the operating system. Since the operating system cannot acquire the business rules of the application, in the case where the target fault is related to the business rules of the third party application, it may not be possible to accurately diagnose the target fault and extract (and optionally analyze) the data related to the target fault. Therefore, the beneficial effects of the scheme are more remarkable under the condition that the target fault is not related to the business rule applied by the third party.
Preferably, in the method 100, the target failure comprises a stability failure, and the target first type of data comprises data related to a failure occurring during the running of the first application.
For example, in the present application, the data related to the failure occurring during the running of the first application includes at least one of: ANR files, crash files, or tombstone files.
It can be understood that the data volume of these three types of files is small (in the order of several Kilobytes (KB)), and even if the data is transmitted without receiving an instruction of an application program or a user, the occupation of the CPU is very small, so that the process of the application program can be affected less possibly while the optimization efficiency of the first application program is improved, and the user experience is improved as much as possible.
Fig. 2 is a schematic diagram of a first implementation of S102 provided in an embodiment of the present application.
As shown in fig. 2, S102 may include the steps of:
step 1-a, calling an AIDL interface of the diagnostic service module by using a first application program, and calling target first type data from the diagnostic service module based on a target identifier.
Wherein the target identifier is used to identify an address of target first type data of the first application. Illustratively, the target identifier is a uniform resource identifier (uniform resource identifier, URI).
Optionally, before step 1-a, further comprising: a trigger message is sent to the diagnostic service module by the first application, the trigger message being used to trigger step 1-a. For example, the trigger message may be a subscription message for subscribing to the target first type data, a query message for querying the target first type data, or a registration message for requesting acquisition of the target first type data.
And step 1-b, calling an interface in an AAR file of the first application program by using the diagnosis service module, and sending a return value to the first application program.
Wherein the return value includes the target first type data.
It can be understood that the first application program obtains the target first type data through the target identifier, so that information leakage among different application programs can be reduced (for example, the target first type data of one application program is sent to another application program), and accuracy and safety of transmitting the target first type data are improved.
Optionally, before step 1-a, step 1-c may be further included, and the diagnostic service module further performs directional authorization to the first application.
Illustratively, a diagnostic service module is utilized to directionally authorize a portion of the plurality of third party applications, the portion of the third party applications including the first application. And respectively sending authorization identifiers to part of the third-party application programs by using the diagnosis service module, wherein the authorization identifiers are in one-to-one correspondence with the part of the third-party application programs, each authorization identifier is respectively used for indicating the address of the target first type data of the corresponding third-party application program, and the authorization identifiers comprise target identifiers.
Illustratively, the diagnostic service module is utilized to call an interface in the AAR file of the first application program to perform directional authorization on the first application program; and calling an interface in the AAR file of the first application program by using the diagnosis service module, and sending the target identifier to the first application program.
It can be appreciated that by means of directional authorization, the security performance of the transmission is further improved, and other application programs are further prevented from acquiring logs of the first application program.
It should be noted that, the first application program may call the target first type data based on the target identifier only by way of example, and the first application program may call the target first type data not based on the target identifier.
Illustratively, a second implementation of S102 may include steps 1-d and 1-e.
And step 1-d, judging whether to acquire target first type data from the diagnosis service module according to the current service scene by using the first application program.
It can be appreciated that, in order to ensure stability and reliability of service data transmission of the first application program (for example, to reduce the situation that the diagnostic service module sends the first type of data to the first application program and occupies the CPU of the electronic device, and affects stability and reliability of service data transmission in the current service scenario), a timing for acquiring the target first type of data is selected according to the service scenario.
And step 1-e, acquiring target first type data from the diagnosis service module based on the target identifier by using the first application program under the condition that the data transmission quantity required by the current service scene is less than or equal to a threshold value.
It can be understood that when the requirement on the data transmission amount of the current service scene is low, the target first type data is acquired, so that the stability and the reliability of service data transmission can be ensured as much as possible.
In other implementations, the amount of data transferred may be replaced with or include other conditions of judgment, such as power consumption or heat dissipation.
Preferably, in such an implementation, in the event that the target failure comprises a performance failure, the target first type data first application invokes trace information of a process of an interface of the operating system to complete the service.
For example, in the present application, trace information of a procedure of calling an interface of an operating system for completing a service by a first application program includes trace files.
It can be appreciated that, compared to the data amount (in the order of several KB) of other first type data, the data amount (in the order of tens to hundreds of Megabytes (MB)) of the trace file is much larger, and the trace file is transmitted under the condition that the first application indicates to transmit the trace file, so that the process of dragging the first application due to transmitting the trace file and the situation of occupying the CPU can be reduced, and the user experience is improved.
By way of example, a third implementation of S102 may include steps 1-f and 1-g in the event of a failure of one or more third party applications.
Step 1-f, obtaining first type data of one or more third party applications using a diagnostic service module.
It will be appreciated that after one or more third party applications fail (wherein the first application fails as a target), the diagnostic service module may obtain the first type of data for the one or more third party applications directly or through other modules of the system layer, respectively.
Step 1-g, screening target first type data of the first application program from the first type data by utilizing a diagnosis service module.
Taking the first type of data as an ANR file as an example, the ANR file of the first application program that is screened out includes:
(1) Basic information: process name, version number, foreground and background, activity, lifetime, screen locking state, failure cause and NoFocus Windows switching state information;
(2) Resource information: CPU, memory, IO PSI information, TOP10 CPU occupancy rate process information;
(3) And (3) stacking processes: an ANR process stack and a binder blocking an opposite process stack;
(4) Process virtual machine information: memory information, GC information, ART metrics;
(5) Binder: blocked binder transaction log.
It is understood that the ANR file of the first application is not related to other applications.
For example, step 1-g may be triggered by a screening indication of the first application, which may be a trigger message (e.g. a subscription message or a query message or a registration message) or carried in a trigger message (e.g. a subscription message or a query message or a registration message).
According to the scheme, the diagnosis service module screens out the data related to the first application program, so that the accuracy and the safety of data transmission can be further ensured.
Optionally, the diagnostic service module performs step 1-g according to the time point when the screening instruction is received, that is, the diagnostic service module screens out the first type log data generated by the first application program after the time point as the target first type data. Compared with the diagnosis service module which takes the first type log data after the first application program is started as target first type data, on one hand, the data transmission quantity can be reduced, so that the occupation of a CPU is reduced, and the user experience is improved; on the other hand, the first application program can control the starting time of the first type log data to be acquired according to the time point of sending the screening indication, so that the application is given greater authority in the commercial version electronic equipment, the failure solving efficiency of the application is improved, and the user experience is improved.
It is understood that one or more of the above three implementations of S102 may be combined arbitrarily.
Fig. 3 is a schematic diagram of another implementation of the method 100, i.e., the method 100', provided in an embodiment of the present application.
And step 2, sending a subscription message to the diagnosis service module by using the first application program, and correspondingly, receiving the subscription message from the first application program by using the diagnosis service module.
Wherein the subscription message is used to subscribe to the target diagnostic data.
For example, the subscription information includes information indicating the first type of data.
The information indicating the first type of data may be used to indicate that the information including the first type of data is required in the subscribed target diagnostic data. That is, step 2 may be understood as one implementation in which the first application instructs the diagnostic service module to provide the targeted first type of data.
Illustratively, in the case where the target diagnostic data for subscription in the subscription message in step 2 includes target second type data, the subscription message may be used to subscribe to the target second type data and the target first type data. The subscription message may be 1 message or may include 2 messages, which is not limited in this application.
In a possible implementation manner, the subscription message in the step 2 may be replaced by a registration message or a query message, where the registration message or the query message is consistent with the function of the subscription message, and the application is not limited.
Optionally, step 2 is triggered when the first application is started, or step 2 is triggered at a preset moment of the application.
The transmission of subscription messages may be implemented, for example, by a Binder thread.
As a specific example of S101, step 3-a, using a diagnostic service module, obtains target first type data according to the information for indicating the first type data.
As a specific example of S102, step 3-b, in response to the subscription message, sends the target diagnostic data to the first application using the diagnostic service module, and accordingly, the first application receives the target diagnostic data from the diagnostic service module.
The transmission of the target diagnostic data may be implemented by a Binder thread, for example.
According to the scheme, whether the diagnostic service sends the first type data or not is indicated through the subscription message of the first application program, whether the application selects to upload the target first type data or not (namely, the target first type data is provided for the first application program under the condition that the first application program requires to acquire the first type data) can be realized, so that the application program is given greater authority in the electronic equipment of the commercial version, the failure solving efficiency of the application program is improved, and the user experience is improved.
Illustratively, step 3-b may be combined with one or more of the three implementations of S102 above.
In the case where step 2 is one implementation of the first application instructing the diagnostic service module to provide the target first type of data, preferably, in the case where the target failure comprises a performance failure, the target first type of data comprises a trace file.
It can be appreciated that, compared to the data amount of other unstructured files (in the order of several Kilobytes (KB)), the data amount of trace files (in the order of tens to hundreds of Megabytes (MB)) is much larger, and the transmission is performed when the first application instructs to transmit the trace file, so that the process of dragging the first application and the situation of occupying the CPU caused by transmitting the trace file can be reduced, and the user experience is improved.
Optionally, outside the method 100', for example, if in step 2, the subscription message does not include information for indicating the first type of data, the subscribed target diagnostic data includes target second type of data and does not include target first type of data.
Optionally, outside the method 100', for example, if in step 3-a, the subscription message does not include information indicating the first type of data, the diagnostic service module obtains the target second type of information and does not obtain the target first type of data.
Optionally, the method 100 or 100' further comprises:
and step 4, sending target diagnosis data to a cloud server of the first application program by using the first application program.
Illustratively, the target diagnostic data is uploaded to the cloud server by the application logic portion of the first application.
Currently, an electronic device provides data (such as fault related data) to a research and development end personnel of a first application program, and one implementation manner is that the electronic device and a computer in a non-commercial version are connected through a universal serial bus (universal serial bus, USB), and after the electronic device transmits unstructured log data to the computer, the unstructured log data is processed by the research and development end personnel of the first application program; another implementation is for the vendor of the electronic device and the vendor of the first application to co-build a platform for information sharing through which structured log data is provided to a research and development end personnel of the first application.
Compared with a mode based on USB transmission, the scheme is more convenient and timely; the cost is lower than the way the platform of information sharing is built together.
Fig. 4 is a schematic diagram of a method 200 for log acquisition according to an embodiment of the present application.
As shown in fig. 4, the method 200 is performed by an electronic device, the software architecture of which includes an application layer and a system layer. The system layer comprises a diagnosis service module, and the application program layer comprises a first application program and a second application program. The first application is a third party application and the second application is a system application, the second application including an enhanced functionality switch.
It is understood that the method 200 may be understood as another possible implementation of S102.
S201, detecting a user operation of turning on the enhanced function switch by the second application.
The enhanced functionality switch is illustratively a control in the second application for turning on or off the enhanced functionality of the diagnostic service module. The enhanced function of the diagnostic service module may be understood as a function of the diagnostic service module providing the first application with the first type of data, or a function of the third party application being able to acquire the first type of data itself.
It should be noted that the names of the enhanced function switches are only examples, and do not limit the protection scope of the present application.
The second application is, for example, a setup application.
Optionally, before S201, the method 200 further includes:
and step 5-a, responding to the operation of a user, displaying an interface of the second application program, wherein the interface comprises a control for selecting the open-close state of the enhanced function switch.
And step 5-b, responding to the operation of the control by the user, and starting a function of providing target diagnosis data for the first application program by the diagnosis service module.
Fig. 5A to 5E are schematic diagrams illustrating an example in which a user opens an enhanced function switch through a second application according to an embodiment of the present application.
As shown in fig. 5A, in response to a user clicking on a control 501 (i.e., an icon of a setup application), a setup interface as shown in fig. 5B is displayed. As shown in FIG. 5B, in response to a user clicking on control 502 (i.e., "System and update"), a system and update interface as shown in FIG. 5C is displayed. As shown in FIG. 5C, in response to a user clicking on control 503 (i.e., "developer option"), a developer option interface, as shown in FIG. 5D, is displayed. As shown in fig. 5D, in the developer option interface, an option of "diagnostic service function enhancement" and a switch control 504 (current state is off state) of the option are included. In addition, there is a line of text below the "diagnostic services functionality enhanced" option for interpretation to the user, which, when opened, allows the application to obtain more detailed diagnostic debug information (i.e. unstructured log data in this application). Upon detecting a user clicking on the switch control 504, an updated developer option interface is presented as shown in FIG. 5E, with the state of the switch control 504 updated to an open state. In response to a user clicking on the switch control 504, the state of the switch control 504 is updated to an on state, and the diagnostic service module is turned on to provide the first application with the functionality of the target diagnostic data.
Illustratively, the user may also open the enhanced functionality switch of the second application in other ways.
For example, the user opens the enhanced functionality switch of the second application through the intelligent voice assistant application.
And responding to a first voice instruction of 'YOYO' sent by the user, and displaying an intelligent voice interaction interface. And responding to a second voice instruction sent by the user, and opening the enhanced function switch. Wherein the second voice command is used for indicating to turn on the enhanced function switch or turn on the related function of the diagnostic service. For example, the second voice command is "turn on the enhanced function switch", or "turn on the enhanced function switch in the setting", or "enable a third party application (e.g., a specific application name) to obtain a fault log", or "allow a third party application (e.g., a specific application name) to obtain fault data", or the like. And in response to an operation of updating the state of the enhanced function switch to an on state, starting a function of the diagnosis service module for providing the target diagnosis data for the first application program.
For example, the user opens an enhanced functionality switch of the second application by pulling down a menu bar. It will be appreciated that the drop down menu bar is used to quickly access commonly used system settings and functions.
Wherein the interface of the drop down menu bar is displayed in response to a user sliding down from the top of the screen of the electronic device (preferably, the top to the right of the line in the screen). The interface of the drop-down menu bar comprises a first control for controlling the open and close states of the enhanced function switch. That is, the first control is used to quickly control the open and closed states of the enhanced function switches in the second application. The state of the enhanced function switch is currently off. And in response to the operation of clicking the first control by the user, updating the state of the first control to an open state. And in response to an operation of updating the state of the enhanced function switch to an on state, starting a function of the diagnosis service module for providing the target diagnosis data for the first application program.
Or wherein the interface of the drop down menu bar is displayed in response to a user sliding down from the top of the screen of the electronic device (preferably, the top to the right of the line in the screen). The interface of the drop-down menu bar comprises a second control for quickly opening a developer option interface of the setting application program. And responding to the operation of clicking the second control by the user, and displaying a developer option interface. The description related to fig. 5D and 5E will be omitted.
S203, in response to the open state, sending target first type data to the first application program by using the diagnosis service module.
S203 may be specifically referred to the description related to S102.
According to the scheme, whether the diagnosis service transmits the target first type data or not is determined according to the operation of opening the enhanced function switch by the user, whether the first type data is uploaded or not can be selected by the user (namely, the target first type data is provided for the first application program under the condition that the user allows the first type data to be acquired), the condition that the CPU is occupied due to the fact that the first type data is transmitted under the condition that the user allows the first type data to be not passed can be reduced, and user experience is guaranteed.
In one possible implementation of the method 200, the method 200 is applicable to all the first type of data referred to herein, that is, the target first type of data may be any one or more of an ANR file, a crash file, a tombstone file, and a trace file.
In another possible implementation of the method 200, preferably, in the method 200, the target first type data is a trace file. That is, the enhanced function switch is in an off state, and the diagnostic service module cannot send the trace file of the first application to the first application, and can send any one or more of the ANR file, the crash file, and the tombstone file of the first application. That is, the enhanced functionality switch does not limit the transmission of the first type of data that can be other than trace files.
It can be appreciated that the data size of the trace file (on the order of tens to hundreds of Megabytes (MB)) is much larger than the data size of other unstructured files (on the order of several KB), and the trace file is transmitted with the user allowed to transmit, so that the process of dragging the first application program and the situation of occupying the CPU caused by transmitting the trace file can be reduced, thereby improving the user experience.
It is understood that method 200 may be combined with method 100 or method 100'.
Fig. 6 is a schematic diagram of a software system of an electronic device according to an embodiment of the present application.
It will be appreciated that the software system shown in fig. 6 corresponds to the method 100 and the method 100' without reference to the second application. The software system shown in fig. 6 corresponds to the method 200 in the case of the second application program.
Wherein the above target first type data is illustrated by way of example of a first diagnostic file (optionally, and a second diagnostic file), and the above target second type data is illustrated by way of example of performance/stability diagnostic information, thermal fault diagnostic information, and power consumption type fault diagnostic information. The first application above is illustrated with respect to a third party APP, and the second application above is illustrated with respect to a system APP.
The layered architecture divides the software into several layers, each with distinct roles and branches. The layers communicate with each other through a software interface.
As shown in fig. 6, the software system of the electronic device includes an application layer 310 and a system layer 320. The software system may also include other layers (not shown in fig. 6), such as a kernel layer, a hardware abstraction layer, and the like.
Next, description will be made with respect to a case where the software system shown in fig. 6 does not involve the second application program.
The application layer 310 may include a series of application packages. As shown in fig. 6, the application layer 310 includes a third party Application (APP), which may be, for example, a third party payment APP, a third party video APP, a third party sports APP, or a third party information APP.
Wherein, third party APP includes APP logic segment and diagnosis AAR file.
Specifically, the APP logic portion may refer to the description of the application logic by the term portion above, and is not described herein.
In particular, a diagnostic AAR file may be understood as a file (e.g. a kit package) in the form of an AAR, comprising one or more software interfaces for the third party APP to communicate with other layers. The diagnosis AAR file is added into the compiling dependence of the third party APP, so that the diagnosis AAR is integrated into the third party APP. Therefore, when the third party APP communicates with other layers, the application logic part calls an interface in the diagnosis AAR file, and then the diagnosis AAR file indirectly calls an interface of a corresponding module or unit of the corresponding layer so as to communicate with the corresponding module or unit. When the other layers communicate with the third party APP, the modules or units of the other layers call the interface in the diagnostic AAR file to communicate with the third party APP.
The system layer 320 may include a plurality of functional modules. As shown in fig. 6, the system layer 320 includes a diagnostic service module. The system layer 320 may also include other functional modules (not shown in FIG. 6), such as a surface manager (surface manager), a media library (media libraries), a three-dimensional graphics processing library (e.g., openGL ES), a 2D graphics engine (e.g., SGL), etc.
The diagnosis service module comprises a database and an AIDL interface.
In particular, the database is primarily responsible for storing and managing data acquired during the diagnostic process for subsequent analysis and processing. Such data may include, but is not limited to, system operating status, fault information, log information, and the like. The primary functions of the database include the pruning of data and the persistent storage of data, which is preserved even after the system is restarted.
As shown in fig. 6, the diagnostic service module respectively performs structural processing on the acquired performance/stability diagnostic information, thermal fault diagnostic information and power consumption fault diagnosis information, and then stores the structural processing in a database (or in a system library in a structural manner) for subsequent call. The performance/stability diagnosis information, the thermal fault diagnosis information and the power consumption fault diagnosis information can be directly obtained by a diagnosis service module or obtained by other modules.
As shown in fig. 6, the system library is used for managing data acquired in the diagnostic process of a plurality of applications, and after a certain application in the plurality of applications is uninstalled, the diagnostic service module may delete the data of the application in the system library.
Specifically, in this application, the AIDL interface is used to diagnose the service module to communicate with other layers. The diagnostic service module is to communicate with other layers and may invoke interfaces of modules or units of other layers through the AIDL interface. The other layers to communicate with the diagnostic service module may call the AIDL interface of the diagnostic service module.
Illustratively, when the third party APP is started, an interface in the diagnostic AAR file is invoked, and the interface indirectly invokes an AIDL interface of the diagnostic service module based on the Binder thread, subscribes (or queries/registers) to the fault of interest (which may be understood as the target fault above) with the diagnostic service module. And then, the electronic equipment starts to monitor faults generated by the third party APP, and when the faults concerned are monitored, the corresponding fault diagnosis information and the first diagnosis file are transmitted to the diagnosis service. The diagnostic service module stores the fault diagnosis information in a database. The diagnostic service calls an interface in the diagnostic AAR file to carry out directional authorization on the third party APP based on a Binder mechanism through an AIDL interface. And then, the diagnosis service module calls back the Binder thread, calls an interface in the diagnosis AAR file through the AIDL interface, and transmits fault diagnosis information in the database to the third party APP. Optionally, other structured data, namely URIs, may also be included in the Binder thread (see description above). The Binder thread is used for informing the third party APP that a fault of interest has occurred and providing a cause of the fault analysis, on the one hand, and for providing a URI, on the other hand. After the third party APP receives the structured data, the APP logic part invokes an interface in the diagnosis AAR file, the diagnosis AAR indirectly invokes an AIDL interface, and the target first type data (namely, a first diagnosis file) of the concerned fault is obtained from the diagnosis service module through the URI. The diagnosis service module calls an interface in the diagnosis AAR file through the AIDL interface, and sends a return value to the third party APP, wherein the return value comprises the first diagnosis file.
For example, the first diagnostic file may refer specifically to a description of the target first type of data in method 100 or method 100'.
Next, description will be made in the case where the second application program is referred to for the software system shown in fig. 6.
In comparison with the case where the software system shown in fig. 6 does not involve the second application, the difference is that:
1. the application layer 310 further includes a system APP, which may be referred to in the method 200 for description of the second application program, and will not be described in detail. The system APP includes an enhanced function switch, which may be specifically described in the method 200, and will not be described herein.
Specifically, the enhanced function switch monitoring function is used for monitoring the on-off state of the enhanced function switch in the system APP. If the enhanced function switch is monitored to be opened, the diagnosis service module can be triggered to transmit a second diagnosis file to the third party APP.
2. Whether the diagnostic service module sends the second diagnostic file to the third party APP is triggered by the on state of the enhanced function switch.
For example, the second diagnostic file and the first diagnostic file may be the same file, that is, the first type of data transmitted by the diagnostic service module to the third party APP is triggered indirectly by the on state of the enhanced function switch, and the enhanced function switch monitoring function monitors that the enhanced function switch is in the on state. The first diagnostic file or the second diagnostic file may be any one or more of an ANR file, a crash file, a tombstone file, and a trace file.
For another example, the second diagnostic file is not the same file as the first diagnostic file. Preferably, the first diagnostic files include ANR files, crash files, and tombstone files; the second diagnostic file includes a trace file. That is, when the enhanced function switch monitoring function monitors that the enhanced function switch is in an on state, the diagnostic service module is triggered to transmit the trace file to the third party APP. The transmission of the ANR file, the crash file, and the tombstone file is not affected by whether the enhanced function switch is on or off.
Fig. 7 illustrates a hardware system suitable for use in the electronic device 400 of the present application.
The electronic device 400 may be a cell phone, a smart screen, a tablet computer, a wearable electronic device, an in-vehicle electronic device, an augmented reality (augmented reality, AR) device, a Virtual Reality (VR) device, a notebook computer, an ultra-mobile personal computer (UMPC), a netbook, a personal digital assistant (personal digital assistant, PDA), a projector, etc., and the specific type of the electronic device 400 is not limited in the embodiments of the present application.
Corresponding to the method 100 or 100', the electronic device 400 may comprise at least one processor 410, a display 420. Optionally, corresponding to the method 200, the electronic device 400 further comprises a sensor 430.
The configuration shown in fig. 7 does not constitute a specific limitation on the electronic apparatus 400. In other embodiments of the present application, electronic device 400 may include more or fewer components than those shown in FIG. 7, or electronic device 400 may include a combination of some of the components shown in FIG. 7, or electronic device 400 may include sub-components of some of the components shown in FIG. 7. The components shown in fig. 7 may be implemented in hardware, software, or a combination of software and hardware.
Processor 410 may include one or more processing units. For example, the processor 410 may include at least one of the following processing units: application processors (application processor, AP), modem processors, graphics processors (graphics processing unit, GPU), image signal processors (image signal processor, ISP), memory, controllers, video codecs, digital signal processors (digital signal processor, DSP), baseband processors, neural-Network Processors (NPU). The different processing units may be separate devices or integrated devices.
Illustratively, in embodiments of the present application, the method may be performed in the processor 410, and for a target failure of a third party application, the method may utilize a diagnostic service module of an operating system to obtain target first type data and send the target first type data to the third party application. Wherein the target first type data is unstructured log data recording the running status of the third party application program. The method and the device can enable the application program to process the target fault, are favorable for optimizing the third-party application program, and improve the optimization efficiency, thereby improving the user experience.
The processor 410 is configured to perform the methods performed by the electronic device in the above embodiments, for example, the methods performed by the electronic device in the embodiments shown in fig. 1 to 4.
The controller can generate operation control signals according to the instruction operation codes and the time sequence signals to finish the control of instruction fetching and instruction execution.
The connection relationships between the modules shown in fig. 7 are merely illustrative, and do not constitute a limitation on the connection relationships between the modules of the electronic device 400. Alternatively, the modules of the electronic device 400 may also use a combination of the various connection manners in the foregoing embodiments.
Electronic device 400 may implement display functionality through a GPU, display screen 420, and an application processor. The GPU is a microprocessor for image processing, and is connected to the display screen 420 and the application processor. The GPU is used to perform mathematical and geometric calculations for graphics rendering. Processor 410 may include one or more GPUs that execute program instructions to generate or change display information.
The display screen 420 may be used to display images or video.
Illustratively, the digital signal processor is configured to process digital signals, and may process other digital signals in addition to digital image signals. For example, when the electronic device 400 is selecting a frequency bin, the digital signal processor is used to fourier transform the frequency bin energy, or the like.
And a memory for storing instructions and data. In some embodiments, the memory in the processor 410 is a cache memory. The memory may hold instructions or data that the processor 410 has just used or recycled. If the processor 410 needs to reuse the instruction or data, it may be called directly from memory. Repeated accesses are avoided, reducing the latency of the processor 410 and thus improving the efficiency of the system.
The sensor 430 may include a pressure sensor and a touch sensor.
The pressure sensor is used for sensing a pressure signal and can convert the pressure signal into an electric signal. In some embodiments, the pressure sensor may be provided on the display screen 420. When a touch operation is applied to the display screen 420, the electronic device detects the touch operation intensity according to the pressure sensor. The electronic device may also calculate the location of the touch based on the detection signal of the pressure sensor. In some embodiments, touch operations that act on the same touch location, but at different touch operation strengths, may correspond to different operation instructions.
Touch sensors, also known as "touch panels". The touch sensor may be disposed on the display screen 420, and the touch sensor and the display screen 420 form a touch screen, which is also called a "touch screen". The touch sensor is used to detect a touch operation acting on or near it. The touch sensor may communicate the detected touch operation to the application processor to determine the touch event type. Visual output related to touch operations may be provided through the display screen 420. In other embodiments, the touch sensor may also be disposed on a surface of the electronic device at a different location than the display screen 420.
In this application, the sensor 430 is used to detect the user's operation of opening the enhanced function switch.
In some embodiments, the processor 410 communicates the targeted first type of data using the diagnostic service module and the first application in the event that the sensor 430 detects that the user has opened the enhanced function switch.
Embodiments of the present application provide a chip system, which includes one or more processors configured to call from a memory and execute instructions stored in the memory, so that the methods of the embodiments of the present application described above are performed. The chip system may be formed of a chip or may include a chip and other discrete devices.
The chip system may include an input circuit or interface for transmitting information or data, and an output circuit or interface for receiving information or data, among other things.
The present application also provides a computer program product which, when executed by a processor, implements the method of any of the method embodiments of the present application.
The computer program product may be stored in a memory and eventually converted to an executable object file that can be executed by a processor through preprocessing, compiling, assembling, and linking.
The present application also provides a computer readable storage medium having stored thereon a computer program which, when executed by a computer, implements a method according to any of the method embodiments of the present application. The computer program may be a high-level language program or an executable object program.
The computer readable storage medium may be volatile memory or nonvolatile memory, or may include both volatile memory and nonvolatile memory. The nonvolatile memory may be a read-only memory (ROM), a Programmable ROM (PROM), an Erasable PROM (EPROM), an electrically Erasable EPROM (EEPROM), or a flash memory. The volatile memory may be random access memory (random access memory, RAM) which acts as an external cache. By way of example, and not limitation, many forms of RAM are available, such as Static RAM (SRAM), dynamic RAM (DRAM), synchronous DRAM (SDRAM), double data rate SDRAM (DDR SDRAM), enhanced SDRAM (ESDRAM), synchronous DRAM (SLDRAM), and direct memory bus RAM (DR RAM).
It will be clearly understood by those skilled in the art that, for convenience and brevity of description, specific working processes and technical effects of the apparatus and device described above may refer to corresponding processes and technical effects in the foregoing method embodiments, which are not described in detail herein.
In several embodiments provided in the present application, the disclosed systems, apparatuses, and methods may be implemented in other manners. For example, some features of the method embodiments described above may be omitted, or not performed. The above-described apparatus embodiments are merely illustrative, the division of units is merely a logical function division, and there may be additional divisions in actual implementation, and multiple units or components may be combined or integrated into another system. In addition, the coupling between the elements or the coupling between the elements may be direct or indirect, including electrical, mechanical, or other forms of connection.
It should be understood that, in various embodiments of the present application, the size of the sequence number of each process does not mean that the execution sequence of each process should be determined by its functions and internal logic, and should not constitute any limitation on the implementation process of the embodiments of the present application.
It should be understood that reference herein to "a plurality" means two or more. The term "and/or" herein is merely one association relationship describing the associated object, meaning that there may be three relationships, e.g., a and/or B, may represent: a exists alone, A and B exist together, and B exists alone. In addition, the character "/" herein generally indicates that the front and rear associated objects are an "or" relationship.
The terms "first," "second," …, etc. appearing in the embodiments of the present application are for descriptive purposes only and are merely for distinguishing between different objects, e.g., different "coordinates," etc., and are not to be construed as indicating or implying a relative importance or an implicit indication of the number of technical features indicated. Thus, features defining "first", "second", …, etc., may include one or more features, either explicitly or implicitly. In the description of the embodiments of the present application, "at least one (an item)" means one or more. The meaning of "plurality" is two or more. "at least one of (an) or the like" below means any combination of these items, including any combination of a single (an) or a plurality (an) of items.
In summary, the foregoing description is only a preferred embodiment of the technical solution of the present application, and is not intended to limit the scope of the present application. Any modification, equivalent replacement, improvement, etc. made within the spirit and principles of the present application should be included in the protection scope of the present application.

Claims (18)

1. The log obtaining method is applied to electronic equipment, the electronic equipment comprises a diagnosis service module and a first application program, the first application program is a third party application program, and the diagnosis service module belongs to an operating system of the electronic equipment, and is characterized in that the method comprises the following steps:
acquiring target diagnosis data by using the diagnosis service module, wherein the target diagnosis data is used for processing target faults of the first application program, the target diagnosis data comprises target first type data, and the target first type data is unstructured log data for recording the running condition of the first application program;
and sending the target diagnosis data to the first application program by utilizing the diagnosis service module.
2. The method of claim 1, wherein the target first type of data comprises: tracking information of a process of calling an interface of the operating system by the first application program for completing a service, and/or data related to a fault occurring during the running process of the first application program, wherein the occurring fault comprises the target fault.
3. The method of claim 1, wherein the target diagnostic data further comprises target second type data, the target second type data comprising: and extracting the structural data related to the target fault based on the target first type data, and the structural data used for indicating the type of the target fault.
4. The method of claim 1, wherein the electronic device does not obtain root rights.
5. The method of claim 1, wherein the sending the target diagnostic data to the first application using the diagnostic service module comprises:
invoking an AIDL interface of the diagnostic service module with the first application program, invoking the target first type data from the diagnostic service module;
and calling an interface in an AAR file of the first application program by using the diagnosis service module, and sending a return value to the first application program, wherein the return value comprises the target first type data, and the AAR file is integrated in the first application program.
6. The method of claim 1, wherein the sending the target diagnostic data to the first application using the diagnostic service module comprises:
Transmitting, with the diagnostic service module, a target identifier to the first application, the target identifier identifying an address of the target first type of data;
the target first type data is obtained from the diagnostic service module based on the target identifier using the first application.
7. The method of claim 6, wherein the sending, with the diagnostic service module, a target identifier to the first application comprises:
performing directional authorization on part of third-party application programs in a plurality of third-party application programs by utilizing the diagnosis service module, wherein the part of third-party application programs comprise the first application program;
and respectively sending authorization identifiers to the part of third-party application programs by using the diagnosis service module, wherein the authorization identifiers are in one-to-one correspondence with the part of third-party application programs, each authorization identifier is respectively used for indicating the address of the unstructured diagnosis file of the corresponding third-party application program, and the authorization identifiers comprise the target identifiers.
8. The method of claim 1, wherein the electronic device further comprises a second application, the second application being a system application, the second application comprising an enhanced functionality switch, the sending the target diagnostic data to the first application with the diagnostic service module comprising:
Detecting, with the second application, an operation of a user to open the enhanced function switch;
monitoring the open state of the enhanced function switch by using the diagnosis service module;
responsive to the open state, the target first type data is sent to the first application using the diagnostic service module.
9. The method of claim 8, wherein the method further comprises:
responsive to a user operation, displaying an interface of the second application program, the interface including a control for selecting an open-closed state of the enhanced function switch;
and responding to the operation of the control by a user, and starting the function of the diagnosis service module for providing the target diagnosis data for the first application program.
10. The method of claim 1 or 8, wherein,
the target failure includes a stability failure, and the target first type of data includes data related to a failure occurring during the running of the first application.
11. The method of claim 10, wherein the data related to a fault occurring during the running of the first application comprises at least one of: ANR files, crash files, or tombstone files.
12. The method of claim 1 or 8, wherein the target fault comprises a performance fault, and the target first type of data comprises: the first application invokes trace information of a process of an interface of the operating system to complete a service.
13. The method of claim 12, wherein the first application invoking trace information of a process of an interface of the operating system for completion of a service comprises: trace file.
14. The method of claim 1, wherein,
the method further comprises the steps of: transmitting, with the first application, a subscription message to the diagnostic service module, the subscription message for subscribing to the target diagnostic data for the target fault, the subscription message including information for indicating the first type of data;
the obtaining, by the diagnostic service module, the target diagnostic data includes: acquiring the target first type data according to the information for indicating the first type data by using the diagnosis service module;
the sending, with the diagnostic service module, the target diagnostic data to the first application, comprising: the target first type data is sent to the first application using the diagnostic service module in response to the subscription message.
15. The method of claim 6, wherein the obtaining, with the first application, the target first type of data from the diagnostic service module based on the target identifier comprises:
judging whether to acquire the target first type data from the diagnosis service module according to the current service scene by using the first application program;
and acquiring the target first type data from the diagnosis service module based on the target identifier by using the first application program under the condition that the data transmission quantity required by the current service scene is less than or equal to a threshold value.
16. The method of claim 1, wherein the obtaining the target diagnostic data with the diagnostic service module in the event of a failure of one or more third party applications comprises:
obtaining, with the diagnostic service module, first type data for the one or more third party applications, the one or more third party applications including the first application;
the target first type data of the first application program is selected from the first type data.
17. An electronic device comprising a memory, and one or more processors, wherein the memory is configured to store a computer program; the processor is configured to invoke the computer program to cause the electronic device to perform the method of any of claims 1 to 16.
18. A computer storage medium, comprising: computer instructions; the computer instructions, when run on an electronic device, cause the electronic device to perform the method of any one of claims 1 to 16.
CN202311770171.8A 2023-12-21 2023-12-21 Log acquisition method and related equipment Pending CN117453513A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202311770171.8A CN117453513A (en) 2023-12-21 2023-12-21 Log acquisition method and related equipment

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202311770171.8A CN117453513A (en) 2023-12-21 2023-12-21 Log acquisition method and related equipment

Publications (1)

Publication Number Publication Date
CN117453513A true CN117453513A (en) 2024-01-26

Family

ID=89582215

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202311770171.8A Pending CN117453513A (en) 2023-12-21 2023-12-21 Log acquisition method and related equipment

Country Status (1)

Country Link
CN (1) CN117453513A (en)

Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN108052354A (en) * 2017-11-06 2018-05-18 北京趣拿软件科技有限公司 Definite method, apparatus, processor and terminal of the application program without response
CN109542689A (en) * 2018-11-30 2019-03-29 努比亚技术有限公司 Applied program processing method, terminal and computer readable storage medium
CN111625425A (en) * 2020-05-28 2020-09-04 北京达佳互联信息技术有限公司 Data monitoring method, device and system
CN114116159A (en) * 2021-10-29 2022-03-01 北京五八信息技术有限公司 Log collection method, device and system, electronic equipment and readable medium
CN115373869A (en) * 2021-09-30 2022-11-22 达闼科技(北京)有限公司 Process processing method and device based on AAR and electronic equipment
CN117149476A (en) * 2023-01-13 2023-12-01 荣耀终端有限公司 Fault reporting method and related device

Patent Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN108052354A (en) * 2017-11-06 2018-05-18 北京趣拿软件科技有限公司 Definite method, apparatus, processor and terminal of the application program without response
CN109542689A (en) * 2018-11-30 2019-03-29 努比亚技术有限公司 Applied program processing method, terminal and computer readable storage medium
CN111625425A (en) * 2020-05-28 2020-09-04 北京达佳互联信息技术有限公司 Data monitoring method, device and system
CN115373869A (en) * 2021-09-30 2022-11-22 达闼科技(北京)有限公司 Process processing method and device based on AAR and electronic equipment
CN114116159A (en) * 2021-10-29 2022-03-01 北京五八信息技术有限公司 Log collection method, device and system, electronic equipment and readable medium
CN117149476A (en) * 2023-01-13 2023-12-01 荣耀终端有限公司 Fault reporting method and related device

Similar Documents

Publication Publication Date Title
CN109597677B (en) Method and apparatus for processing information
CN108874624B (en) Server, method for monitoring Java process and storage medium
US20200092180A1 (en) Methods and systems for microservices observability automation
US9811356B2 (en) Automated software configuration management
US7962899B2 (en) System for monitoring a target application and method thereof
WO2019169765A1 (en) Electronic device, method for acquiring state information in cluster environment, system, and storage medium
CN114254304A (en) Container security intrusion detection method and device, computer equipment and storage medium
CN111625383B (en) Process exception event processing method and device, electronic equipment and storage medium
WO2019140739A1 (en) Method for determining return visits to client, and electronic apparatus and computer-readable storage medium
CN113315828B (en) Traffic recording method and device, traffic recording equipment and storage medium
CN112181746A (en) Fault repairing method, device and equipment for vehicle-mounted operating system
CN113032080A (en) Page implementation method, application program, electronic device and storage medium
CN113254320A (en) Method and device for recording user webpage operation behaviors
CN112100239A (en) Portrait generation method and apparatus for vehicle detection device, server and readable storage medium
CN113220403B (en) Method and device for h5 intercepting Android return event and electronic equipment
CN114595038A (en) Data processing method, computing device and computer storage medium
CN110941530A (en) Method and device for acquiring monitoring data, computer equipment and storage medium
CN112818343B (en) Block chain big data analysis early warning method and system and cloud platform
CN106482742B (en) The acquisition methods and device of step counting data
CN109189652A (en) A kind of acquisition method and system of close network terminal behavior data
CN112527600A (en) Monitoring log processing method, device, equipment and storage medium
CN117453513A (en) Log acquisition method and related equipment
CN116126808A (en) Behavior log recording method, device, computer equipment and storage medium
CN113238815B (en) Interface access control method, device, equipment and storage medium
CN113656314A (en) Pressure test processing method and device

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination