Application program operation control method and device, electronic equipment, medium and product
By using artificial intelligence exceptions when the first process of the application is abnormal, the code block is determined and corrected by using the artificial intelligence exception correction service to solve the problem of application operation stability, realizing timely repair and normal operation, and improving user experience.
Patent Information
- Application Number
- CN202510322252.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-03-18
- Publication Date
- 2025-07-04
AI Technical Summary
Exception events in the prior art affect operation stability, and the program version update time interval is long and cannot be resolved in time, resulting in a decline in user experience.
When the first process of the application is abnormal, the AI exception correction service is used to determine the code adjustment information, correct the code block that causes the exception, and generate a second code block that can run normally.
Timely repair abnormal events in the application, shorten the repair time, ensure the normal operation of applications and electronic devices, and improve the user experience.
Smart Images

Figure CN120255947A_ABST
Abstract
Description
Technical Field
[0001] This application belongs to the technical field of electronic devices, and particularly relates to a method, device, electronic device, medium, and product for controlling the operation of application programs. Background Art
[0002] During the use of an electronic device, abnormal events that affect the running stability of application programs often occur. For example, when an application program performs graphics rendering or executes a processor-intensive task, it will generate high power consumption, shortening the battery life of the electronic device. Another example is that the application program crashes, freezes, or stops running, affecting the user's operation.
[0003] In the related art, the above abnormal events can be fixed by upgrading the program version of the application program. However, the time interval for program version updates is relatively long, with a lag, and the above abnormal events cannot be resolved in a timely manner, affecting the user's use of the electronic device. Summary of the Invention
[0004] The purpose of the embodiments of this application is to provide a method, device, electronic device, medium, and product for controlling the operation of application programs, which can timely solve abnormal events that affect the running stability of application programs and ensure the normal operation of the electronic device and the application program.
[0005] In a first aspect, the embodiments of this application provide a method for controlling the operation of an application program, including:
[0006] When the running characteristics of the first process of the application program indicate that the first process is an abnormal process, determine code adjustment information according to the first code block, where the first code block includes the code that causes the first process to be abnormal;
[0007] According to the code adjustment information, correct the code in the first code block to obtain a second code block;
[0008] Run the second code block.
[0009] In a second aspect, the embodiments of this application provide an apparatus for controlling the operation of an application program, including:
[0010] A determination module, configured to determine code adjustment information according to the first code block when the running characteristics of the first process of the application program indicate that the first process is an abnormal process, where the first code block includes the code that causes the first process to be abnormal;
[0011] A correction module, configured to correct the code in the first code block according to the code adjustment information to obtain a second code block;
[0012] A running module, configured to run the second code block.
[0013] In a third aspect, an embodiment of the present application provides an electronic device, which includes a processor, a memory, and a program or instruction stored in the memory and executable on the processor. When the program or instruction is executed by the processor, the steps of the application program running control method shown in the first aspect are implemented.
[0014] In a fourth aspect, an embodiment of the present application provides a readable storage medium, on which a program or instruction is stored. When the program or instruction is executed by a processor, the steps of the application program running control method shown in the first aspect are implemented.
[0015] In a fifth aspect, an embodiment of the present application provides a chip, which includes a processor and a display interface. The display interface is coupled to the processor, and the processor is used to run a program or instruction to implement the steps of the application program running control method shown in the first aspect.
[0016] In a sixth aspect, an embodiment of the present application provides a computer program product, which is stored in a storage medium and is executed by at least one processor to implement the steps of the application program running control method shown in the first aspect.
[0017] In the embodiment of the present application, when the running characteristics of the first process of the application program characterize the first process as an abnormal process, code adjustment information can be determined according to the first code block. The first code block includes the code that causes the first process to be abnormal. Then, according to the code adjustment information, the code in the first code block is corrected to obtain and run the second code block. In this way, during the running process of the application program, according to the code that causes the first process of the application program to be abnormal, code adjustment information for correcting these abnormalities can be determined, and the first code block during the running process of the application program can be corrected in a timely manner through the code adjustment information to obtain a second code block that can run normally, without waiting for the application program version to be updated when the process of the application program is abnormal, shortening the repair time, timely resolving abnormal events that affect the running stability of the application program, and being able to ensure the normal running of the electronic device and the application program, and ensuring that the user can use the application program normally. Description of the Drawings
[0018] Figure 1 It is a flowchart of the application program running control method provided by some embodiments of the present application;
[0019] Figure 2 It is a schematic flowchart of the application program running control method provided by some embodiments of the present application;
[0020] Figure 3 It is a schematic flowchart of the application program running control method provided by some embodiments of the present application;
[0021] Figure 4Flow chart of the application program running control method provided by some embodiments of the present application;
[0022] Figure 5 Flow chart of the application program running control method provided by some embodiments of the present application;
[0023] Figure 6 Structural schematic diagram of the application program running control device provided by some embodiments of the present application;
[0024] Figure 7 Structural schematic diagram of the electronic device provided by some embodiments of the present application;
[0025] Figure 8 Hardware structural schematic diagram of the electronic device provided by some embodiments of the present application. Detailed implementation manners
[0026] Next, the technical solutions in the embodiments of the present application will be clearly described in conjunction with the accompanying drawings in the embodiments of the present application. Obviously, the described embodiments are some, but not all, of the embodiments of the present application. All other embodiments obtained by those of ordinary skill in the art based on the embodiments in the present application belong to the scope of protection of the present application.
[0027] The terms "first", "second", etc. in the specification and claims of the present application are used to distinguish similar objects, rather than to describe a specific order or sequence. It should be understood that such terms may be interchanged under appropriate circumstances so that the embodiments of the present application can be implemented in an order different from those illustrated or described herein, and the objects distinguished by "first", "second", etc. generally belong to the same category, and the number of objects is not limited. For example, the first object may be one or more. In addition, "and / or" in the specification and claims means at least one of the connected objects, and the character " / " generally represents an "or" relationship between the associated objects before and after.
[0028] To solve the problems in the related art, the embodiments of the present application provide an application program running control method, device, electronic device and storage medium. Next, in conjunction with the attached Figures 1 to 4 , the application program running control method provided by the embodiments of the present application will be described in detail through specific embodiments and their application scenarios.
[0029] First, in conjunction with Figure 1 A detailed description will be given of an application program running control method provided by the embodiments of the present application.
[0030] Figure 1 Flow chart of the application program running control method provided by some embodiments of the present application.
[0031] AsFigure 1 As shown, the application program running control method provided by the embodiments of the present application can be applied to an electronic device. Based on this, the application program running control method may include steps 110 to 130 as specifically shown below.
[0032] Step 110, when the running characteristics of the first process of the application program characterize the first process as an abnormal process, determine code adjustment information according to the first code block, where the first code block includes the code that causes the first process to be abnormal; Step 120, correct the code in the first code block according to the code adjustment information to obtain a second code block; Step 130, run the second code block.
[0033] Exemplarily, as Figure 2 shown, the electronic device can obtain at least one first process of the running application program through the exception detection service of the framework layer. Since the running characteristics of each abnormal process will correspond to obvious characteristics, for example, the abnormal process includes a process with abnormal operation, and the running characteristics of the process with abnormal operation may include at least one of the following: array out-of-bounds, null pointer, class name conversion exception. In this way, when the running characteristics of the first process match the running characteristics of the foregoing abnormal process, it can be characterized that the first process is an abnormal process. For example, if the running characteristics of the first process are a null pointer, then the first code block including the code that causes the first process to be abnormal may be as follows:
[0034] / / Partial abnormal code of the first code block
[0035] Class A a;
[0036] getName(); / / Get the name of a
[0037] Next, the framework layer of the electronic device can call the Artificial Intelligence (AI) exception correction service, and through the AI exception correction service, determine the code adjustment information according to the foregoing first code block. For example, / / a null pointer exception occurs because a has not been assigned an object space. Then, through the AI exception correction service, correct the code in the first code block according to the foregoing code adjustment information, that is, allocate an object space such as "zhangsan" to a. In this way, a second code block that will not cause the first process to be abnormal can be obtained, where the second code block may be as follows:
[0038] Class A a = new A("zhangsan");
[0039] getName();
[0040] Then, the second code block that can be run normally.
[0041] Thus, during the running of the application, according to the code that causes an exception in the first process of the application, the code adjustment information for correcting these exceptions can be determined, and the first code block during the running of the application can be corrected in a timely manner through the code adjustment information, obtaining a second code block that can run normally, without waiting for the application version update when the application process has an exception, shortening the repair time, timely resolving the exception events that affect the running stability of the application, being able to ensure the normal running of the electronic device and the application, and guaranteeing the normal use of the application by the user.
[0042] The above steps will be described in detail as follows.
[0043] In the embodiments of the present application, the application includes at least one of the following: an application running in the foreground and an application running in the background. Among them, the foreground application in the embodiments of the present application refers to an application or system interface directly facing the user, that is, the application that the user is currently operating or displaying, and is the first contact point for the user to interact with the system. The background application in the embodiments of the present application refers to an application or service that still runs in the operating system of the electronic device without the user directly interacting with it. These applications may be performing background tasks such as data synchronization and push notifications, or waiting to be called by the user at any time.
[0044] The first process in the embodiments of the application can be a process running in a virtual machine corresponding to the application. Among them, the virtual machine corresponding to the application involved above can be the first virtual machine in the embodiments of the present application. Here, it should be noted that when the application runs in the operating system of the electronic device, the operating system will allocate an independent virtual machine for the application, and at least one process of each application can run independently in the virtual machine corresponding to the application, and the execution of the process can be controlled by the virtual machine.
[0045] Regarding step 110, in the embodiments of the present application, the following three ways to determine the code adjustment information are provided, as follows.
[0046] In some embodiments of the present application, this step 110 may specifically include step 1101 and step 1102.
[0047] Step 1101, according to the first code block, obtain the reference system log of the operation to which the application belongs. The reference system log includes a third code block, and the third code block includes the code that does not cause an exception in the process of the application.
[0048] Among them, the reference system log may be the system log of the previous running process of the application, and this system log may include the code that does not cause an exception in the process of the application.
[0049] Exemplarily, in the presence of code that causes an exception in the first process, the operating system in the electronic device may invoke an Artificial Intelligence (AI) exception correction service to obtain the reference system log of the operation to which the application belongs through the AI exception correction service.
[0050] Step 1102: Determine the code adjustment information according to the differences between the codes in the first code block and the third code block.
[0051] Exemplarily, the first code block may include:
[0052] / / Part of the exception code in the first code block
[0053] Class A a;
[0054] getName(); / / Get the name of a
[0055] Among them, / / A null pointer exception occurs because an object space has not been allocated to a. Then, referring to the third code where an object space such as "zhangsan" is allocated to a, the code adjustment information for the first code block can be determined, that is, allocate an object space such as "zhangsan" to a.
[0056] Example 2:
[0057] Resources are not released (resulting in memory leakage or power consumption anomalies)
[0058] / / Register a sensor detection and other actions when the page comes in
[0059] public void onCreate(){…}
[0060] / / Exception code: Do not unregister when exiting the page
[0061] public void onDestory(){…}
[0062] Among them, the code adjustment information for the first code block may be to unregister the detection and release the resources.
[0063] Thus, in the electronic device, through the AI exception correction service, according to the code in the reference system log of the operation to which the application belongs that does not cause an exception in the application process, the code adjustment information for correcting the code that causes the first process exception is quickly determined, shortening the time for determining the code adjustment information.
[0064] In some other embodiments of the present application, the time for determining the code adjustment information of the first code block is relatively short for some, and relatively long for others. To avoid affecting the operation of the process of the first virtual machine corresponding to the current application, the first code block that causes the first process exception can be extracted, without occupying the memory space of the original process in the first virtual machine and without affecting the normal operation of the original process. Based on this, the first process runs in the first virtual machine corresponding to the application program, and step 110 may specifically include steps 1103 to 1105.
[0065] Step 1103: Copy the first code block in the first virtual machine to obtain a first copied code block.
[0066] Step 1104: Add the first copied code block to a newly created second virtual machine.
[0067] Step 1105: Determine the code adjustment information based on the first copied code block in the second virtual machine.
[0068] Exemplarily, as Figure 3 shown, if the process of the AI exception correction service for determining the code adjustment information is relatively long, to avoid affecting the user's operation, the AI exception correction service can copy the first code block and add it to a newly created second virtual machine, and determine the code adjustment information through the computing resources and memory space in the second virtual machine.
[0069] Thus, to avoid affecting the operation of the process of the first virtual machine corresponding to the current application, shorten the repair time, and promptly solve the exception event that affects the running stability of the application program, the first code block can be detached from the original process, without occupying the memory space of the original process and without affecting the operation of the original process, resulting in little perceptibility to the user and ensuring the normal use of the application program by the user.
[0070] Further, step 1105 may specifically include:
[0071] Obtain the reference system log of the operation to which the application program belongs according to the first copied code block in the second virtual machine. The reference system log includes a third code block, and the third code block includes the code that does not cause the process exception of the application program;
[0072] Determine the code adjustment information according to the difference between the codes in the first copied code block and the third code block.
[0073] It should be noted that the principle of the step for determining the code adjustment information here is similar to the steps for determining the code adjustment information involved in steps 1101 and 1102 above. Specifically, reference can be made to steps 1101 and 1102 above, and details will not be elaborated here.
[0074] In addition, it should be noted that in the embodiments of the present application, in addition to determining the code adjustment information based on the reference system log, the execution logic and processing purpose of the abnormal code class in the first code block can also be analyzed by combining the AI exception correction service, such as specific logical purposes of processing pictures, network requests, text processing, etc. In this way, the code adjustment information can be determined based on the reference system log and in combination with the execution logic and processing purpose of the abnormal code class in the first code block, so as to improve the accuracy of determining the code adjustment information.
[0075] Here, it should be noted that the AI exception correction service in the embodiments of the present application is an AI exception correction engine set in the system framework layer of the electronic device. This AI exception correction engine can be used to detect and correct the code that causes the first process exception in the first code block by using artificial intelligence technology. Specifically, the AI exception correction engine trains and analyzes a large number of codes that cause process exceptions through machine learning and deep learning algorithms to identify and correct those codes that do not meet the expectations or are abnormal, so that the corrected code can not interfere with the normal operation of the process.
[0076] In some other embodiments of the present application, in order to save the computing resources of the electronic device and the accuracy of determining the code adjustment information, the code adjustment information can be determined by the server. Based on this, step 110 can specifically include steps 1106 to 1109.
[0077] Step 1106, copy the first code block in the first virtual machine to obtain a second copied code block.
[0078] Step 1107, send an instruction to the server. The instruction includes the second copied code block, and the instruction is used to instruct the server to determine the copied code adjustment information based on the second copied code block.
[0079] Step 1108, receive the copied code adjustment information sent by the server.
[0080] Step 1109, determine the copied code adjustment information as the code adjustment information.
[0081] Exemplarily, as Figure 4 shown, if the process of the AI exception correction service determining the code adjustment information is relatively long, the application is a background application, or the accuracy of the code adjustment information needs to be ensured, in order not to affect the user's operation, the AI exception correction service can copy the first code block and send the second copied code block after copying to the server, so as to determine the copied code adjustment information through the server and determine the copied code adjustment information sent by the server as the code adjustment information.
[0082] Thus, in order not to affect the operation of the process of the first virtual machine corresponding to the current application, shorten the repair time, and improve the accuracy of determining the code adjustment information, the first code block can be detached from the original process, and the code adjustment information can be determined by the server, without occupying the memory space of the original process, without affecting the operation of the original process, and having little impact on the user's perception, ensuring the normal use of the application by the user.
[0083] It should be noted that the conditions for triggering the execution of step 110 in the embodiments of the present application may include pausing the operation of the first code block, or pausing the operation of the first process and running the second process of the application. Based on this, step 110 may specifically include:
[0084] In the case of pausing the operation of the first code block, or pausing the operation of the first process and running the second process of the application, determine the code adjustment information according to the first code block.
[0085] Among them, if the first process is the main process of the application, the operation of the first code block can be paused. If the first process is not the main process of the application, and in the case where the processes of the application include a second process in addition to the first process, the operation of the first process can be paused and the second process of the application can be continued to run, so as to ensure that the response to the user's input will not stop and no obvious delay perception will be brought to the user.
[0086] Thus, since the first virtual machine does not terminate the process of the application, the response to the user's input will not stop, no obvious delay perception will be brought to the user, and at the same time, the user does not need to click to start the application again, reducing the user's operation and improving the efficiency of the user using the application.
[0087] In addition, in some embodiments of the present application, before step 110, the following steps 1301 and 1302 can be used to determine whether the first process is an abnormal process.
[0088] Step 1301, detect the running characteristics of the first process through the operating system exception detection service of the electronic device to obtain a detection result.
[0089] Among them, the operating system exception detection service in the embodiments of the present application refers to a function used to detect various abnormal situations that may occur during the operation of the electronic device. These abnormal situations may include hardware failures, software conflicts, system vulnerabilities, etc., which may cause the electronic device to run unstably, the application to crash, the system to freeze, etc. Among them, in the embodiments of the present application, the software conflict may include the abnormality of the running characteristics of the process of the application.
[0090] In the embodiments of the present application, the running characteristics of abnormal processes include, but are not limited to, the running characteristics of running exceptions (JE), freezes (ANR), memory overflows or leaks (OOM), and high power consumption. Specifically, the running characteristics of a process with a running exception may include at least one of the following: array out-of-bounds, null pointer, and class name conversion exception. The running characteristics of ANR may include that a time-consuming operation occurs in the main thread of the following application, where the time-consuming operation includes, but is not limited to, network requests, database operations, file reading and writing, and complex calculations. The running characteristics of memory overflow or leak may include at least one of the following: unreasonable memory usage of the application, existence of unreleased class files, or excessive application of memory objects. The running characteristics of high power consumption include at least one of the following: the calculation or rendering resources applied in the application code are greater than a preset threshold, and the calculation or rendering resources applied in the application code are not released.
[0091] Step 1302, when the detection result indicates that the running characteristics of the first process match the preset running characteristics, determine that the running characteristics of the first process indicate that the first process is an abnormal process.
[0092] Exemplarily, if the operating system of the electronic device is the Android system, the operating system exception detection service of the operating system can be used to detect the running characteristics of the application, and a detection result can be obtained. If the detection result indicates that the detected running characteristics of the application, such as a null pointer, match the running characteristics of the above abnormal process, such as a null pointer, it can be determined that the first process is an abnormal process.
[0093] In addition, in the embodiments of the present application, in addition to matching the running characteristics of the detected process with the running characteristics of the abnormal process, the system log of the operating system can also be recorded. For example, the system log may record the abnormal behavior of the process, such as the recording of error messages, warnings, or security events.
[0094] Therefore, the identification of the processes of each application can be realized through the operating system exception detection service in the electronic device. The process detection can be realized without additional detection resources in the electronic device, avoiding resource waste and, to a certain extent, extending the battery life of the electronic device.
[0095] In some embodiments of the present application, if the process of the application is detected to be abnormal by the operating system exception detection service, the exception detection service in the system framework layer can locate the abnormal location by analyzing the type of process exception and the stack being executed by the process. Based on this, before step 110, the application running control method may further include step 1401 and step 1402, which are specifically as follows.
[0096] Step 1401: Determine the exception type of the first process according to the running characteristics of the first process.
[0097] Exemplarily, if the running characteristic of the first process is an array out-of-bounds, the exception type is a runtime exception code. If the running characteristic of the first process is high power consumption, the exception type is memory leakage or power consumption anomaly caused by un-released resources.
[0098] Step 1402: Determine the first code block from the first process according to the exception type of the first process and the stack executed by the first process.
[0099] Among them, the stack refers to two memory areas used to store data and instructions during the running of an application: the heap and the stack. Since during the execution of the first process, the stack is used to manage function calls and the storage of local variables, whenever a function is called, the operating system allocates a stack frame for it on the stack, and this stack frame contains the execution environment of the function. When the function execution is completed, the stack frame is released and restored to the state before the call. In this way, the code that causes the exception of the first process can be accurately located through the stack during the execution of the first process.
[0100] Therefore, the code block in the first process can be accurately located through the exception type and the executed stack of the first process, providing the accurate code that causes the exception of the first process for the subsequent code correction process.
[0101] Regarding step 120, in some embodiments of the present application, if the first code block is in the first virtual machine, this step 120 may specifically include:
[0102] Modify the code in the first code block in the first virtual machine according to the code adjustment information to obtain a second code block.
[0103] In some embodiments of the present application, based on the above steps 1103 to 1105, this step 120 may specifically include:
[0104] Modify the code in the first copied code block according to the code adjustment information to obtain a second code block.
[0105] Exemplarily, the code adjustment information may include "allocate object space for a, such as "zhangsan"", and based on this, the second code block may be as follows:
[0106] Class A a = new A("zhangsan");
[0107] getName();
[0108] Or, the second code block may be as follows:
[0109] public void onDestory(){
[0110] this.unRegisterSensor(s); / / Unregister the sensor and release resources
[0111] }
[0112] Thus, the first code block during the operation of the application can be corrected in a timely manner through code adjustment information, and the second code block that can run normally can be obtained. There is no need to wait for the application version update when the application process is abnormal, shortening the repair time, promptly resolving abnormal events that affect the running stability of the application, ensuring the normal operation of the electronic device and the application, and guaranteeing the normal use of the application by the user.
[0113] In some embodiments of the present application, in addition to correcting the code block in the electronic device to obtain the second code block, the server can also adjust the information according to the copied code to correct the second copied code block to obtain the corrected code block. In this way, when the electronic device receives the corrected code block sent by the server, it can determine the corrected code block as the second code block.
[0114] Thus, the code block can be repaired through the server to reduce the repair resources of the electronic device and not interfere with the operation of each process of the electronic device.
[0115] Regarding step 130, in some embodiments of the present application, this step 120 may specifically include step 1301 and step 1302.
[0116] Step 1301, compile the class file corresponding to the second code block to obtain a bytecode file, and the file size of the bytecode file is smaller than that of the class file.
[0117] Among them, the bytecode file is the dex file, which is a file generated after the class file corresponding to the second code block on the operating system such as the Android system, such as a Java or Kotlin file, is compiled, refactored, rearranged, compressed, and obfuscated. Different from the traditional class file corresponding to the second code block, such as the Java class file, the dex file is optimized for the virtual machine in the operating system and is more suitable for running on electronic devices with limited resources.
[0118] Step 1302, run the bytecode file.
[0119] Exemplarily, such as Figure 5As shown, since the operating system record saves the execution position of the first code block in the process, after the abnormal code is overwritten by the correct and appropriate code of the AI exception correction service, the operating system recompiles this corrected second code block with the least resources. For example, in the Android system, the class file corresponding to the code in the second code block is compiled into a dex file that can be executed by the virtual machine. Then the operating system recompiles the class file where the second code block is located into the smallest unit of dex file, and then allows the virtual machine to re-recognize and execute it.
[0120] Thus, the repaired second code block can be quickly compiled into an executable dex execution file with the smallest unit, the impact of the process exception can be reduced most quickly, the repair time can be shortened, and the abnormal events affecting the running stability of the application program can be solved in time, which can ensure the normal operation of the electronic device and the application program and guarantee the normal use of the application program by the user.
[0121] It should be noted that for the application program running control method provided in the embodiments of the present application, the execution subject can be an electronic device such as a mobile phone, a tablet computer, a notebook computer, a handheld computer, a wearable device, etc. In some embodiments of the present application, taking the electronic device as the execution subject to execute the application program running control method as an example, the application program running control method provided in the embodiments of the present application is described.
[0122] For the application program running control method provided in the embodiments of the present application, the execution subject can be an application program running control device. In the embodiments of the present application, taking the application program running control device to execute the application program running control method as an example, the device of the application program running control method provided in the embodiments of the present application is described.
[0123] The present application also provides an application program running control device. Specifically, it is described in detail in combination with Figure 6 for details.
[0124] Figure 6 FIG. is a schematic structural diagram of an application program running control device provided in some embodiments of the present application.
[0125] As Figure 6 shown, the application program running control device 60 can be applied to an electronic device. Specifically, the application program running control device 60 may include:
[0126] An obtaining module 601, configured to obtain a first process of an application program;
[0127] A determining module 602, configured to determine code adjustment information according to a first code block when the running feature of the first process characterizes the first process as an abnormal process, where the first code block includes the code that causes the first process to be abnormal;
[0128] A correction module 603, configured to correct the code in the first code block according to the code adjustment information to obtain a second code block;
[0129] An execution module 604, configured to execute the second code block.
[0130] The application program running control device 60 in the embodiments of the present application will be described in detail below, as specifically shown below.
[0131] In some embodiments of the present application, the application program running control device 60 in the embodiments of the present application may further include a detection module, configured to detect the running characteristics of the first process through the operating system exception detection service of the electronic device to obtain a detection result;
[0132] The determination module 602 may further be configured to determine that the running characteristics of the first process characterize the first process as an abnormal process when the detection result indicates that the running characteristics of the first process match the preset running characteristics.
[0133] In some embodiments of the present application, the determination module 602 may further be configured to determine the abnormal type of the first process according to the running characteristics of the first process;
[0134] According to the abnormal type of the first process and the stack executed by the first process, determine the first code block from the first process.
[0135] In some embodiments of the present application, the determination module 602 may specifically be configured to obtain a reference system log of the operation to which the application program belongs according to the first code block, where the reference system log includes a third code block, and the third code block includes code that does not cause a process exception of the application program;
[0136] Determine the code adjustment information according to the difference between the code in the first code block and the third code block.
[0137] In some embodiments of the present application, the application program running control device 60 in the embodiments of the present application may further include a copying module, configured to copy the first code block in the first virtual machine when the first process runs in the first virtual machine corresponding to the application program to obtain a first copied code block;
[0138] The application program running control device 60 in the embodiments of the present application may further include an adding module, configured to add the first copied code block to a newly created second virtual machine;
[0139] The determination module 602 may further be configured to determine the code adjustment information according to the first copied code block in the second virtual machine.
[0140] In some embodiments of the present application, the correction module 603 may specifically be configured to correct the code in the first replicated code block according to the code adjustment information to obtain a second code block.
[0141] In some embodiments of the present application, the application program running control device 60 in the embodiments of the present application may further include a replication module, configured to replicate the first code block in the first virtual machine to obtain a second replicated code block;
[0142] The application program running control device 60 in the embodiments of the present application may further include a sending module, configured to send an instruction to the server, where the instruction includes the second replicated code block, and the instruction is used to instruct the server to determine replication code adjustment information based on the second replicated code block;
[0143] The application program running control device 60 in the embodiments of the present application may further include a receiving module, configured to receive the replication code adjustment information sent by the server;
[0144] The determination module 602 may further be configured to determine the replication code adjustment information as the code adjustment information.
[0145] In some embodiments of the present application, the determination module 602 may specifically be configured to determine the code adjustment information according to the first code block when the first code block is paused from running, or when the first process is paused from running and the second process of the application program is running.
[0146] In some embodiments of the present application, the application program running control device 60 in the embodiments of the present application may further include a mutation module, configured to compile the class file corresponding to the second code block to obtain a bytecode file, and the file size of the bytecode file is smaller than the file size of the class file;
[0147] The running module 604 may specifically be configured to run the bytecode file.
[0148] The application program running control device in the embodiments of the present application may be an electronic device or a component in the electronic device, such as an integrated circuit or a chip. The electronic device may be a terminal or other devices other than the terminal. Exemplarily, the electronic device may be a mobile phone, a tablet computer, a laptop computer, a handheld computer, an in-vehicle electronic device, a Mobile Internet Device (MID), an augmented reality (AR) / virtual reality (VR) device, a robot, a wearable device, an ultra-mobile personal computer (UMPC), a netbook, or a personal digital assistant (PDA), etc. It may also be a server, a Network Attached Storage (NAS), a personal computer (PC), a television (TV), a teller machine, or a self-service machine, etc. The embodiments of the present application do not make specific limitations.
[0149] The application program running control device in the embodiments of the present application may be a device with an operating system. The operating system may be an Android operating system, an IOS operating system, or other possible operating systems. The embodiments of the present application do not make specific limitations.
[0150] The application program running control device provided by the embodiments of the present application can implement Figures 1 to 5 each process implemented by the application program running control method embodiments shown, achieving the same technical effects. To avoid repetition, details are not described here again.
[0151] Based on this, the application program running control device provided by the embodiments of the present application can obtain the first process of the application program. When the running characteristics of the first process indicate that the first process is an abnormal process, code adjustment information is determined according to the first code block, and the first code block includes the code that causes the abnormality of the first process. Then, according to the code adjustment information, the code in the first code block is corrected to obtain and run the second code block. In this way, during the running of the application program, according to the code that causes the abnormality of the first process, code adjustment information for correcting these abnormalities can be determined, and the first code block during the running of the application program can be corrected in a timely manner through the code adjustment information to obtain the second code block that can run normally, without waiting for the application program version update when the process of the application program is abnormal, shortening the repair time, and timely solving the abnormal events that affect the running stability of the application program, which can ensure the normal running of the electronic device and the application program and guarantee the normal use of the application program by the user.
[0152] Optionally, as Figure 7 shown, the embodiments of the present application also provide an electronic device 70, including a processor 701 and a memory 702. A program or instruction that can run on the processor 701 is stored on the memory 702. When the program or instruction is executed by the processor 701, each step of the above-mentioned embodiment of the application program running control method is implemented, and the same technical effect can be achieved. To avoid repetition, it will not be described in detail here.
[0153] It should be noted that the electronic device in the embodiments of the present application includes the above-mentioned mobile electronic device and non-mobile electronic device.
[0154] Figure 8 It is a schematic diagram of the hardware structure of an electronic device provided by the embodiments of the present application.
[0155] The electronic device 800 includes, but is not limited to: a radio frequency unit 801, a network module 802, an audio output unit 803, an input unit 804, a sensor 805, a display unit 806, a user input unit 807, an interface unit 808, a memory 809, a processor 810, and other components.
[0156] Those skilled in the art can understand that the electronic device 800 may further include a power supply (such as a battery) for supplying power to each component. The power supply can be logically connected to the processor 810 through a power management system, so as to realize functions such as management of charging, discharging, and power consumption management through the power management system.
[0157] Figure 8 The structure of the electronic device shown in does not constitute a limitation on the electronic device. The electronic device may include more or fewer components than shown, or combine some components, or have different component arrangements, which will not be described in detail here.
[0158] Among them, in the embodiments of the present application, the processor 810 is configured to obtain the first process of the application program. The processor 810 may also be configured to, when the running characteristics of the first process characterize the first process as an abnormal process, determine code adjustment information according to the first code block, where the first code block includes the code that causes the abnormality of the first process. The processor 810 may also be configured to correct the code in the first code block according to the code adjustment information to obtain a second code block. The processor 810 may also be configured to run the second code block.
[0159] The electronic device 800 will be described in detail below, as follows.
[0160] In some embodiments of the present application, the processor 810 is configured to detect the running characteristics of the first process through the operating system exception detection service of the electronic device to obtain a detection result;
[0161] When the detection result indicates that the running characteristics of the first process match the preset running characteristics, it is determined that the running characteristics of the first process characterize the first process as an abnormal process.
[0162] In some embodiments of the present application, the processor 810 may also be configured to determine the abnormal type of the first process according to the running characteristics of the first process;
[0163] Determine the first code block from the first process according to the abnormal type of the first process and the stack executed by the first process.
[0164] In some embodiments of the present application, the processor 810 may also be configured to obtain the reference system log of the operation to which the application program belongs according to the first code block, where the reference system log includes a third code block, and the third code block includes the code that does not cause the process abnormality of the application program;
[0165] Determine the code adjustment information according to the difference between the code in the first code block and the third code block.
[0166] In some embodiments of the present application, the processor 810 may also be configured to, when the first process runs in the first virtual machine corresponding to the application program, copy the first code block in the first virtual machine to obtain a first copied code block;
[0167] Add the first copied code block to the newly created second virtual machine;
[0168] Determine the code adjustment information according to the first copied code block in the second virtual machine.
[0169] In some embodiments of the present application, the processor 810 may also be configured to correct the code in the first copied code block according to the code adjustment information to obtain a second code block.
[0170] In some embodiments of the present application, the processor 810 may also be used to copy the first code block in the first virtual machine to obtain a second copied code block;
[0171] The network module 802 is configured to send an instruction to the server, where the instruction includes the second copied code block, and the instruction is used to instruct the server to determine copied code adjustment information based on the second copied code block;
[0172] The network module 802 may also be used to receive the copied code adjustment information sent by the server;
[0173] The processor 810 may also be used to determine the copied code adjustment information as code adjustment information.
[0174] In some embodiments of the present application, the processor 810 may also be used to determine code adjustment information according to the first code block when the first code block is paused from running, or when the first process is paused from running and the second process of the application is running.
[0175] In some embodiments of the present application, the processor 810 may also be used to compile the class file corresponding to the second code block to obtain a bytecode file, and the file size of the bytecode file is smaller than the file size of the class file;
[0176] Run the bytecode file.
[0177] It should be understood that the input unit 804 may include a Graphics Processing Unit (GPU) 8041 and a microphone 8042. The graphics processor 8041 processes the image data of the static image or video obtained by the image capture device (such as a camera) in the video capture mode or the image capture mode. The display unit 806 may include a display panel, and the display panel may be configured in the form of a liquid crystal display, an organic light emitting diode, etc. The user input unit 807 includes at least one of a touch panel 8051 and other input devices 8052. The touch panel 8051 is also called a touch screen. The touch panel 8051 may include two parts: a touch detection device and a touch display. The other input devices 8052 may include, but are not limited to, a physical keyboard, function keys (such as volume display keys, switch keys, etc.), a trackball, a mouse, and a joystick, which will not be elaborated here.
[0178] The memory 809 can be used to store software programs and various data. The memory 809 mainly includes a first storage area for storing programs or instructions and a second storage area for storing data. Among them, the first storage area can store an operating system, application programs or instructions required for at least one function (such as a sound playback function, an image playback function, etc.). In addition, the memory 809 can include a volatile memory or a non-volatile memory, or the memory 809 can include both a volatile memory and a non-volatile memory. Among them, the non-volatile memory can be a read-only memory (ROM), a programmable read-only memory (PROM), an erasable programmable read-only memory (EPROM), an electrically erasable programmable read-only memory (EEPROM), or a flash memory. The volatile memory can be a random access memory (RAM), a static random access memory (SRAM), a dynamic random access memory (DRAM), a synchronous dynamic random access memory (SDRAM), a double data rate synchronous dynamic random access memory (DDR SDRAM), an enhanced synchronous dynamic random access memory (ESDRAM), a synch link dynamic random access memory (SLDRAM), and a direct rambus random access memory (DRRAM). The memory 809 in the embodiments of the present application includes but is not limited to these and any other suitable types of memories.
[0179] The processor 810 may include one or more processing units; optionally, the processor 810 integrates an application processor and a modem processor. Among them, the application processor mainly processes operations related to the operating system, user interface, and application programs, etc., and the modem processor mainly processes wireless display signals, such as a baseband processor. It can be understood that the above modem processor may not be integrated into the processor 810.
[0180] The embodiments of the present application also provide a readable storage medium. A program or instructions are stored on the readable storage medium. When the program or instructions are executed by a processor, each process of the above embodiment of the application program running control method is implemented, and the same technical effects can be achieved. To avoid repetition, it will not be elaborated here.
[0181] Among them, the processor is the processor in the electronic device in the above-mentioned embodiment. Among them, the readable storage medium includes computer-readable storage media, such as computer read-only memory ROM, random access memory RAM, magnetic disks or optical discs, etc.
[0182] In addition, an embodiment of the present application further provides a chip, which includes a processor and a display interface. The display interface is coupled to the processor. The processor is used to run programs or instructions to implement each process of the above-mentioned embodiment of the application program running control method, and can achieve the same technical effect. To avoid repetition, it will not be elaborated here.
[0183] It should be understood that the chip mentioned in the embodiment of the present application may also be referred to as a system-on-chip, system chip, chip system or system-on-chip, etc.
[0184] An embodiment of the present application provides a computer program product. The program product is stored in a storage medium. The program product is executed by at least one processor to implement each process of the above-mentioned embodiment of the application program running control method, and can achieve the same technical effect. To avoid repetition, it will not be elaborated here.
[0185] It should be noted that in this article, the term "including", "comprising" or any other variant thereof is intended to cover non-exclusive inclusion, so that a process, method, article or device including a series of elements not only includes those elements, but also includes other elements not expressly listed, or also includes elements inherent to such process, method, article or device. Without further limitation, an element defined by the statement "including a..." does not exclude the existence of additional identical elements in the process, method, article or device including that element.
[0186] In addition, it should be pointed out that the scope of the methods and devices in the embodiments of the present application is not limited to performing functions in the order shown or discussed. It may also include performing functions in a substantially simultaneous manner or in a reverse order according to the functions involved. For example, the described methods may be performed in an order different from that described, and various steps may be added, omitted, or combined. Additionally, the features described with reference to certain examples may be combined in other examples.
[0187] Through the description of the above embodiments, those skilled in the art can clearly understand that the above-described embodiment methods can be implemented by means of software plus a necessary general hardware platform. Of course, they can also be implemented by hardware, but in many cases, the former is a better implementation. Based on such an understanding, the technical solution of the present application, in essence, or the part that contributes to the prior art, can be embodied in the form of a computer software product. The computer software product is stored in a storage medium (such as ROM / RAM, magnetic disk, optical disk), and includes several instructions for causing a terminal (which can be a mobile phone, computer, server, or network device, etc.) to execute the methods of the various embodiments of the present application.
[0188] The embodiments of the present application have been described above in conjunction with the accompanying drawings. However, the present application is not limited to the above specific embodiments. The above specific embodiments are merely illustrative and not restrictive. Under the inspiration of the present application, those of ordinary skill in the art can also make many forms without departing from the scope protected by the purpose and claims of the present application, and all of them belong to the protection scope of the present application.
Claims
1. An application program running control method, characterized in that, including: when the running characteristics of the first process of the application program characterize the first process as an abnormal process, determining code adjustment information according to a first code block, where the first code block includes the code that causes the abnormality of the first process; correcting the code in the first code block according to the code adjustment information to obtain a second code block; running the second code block.
2. The method according to claim 1, wherein The method further includes: detecting the running characteristics of the first process through a framework layer to obtain a detection result; when the detection result indicates that the running characteristics of the first process match the preset running characteristics, determining that the running characteristics of the first process characterize the first process as an abnormal process.
3. The method according to claim 1 or 2, characterized in that, The method further includes: determining the abnormal type of the first process according to the running characteristics of the first process; determining the first code block from the first process according to the abnormal type of the first process and the stack executed by the first process.
4. The method according to claim 1, characterized in that, The determining code adjustment information according to the first code block includes: obtaining a reference system log of the operation to which the application program belongs according to the first code block, where the reference system log includes a third code block; determining the code adjustment information according to the difference between the codes in the first code block and the third code block.
5. The method according to claim 1, characterized in that, The first process runs in a first virtual machine corresponding to the application program; the determining code adjustment information according to the first code block includes: copying the first code block in the first virtual machine to obtain a first copied code block; adding the first copied code block to a second virtual machine; determining the code adjustment information according to the first copied code block in the second virtual machine.
6. The method according to claim 5, characterized in that, The correcting the code in the first code block according to the code adjustment information to obtain the second code block includes: correcting the code in the first copied code block according to the code adjustment information to obtain the second code block.
7. The method according to claim 1, wherein The first process runs in a first virtual machine corresponding to the application program; The determining code adjustment information according to the first code block includes: copying the first code block in the first virtual machine to obtain a second copied code block; sending an instruction to a server, where the instruction includes the second copied code block, and the instruction is used to instruct the server to determine copied code adjustment information based on the second copied code block; receiving the copied code adjustment information sent by the server; determining the copied code adjustment information as the code adjustment information.
8. The method according to any one of claims 1, 4 to 7, characterized in that The determining code adjustment information according to the first code block includes: when suspending the running of the first code block, or suspending the running of the first process and running a second process of the application program, determining the code adjustment information according to the first code block.
9. The method according to claim 1, characterized in that The running the second code block includes: compiling a class file corresponding to the second code block to obtain a bytecode file, where the file size of the bytecode file is smaller than the file size of the class file; running the bytecode file.
10. An application program running control device, characterized in that, including: A determination module, configured to determine code adjustment information according to a first code block when the running characteristics of a first process of an application program characterize the first process as an abnormal process, where the first code block includes the code that causes the abnormality of the first process; A correction module, configured to correct the code in the first code block according to the code adjustment information to obtain a second code block; An execution module, configured to execute the second code block.
11. An electronic device, characterized in that, Comprising: A processor and a memory, where the memory stores a program or instructions that can be run on the processor, and when the program or instructions are executed by the processor, the steps of the application program running control method according to any one of claims 1-9 are implemented.
12. A readable storage medium, characterized in that, The readable storage medium stores a program or instructions, and when the program or instructions are executed by a processor, the steps of the application program running control method according to any one of claims 1-9 are implemented.
13. A computer program product, characterized in that, The program product is stored in a storage medium, and the program product is executed by at least one processor to implement the steps of the application program running control method according to any one of claims 1-9.