Method for determining instrumentation process based on file type and related device

Through the instrumentation process determined based on file type, the instrumentation process is performed on the subfunctions in the operation files of third-party applications, which solves the problem of high difficulty in instrumentation in the existing technology, and realizes detailed operational monitoring of third-party applications and optimization improves user experience.

CN119271533AActive Publication Date: 2025-01-07HONOR DEVICE CO LTD
View PDF 8 Cites 0 Cited by

Patent Information

Application Number
CN202410042952.3
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-01-10
Publication Date
2025-01-07
Estimated Expiration
2044-01-10

AI Technical Summary

Technical Problem

It is difficult for the existing technology to comprehensively screen out key functions in third-party applications, which makes it difficult to process instrumentation and cannot effectively optimize third-party applications, affecting user experience.

Method used

Determine the instrumentation process based on file type, traverse the subfunctions in the running file, judge its execution interface type and compilation identification information, adopt different traversal processes for different file types, perform instrumentation processing on the target subfunction, and adjust its execution interface , so as to interpret the execution through the interpreter.

Benefits of technology

It realizes key event positioning and optimization for third-party applications, improves optimization accuracy and user experience, reduces the burden on compilers and interpreters, and avoids leakage of instrumentation.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119271533A_ABST
    Figure CN119271533A_ABST
Patent Text Reader

Abstract

The invention provides a method for determining an instrumentation process based on a file type and a related device.The method for determining the instrumentation process based on the file type can determine different traversal processes based on the file type of a running file generated after an application file of a third-party application is compiled and optimized; instrumentation processing is carried out on the target sub-function based on different traversal processes, it can be guaranteed that key functions existing in the third-party application are comprehensively screened out, the target sub-function (or the key functions) is explained and executed based on an independent interpreter (namely the first interpreter), normal operation of the third-party application is guaranteed, and the third-party application performance is improved. The influence of instrumentation processing on third-party application operation is reduced, and the use experience of a user is protected.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The embodiments of the present application relate to the field of terminal technology, and in particular to a method for determining an instrumentation process based on a file type and a related device. Background Art

[0002] With the development of the Internet, users download and use more and more third-party applications in the application market of electronic devices for the convenience of life and entertainment. However, for users, various related functions or related application contents in third-party applications can be quickly opened or displayed in response to user operations, which can bring users a better user experience.

[0003] Since the third-party application does not involve the relevant operation operation of the operating system in the electronic device during operation, therefore, the relevant operation events such as when the various related functions in the third-party application start to run and when to end the operation are all unknown to the operating system of the electronic device. Therefore, in order to avoid the situation that the application content (such as: pictures, text, voice or controls, etc.) loading time is too long or the related function loading speed is slow in the third-party application during operation, in the prior art, the key functions in the third-party application will usually be plugged based on the compiler in the virtual machine. Due to the complex operation principle of the compiler, the design difficulty of the plugged function based on the compiler is too high, and the phenomenon of "missing plugging" is prone to occur, so that the electronic device cannot fully and in detail grasp the operation of the third-party application, thereby causing the electronic device to be difficult to achieve a good optimization effect for the third-party application, and the user experience is not good.

[0004] Therefore, how to comprehensively screen out key functions in third-party applications and perform instrumentation processing on them to efficiently optimize third-party applications and improve user experience is an urgent problem to be solved. Summary of the invention

[0005] The present application provides a method for determining an instrumentation process based on a file type and a related device, wherein in the method for determining an instrumentation process based on a file type, based on the file type of a running file after the application file of a third-party application is compiled and optimized, a corresponding traversal process can be adopted to achieve the purpose of comprehensively screening target sub-functions and performing instrumentation processing on them, and the execution interface of the target sub-function can be adjusted, which helps electronic devices monitor the running status of third-party applications, so that key events of third-party applications can be optimized in a targeted manner, thereby improving the user experience.

[0006] In a first aspect, an embodiment of the present application provides a method for determining an instrumentation process based on a file type, and the method may include: obtaining file information of a running file corresponding to a third-party application, the running file being an application file corresponding to a third-party application currently compiled and executed or interpreted and executed in a runtime virtual machine ART, the file information including a file name of the running file, and the running file including at least one sub-function; based on the file name in the running file, determining a file type of the running file, the file type including a first file type and a second file type; based on a traversal process corresponding to the file type of the running file, performing an instrumentation Hook process on a target sub-function in the running file, and continuing to interpret and execute the target sub-function through a first interpreter, the target sub-function being a sub-function with a key function label.

[0007] In the prior art, due to the lack of stubs, electronic devices cannot optimize third-party applications in a targeted manner, resulting in poor user experience. In an embodiment of the present application, when ART compiles or interprets the running files of third-party applications, it can select different traversal processes based on the compilation optimization attributes of the running files to perform stub processing for the target sub-functions in the running files, which helps the electronic device to locate key events in the running process of third-party applications, and then can optimize the third application in a targeted manner based on the key events of the third-party applications obtained, avoiding the optimization of the entire third-party application, improving the accuracy of the optimization, and improving the user experience.

[0008] In one possible implementation, the first traversal process may include traversing the type of execution interface corresponding to each sub-function in the running file, and the first traversal process is the traversal process corresponding to the first file type; the second traversal process may include traversing the type of compilation identification information corresponding to each sub-function in the running file, and the second traversal process is the traversal process corresponding to the second file type.

[0009] In an embodiment of the present application, ART can adopt different traversal processes for sub-functions in running files based on different file types of running files. Specifically, the first traversal process will first determine the type of the execution interface of the sub-function, and then determine whether the sub-function is the target sub-function; the second traversal process will first determine whether the compilation identification information of the sub-function is empty, and then determine whether the sub-function with non-empty compilation identification information is "the target sub-function". The embodiment of the present application adopts different traversal processes to help more comprehensively check the key functions of sub-functions in third-party applications, and to help with the subsequent plug-in processing of target sub-functions, thereby helping electronic devices to grasp the detailed operation of third-party applications, facilitating the subsequent targeted optimization of third-party applications by electronic devices, and improving the operation performance and user experience of third-party applications.

[0010] In one possible implementation, the execution interface may include a compiled execution interface and an interpreted execution interface, and the interpreted execution interface may include a first interpreted execution interface and a second interpreted execution interface; when the file type of the running file is the first file type, the running file is image file data; the above method may also include: traversing the execution interfaces of each sub-function in the running file; if there is a first sub-function whose execution interface is a compiled execution interface, and the first sub-function is a target sub-function, then adjusting the execution interface of the first sub-function to the first interpreted execution interface, and interpreting and executing the first sub-function through the first interpreter; if there is a second sub-function whose execution interface is a second interpreted execution interface, and the second sub-function is a target sub-function, then adjusting the execution interface of the second sub-function to the first interpreted execution interface, and interpreting and executing the second sub-function through the first interpreter.

[0011] In an embodiment of the present application, the first file type may represent the file suffix of the running file. For example, when the running file is a file compiled and optimized by speed-profile, and the suffix of the running file is ".art", the running file can be considered to be the first file type. Since the ".art" file is a mirror file, in which one or more hot functions are stored, when the file type of the running file is the first file type, ART needs to traverse the execution interface of each hot function in the running file, and determine whether each hot function has a key function label, and then perform plugging processing and adjust the execution interface of the target sub-function with the key function label. By transferring the target sub-function to the first interpreter for interpretation and execution, it helps to reduce the operating burden of the compiler and the second interpreter, thereby further improving, and the design principle of using the interpreter for plugging processing is simpler than using the interpreter for plugging processing, so that the target sub-function can be captured and interpreted more comprehensively, avoiding the omission of plugging key events, and helping electronic devices to more comprehensively grasp the operation of third-party applications.

[0012] In one possible implementation, ART may include a compiler and an interpreter, and the interpreter may include a first interpreter and a second interpreter; when the file type of the running file is the first file type, the above method may also include: if there is a third sub-function whose execution interface is a compilation execution interface, and the third sub-function is not a target sub-function, then executing the machine code corresponding to the third sub-function; if there is a fourth sub-function whose execution interface is a second interpretation execution interface, and the fourth sub-function is not a target sub-function, then interpreting and executing the fourth sub-function through the second interpreter.

[0013] In the embodiment of the present application, ART will not change the execution interface of sub-functions other than the target sub-function. Specifically, if there is a sub-function whose execution interface is a compiled execution interface, and the sub-function is not the target sub-function, it means that the sub-function has been compiled and optimized, so the machine code corresponding to the sub-function can be directly executed; if there is a sub-function whose execution interface is a second interpreted execution, and the sub-function is not the target sub-function, the second interpreter continues to interpret and execute the sub-function, which helps to ensure the operating efficiency of third-party applications and user experience.

[0014] In one possible implementation, when the file type of the running file is the second file type, the method may further include: obtaining compilation identification information corresponding to each sub-function in the running file; if the compilation identification information of the fifth sub-function is empty, and the fifth sub-function is not the target sub-function, adjusting the execution interface of the fifth sub-function to the second interpretation execution interface, and interpreting and executing the fifth sub-function through the second interpreter; if the compilation identification information of the sixth sub-function is empty, and the sixth sub-function is the target sub-function, adjusting the execution interface of the sixth sub-function to the first interpretation execution interface, and interpreting and executing the sixth sub-function through the first interpreter; if the compilation identification information of the seventh sub-function is not empty, and the seventh sub-function is the target sub-function, adjusting the execution interface of the seventh sub-function to the first interpretation execution interface, and interpreting and executing the sixth sub-function through the first interpreter; if the compilation identification information of the eighth sub-function is not empty, and the eighth sub-function is not the target sub-function, executing the machine code corresponding to the eighth sub-function.

[0015] In an embodiment of the present application, the second file type may represent the file suffix of the running file. For example, when the running file is a file optimized by AOT compilation, the suffix of the running file is ".odex", so the running file can be considered to be the second file type. In the case where the file type of the running file is the second file type, the method of the present application can set an execution interface for each sub-function in the running file by judging whether the compilation identification information corresponding to each sub-function in the running file is empty. Specifically, when the compilation identification information of a sub-function is empty, it can be considered that the sub-function has not been compiled and optimized, and the execution interface of the sub-function can be set to the second interpretation execution interface, and the second interpreter continues to interpret and execute the sub-function; if the compilation identification information of a sub-function is not empty, it can be considered that the sub-function has been compiled and optimized, and when the sub-function is a target sub-function, the execution interface of the sub-function can be set to the first interpretation execution interface, and the first interpreter continues to interpret and execute the sub-function; if the compilation identification information of a sub-function is not empty, it can be considered that the sub-function has been compiled and optimized, and when the sub-function is not a target sub-function, it can be understood that the sub-function has been compiled and optimized, so the machine code corresponding to the sub-function can be directly executed, which helps to ensure the operating efficiency of third-party applications and the user experience.

[0016] In one possible implementation, after performing the Hook processing on the target sub-function in the running file, the method may further include: obtaining the Hook information corresponding to the target sub-function; reflecting the Hook information to the message queue, and continuing to interpret and execute the target sub-function through the first interpreter.

[0017] In an embodiment of the present application, the message queue storing the instrumentation information belongs to an asynchronous message queue, that is, the instrumentation information will not be processed immediately after being reflected to the message queue. Instead, in order to ensure the normal operation of the third-party application, after the instrumentation information is saved in the message queue, the interpreter can continue to interpret and execute the target sub-function. The instrumentation information can be processed asynchronously, which greatly weakens the impact of the instrumentation processing on the third-party application and ensures the operating efficiency and user experience of the third-party application.

[0018] In one possible implementation, the third-party application includes at least one application file, and one application file includes at least one sub-function. Before obtaining file information of a running file corresponding to the third-party application, the method may further include: in response to the third-party application being in a running state, traversing function information of each sub-function corresponding to each application file of the third-party application, the function information including a function name corresponding to the function; based on the function information and a pre-acquired configuration file, determining whether there is a function name of a key function in the configuration file that is identical to the function name of a ninth sub-function in the third-party application, the configuration file including function names corresponding to one or more key functions; and setting a key function label for the ninth sub-function when it is determined that there is a function name of a key function in the configuration file that is identical to the function name of a ninth sub-function in the third-party application.

[0019] In an embodiment of the present application, ART can traverse each sub-function in each application file corresponding to the third-party application when the third-party application is first started, and judge whether there is a function name of a key function that is the same as the function name of the ninth sub-function in the third-party application in the configuration file based on the function information of each sub-function and the pre-acquired configuration file, wherein if there is a function name of a key function that is the same as the function name of the ninth sub-function in the third-party application in the configuration file, then the ninth sub-function can be considered to be the function corresponding to the key event. Furthermore, ART will set a key function label for the eighth function, so that ART does not need to perform key function judgments on the sub-functions in the running file multiple times during the running of the third application, which helps to reduce the running burden of the electronic device, and also helps to improve the efficiency of the subsequent ART based on the interpreter to perform plug-in processing on the target sub-function in the running file.

[0020] In the second aspect, an embodiment of the present application provides a system for determining an instrumentation process based on a compiled optimization function, and the above-mentioned system may include: an instrumentation module and a first interpreter; wherein the instrumentation module can be used to: obtain file information of a running file corresponding to a third-party application, the running file is an application file corresponding to a third-party application currently compiled and executed or interpreted in the runtime virtual machine ART, the file information includes the file name of the running file, and the running file includes at least one sub-function; based on the file name in the running file, determine the file type of the running file, the file type includes a first file type and a second file type; based on the traversal process corresponding to the file type of the running file, perform instrumentation Hook processing on the target sub-function in the running file, the target sub-function is a sub-function with a key function label; the first interpreter can be used to continue interpreting and executing the target sub-function.

[0021] In one possible implementation, the first traversal process may include traversing the type of execution interface corresponding to each sub-function in the running file, and the first traversal process is the traversal process corresponding to the first file type; the second traversal process may include traversing the type of compilation identification information corresponding to each sub-function in the running file, and the second traversal process is the traversal process corresponding to the second file type.

[0022] In one possible implementation, the execution interface may include a compiled execution interface and an interpreted execution interface, and the interpreted execution interface may include a first interpreted execution interface and a second interpreted execution interface; when the file type of the running file is the first file type, the running file is image file data; the above-mentioned system may also include: a management module; wherein the above-mentioned stub module may also be used to: traverse the execution interfaces of each sub-function in the running file; the above-mentioned management module may also be used to: when the execution interface of the first sub-function is a compiled execution interface and the first sub-function is a target sub-function, adjust the execution interface of the first sub-function to the first interpreted execution interface; when the execution interface of the second sub-function is a second interpreted execution interface and the second sub-function is a target sub-function, adjust the execution interface of the second sub-function to the first interpreted execution interface; the above-mentioned first interpreter may also be used to: interpret and execute the above-mentioned first sub-function; interpret and execute the above-mentioned second sub-function.

[0023] In one possible implementation, the ART may include a compiler and an interpreter, and the interpreter may include the first interpreter and the second interpreter. When the file type of the running file is the first file type, the stub module may be used to execute the machine code corresponding to the third sub-function when the execution interface of the third sub-function is a compilation execution interface and the third sub-function is not a target function. The second interpreter may be used to interpret and execute the fourth sub-function when the execution interface of the fourth sub-function is a second interpretation execution interface and the fourth sub-function is not a target sub-function.

[0024] In a possible implementation, when the file type of the running file is the second file type, the above-mentioned plug-in module can also be used to obtain the compilation identification information corresponding to each sub-function in the running file; when the compilation identification information of the fifth sub-function is empty and the fifth sub-function is not the target sub-function, the execution interface of the fifth sub-function is adjusted to the second interpretation execution interface; when the compilation identification information of the sixth sub-function is empty and the sixth sub-function is the target sub-function, the execution interface of the sixth sub-function is adjusted to the first interpretation execution interface; when the compilation identification information of the seventh sub-function is not empty and the seventh sub-function is the target sub-function, the execution interface of the seventh sub-function is adjusted to the first interpretation execution interface; when the compilation identification information of the eighth sub-function is not empty and the eighth sub-function is not the target sub-function, the machine code corresponding to the eighth sub-function is executed; the above-mentioned second interpreter can also be used to interpret and execute the above-mentioned fifth sub-function; the above-mentioned first interpreter can also be used to interpret and execute the above-mentioned sixth sub-function and / or the above-mentioned seventh sub-function.

[0025] In one possible implementation, after performing the Hook processing on the target sub-function in the running file, when the file type of the running file is the second file type, the above-mentioned plug-in module can also be used to obtain the plug-in information corresponding to the target sub-function and reflect the plug-in information to the message queue; the above-mentioned first interpreter can also be used to continue to interpret and execute the target sub-function after reflecting the plug-in information to the message queue.

[0026] In one possible implementation, a third-party application includes at least one application file, and one application file includes at least one sub-function. Before obtaining file information of a running file corresponding to the third-party application, the above-mentioned plug-in module can also be used to: in response to the third-party application being in a running state, traverse function information of each sub-function corresponding to each application file of the third-party application, the function information including a function name corresponding to the function; based on the function information and a pre-acquired configuration file, determine whether there is a function name of a key function in the configuration file that is the same as the function name of a ninth sub-function in the third-party application, the configuration file including function names corresponding to one or more key functions; when it is determined that there is a function name of a key function in the configuration file that is the same as the function name of a ninth sub-function in the third-party application, set a key function label for the ninth sub-function.

[0027] In a third aspect, an embodiment of 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, and the one or more memories are used to store computer program codes, and the computer program codes include computer instructions, and when the one or more processors execute the computer instructions, the electronic device executes the interpreter-based plug-in method as in the first aspect or any possible implementation of the first aspect.

[0028] In a fourth aspect, the present application provides a computer storage medium comprising computer instructions, which, when executed on an electronic device, enables a communication device to execute an interpreter-based plugging method as described in the first aspect or any possible implementation of the first aspect.

[0029] In a fifth aspect, the present application provides a computer program product, which, when executed on a computer, enables the computer to execute the interpreter-based instrumentation method in the above-mentioned first aspect or any possible implementation of the first aspect.

[0030] It is understandable that the system provided in the second aspect, the electronic device provided in the third aspect, the computer-readable storage medium provided in the fourth aspect, and the computer program product provided in the fifth aspect are all used to execute the method provided in the embodiment of the present application. Therefore, the beneficial effects that can be achieved can refer to the beneficial effects in the corresponding method, which will not be repeated here. BRIEF DESCRIPTION OF THE DRAWINGS

[0031] In order to more clearly illustrate the technical solutions in the embodiments of the present application or the background technology, the drawings required for use in the embodiments of the present application or the background technology will be described below.

[0032] Figures 1 to 4 This is a schematic diagram of a user interface of a group of electronic devices provided in an embodiment of the present application.

[0033] Figure 5 This is a schematic diagram of the operation of a third-party application provided in an embodiment of the present application.

[0034] Figure 6 It is a schematic diagram of the hardware structure of an electronic device provided in an embodiment of the present application.

[0035] Figure 7 It is a software structure block diagram of an electronic device provided in an embodiment of the present application.

[0036] Figure 8 It is a software structure block diagram of another electronic device provided in an embodiment of the present application.

[0037] Fig. 9This is a schematic diagram of a third-party application execution method provided in an embodiment of the present application.

[0038] Fig.10 It is a flowchart of a method for determining an instrumentation process based on a file type provided in an embodiment of the present application.

[0039] Fig.11 It is a flow chart of an adjustment sub-function execution interface corresponding to a first traversal process provided in an embodiment of the present application.

[0040] Fig.12 It is a flow chart of another adjustment sub-function execution interface corresponding to the first traversal process provided in an embodiment of the present application.

[0041] Fig.13 It is a flow chart of an adjustment sub-function execution interface corresponding to a second traversal process provided in an embodiment of the present application.

[0042] Fig.14 It is a flow chart of another adjustment sub-function execution interface corresponding to the second traversal process provided in an embodiment of the present application.

[0043] Fig.15 This is a schematic diagram of optimizing the performance of a third-party application through an instrumentation method provided in an embodiment of the present application. DETAILED DESCRIPTION

[0044] The technical solutions in the embodiments of the present application will be described clearly and in detail below in conjunction with the accompanying drawings. In the description of the embodiments of the present application, unless otherwise specified, " / " means or, for example, A / B can mean A or B; "and / or" in the text is only a description of the association relationship of associated objects, indicating that there can be three relationships, for example, A and / or B can mean: A exists alone, A and B exist at the same time, and B exists alone. In addition, in the description of the embodiments of the present application, "multiple" means two or more than two.

[0045] The term "user interface (UI)" in the following embodiments of the present application refers to a medium interface for interaction and information exchange between an application or operating system and a user, which realizes the conversion between the internal form of information and the form acceptable to the user. The user interface of an application is a source code written in a specific computer language such as Java and extensible markup language (XML). The interface source code is parsed and rendered on an electronic device, and finally presented as content that the user can recognize, such as pictures, text, buttons and other controls. A control, also called a widget, is a basic element of a user interface. Typical controls include a toolbar, menu bar, text box, button, scrollbar, picture and text. The properties and contents of controls in the interface are defined by tags or nodes, such as XML through <textview> 、 <imgview> 、 <videoview>The controls contained in the interface are specified by nodes such as <head> and <body>. A node corresponds to a control or attribute in the interface. After being parsed and rendered, the node is presented as user-visible content. In addition, many applications, such as hybrid applications, usually also contain web pages in their interfaces. A web page, also known as a page, can be understood as a special control embedded in the application interface. A web page is source code written in a specific computer language, such as hypertext markup language (HTML), cascading style sheets (CSS), JavaScript (JS), etc. The web page source code can be loaded and displayed as user-recognizable content by a browser or a web page display component with similar functions to a browser. The specific content contained in a web page is also defined by tags or nodes in the web page source code. For example, HTML is defined by <body> tags or nodes in the web page source code. 、 、 <video> 、 <canvas>To define the elements and attributes of a web page.

[0046] The most common form of user interface is graphical user interface (GUI), which refers to a user interface related to computer operation that is displayed in a graphical manner. It can be an icon, window, control or other interface element displayed on the display screen of an electronic device, where a control can include icons, buttons, menus, tabs, text boxes, dialog boxes, status bars, navigation bars, widgets and other visual interface elements.

[0047] In addition, the following also introduces electronic devices, user interfaces for such electronic devices, and embodiments for using such electronic devices. In some embodiments, the electronic device may be a portable electronic device that also includes other functions such as message management, message receiving and push functions, such as a mobile phone, a tablet computer, a wearable electronic device with wireless communication functions (such as a smart watch), etc. Exemplary embodiments of portable electronic devices include but are not limited to devices equipped with Or a portable electronic device with other operating systems. The above-mentioned portable electronic device may also be other portable electronic devices, such as a laptop computer (Laptop) with a touch-sensitive surface or a touch panel. It should also be understood that in some other embodiments, the above-mentioned electronic device may not be a portable electronic device, but a desktop computer, a car computer, etc. with a touch-sensitive surface or a touch panel. It can be understood that the embodiment of the present application is introduced by taking a smart phone as an example, but it is not limited to smart phones, and it can also be other smart devices with communication functions, such as smart watches, smart bracelets, etc.

[0048] In order to facilitate understanding of the embodiments of the present application, the technical problems that need to be solved by the embodiments of the present application are analyzed in detail below.

[0049] With the development of the Internet, users download and use more and more third-party software in the application market of electronic devices for the convenience of life and entertainment. However, for users, various related functions or related applications in third-party applications can be opened quickly or can respond to user operations quickly, which can bring users a better user experience.

[0050] Please refer to the attached Figure 1 To Attachment Figure 4 , Figures 1 to 4 This is a schematic diagram of a user interface of a group of electronic devices provided in an embodiment of the present application.

[0051] Electronic devices can display Figure 1 The user interface shown in Figure 1 The user interface shown may include one or more third-party applications (such as third party 101). The user may click (or perform other user operations) on the third party 101. In the case where the application loading time is very short, the electronic device may quickly respond to the user's click operation and display the following information: Figure 2 The user interface shown in Figure 2 The user interface shown is the application display interface of the third-party application, such as Figure 2 As shown, the third-party application is a shopping application. When the user clicks on the application 1022 in the third-party application in the application display interface (such as the various applications shown in the display area 102), the third-party application will load the corresponding application content to be displayed in the electronic device, such as Figure 3 The user interface shown.

[0052] Currently, third-party applications often display different content in different ways due to the configuration of electronic devices, network speed, or other related factors. Figure 3 Before the user interface shown in the figure, the electronic device will first display the following Figure 4 The user interface shown in the figure Figure 4 The user interface shown is a user interface in which the application content of the third-party application is not fully loaded, such as Figure 4 As shown, this user interface is different from the above Figure 3 The user interface shown lacks images, text, voice, or controls related to the app content.

[0053] Above Figure 4 The longer the user interface is displayed, the longer the third-party application will load, and the worse the user experience will be. Figure 4 The display time of the displayed user interface to improve the user experience.

[0054] However, the operation of third-party applications does not involve the relevant operation events of the operating system in the electronic device. Please refer to the attached Figure 5 , Figure 5 Schematic diagram of the operation of a third-party application provided in the embodiment of the present application. Figure 5 As shown, when a third-party application is running, it is often a collection of multiple function operations, and there is no clear system event to define it. It can also be understood that the content loading process of the third-party application mainly executes the third-party application content, which is a black box for the operating system of the electronic device and cannot be modified. That is, the operating system of the electronic device cannot obtain the relevant running nodes during the running of the third-party application (such as: the running start node and running end node of a certain application content, etc.). When the third-party application is running, there is a lack of pile points, and the electronic device cannot optimize or improve the third-party application runtime based on the pile points.

[0055] In the prior art, one prior art solution is to optimize the operation of the entire third-party application, for example, as mentioned above Figure 5 As shown, when the entire third-party application is running, the operating frequency of the processing core corresponding to the prior art is higher than the operating frequency of the initial corresponding processing core, that is, the prior art optimizes the application operation by increasing the operating frequency of the processing core when the entire third-party application is running. That is, in the prior art, the operating frequency of the processing core when the entire third-party application is running is higher than the operating frequency of the processing core when the third-party application is initially running. The loading time of the third-party application can be shortened, and the user experience can be improved. However, the optimization operation of this solution (i.e., overall increasing the operating frequency of the processing core when the third-party application is running) is often limited by the power consumption of the processing core or the overall temperature control of the electronic device.

[0056] Please refer to the following Table 1, which is a table of the running and loading time of third-party applications in different electronic devices in the prior art provided in an embodiment of the present application.

[0057] Table 1

[0058]

[0059] As shown in Table 1 above, after the overall optimization of third-party application A and third-party application B, the loading time of the above third-party applications will be reduced. However, since this solution is for the overall optimization of third-party applications, that is, when the third-party application is running, the high operating frequency of the processing core is continuously maintained. Therefore, although this solution will shorten the loading time of third-party applications, due to its overall frequency modulation (that is, adjusting the operating frequency of the processing core) when the third-party application is running, the shell temperature of the electronic device will increase significantly. Therefore, in order to control the temperature of the electronic device, it cannot make a significant modification to the operating frequency of the processing core, and thus the loading time of the third-party application will not be significantly reduced.

[0060] Another existing solution is to regard the user's click operation in the third-party application interface as the time point when the application content of the third-party application starts to load, and based on this, start frequency optimization. The frequency modulation time of this solution is significantly shorter than the overall optimization of the third-party application, so the time for processing core frequency modulation is shortened, so that the shell temperature limit point of the electronic device remains unchanged, and the adjusted operating frequency is further increased, thereby shortening the loading time of the third-party application.

[0061] However, the problem with this solution is that, due to the different objects clicked by the user, the trigger point of the user's click operation cannot completely correspond to the time point when the application content of the third-party application starts to load. Moreover, this solution does not have a clear end point of operation. Therefore, even if there is an alternative start point of operation, it is impossible to know the end point of operation after the application content is loaded. Moreover, different click operations require the electronic device to determine whether it is the start point of operation. The ambiguity may lead to abuse of the solution. The lack of an end point may cause the scope of influence of the solution to expand, and some operation efficiency improvements will become low.

[0062] Therefore, the embodiments of the present application provide a method and related devices for determining the plug-in process based on the file type, which can take the corresponding traversal process to achieve the purpose of plug-in processing on the target sub-function based on the file type of the running file of the third-party application, and adjust the execution interface of the target sub-function, which helps the electronic device to accurately determine the nodes of various events in the operation of the third-party application through the plug-in information after plug-in, and then optimize the third-party application in a targeted manner, such as: shortening the loading time of a certain application content in the third-party application and improving the user experience.

[0063] Exemplarily, the embodiment of the present application can take a corresponding traversal process based on the file type of the running file of the third-party application to achieve the purpose of performing instrumentation processing on the target sub-function. Among them, the target sub-function is a function with a key function identifier, and the target sub-function represents the function corresponding to the key event in the running file. Furthermore, the method of the embodiment of the present application will also adjust the execution interface of the target sub-function to a first interpretation execution interface, and the first interpreter (such as the Switch interpreter) will interpret and execute the target sub-function. Furthermore, the instrumentation information of the target sub-function after the instrumentation processing will be reflected to the message queue to be processed and wait for processing. It can be seen that the method of the embodiment of the present application can perform instrumentation processing on the target sub-function in the running file to be executed in the third-party application based on the interpreter, and obtain the corresponding instrumentation information, so as to realize the positioning of the key event points in the running process of the third-party application, and then can optimize the third application in a targeted manner based on the key events of the third-party application obtained, avoid optimizing the entire third-party application, improve the accuracy of the optimization, and increase the user experience. For example: as mentioned above Figure 5 As shown, the operating frequency of the processing core is increased at key function 1, and the operating frequency of the processing core is decreased at key function 2 to keep it consistent with that before the increase, so that when the third-party application is running, the operating frequency of the processing core in the time period between key function 1 and key function 2 is higher than the operating frequency of the processing core initially corresponding to the third-party application, and is also higher than the operating frequency of the processing core during the runtime of the entire third-party application corresponding to the prior art, so that the loading time of the application content in the third-party application can be greatly shortened, and the user experience can be improved. In addition, the message queue storing the plugging information belongs to an asynchronous message queue, that is, after the plugging information is reflected to the message queue, it will not be processed immediately, but in order to ensure the normal operation of the third-party application, after the plugging information is saved in the message queue, the interpreter can continue to interpret and execute the above-mentioned running function, and the plugging information can be processed asynchronously. This method greatly weakens the impact of the plugging processing on the third-party application, and ensures the operating efficiency and user experience of the third-party application.

[0064] The implementation of the present application embodiment can optimize the performance of third-party applications in a targeted manner. The specific implementation of the method is described in detail in the following related embodiments, and the present application embodiment is not described in detail here.

[0065] It should be understood that the user interface shown above is only an exemplary interface for loading an application of a third-party application and should not limit the embodiments of the present application.

[0066] First, the following exemplifies the electronic device 100 as an example. Figure 1-Figure 4 The electronic equipment shown is introduced.

[0067] Please refer to the attached Figure 6 , Figure 6 It is a schematic diagram of the hardware structure of an electronic device provided in an embodiment of the present application.

[0068] The following is a detailed description of the embodiment using the electronic device 100 as an example. It should be understood that the electronic device 100 may have more than Figure 6 More or fewer components may be shown, two or more components may be combined, or there may be a different configuration of components. Figure 6 The various components shown in the drawings may be implemented in hardware, software, or a combination of hardware and software, including one or more signal processing and / or application specific integrated circuits.

[0069] The electronic device 100 may include: a processor 110, an external memory interface 120, an internal memory 121, a universal serial bus (USB) interface 130, a charging management module 140, a power management module 141, a battery 142, an antenna 1, an antenna 2, a mobile communication module 150, a wireless communication module 160, an audio module 170, a speaker 170A, a receiver 170B, a microphone 170C, an earphone interface 170D, a sensor module 180, a button 190, a motor 191, an indicator 192, a camera 193, a display screen 194 and a subscriber identification module (SIM) card interface 195, etc. The sensor module 180 may include a pressure sensor 180A, a gyroscope sensor 180B, an air pressure sensor 180C, a magnetic sensor 180D, an acceleration sensor 180E, a distance sensor 180F, a proximity light sensor 180G, a fingerprint sensor 180H, a temperature sensor 180J, a touch sensor 180K, an ambient light sensor 180L, a bone conduction sensor 180M, etc.

[0070] The processor 110 may include one or more processing units, for example, the processor 110 may include an application processor (AP), a modem processor, a graphics processor (GPU), an image signal processor (ISP), a controller, a memory, a video codec, a digital signal processor (DSP), a baseband processor, and / or a neural-network processing unit (NPU), etc. Different processing units may be independent devices or integrated into one or more processors.

[0071] The controller may be the nerve center and command center of the electronic device 100. The controller may generate an operation control signal according to the instruction operation code and the timing signal to complete the control of fetching and executing instructions.

[0072] The processor 110 may also be provided with a memory for storing instructions and data. In some embodiments, the memory in the processor 110 is a cache memory. The memory may store instructions or data that the processor 110 has just used or cyclically used. If the processor 110 needs to use the instruction or data again, it may be directly called from the memory. This avoids repeated access, reduces the waiting time of the processor 110, and thus improves the efficiency of the system.

[0073] In some embodiments, the processor 110 may include one or more interfaces. The interface may include an inter-integrated circuit (I2C) interface, an inter-integrated circuit sound (I2S) interface, a pulse code modulation (PCM) interface, a universal asynchronous receiver / transmitter (UART) interface, a mobile industry processor interface (MIPI), a general-purpose input / output (GPIO) interface, a subscriber identity module (SIM) interface, and / or a universal serial bus (USB) interface, etc.

[0074] The I2C interface is a bidirectional synchronous serial bus, including a serial data line (SDA) and a serial clock line (SCL). In some embodiments, the processor 110 may include multiple groups of I2C buses. The processor 110 may be coupled to the touch sensor 180K, the charger, the flash, the camera 193, etc. through different I2C bus interfaces. For example: the processor 110 may be coupled to the touch sensor 180K through the I2C interface, so that the processor 110 communicates with the touch sensor 180K through the I2C bus interface, thereby realizing the touch function of the electronic device 100.

[0075] The I2S interface can be used for audio communication. In some embodiments, the processor 110 can include multiple I2S buses. The processor 110 can be coupled to the audio module 170 via the I2S bus to achieve communication between the processor 110 and the audio module 170. In some embodiments, the audio module 170 can transmit an audio signal to the wireless communication module 160 via the I2S interface to achieve the function of answering a call through a Bluetooth headset.

[0076] The PCM interface can also be used for audio communication, sampling, quantizing and encoding analog signals. In some embodiments, the audio module 170 and the wireless communication module 160 can be coupled via a PCM bus interface. In some embodiments, the audio module 170 can also transmit audio signals to the wireless communication module 160 via the PCM interface to realize the function of answering calls via a Bluetooth headset. Both the I2S interface and the PCM interface can be used for audio communication.

[0077] The UART interface is a universal serial data bus for asynchronous communication. The bus can be a bidirectional communication bus. It converts the data to be transmitted between serial communication and parallel communication. In some embodiments, the UART interface is generally used to connect the processor 110 and the wireless communication module 160. For example, the processor 110 communicates with the Bluetooth module in the wireless communication module 160 through the UART interface to implement the Bluetooth function. In some embodiments, the audio module 170 can transmit an audio signal to the wireless communication module 160 through the UART interface to implement the function of playing music through a Bluetooth headset.

[0078] The MIPI interface can be used to connect the processor 110 with peripheral devices such as the display screen 194 and the camera 193. The MIPI interface includes a camera serial interface (CSI), a display serial interface (DSI), etc. In some embodiments, the processor 110 and the camera 193 communicate via the CSI interface to implement the shooting function of the electronic device 100. The processor 110 and the display screen 194 communicate via the DSI interface to implement the display function of the electronic device 100.

[0079] The GPIO interface can be configured by software. The GPIO interface can be configured as a control signal or as a data signal. In some embodiments, the GPIO interface can be used to connect the processor 110 with the camera 193, the display 194, the wireless communication module 160, the audio module 170, the sensor module 180, etc. The GPIO interface can also be configured as an I2C interface, an I2S interface, a UART interface, a MIPI interface, etc.

[0080] The SIM card interface can be used to communicate with the SIM card interface 195 to implement the function of transmitting data to the SIM card or reading data in the SIM card.

[0081] The USB interface 130 is an interface that complies with the USB standard specification, and specifically can be a Mini USB interface, a Micro USB interface, a USB Type C interface, etc. The USB interface 130 can be used to connect a charger to charge the electronic device 100, and can also be used to transfer data between the electronic device 100 and a peripheral device. It can also be used to connect headphones to play audio through the headphones. The interface can also be used to connect other electronic devices, such as AR devices, etc.

[0082] It is understandable that the interface connection relationship between the modules illustrated in the embodiment of the present application is only a schematic illustration and does not constitute a structural limitation on the electronic device 100. In other embodiments of the present application, the electronic device 100 may also adopt different interface connection methods in the above embodiments, or a combination of multiple interface connection methods.

[0083] The charging management module 140 is used to receive charging input from a charger, where the charger can be a wireless charger or a wired charger.

[0084] The power management module 141 is used to connect the battery 142, the charging management module 140 and the processor 110. The power management module 141 receives input from the battery 142 and / or the charging management module 140 to power the processor 110, the internal memory 121, the external memory, the display screen 194, the camera 193, and the wireless communication module 160.

[0085] The wireless communication function of the electronic device 100 can be implemented through the antenna 1, the antenna 2, the mobile communication module 150, the wireless communication module 160, the modem processor and the baseband processor.

[0086] Antenna 1 and antenna 2 are used to transmit and receive electromagnetic wave signals. Each antenna in electronic device 100 can be used to cover a single or multiple communication frequency bands. Different antennas can also be reused to improve the utilization of antennas. For example, antenna 1 can be reused as a diversity antenna for a wireless local area network. In some other embodiments, the antenna can be used in combination with a tuning switch.

[0087] The mobile communication module 150 can provide solutions for wireless communications including 2G / 3G / 4G / 5G, etc., applied to the electronic device 100. The mobile communication module 150 may include at least one filter, a switch, a power amplifier, a low noise amplifier (LNA), etc. The mobile communication module 150 can receive electromagnetic waves from the antenna 1, and filter, amplify, and process the received electromagnetic waves, and transmit them to the modulation and demodulation processor for demodulation. The mobile communication module 150 can also amplify the signal modulated by the modulation and demodulation processor, and convert it into electromagnetic waves for radiation through the antenna 1. In some embodiments, at least some of the functional modules of the mobile communication module 150 can be set in the processor 110. In some embodiments, at least some of the functional modules of the mobile communication module 150 can be set in the same device as at least some of the modules of the processor 110.

[0088] The modem processor may include a modulator and a demodulator. Among them, the modulator is used to modulate the low-frequency baseband signal to be sent into a medium-high frequency signal. The demodulator is used to demodulate the received electromagnetic wave signal into a low-frequency baseband signal. The demodulator then transmits the demodulated low-frequency baseband signal to the baseband processor for processing. After the low-frequency baseband signal is processed by the baseband processor, it is passed to the application processor. The application processor outputs a sound signal through an audio device (not limited to a speaker 170A, a receiver 170B, etc.), or displays an image or video through a display screen 194. In some embodiments, the modem processor may be an independent device. In other embodiments, the modem processor may be independent of the processor 110 and be set in the same device as the mobile communication module 150 or other functional modules.

[0089] The wireless communication module 160 can provide wireless communication solutions including wireless local area networks (WLAN) (such as wireless fidelity (Wi-Fi) networks), bluetooth (BT), global navigation satellite system (GNSS), frequency modulation (FM), near field communication (NFC), infrared (IR), etc., which are applied to the electronic device 100. The wireless communication module 160 can be one or more devices integrating at least one communication processing module. The wireless communication module 160 receives electromagnetic waves via the antenna 2, modulates the frequency of the electromagnetic wave signal and performs filtering, and sends the processed signal to the processor 110. The wireless communication module 160 can also receive the signal to be sent from the processor 110, modulate the frequency of it, amplify it, and convert it into electromagnetic waves for radiation through the antenna 2.

[0090] In some embodiments, the antenna 1 of the electronic device 100 is coupled to the mobile communication module 150, and the antenna 2 is coupled to the wireless communication module 160, so that the electronic device 100 can communicate with the network and other devices through wireless communication technology. The wireless communication technology may include global system for mobile communications (GSM), general packet radio service (GPRS), code division multiple access (CDMA), wideband code division multiple access (WCDMA), time-division code division multiple access (TD-SCDMA), long term evolution (LTE), BT, GNSS, WLAN, NFC, FM, and / or IR technology. The GNSS may include a global positioning system (GPS), a global navigation satellite system (GLONASS), a Beidou navigation satellite system (BDS), a quasi-zenith satellite system (QZSS) and / or a satellite based augmentation system (SBAS).

[0091] The electronic device 100 implements the display function through a GPU, a display screen 194, and an application processor. The GPU is a microprocessor for image processing, which connects the display screen 194 and the application processor. The GPU is used to perform mathematical and geometric calculations for graphics rendering. The processor 110 may include one or more GPUs that execute program instructions to generate or change display information.

[0092] The display screen 194 is used to display images, text, videos, etc. The display screen 194 includes a display panel. The display panel can be a liquid crystal display (LCD), an organic light-emitting diode (OLED), an active-matrix organic light emitting diode or an active-matrix organic light emitting diode (AMOLED), a flexible light-emitting diode (FLED), Miniled, MicroLed, Micro-oLed, a quantum dot light emitting diode (QLED), etc. In some embodiments, the electronic device 100 may include 1 or N display screens 194, where N is a positive integer greater than 1.

[0093] The electronic device 100 can realize the shooting function through ISP, camera 193, video codec, GPU, display screen 194 and application processor.

[0094] The ISP is used to process the data fed back by the camera 193. For example, when taking a photo, the shutter is opened, and the light is transmitted to the camera photosensitive element through the lens. The light signal is converted into an electrical signal, and the camera photosensitive element transmits the electrical signal to the ISP for processing and converts it into an image visible to the naked eye. The ISP can also perform algorithm optimization on the noise and brightness of the image. The ISP can also optimize the exposure, color temperature and other parameters of the shooting scene. In some embodiments, the ISP can be set in the camera 193.

[0095] The camera 193 is used to capture still images or videos. The object generates an optical image through the lens and projects it onto the photosensitive element. The photosensitive element can be a charge coupled device (CCD) or a complementary metal-oxide-semiconductor (CMOS) phototransistor. The photosensitive element converts the optical signal into an electrical signal, and then passes the electrical signal to the ISP for conversion into a digital image signal. The ISP outputs the digital image signal to the DSP for processing. The DSP converts the digital image signal into an image signal in a standard RGB, YUV or other format. In some embodiments, the electronic device 100 may include 1 or N cameras 193, where N is a positive integer greater than 1. In other embodiments, the electronic device 100 may not include the camera 193.

[0096] The digital signal processor is used to process digital signals, and can process not only digital image signals but also other digital signals. For example, when the electronic device 100 is selecting a frequency point, the digital signal processor is used to perform Fourier transform on the frequency point energy.

[0097] Video codecs are used to compress or decompress digital videos. The electronic device 100 may support one or more video codecs. Thus, the electronic device 100 may play or record videos in a variety of coding formats, such as Moving Picture Experts Group (MPEG) 1, MPEG2, MPEG3, MPEG4, etc.

[0098] NPU is a neural network (NN) computing processor. By drawing on the structure of biological neural networks, such as the transmission mode between neurons in the human brain, it can quickly process input information and can also continuously self-learn. Through NPU, applications such as intelligent cognition of electronic device 100 can be realized, such as image recognition, face recognition, voice recognition, text understanding, etc.

[0099] The external memory interface 120 can be used to connect an external memory card, such as a Micro SD card, to expand the storage capacity of the electronic device 100. The external memory card communicates with the processor 110 through the external memory interface 120 to implement a data storage function, such as storing music, video and other files in the external memory card.

[0100] The internal memory 121 can be used to store computer executable program codes, which include instructions. The processor 110 executes various functional applications and data processing of the electronic device 100 by running the instructions stored in the internal memory 121. The internal memory 121 may include a program storage area and a data storage area. Among them, the program storage area may store an operating system, applications required for at least one function (such as face recognition function, fingerprint recognition function, mobile payment function, etc.), etc. The data storage area may store data created during the use of the electronic device 100 (such as face information template data, fingerprint information template, etc.), etc. In addition, the internal memory 121 may include a high-speed random access memory, and may also include a non-volatile memory, such as at least one disk storage device, a flash memory device, a universal flash storage (UFS), etc.

[0101] The electronic device 100 can implement audio functions such as music playing and recording through the audio module 170, the speaker 170A, the receiver 170B, the microphone 170C, the headphone jack 170D, and the application processor.

[0102] The audio module 170 is used to convert digital audio information into analog audio signal output, and is also used to convert analog audio input into digital audio signals. The audio module 170 can also be used to encode and decode audio signals. In some embodiments, the audio module 170 can be arranged in the processor 110, or some functional modules of the audio module 170 can be arranged in the processor 110.

[0103] The speaker 170A, also called a "speaker", is used to convert an audio electrical signal into a sound signal. The electronic device 100 can listen to music or listen to a hands-free call through the speaker 170A.

[0104] The receiver 170B, also called a "earpiece", is used to convert audio electrical signals into sound signals. When the electronic device 100 receives a call or voice message, the voice can be received by placing the receiver 170B close to the human ear.

[0105] Microphone 170C, also called "microphone" or "microphone", is used to convert sound signals into electrical signals. When making a call or sending a voice message, the user can make a sound by putting his mouth close to microphone 170C to input the sound signal into microphone 170C. The electronic device 100 can be provided with at least one microphone 170C. In other embodiments, the electronic device 100 can be provided with two microphones 170C, which can not only collect sound signals but also realize noise reduction function. In other embodiments, the electronic device 100 can also be provided with three, four or more microphones 170C to realize collection of sound signals, noise reduction, identification of sound source, realization of directional recording function, etc.

[0106] The earphone interface 170D is used to connect a wired earphone and can be a USB interface 130 or a 3.5 mm open mobile terminal platform (OMTP) standard interface or a cellular telecommunications industry association of the USA (CTIA) standard interface.

[0107] The pressure sensor 180A is used to sense the pressure signal and can convert the pressure signal into an electrical signal. In some embodiments, the pressure sensor 180A can be set on the display screen 194. There are many types of pressure sensors 180A, such as resistive pressure sensors, inductive pressure sensors, capacitive pressure sensors, etc. The capacitive pressure sensor can be a parallel plate including at least two conductive materials. When a force acts on the pressure sensor 180A, the capacitance between the electrodes changes. The electronic device 100 determines the intensity of the pressure according to the change in capacitance. When a touch operation acts on the display screen 194, the electronic device 100 detects the touch operation intensity according to the pressure sensor 180A. The electronic device 100 can also calculate the touch position according to the detection signal of the pressure sensor 180A. In some embodiments, touch operations acting on the same touch position but with different touch operation intensities can correspond to different operation instructions. For example: when a touch operation with a touch operation intensity less than the first pressure threshold acts on the short message application icon, an instruction to view the short message is executed. When a touch operation with a touch operation intensity greater than or equal to the first pressure threshold acts on the short message application icon, an instruction to create a new short message is executed.

[0108] The gyro sensor 180B can be used to determine the motion posture of the electronic device 100. In some embodiments, the angular velocity of the electronic device 100 around three axes (i.e., x, y, and z axes) can be determined by the gyro sensor 180B. The gyro sensor 180B can be used for anti-shake shooting. For example, when the shutter is pressed, the gyro sensor 180B detects the angle of the electronic device 100 shaking, calculates the distance that the lens module needs to compensate based on the angle, and allows the lens to offset the shaking of the electronic device 100 through reverse movement to achieve anti-shake. The gyro sensor 180B can also be used for navigation and somatosensory game scenes.

[0109] The air pressure sensor 180C is used to measure air pressure. In some embodiments, the electronic device 100 calculates the altitude through the air pressure value measured by the air pressure sensor 180C to assist positioning and navigation.

[0110] The magnetic sensor 180D includes a Hall sensor. The electronic device 100 can use the magnetic sensor 180D to detect the opening and closing of the flip leather case. In some embodiments, when the electronic device 100 is a flip phone, the electronic device 100 can detect the opening and closing of the flip cover according to the magnetic sensor 180D. Then, according to the detected opening and closing state of the leather case or the opening and closing state of the flip cover, the flip cover can be automatically unlocked.

[0111] The acceleration sensor 180E can detect the magnitude of the acceleration of the electronic device 100 in all directions (generally three axes). When the electronic device 100 is stationary, the magnitude and direction of gravity can be detected. It can also be used to identify the posture of the electronic device and is applied to applications such as horizontal and vertical screen switching and pedometers.

[0112] The distance sensor 180F is used to measure the distance. The electronic device 100 can measure the distance by infrared or laser. In some embodiments, when shooting a scene, the electronic device 100 can use the distance sensor 180F to measure the distance to achieve fast focusing.

[0113] The proximity light sensor 180G may include, for example, a light emitting diode (LED) and a light detector, such as a photodiode. The light emitting diode may be an infrared light emitting diode. The electronic device 100 emits infrared light outward through the light emitting diode. The electronic device 100 uses a photodiode to detect infrared reflected light from nearby objects. When sufficient reflected light is detected, it can be determined that there is an object near the electronic device 100. When insufficient reflected light is detected, the electronic device 100 can determine that there is no object near the electronic device 100. The electronic device 100 can use the proximity light sensor 180G to detect that the user holds the electronic device 100 close to the ear to talk, so as to automatically turn off the screen to save power. The proximity light sensor 180G can also be used in leather case mode and pocket mode to automatically unlock and lock the screen.

[0114] The ambient light sensor 180L is used to sense the ambient light brightness. The electronic device 100 can adaptively adjust the brightness of the display screen 194 according to the perceived ambient light brightness. The ambient light sensor 180L can also be used to automatically adjust the white balance when taking pictures. The ambient light sensor 180L can also cooperate with the proximity light sensor 180G to detect whether the electronic device 100 is in a pocket to prevent accidental touches.

[0115] The fingerprint sensor 180H is used to collect fingerprints. The electronic device 100 can use the collected fingerprint characteristics to implement fingerprint unlocking, access application locks, fingerprint photography, fingerprint call answering, etc.

[0116] The temperature sensor 180J is used to detect temperature. In some embodiments, the electronic device 100 uses the temperature detected by the temperature sensor 180J to execute a temperature processing strategy. For example, when the temperature reported by the temperature sensor 180J exceeds a threshold, the electronic device 100 reduces the performance of a processor located near the temperature sensor 180J to reduce power consumption and implement thermal protection. In other embodiments, when the temperature is lower than another threshold, the electronic device 100 heats the battery 142 to avoid abnormal shutdown of the electronic device 100 due to low temperature. In other embodiments, when the temperature is lower than another threshold, the electronic device 100 boosts the output voltage of the battery 142 to avoid abnormal shutdown caused by low temperature.

[0117] The touch sensor 180K is also called a "touch panel". The touch sensor 180K can be set on the display screen 194, and the touch sensor 180K and the display screen 194 form a touch screen, also called a "touch screen". The touch sensor 180K is used to detect touch operations acting on or near it. The touch sensor can pass the detected touch operation to the application processor to determine the type of touch event. Visual output related to the touch operation can be provided through the display screen 194. In other embodiments, the touch sensor 180K can also be set on the surface of the electronic device 100, which is different from the position of the display screen 194.

[0118] The key 190 includes a power key, a volume key, etc. The key 190 may be a mechanical key or a touch key. The electronic device 100 may receive key input and generate key signal input related to user settings and function control of the electronic device 100.

[0119] Motor 191 can generate vibration prompts. Motor 191 can be used for incoming call vibration prompts, and can also be used for touch vibration feedback. For example, touch operations acting on different applications (such as taking pictures, audio playback, etc.) can correspond to different vibration feedback effects. For touch operations acting on different areas of the display screen 194, motor 191 can also correspond to different vibration feedback effects. Different application scenarios (for example: time reminders, receiving messages, alarm clocks, games, etc.) can also correspond to different vibration feedback effects. The touch vibration feedback effect can also support customization.

[0120] Indicator 192 may be an indicator light, which may be used to indicate charging status, power changes, synthesis requests, missed calls, notifications, etc.

[0121] The SIM card interface 195 is used to connect a SIM card. The SIM card can be connected to and separated from the electronic device 100 by inserting it into the SIM card interface 195 or pulling it out from the SIM card interface 195. The electronic device 100 can support 1 or N SIM card interfaces, where N is a positive integer greater than 1. The SIM card interface 195 can support Nano SIM cards, Micro SIM cards, SIM cards, and the like. Multiple cards can be inserted into the same SIM card interface 195 at the same time. The types of the multiple cards can be the same or different. The SIM card interface 195 can also be compatible with different types of SIM cards. The SIM card interface 195 can also be compatible with external memory cards. The electronic device 100 interacts with the network through the SIM card to implement functions such as calls and data communications.

[0122] Please refer to the attached Figure 7 , Figure 7 It is a software structure block diagram of an electronic device provided in an embodiment of the present application.

[0123] like Figure 7 As shown, the software structure diagram can be applied to the above Figure 6 In the hardware architecture of the electronic device 100 shown, the layered architecture can divide the software in the electronic device 100 into several layers, each layer has a clear role and division of labor. The layers communicate with each other through software interfaces. In other embodiments, the Android system is divided into four layers, from top to bottom, namely, the application layer, the application framework layer (also referred to as the application management layer in the embodiment of the present application), the Android runtime (Android runtime) and the system library, and the kernel layer.

[0124] The application layer can include a series of application packages.

[0125] like Figure 7 As shown, the application layer may include applications such as camera, gallery, calendar, call, map, navigation, WLAN, Bluetooth, music, running health, etc.

[0126] The application framework layer provides an application programming interface (API) and a programming framework for the applications in the application layer. The application framework layer includes some predefined functions.

[0127] In some embodiments, the application framework layer can obtain a configuration file, which includes one or more key functions and instrumentation information corresponding to the one or more key functions. Based on the configuration file, it can be used to perform instrumentation processing when the application calls a function.

[0128] like Figure 7 As shown, the application framework layer may include a display manager, a sensor manager, a cross-device connection manager, an event manager, an activity manager, a window manager, a content provider, a view system, a resource manager, a notification manager, and the like.

[0129] The display manager is used for system display management and is responsible for managing all display-related affairs, including creation, destruction, direction switching, size and state changes, etc. Generally speaking, there is only one default display module on a single device, that is, the main display module.

[0130] The sensor manager is responsible for the status management of the sensor, and manages the applications to monitor sensor events and report the events to the applications in real time.

[0131] The cross-device connection manager is used to establish communication connections with other devices.

[0132] The event manager is used for the system's event management service. It is responsible for receiving events uploaded by the bottom layer and distributing them to each window, completing tasks such as event reception and distribution.

[0133] The task manager is used to manage task (Activity) components, including startup management, life cycle management, task direction management, etc.

[0134] The window manager is used to manage window programs. The window manager can obtain the display screen size, determine whether there is a status bar, lock the screen, capture the screen, etc. The window manager is also responsible for window display management, including window display mode, display size, display coordinate position, display level, etc.

[0135] The specific execution process of each of the above embodiments can refer to the relevant content of the human-computer dialogue method below.

[0136] Content providers are used to store and retrieve data and make it accessible to applications. The data may include videos, images, audio, calls made and received, browsing history and bookmarks, phone books, etc.

[0137] The view system includes visual controls, such as controls for displaying text, controls for displaying images, etc. The view system can be used to build applications. A display interface can be composed of one or more views. For example, a display interface including a text notification icon can include a view for displaying text and a view for displaying images.

[0138] The resource manager provides various resources for applications, such as localized strings, icons, images, layout files, video files, and so on.

[0139] The notification manager enables applications to display notification information in the status bar. It can be used to convey notification-type messages and can disappear automatically after a short stay without user interaction. For example, the notification manager is used to notify download completion, message reminders, etc. The notification manager can also be a notification that appears in the system top status bar in the form of a chart or scroll bar text, such as notifications of applications running in the background, or a notification that appears on the screen in the form of a dialog window. For example, a text message is displayed in the status bar, a prompt sound is emitted, an electronic device vibrates, an indicator light flashes, etc.

[0140] Android Runtime includes core libraries and virtual machines. Android runtime is responsible for scheduling and management of the Android system.

[0141] The core library consists of two parts: one part is the function that needs to be called by the Java language, and the other part is the Android core library.

[0142] Both the application layer and the application framework layer run in a virtual machine. The virtual machine executes the Java files of the application layer and the application framework layer as binary files. The virtual machine is used to perform functions such as object life cycle management, stack management, thread management, security and exception management, and garbage collection.

[0143] The system library (also called the data management layer) can include multiple functional modules, such as surface manager, media library, 3D graphics processing library (such as OpenGL ES), 2D graphics engine (such as SGL) and event data.

[0144] The surface manager is used to manage the display subsystem and provide the fusion of 2D and 3D layers for multiple applications.

[0145] The media library supports playback and recording of a variety of commonly used audio and video formats, as well as static image files, etc. The media library can support a variety of audio and video encoding formats, such as: MPEG4, H.264, MP3, AAC, AMR, JPG, PNG, etc.

[0146] The 3D graphics processing library is used to implement 3D graphics drawing, image rendering, compositing, and layer processing.

[0147] A 2D graphics engine is a drawing engine for 2D drawings.

[0148] The kernel layer is the layer between hardware and software. The kernel layer contains at least display driver, camera driver, audio driver, and sensor driver.

[0149] In one illustrated embodiment, please refer to the attached Figure 8 , Figure 8 It is a software structure block diagram of another electronic device provided in an embodiment of the present application.

[0150] It should be noted that if Figure 8 The software structure shown is based on the above Figure 7 The software structure shown is a method of illustrating an embodiment of the present application.

[0151] like Figure 8 As shown, in an embodiment of the present application, the application layer may also include third-party applications, etc., which may be obtained from major application stores; the application framework layer may also include a management module, which may include a third-party application for process creation, and related functional modules for optimizing maintenance information and system optimization of third-party applications; the system library may include a plug-in module, a compiler and an interpreter for pre-acquiring configuration files corresponding to third-party applications; in addition to display drivers, camera drivers, audio drivers, and sensor drivers, the kernel layer may also include a functional module for kernel system optimization, which is used to optimize the kernel part. The embodiments of the present application do not go into details about each functional module. For a specific description of each functional module, please refer to the relevant description below.

[0152] Specifically, a compiler is responsible for converting source code written in a programming language into another type of computer code, which is often in binary form and is called object code. The purpose of this conversion process is usually to generate an executable program, which is then executed by computer hardware. For example, a compiler will compile the entire source code of a third-party application into machine code, so that the hardware of the electronic device can directly execute the compiled machine code.

[0153] An interpreter is used to directly execute code written in a programming language or scripting language, and does not precompile the source code into machine code. Exemplarily, an interpreter usually executes program code in the following ways: the interpreter reads the source code of a third-party application line by line, that is, analyzes the source code line by line (for example, the java file corresponding to the third-party application), and executes it directly; or, translates the source code into a relatively more efficient intermediate code, and then executes it immediately; or, executes the code saved after precompilation by the compiler inside the interpreter. It can be understood that the interpreter can be regarded as a black box. When the source code is input, the result will be returned in real time.

[0154] For example: In an embodiment of the present application, the interpreter can be used to reflect the plug-in information into the message queue and then continue to interpret and execute the target sub-function.

[0155] For another example: when it is determined that the execution interface of the sub-function in the running file of the third-party application is an interpreted execution interface, and the sub-function is not a target sub-function (i.e., a key function), the running function continues to be interpreted and executed. The interpreter can interpret and execute the function corresponding to the third-party application, and interpret and execute the hook function after the function corresponding to the third-party application is instrumented. This embodiment of the present application does not specifically limit this.

[0156] The instrumentation module can perform instrumentation processing on the key functions that are about to be interpreted and executed in the third-party application based on the configuration file to obtain the instrumentation information corresponding to the key function, and reflect the instrumentation information to the message queue of the management module, so that the management module can perform system optimization or maintenance information processing on the third-party application in a targeted manner based on the instrumentation information.

[0157] In an embodiment of the present application, the plug-in module can be used to: obtain file information of a running file corresponding to a third-party application, where the running file is a file corresponding to a third-party application currently compiled and executed or interpreted in the runtime virtual machine ART, and the file information may include a file name of the running file, and the running file may include at least one sub-function; based on the file name in the running file, determine the file type of the running file, and the file type may include a first file type and a second file type; when the file type of the running file is the first file type, perform plug-in Hook processing on the target sub-function in the running file based on the first traversal process, and the first traversal process is related to the execution interface corresponding to each sub-function in the running file, and the target sub-function is a sub-function with a key function label; when the file type of the running file is the second file type, perform plug-in Hook processing on the target sub-function in the running file based on the second traversal process, and the second traversal process is related to the compilation identification information corresponding to each sub-function in the running file.

[0158] Hook means intercepting the original function that was originally to be called in the original target application through a hook program, and modifying the entry address of the original function to the entry address of the hook function, so as to realize the function of calling the hook function before executing the call to the original function, thereby realizing the modification or expansion of the corresponding function of the target application. In the process of program running, the operations of inserting hook programs, removing hook programs, and changing hook programs can be called dynamic hooks. The dynamic hook mechanism is used to implement dynamic hooks, which can flexibly modify and expand the functions of the target application.

[0159] Through the plugging module, the Java function to be or being executed in the third-party application is plugged, that is, the key function is hooked (that is, plugged), and the corresponding plugging information is obtained. Based on the plugging information, the location of the key event of the third-party application can be indicated, and then the performance of the third-party application can be optimized in a targeted manner to improve the user experience. For example: when the third-party application calls a function at the start point of operation and the end point of operation, the plugging process is performed respectively, so that the operating system of the electronic device locates the start point and the end point of operation of the third-party application, and then the loading time and other related maintenance information of the third-party application can be determined based on the plugging information corresponding to the start point and the end point of operation, or the working frequency of the processing core at the start point of operation (such as: increase) and the working frequency of the processing core at the end point of operation (such as: decrease) can be adjusted in a targeted manner, so that the working frequency of the processing core of the third-party application is higher in the time period between the start point of operation and the end point of operation; the working frequency of the processing core is lower in the remaining time period. For example, compared to increasing the operating frequency of the processing core during the running of the third-party application, in the embodiment of the present application, the operating frequency of the processing core can be higher during the special time period when the third-party application is running (the time period between the running start point and the running end point). This can greatly reduce the loading time of the third-party application while avoiding the temperature limitation of the electronic device when adjusting the frequency, thereby greatly improving the user experience.

[0160] The management module can be used to adjust the execution interface corresponding to the target sub-function to the first interpretation execution interface, and can also perform system optimization or maintenance information processing on the third-party application corresponding to the plug-in information based on the configuration file and the plug-in information in the message queue.

[0161] Among them, the specific implementation methods of the above-mentioned modules can refer to the following related embodiments, and the embodiments of the present application will not be described in detail here.

[0162] In addition, please refer to the attached Fig. 9 , Fig. 9 is a schematic diagram of a third-party application execution method provided in an embodiment of the present application, such as Fig. 9 As shown, the running status of the Android Runtime code of the third-party application (i.e., the source code file of the third-party application) is generally divided into three categories, namely interpreted execution (which can be understood as executing the source code of the application through the interpreter to obtain the code execution result), AOT execution and JIT execution.

[0163] Among them, interpreted execution means that the compiler does not intervene in the work. When the interpreter executes each bytecode corresponding to the third-party application, it translates the bytecode into machine code and executes it to realize the operation of the third-party application. The bytecode at this time can be called cold code.

[0164] AOT execution means compiling the program code of a third-party application into machine code in advance through a compiler, and executing it directly in machine code during the ART runtime to enable the operation of the third-party application.

[0165] When AOT is not used for execution, JIT execution means that when a third-party application is running (ART runtime), the virtual machine compiles the hot code into machine code through the compiler, and then executes it in machine code to run the third-party application.

[0166] It can be understood that the above-mentioned AOT execution and JIT execution can both be referred to as compiled execution. In the embodiment of the present application, compared with the compiler which only translates the source code as a whole into machine code, the interpreter reads the source code line by line, interprets it, and then executes it immediately.

[0167] In addition, in an embodiment of the present application, the interpreter may include an Nterp interpreter and an interpreter based on a Switch structure. Among them, the core of the Nterp interpreter is to introduce a handler table for instruction mapping, and to achieve fast switching between instructions through handwritten assembly. It is the interpreter currently mainly used in electronic devices, is frequently used, has good performance, and can interpret most of the source code in electronic devices. The interpreter based on the Switch structure has stronger compatibility. When the Nterp interpreter is not supported, the interpreter based on the Switch structure can be used for interpretation and execution, which can improve the success rate of application execution. Generally, interpretation and execution are only performed in a debugging environment, method tracking, instruction unsupported, or when an exception occurs in the bytecode (such as failed structured-locking verification).

[0168] In this regard, the embodiment of the present application mainly adopts the corresponding traversal process to achieve the purpose of inserting the target sub-function based on the file type of the running file of the third-party application, and adjusts the execution interface of the target sub-function, which helps to divert the functions that the compiler and interpreter need to execute. While ensuring the efficiency of the electronic device inserting the target sub-function, it also helps to ensure the normal operation of the third-party application and the user experience. Furthermore, by obtaining the insertion information corresponding to the target sub-function, the key event points in the operation process of the third-party application are located based on the insertion information to realize the Hook of the key function, and then the third application can be optimized in a targeted manner based on the key events of the third-party application obtained, for example: shortening the loading time of the third-party application.

[0169] Exemplarily, when the interpreter interprets and executes a third-party application, the target sub-function containing the key function identifier can be inserted based on the file type of the running file of the third-party application, and the execution interface of the target sub-function is adjusted to the first interpretation execution interface, and the first interpreter (which can be regarded as a Switch interpreter) continues to interpret and execute the target sub-function; after the insertion is completed, the insertion information can be reflected to the message queue to be processed and wait for processing. In addition, based on the insertion information corresponding to the key function (for example: the insertion information includes pile point information, the call address information of the key function, the function name of the key function and other related information) and the relevant configuration file, the corresponding hook function can be called at the above pile point by Hook mode to achieve system optimization processing such as adjusting the operating frequency of the processing core or the acquisition of the measurement information of the third-party application. Among them, the specific implementation method can correspond to the relevant description of the following embodiment, and the embodiment of the present application will not be repeated for the time being.

[0170] Next, based on the above Figure 8 The software structure shown exemplarily introduces the overall process of the method for determining the instrumentation process based on the file type.

[0171] First of all, it should be noted that the users involved in the embodiments of the present application and the following related embodiments are users of electronic devices. In other embodiments, the users may also be associated persons of the electronic devices, and the embodiments of the present application do not make specific limitations on this.

[0172] Secondly, based on the above Figure 8 The software structure shown, combined with the method for determining the plugging process based on file type provided in this application, specifically analyzes and solves the technical problems raised in this application.

[0173] See also Fig.10 , Fig.10 It is a flowchart of a method for determining an instrumentation process based on a file type provided in an embodiment of the present application.

[0174] The method for determining the instrumentation process based on file type can be applied to the above Figure 8 In the software architecture described in, the plug-in module can be used to support and execute the Fig.10 The method flow steps S201, S202 and part of step S203 shown in FIG. 1 can be used to support and execute the method flow steps S201, S202 and part of step S203. Fig.10 The method flow part step S203 shown in FIG. The specific description of each step is as follows:

[0175] Step S201: Obtain file information of a corresponding running file of a third-party application.

[0176] Among them, the running file is the application file corresponding to the third-party application currently compiled and executed or interpreted in the runtime virtual machine ART. The file information may include the file name of the running file, and the running file may include at least one sub-function. Among them, the running file can be understood as the file that ART is about to execute or call. For example: after obtaining the call entry address information of the sub-function at the top of the stack in the running file, the file that has not yet called the sub-function can be called a running file. For example: after all sub-functions in the current file are called, the file to which the next sub-function to be called belongs can also be called a running file. It should be noted that the way ART executes the running file can be one of compilation execution or interpretation execution.

[0177] Optionally, the third-party application can be a third-party application downloaded by the target user from an application store or other relevant channels that can be obtained, and the embodiments of the present application do not specifically limit this. When ART executes the source code of the third-party application, the function information of the sub-function in the corresponding running file of the third-party application can also be obtained, and the function information of the sub-function can be sent to the plug-in module. In addition, when the plug-in module determines whether there is a function in the running file as the target function when the third-party application is first run and sets a key function label for the target function, it is also necessary to obtain the function information. Among them, the first run of a third-party application can be understood as the first run of the third-party application after it is downloaded to the electronic device; it can also be understood as the target user starting the third-party application on the electronic device again after using the third-party application once and closing the background of the third-party application.

[0178] In a method shown for implementation, a third-party application includes at least one application file, and one application file includes at least one sub-function. Before obtaining file information of a running file corresponding to the third-party application, the method may further include: in response to the third-party application being in a running state, traversing function information of each sub-function corresponding to each application file of the third-party application, the function information including a function name corresponding to the function; based on the function information and a pre-acquired configuration file, determining whether there is a function name of a key function in the configuration file that is identical to the function name of a ninth sub-function in the third-party application; and when it is determined that there is a function name of a key function in the configuration file that is identical to the function name of a ninth sub-function in the third-party application, setting a key function label for the ninth sub-function.

[0179] The function information of the corresponding function of the third-party application may include relevant information such as the function name of the corresponding function and the entry address for calling the function.

[0180] Specifically, based on the function information of the function corresponding to the third-party application and the pre-acquired configuration file, the plug-in module can determine whether any sub-function corresponding to the third-party application is a key function. The configuration file may include the function names corresponding to one or more key functions. Among them, the configuration file can be used to identify whether there is a key function in the sub-function corresponding to the third-party application. The configuration file can be a related configuration file pre-acquired by the plug-in module from the management module. The embodiment of the present application does not specifically limit the method for obtaining the configuration file.

[0181] For example, the configuration file includes the following information: the function name A1 of the key function 1, and the function name A2 of the key function 2. When determining whether the functions 1 and 2 corresponding to the third-party application are key functions, if the function name of function 1 is A1, it can be confirmed that function 1 in the third-party application is the key function and is the key function 1 in the configuration file. If the function name of function 2 is B2, function 2 is not a key function.

[0182] In addition, the configuration file may correspond to one or more third-party applications, and the configuration file may include function names corresponding to one or more key functions, wherein the key function may be understood as a function called when a key event in the corresponding third-party application occurs, and the plugging module may perform plugging by locating the called key function, thereby locating and determining the key event that is about to occur in the third-party application, and obtaining the corresponding plugging information. Among them, the key event may be pre-set, for example: the key event may include an application content start loading event, an application content end loading event, an application content jump loading event, etc., and the embodiments of the present application are not specifically limited to this. Through a configuration file containing the function names of one or more key functions, it can be determined whether there is a target function in the corresponding function of the third-party application as a key function, so as to locate the key event of the third-party application, thereby facilitating the targeted optimization of the third-party application and improving the user experience. In addition, the configuration file may be pre-stored in the management module, and the embodiments of the present application are not specifically limited to this.

[0183] It can be seen that the method of the embodiment of the present application can greatly improve the subsequent instrumentation efficiency of the key function (i.e., the target sub-function) by determining whether the target function is a key function in the corresponding function of the third-party application based on the function name when the third-party application is first run or started, thereby reducing the impact of the instrumentation process on the operation of the third-party application.

[0184] Step S202: Determine the file type of the running file based on the file name in the running file.

[0185] The file type may include a first file type and a second file type.

[0186] Exemplarily, both the first file type and the second file type can represent the file suffix of the running file. When the running file is a file compiled and optimized by speed-profile, the suffix of the running file is ".art", so the running file can be considered as the first file type; when the running file is a file compiled and optimized by AOT, the suffix of the running file is ".odex", so the running file can be considered as the second file type.

[0187] It should be noted that there are compilation options in ART: verify, quicken, speed, and speed-profile. Among them, the verify compilation method only verifies the code of the dex file and verifies the legitimacy of each part of the function; the quicken compilation method optimizes some dex instructions based on the verify compilation method to improve the interpreter performance; the speed compilation method performs AOT compilation on all functions based on the verify compilation method; the speed-profile compilation method performs AOT compilation on the functions listed in the configuration file (such as hotspot functions) based on the verify compilation method.

[0188] Furthermore, based on the above compilation method, files with suffixes of .dex, .odex and .art can be generated. Among them, all the Java source codes of third-party applications will generate numerous class files after compilation. After these class files are compiled by DX / D8, one or more .dex files can be generated, and the .dex files are compiled and executed by the virtual machine; after verifying and optimizing the .dex files, the .odex files under ART contain the code compiled by AOT and the complete content of dex. After Android 8.0, the dex content in the .odex file is moved to the .vdex file; when ART generates the .odex file according to the configuration file, it will also generate the .art file. The .art file is mainly used to improve the speed of loading the hot function in the .odex file when the third-party application is running. The .art file contains class information (class information) and the index of the hot function in the .odex file. When running the third-party application, ART will first load the compiled code in the .odex file according to the .art file. It should be noted that only the third-party application that has executed the speed-profile compilation method will generate the .art file. It can be understood that the .art file is a mirror file containing the hotspot functions in the .odex file.

[0189] Step S203: Based on the traversal process corresponding to the file type of the running file, a target sub-function in the running file is subjected to a plug-in Hook process, and the target sub-function is continuously interpreted and executed by the first interpreter.

[0190] Among them, the target sub-function is the sub-function with the key function label.

[0191] In a method shown in the implementation, the first traversal process may include traversing the type of execution interface corresponding to each sub-function in the running file, and the first traversal process is the traversal process corresponding to the first file type; the second traversal process may include traversing the type of compilation identification information corresponding to each sub-function in the running file, and the second traversal process is the traversal process corresponding to the second file type.

[0192] In a method of illustrating implementation, the execution interface may include a compiled execution interface and an interpreted execution interface, and the interpreted execution interface may include a first interpreted execution interface and a second interpreted execution interface; when the file type of the running file is the first file type, the running file is image file data; the above method may also include: traversing the execution interfaces of each sub-function in the running file; if there is a first sub-function whose execution interface is a compiled execution interface, and the first sub-function is a target sub-function, then adjusting the execution interface of the first sub-function to the first interpreted execution interface, and interpreting and executing the first sub-function through the first interpreter; if there is a second sub-function whose execution interface is a second interpreted execution interface, and the second sub-function is a target sub-function, then adjusting the execution interface of the second sub-function to the first interpreted execution interface, and interpreting and executing the second sub-function through the first interpreter.

[0193] In a method of illustrating implementation, ART may include a compiler and an interpreter, and the interpreter may include a first interpreter and a second interpreter; when the file type of the running file is the first file type, the above method may also include: if there is a third sub-function whose execution interface is a compilation execution interface, and the third sub-function is not a target sub-function, then executing the machine code corresponding to the third sub-function; if there is a fourth sub-function whose execution interface is a second interpretation execution interface, and the fourth sub-function is not a target sub-function, then interpreting and executing the fourth sub-function through the second interpreter.

[0194] For example, see Fig.11 , Fig.11 1 is a flow chart of an adjustment sub-function execution interface corresponding to a first traversal process provided by an embodiment of the present application. Fig.11 As shown, when ART executes each sub-function in the running file, it is necessary to set the interpretation execution method, which can be understood as setting the execution interface of the interpretation execution. Before executing each sub-function, before judging whether the sub-function is the target sub-function (that is, the sub-function with the key function label), it is necessary to determine whether the execution interface corresponding to the sub-function currently traversed is the interpretation execution interface. Further, when the execution interface corresponding to the sub-function currently traversed is not the interpretation execution interface (it can be understood that the execution interface corresponding to the sub-function is the compilation execution interface), it is judged whether the sub-function is the target sub-function; if the execution interface corresponding to the sub-function currently traversed is the interpretation execution interface, it is necessary to judge whether the execution interface corresponding to the sub-function is the second interpretation execution interface (it can be understood as the execution interface corresponding to the Nterp interpreter). Furthermore, when the execution interface corresponding to the sub-function currently traversed is the interpretation execution interface, and it is the second interpretation execution interface, it is judged whether the sub-function is the target sub-function. Furthermore, for the sub-function determined as the target sub-function, the execution interface corresponding to the sub-function can be adjusted to the first interpretation execution interface (i.e., adjusted to the interpretation execution interface corresponding to the Switch interpreter, and the Switch interpreter interprets and executes the sub-function). After adjusting the execution interface of the target sub-function, the target sub-function can be plugged to obtain the plugging information corresponding to the target sub-function. If the sub-function currently judged is not the target sub-function (i.e., the sub-function does not have a key function label), the compiler or interpreter corresponding to the original execution interface of the sub-function continues to execute the sub-function. Exemplarily, if ART currently traverses to sub-function 1 in the running file (the original execution interface is the compilation execution interface, without the key function label), it can be determined that sub-function 1 is not the target sub-function, and the compiler (such as the AOT compiler) can continue to compile and execute sub-function 1; if ART currently traverses to sub-function 2 in the running file (the original execution interface is the second interpretation execution interface, without the key function label), it can be determined that sub-function 2 is not the target sub-function, and the second interpreter (i.e., the Nterp interpreter) can continue to interpret and execute sub-function 2. It is understandable that if the sub-function in the running file currently traversed by ART is not the target sub-function, that is, the sub-function is not the trigger point of the key event of the third-party application when it is called, the electronic device does not need to perform plug-in processing on the sub-function, nor does it need to adjust the execution method of the sub-function. By executing the sub-function by the compiler or interpreter corresponding to the original execution interface of the sub-function, it helps to ensure the normal operation of the third-party application.

[0195] Please refer to the following Table 2, which is a table of an actuator and its corresponding execution interface provided in an embodiment of the present application.

[0196] Table 2

[0197] < / canvas> < / video> Actuator Execution interface AOT Compiler quick_code Nterp Interpreter interpreter::ExecuteNterpImpl Switch Interpreter art_quick_to_interpreter_bridge … …

[0198] As shown in Table 2 above, different executors correspond to different execution interfaces. After determining that the sub-function currently traversed in the running file is the target sub-function, the execution interface corresponding to the target sub-function can be adjusted to the interpretation execution interface art_quick_to_interpreter_bridge corresponding to the Switch interpreter, so as to continue to interpret and execute the target sub-function through the Switch interpreter.

[0199] It should be noted that the actuator and its corresponding execution interface shown in the above Table 2 are only one implementation method shown in the embodiment of the present application, and the embodiment of the present application does not make any specific limitation on this.

[0200] Understandably, see Fig.12 , Fig.12 1 is a flow chart of another adjustment sub-function execution interface corresponding to the first traversal process provided by the embodiment of the present application. Fig.12 As shown, when ART executes the running file corresponding to the third-party application, the plug-in module can be used to: obtain the file information of the running file corresponding to the third-party application; determine the file type of the running file based on the file name in the running file; when the file type of the running file is the first file type, traverse the execution interface corresponding to each sub-function in the running file; if the execution interface of the first sub-function is a compiled execution interface, and the first sub-function is a target sub-function, the execution interface of the first sub-function is adjusted to the first interpretation execution interface, and the first interpreter continues to interpret and execute the first sub-function. Further, the plug-in module can be used to: if the execution interface of the second sub-function is a second interpretation execution interface, and the second sub-function is a target sub-function, the execution interface of the second sub-function is adjusted to the first interpretation execution interface, and the first interpreter continues to interpret and execute the second sub-function. Further, the plug-in module can be used to: when the execution interface of the third sub-function is a compiled execution interface, and the third sub-function is not a target sub-function, execute the machine code corresponding to the third sub-function. Furthermore, the second interpreter can be used to: interpret and execute the fourth sub-function through the second interpreter when the execution interface of the fourth sub-function is the second interpretation execution interface and the fourth sub-function is not the target sub-function. Furthermore, the plug-in module can also be used to: perform plug-in Hook processing on the target sub-function in the running file, obtain the plug-in information corresponding to the target sub-function; reflect the plug-in information to the message queue, and continue to interpret and execute the target sub-function through the first interpreter. Furthermore, the management module can be used to: obtain the plug-in information of the target sub-function from the message queue; determine the hook function corresponding to the target sub-function based on the configuration file and the plug-in information, and execute the hook function corresponding to the running function.

[0201] It should be noted that the number of the above-mentioned first sub-function, second sub-function, third sub-function and fourth sub-function is greater than or equal to 0, and the number of the first sub-function, second sub-function, third sub-function and fourth sub-function may be the same or different, and this application document does not limit this.

[0202] Among them, it should be noted that in order to avoid the impact on the operating efficiency of third-party applications when calling the hook function based on the instrumentation information, the message queue is an asynchronous message queue, that is, the instrumentation information will not be processed immediately after being reflected to the message queue. Instead, in order to ensure the normal operation of the third-party application, after the instrumentation information is saved in the message queue, the first interpreter (i.e., the Switch interpreter) can continue to interpret and execute the target sub-function in the running file. The instrumentation information can be processed asynchronously, which greatly weakens the impact of the instrumentation processing on the third-party application and ensures the performance efficiency and user experience of the third-party application.

[0203] It should also be noted that the above-mentioned reflection of the instrumentation information corresponding to the target sub-function to the message queue refers to decompiling the instrumentation information corresponding to the target sub-function and saving it to the message queue. This embodiment of the present application does not make any specific limitation on this.

[0204] In a method for illustrating implementation, when the file type of the running file is the second file type, the method may also include: obtaining compilation identification information corresponding to each sub-function in the running file; if the compilation identification information of the fifth sub-function is empty, and the fifth sub-function is not the target sub-function, adjusting the execution interface of the fifth sub-function to the second interpretation execution interface, and interpreting and executing the fifth sub-function through the second interpreter; if the compilation identification information of the sixth sub-function is empty, and the sixth sub-function is the target sub-function, adjusting the execution interface of the sixth sub-function to the first interpretation execution interface, and interpreting and executing the sixth sub-function through the first interpreter; if the compilation identification information of the seventh sub-function is not empty, and the seventh sub-function is the target sub-function, adjusting the execution interface of the seventh sub-function to the first interpretation execution interface; if the compilation identification information of the eighth sub-function is not empty, and the eighth sub-function is not the target sub-function, executing the machine code corresponding to the eighth sub-function.

[0205] For example, see Fig.13 , Fig.13 This is a flow chart of adjusting the sub-function execution interface corresponding to the second traversal process provided by the present application. Fig.13 As shown, when ART executes each sub-function in the running file, it is necessary to determine whether the compilation identification information corresponding to each sub-function is empty. If the compilation identification information of the fifth sub-function is empty, it means that the fifth sub-function has not been compiled and processed by the compiler (such as the AOT compiler), and it is necessary to further determine whether the fifth sub-function is the target sub-function. If the fifth sub-function is not the target sub-function, the execution interface of the fifth sub-function can be set to the second interpretation execution interface (that is, the execution interface corresponding to the Nterp interpreter, and the fifth sub-function can be subsequently interpreted and executed by the Nterp interpreter); if the compilation identification information of the sixth sub-function is empty, it means that the sixth sub-function has not been compiled and optimized by the compiler (such as the AOT compiler). Further, if the sixth sub-function is the target sub-function, the execution interface of the sixth sub-function can be set to The first interpretation execution interface is set to the execution interface corresponding to the Switch interpreter, and the sixth sub-function can be interpreted and executed by the Switch interpreter later; if the compilation identification information of the seventh sub-function is not empty, it means that the seventh sub-function has been compiled and optimized by the compiler (such as the AOT compiler), and further, if the seventh sub-function is the target sub-function, the execution interface of the seventh sub-function can be set to the first interpretation execution interface (that is, the execution interface corresponding to the Switch interpreter, and the sixth sub-function can be interpreted and executed by the Switch interpreter later); if the compilation identification information of the eighth sub-function is not empty, it means that the eighth sub-function has been compiled and optimized by the compiler (such as the AOT compiler), and further, if the eighth sub-function is not the target sub-function, the machine code corresponding to the eighth sub-function can be directly executed.

[0206] Understandably, see Fig.14 , Fig.14 1 is a flow chart of another adjustment sub-function execution interface corresponding to the second traversal process provided by an embodiment of the present application. Fig.14 As shown, when ART executes the running file corresponding to the third-party application, the plug-in module can be used to: obtain the file information of the running file corresponding to the third-party application; determine the file type of the running file based on the file name in the running file; when the file type of the running file is the second file type, obtain the compilation identification information corresponding to each sub-function in the running file. Further, the above-mentioned plug-in module can also be used to: when the compilation identification information of the fifth sub-function is empty and the fifth sub-function is not the target sub-function, adjust the execution interface of the fifth sub-function to the second interpretation execution interface; when the compilation identification information of the sixth sub-function is empty and the sixth sub-function is the target sub-function, adjust the execution interface of the sixth sub-function to the first interpretation execution interface; when the compilation identification information of the seventh sub-function is not empty and the seventh sub-function is the target sub-function, adjust the execution interface of the seventh sub-function to the first interpretation execution interface; when the compilation identification information of the eighth sub-function is not empty and the eighth sub-function is not the target sub-function, execute the machine code corresponding to the eighth sub-function. Further, the above-mentioned second interpreter can also be used to interpret and execute the above-mentioned fifth sub-function. Furthermore, the first interpreter can also be used to interpret and execute the sixth sub-function and / or the seventh sub-function. Furthermore, the plug-in module can also be used to: perform plug-in Hook processing on the target sub-function in the running file, obtain the plug-in information corresponding to the target sub-function; reflect the plug-in information to the message queue, and continue to interpret and execute the target sub-function through the first interpreter. Furthermore, the management module can be used to: obtain the plug-in information from the message queue; execute the hook function corresponding to the running function based on the configuration file and the plug-in information.

[0207] It should be noted that the number of the fifth sub-function, the sixth sub-function, the seventh sub-function and the eighth sub-function is greater than or equal to 0, and the number of the fifth sub-function, the sixth sub-function, the seventh sub-function and the eighth sub-function may be the same or different, and this application document does not limit this.

[0208] In a method of illustrating implementation, the interpreter may include an Nterp interpreter and a Switch interpreter, the first interpreter is a Switch interpreter, the second interpreter is an Nterp interpreter, the first interpretation execution interface is an interpretation execution interface corresponding to the Switch interpreter, and the second interpretation execution interface is an interpretation execution interface corresponding to the Nterp interpreter.

[0209] Among them, the interpreters include Nterp interpreter and Switch interpreter. Since the functions executed by AOT after most third-party applications are installed account for a small proportion, the remaining vast majority of codes are still executed through interpretation. Therefore, directly performing the instrumentation process in the Nterp interpreter will have a great impact. In order to reduce the above impact, the instrumentation Hook method can be downgraded to the Switch interpretation method.

[0210] In a method of illustrating implementation, after performing a plug-in Hook process on a target sub-function in a running file, the method may further include: obtaining plug-in information corresponding to the target sub-function; reflecting the plug-in information to a message queue, and continuing to interpret and execute the target sub-function through a first interpreter.

[0211] Specifically, when it is determined that the running function is a key function, the plugging module can perform plugging Hook processing on the target sub-function to obtain the plugging information corresponding to the target sub-function. The plugging information can be used to indicate that a corresponding hook function is plugged at the target position of the target sub-function. The plugging information may include one or more of the following corresponding pile points or plugging positions of the target sub-function, the calling address information of the target sub-function, the calling address information of the hook function corresponding to the target sub-function, the function name of the target sub-function, and other related plugging information. By plugging the target sub-function with Hook processing, one or more plugging information of the third-party application during the application or application content loading process can be determined, and then the third-party application can be optimized or the maintenance information can be obtained during the application or application content loading through the one or more plugging information. In addition, the hook function can be understood as referring to the function that is interpreted and executed by the first interpreter after the target sub-function is plugged and is different from the third-party application.

[0212] Among them, it should be noted that in order to avoid the impact on the operating efficiency of third-party applications when calling the hook function based on the instrumentation information, the message queue is an asynchronous message queue, that is, the instrumentation information will not be processed immediately after being reflected to the message queue. Instead, in order to ensure the normal operation of the third-party application, after the instrumentation information is saved in the message queue, the first interpreter (i.e., the Switch interpreter) can continue to interpret and execute the target sub-function in the running file. The instrumentation information can be processed asynchronously, which greatly weakens the impact of the instrumentation processing on the third-party application and ensures the performance efficiency and user experience of the third-party application.

[0213] It should also be noted that the above-mentioned reflection of the instrumentation information corresponding to the target sub-function to the message queue refers to decompiling the instrumentation information corresponding to the target sub-function and saving it to the message queue. This embodiment of the present application does not make any specific limitation on this.

[0214] In a method that illustrates implementation, the management module may obtain the instrumentation information corresponding to the target sub-function from the message queue.

[0215] Specifically, the management module can obtain the plugging information corresponding to the target sub-function to be processed from the message queue at any time. Based on the plugging information and the above configuration file, targeted processing is performed on the corresponding third-party application. Fig.12 and / or Fig.13 As shown, the management module can obtain the instrumentation information corresponding to the target sub-function from the message queue.

[0216] In a method that illustrates implementation, the management module may execute a hook function corresponding to the target sub-function based on a configuration file and the instrumentation information corresponding to the target sub-function.

[0217] Specifically, based on the configuration file and the plugging information corresponding to the target sub-function, the hook function corresponding to the target sub-function is executed. In addition, the configuration file also includes one or more hook functions corresponding to key functions, and each key function can correspond to one or more hook functions. For example, the key function called at the starting point of the third-party application can correspond to a hook function that adjusts the operating frequency of the processing core, and can also correspond to a hook function that records the current time point. The hook function can be used to optimize third-party applications or obtain maintenance information in order to improve the user experience. Therefore, the embodiment of the present application does not specifically limit the type and number of hook functions corresponding to each key function.

[0218] In addition, in other embodiments, the configuration file may also include function information of each hook function, and the function information of each hook function may include relevant information such as the function name and function call address of the corresponding hook function, which is not specifically limited in the embodiments of the present application. Fig.12 and / or Fig.13 As shown, the management module can also determine the hook function corresponding to the target sub-function based on the configuration file and the plug-in information corresponding to the target sub-function, so that the first interpreter (i.e., the Switch interpreter) can interpret and execute the hook function corresponding to the target sub-function to optimize the third-party application or obtain maintenance information in a targeted manner.

[0219] In other embodiments, the hook function can also be executed or called through other execution modes, for example, through a compiler, as described above. Fig. 9 The AOT execution and JIT execution shown; or the execution or call by the relevant processing unit in the management module, which will not be described in detail in the embodiments of the present application.

[0220] For example: Please refer to the attached Fig.15 , Fig.15 This is a schematic diagram of optimizing the performance of a third-party application through an instrumentation method provided in an embodiment of the present application.

[0221] like Fig.15 As shown, when the third-party application is running after the user's operation, the running start point can be regarded as the starting point, and the running end point can be regarded as the ending point. When the third-party application calls the sub-function in the running file at the running start point and the running end point, it can be determined as key function 1 and key function 2 respectively, and then further inserts the key function 1 and key function 2 to obtain the insertion information corresponding to the key function 1 and the key function 2 respectively, and puts the corresponding insertion information into the message queue. At the same time, the electronic device can call the running file normally to load the normal application content. Among them, based on the configuration file, the hook function 1 corresponding to the key function 1 to increase the working frequency of the processing core and the hook function 2 corresponding to the key function 2 to lower the working frequency of the processing core can be determined. Correspondingly, the electronic device can also determine the corresponding hook functions based on the insertion information corresponding to the key function 1 and the key function 2 in the message queue. The electronic device can call hook function 1 at the running start point and call hook function 2 at the running end point, and specifically increase the four processing cores (such as Fig.13 The operating frequencies of the four processing cores shown in the figure (processing core 1, processing core 2, processing core 3, processing core 4) are adjusted down at the end of the operation, so that the operating frequencies of the four processing cores are higher in the time period between the start point and the end point of the operation of the third-party application; and the operating frequencies of the four processing cores are lower in the remaining time periods. Therefore, compared with the overall increase in the operating frequency of the processing cores during the operation of the third-party application, the operating frequency of the processing cores in the embodiment of the present application can be higher, so that the loading time of the third-party application can be greatly reduced while complying with the temperature limit of the electronic device, greatly improving the user experience.

[0222] In an embodiment of the present application, when ART executes the running file of a third-party application, different traversal processes can be determined based on the file type of the running file, and then the target sub-function can be instrumented and the execution interface of the target sub-function can be adjusted based on the different traversal processes, which helps to ensure that the key functions existing in the third-party application are comprehensively screened out, and the target sub-function (or key function) is interpreted and executed based on a separate interpreter (i.e., the first interpreter), which helps to ensure the normal operation of the third-party application, reduce the impact of instrumentation on the operation of the third-party application, and protect the user's experience. Among them, based on the first interpreter, the target sub-function in the third-party application is instrumented and the corresponding instrumentation information is obtained, which can realize the positioning of key event points in the operation process of the third-party application, and then the third application can be optimized in a targeted manner based on the key events of the third-party application obtained, avoiding the optimization of the entire third-party application, improving the accuracy of the optimization, and increasing the user experience. Moreover, the message queue storing the instrumentation information is an asynchronous message queue, that is, the instrumentation information will not be processed immediately after being reflected to the message queue. Instead, in order to ensure the normal operation of the third-party application, the instrumentation information can be saved in the message queue and can continue to be interpreted and executed by the interpreter. The instrumentation information can be processed asynchronously, which greatly weakens the impact of the instrumentation processing on the third-party application and ensures the operating efficiency and user experience of the third-party application.

[0223] An embodiment of the present application also provides an electronic device, which includes one or more processors and one or more memories; wherein the one or more memories are coupled to the one or more processors, and the one or more memories are used to store computer program codes, and the computer program codes include computer instructions, and when the one or more processors execute the computer instructions, the electronic device executes the method described in the above embodiment.

[0224] The embodiments of the present application also provide a computer program product including instructions. When the computer program product is executed on an electronic device, the electronic device executes the method described in the above embodiments.

[0225] An embodiment of the present application also provides a computer-readable storage medium, including instructions, which, when executed on an electronic device, enable the electronic device to execute the method described in the above embodiment.

[0226] It can be understood that the various embodiments of the present application can be combined arbitrarily to achieve different technical effects.

[0227] In the above embodiments, it can be implemented in whole or in part by software, hardware, firmware or any combination thereof. When implemented using software, it can be implemented in whole or in part in the form of a computer program product. The computer program product includes one or more computer instructions. When the computer program instructions are loaded and executed on a computer, the process or function described in this application is generated in whole or in part. The computer can be a general-purpose computer, a special-purpose computer, a computer network, or other programmable device. The computer instructions can be stored in a computer-readable storage medium, or transmitted from one computer-readable storage medium to another computer-readable storage medium. For example, the computer instructions can be transmitted from a website site, computer, server or data center to another website site, computer, server or data center by wired (e.g., coaxial cable, optical fiber, digital subscriber line) or wireless (e.g., infrared, wireless, microwave, etc.) mode. The computer-readable storage medium can be any available medium that a computer can access or a data storage device such as a server or data center that includes one or more available media integration. The available medium can be a magnetic medium (e.g., a floppy disk, a hard disk, a tape), an optical medium (e.g., a DVD), or a semiconductor medium (e.g., a solid-state hard disk Solid State Disk), etc.

[0228] Those skilled in the art can understand that to implement all or part of the processes in the above-mentioned embodiments, the processes can be completed by computer programs to instruct related hardware, and the programs can be stored in computer-readable storage media. When the programs are executed, they can include the processes of the above-mentioned method embodiments. The aforementioned storage media include: ROM or random access memory RAM, magnetic disk or optical disk and other media that can store program codes.

[0229] In short, the above is only an embodiment of the technical solution of this application, and is not intended to limit the protection scope of this application. Any modification, equivalent replacement, improvement, etc. made according to the disclosure of this application shall be included in the protection scope of this application.< / videoview> < / imgview> < / textview>

Claims

1. A method for determining an instrumentation process based on a file type, characterized in that: The method comprises: Obtain file information of a running file corresponding to a third-party application, where the running file is an application file corresponding to the third-party application currently compiled and executed or interpreted and executed in the runtime virtual machine ART, where the file information includes a file name of the running file, and the running file includes at least one sub-function; Determine, based on the file name in the running file, a file type of the running file, wherein the file type includes a first file type and a second file type; Based on the traversal process corresponding to the file type of the running file, a target sub-function in the running file is plugged with a hook, and the target sub-function is continuously interpreted and executed by the first interpreter, where the target sub-function is a sub-function having a key function label.

2. The method according to claim 1, characterized in that The first traversal process includes traversing the types of execution interfaces corresponding to the sub-functions in the running file, and the first traversal process is a traversal process corresponding to the first file type; The second traversal process includes traversing the types of compilation identification information corresponding to each sub-function in the running file, and the second traversal process is a traversal process corresponding to the second file type.

3. The method according to claim 2, characterized in that The execution interface includes a compiled execution interface and an interpreted execution interface, and the interpreted execution interface includes a first interpreted execution interface and a second interpreted execution interface; In the case where the file type of the running file is the first file type, the running file is image file data; the method further includes: Traversing the execution interfaces of the sub-functions in the running file; If there is a first sub-function whose execution interface is the compiled execution interface, and the first sub-function is the target sub-function, adjusting the execution interface of the first sub-function to the first interpreted execution interface, and interpreting and executing the first sub-function through the first interpreter; If there is a second sub-function whose execution interface is the second interpreted execution interface, and the second sub-function is the target sub-function, the execution interface of the second sub-function is adjusted to the first interpreted execution interface, and the second sub-function is interpreted and executed by the first interpreter.

4. The method according to claim 3, characterized in that The ART includes a compiler and an interpreter, and the interpreter includes the first interpreter and the second interpreter; When the file type of the running file is the first file type, the method further includes: If there is a third sub-function whose execution interface is the compilation execution interface, and the third sub-function is not the target sub-function, then executing the machine code corresponding to the third sub-function; If there is a fourth sub-function whose execution interface is the second interpretation execution interface, and the fourth sub-function is not the target sub-function, the fourth sub-function is interpreted and executed by the second interpreter.

5. The method according to any one of claims 2 to 4, characterized in that: In a case where the file type of the running file is the second file type, the method further includes: Obtaining compilation identification information corresponding to each sub-function in the running file; If the compilation identification information of the fifth sub-function is empty, and the fifth sub-function is not the target sub-function, adjusting the execution interface of the fifth sub-function to the second interpretation execution interface, and interpreting and executing the fifth sub-function through the second interpreter; If the compilation identification information of the sixth sub-function is empty, and the sixth sub-function is the target sub-function, adjusting the execution interface of the sixth sub-function to the first interpretation execution interface, and interpreting and executing the sixth sub-function through the first interpreter; If the compilation identification information of the seventh sub-function is not empty, and the seventh sub-function is the target sub-function, adjusting the execution interface of the seventh sub-function to the first interpretation execution interface, and interpreting and executing the seventh sub-function through the first interpreter; If the compilation identification information of the eighth sub-function is not empty, and the eighth sub-function is not the target sub-function, the machine code corresponding to the eighth sub-function is executed.

6. The method according to any one of claims 1 to 5, characterized in that: After performing the Hook processing on the target sub-function in the running file, the method further includes: Obtaining the instrumentation information corresponding to the target sub-function; The plugging information is reflected into a message queue, and the target sub-function is continuously interpreted and executed by the first interpreter.

7. The method according to any one of claims 1 to 6, characterized in that: The third-party application includes at least one application file, and one of the application files includes at least one sub-function; before obtaining the file information of the running file corresponding to the third-party application, the method further includes: In response to the third-party application being in a running state, traversing function information of each sub-function corresponding to each application file of the third-party application, the function information including a function name corresponding to the function; Based on the function information and the pre-acquired configuration file, determining whether there is a function name of a key function that is the same as the function name of the ninth sub-function in the third-party application in the configuration file, the configuration file including function names corresponding to one or more key functions respectively; In a case where it is determined that there exists in the configuration file a function name of a key function that is identical to the function name of a ninth sub-function in the third-party application, the key function tag is set for the ninth sub-function.

8. A system for determining an instrumentation process based on a compiled optimization function, characterized in that: The system comprises: an instrumentation module and a first interpreter; The plugging module is used to: Obtain file information of a running file corresponding to a third-party application, where the running file is an application file corresponding to the third-party application currently compiled and executed or interpreted and executed in the runtime virtual machine ART, where the file information includes a file name of the running file, and the running file includes at least one sub-function; Determine, based on the file name in the running file, a file type of the running file, wherein the file type includes a first file type and a second file type; Based on the traversal process corresponding to the file type of the running file, a target sub-function in the running file is subjected to a plug-in Hook process, where the target sub-function is a sub-function having a key function label; The first interpreter is used to continue interpreting and executing the target sub-function.

9. An electronic device, characterized in that: The electronic device includes one or more processors and one or more memories; wherein the one or more memories are coupled to the one or more processors, and the one or more memories are used to store computer program code, and the computer program code includes computer instructions, and when the one or more processors execute the computer instructions, the electronic device executes the method as described in any one of claims 1-7.

10. A computer-readable storage medium comprising instructions, characterized in that: When the instructions are executed on an electronic device, the electronic device is caused to execute the method as claimed in any one of claims 1 to 7.

Citation Information

Patent Citations

  • According-to-requirement tracking method based on dynamic taint analysis and device thereof

    CN105279091A

  • Configuration file pushing method and device, server and storage medium

    CN112948012A

  • Method-level link tracking method

    CN115576786A

  • Instrumentation method and system based on interpreter and related electronic equipment

    CN116467221A

  • Compiler-based instrumentation method and system and related electronic equipment

    CN116483734A