Application control method and device and storage medium
By determining the application -related process stack of the application related to the system and system -related process stacks in parallel, the pop -up window display is too long, and the user experience and saving the processing time are improved.
Patent Information
- Application Number
- CN202310897211.9
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2023-07-20
- Publication Date
- 2025-01-21
AI Technical Summary
In the prior art, when an application does not respond (ANR) occurs, the process from the application to the pop-up display takes a long time, resulting in poor user experience.
By determining the first type of process (process related to the application) and the second type of process (process related to the system) in response to an ANR occurring in an application running on the electronic device, grabbing the stacks of the two types of processes in parallel, and completing the stack grabbing. Then execute the pop-up window process, prompting you to process the application.
By capturing the process stack in parallel, the time for pop-up prompts is shortened, the user experience is improved, and the terminal's processing time in ANR situations is saved.
Smart Images

Figure CN119336424A_ABST
Abstract
Description
Technical Field
[0001] The present disclosure relates to the field of terminal technology, and in particular to an application control method, device and storage medium. Background Art
[0002] With the popularization of electronic devices such as terminals, the functions realized by applications (APPs) installed on electronic devices are becoming more and more complete, which can provide many conveniences for users' work and life. Users also have higher and higher requirements for the smoothness of the running of applications on electronic devices.
[0003] When a user uses an application on an electronic device, if the application is stuck, stuck, or has other unresponsive (ANR) phenomena, a fault detection will be performed. When a problem is detected, a pop-up window will be displayed to prompt the user to choose to kill the application or wait. However, the current method takes a long time from the occurrence of the ANR phenomenon in the application to the pop-up window display, resulting in poor user experience. Summary of the invention
[0004] In order to overcome the problems existing in the related art, the present disclosure provides an application control method, device and storage medium.
[0005] According to a first aspect of an embodiment of the present disclosure, there is provided an application control method, including:
[0006] In response to an application not responding (ANR) occurring when an application is running on an electronic device, a first type of process and a second type of process are determined, wherein the first type of process is a process related to the application, and the second type of process is a process related to the system; the stack of the first type of process and the stack of the second type of process are captured in parallel; in response to determining that the capture of the first type of process stack is complete, a pop-up process is executed, and a pop-up window prompts the user to process the application.
[0007] In one implementation, determining the first type of process includes:
[0008] Determine a first process identifier and a second process identifier, wherein the first process identifier is used to identify the process of the application, and the second identifier is used to identify the process communicating with the application; determine the first type of process based on the processes identified by the first process identifier and the second process identifier respectively.
[0009] In one implementation, determining the first type of process based on the processes identified by the first process identifier and the second process identifier includes:
[0010] Determine the non-system-level processes and the system-level processes corresponding to the processes identified by the first process identifier and the second process identifier respectively; add the non-system-level processes to a first array, and add the system-level processes to a second array; determine the processes in the first array and the second array as the first category of processes.
[0011] In one implementation, the concurrently capturing the stack of the first type of process and the stack of the second type of process includes:
[0012] The stack of the first type of process is captured with a first time-consuming threshold for capturing stacks, and the stack of the second type of process is captured with a second time-consuming threshold for capturing stacks; the first time-consuming threshold for capturing stacks is less than the second time-consuming threshold for capturing stacks.
[0013] In one implementation, the determining that the capture of the first type of process stack is completed includes:
[0014] In response to each stack capture in the stack of the first type of process, the capture time is determined, and the capture time is subtracted from the first stack capture time threshold to obtain the remaining time; if the remaining time is greater than zero and the capture of all stacks in the first type of process is completed, it is determined that the capture of the stack of the first type of process is completed.
[0015] In one implementation, the pop-up window prompting processing the application includes:
[0016] The reason why the ANR occurs in the application is determined, and a prompt indicating the reason is displayed in a pop-up window to prompt the application to be processed according to the reason.
[0017] According to a second aspect of an embodiment of the present disclosure, there is provided an application control device, including:
[0018] A determination unit is used to determine a first type of process and a second type of process in response to an application not responding (ANR) occurring when an application is running on an electronic device, wherein the first type of process is a process related to the application, and the second type of process is a process related to the system; a capture unit is used to capture the stack of the first type of process and the stack of the second type of process in parallel; an execution unit is used to execute a pop-up process in response to determining that the capture of the first type of process stack is completed, and to prompt a pop-up window to process the application.
[0019] In one implementation, the determining unit determines the first type of process in the following manner:
[0020] Determine a first process identifier and a second process identifier, wherein the first process identifier is used to identify the process of the application, and the second identifier is used to identify the process communicating with the application; determine the first type of process based on the processes identified by the first process identifier and the second process identifier respectively.
[0021] In one implementation, the determining unit determines the first type of process based on the processes identified by the first process identifier and the second process identifier respectively in the following manner:
[0022] Determine the non-system-level processes and the system-level processes corresponding to the processes identified by the first process identifier and the second process identifier respectively; add the non-system-level processes to a first array, and add the system-level processes to a second array; determine the processes in the first array and the second array as the first category of processes.
[0023] In one implementation, the capture unit captures the stack of the first type of process and the stack of the second type of process in parallel in the following manner:
[0024] The stack of the first type of process is captured with a first time-consuming threshold for capturing stacks, and the stack of the second type of process is captured with a second time-consuming threshold for capturing stacks; the first time-consuming threshold for capturing stacks is less than the second time-consuming threshold for capturing stacks.
[0025] In one implementation, the determining unit determines whether to complete the capture of the first type of process stack in the following manner:
[0026] In response to each stack capture in the stack of the first type of process, the capture time is determined, and the capture time is subtracted from the first stack capture time threshold to obtain the remaining time; if the remaining time is greater than zero and the capture of all stacks in the first type of process is completed, it is determined that the capture of the stack of the first type of process is completed.
[0027] In one implementation, the execution unit uses the following method to prompt a pop-up window to process the application:
[0028] The reason why the ANR occurs in the application is determined, and a prompt indicating the reason is displayed in a pop-up window to prompt the application to be processed according to the reason.
[0029] According to a third aspect of an embodiment of the present disclosure, there is provided an application control device, including:
[0030] A processor; a memory for storing processor executable instructions; wherein the processor is configured to: execute the application control method described in the first aspect or any one of the embodiments of the first aspect.
[0031] According to a fourth aspect of an embodiment of the present disclosure, a storage medium is provided, in which instructions are stored. When the instructions in the storage medium are executed by a processor of a terminal, the terminal is enabled to execute the application control method described in the first aspect or any one of the embodiments of the first aspect.
[0032] The technical solution provided by the embodiments of the present disclosure may include the following beneficial effects: when ANR occurs, the processes whose stacks need to be captured are divided into a first type of processes related to the application and a second type of processes related to the system, and the stacks of the first type of processes and the second type of processes are captured in parallel, so that the pop-up process is executed as early as possible and the pop-up prompt is triggered, thereby saving processing time when the terminal becomes unresponsive when the application becomes unresponsive.
[0033] It is to be understood that the foregoing general description and the following detailed description are exemplary and explanatory only and are not restrictive of the present disclosure. BRIEF DESCRIPTION OF THE DRAWINGS
[0034] The accompanying drawings, which are incorporated in and constitute a part of this specification, illustrate embodiments consistent with the present disclosure and, together with the description, serve to explain the principles of the present disclosure.
[0035] Figure 1 The figure is a flowchart of an application control method according to an exemplary embodiment.
[0036] Figure 2 The figure is a flowchart of an application control method according to an exemplary embodiment.
[0037] Figure 3 The figure is a flowchart of an application control method according to an exemplary embodiment.
[0038] Figure 4 The figure is a flowchart of an application control method according to an exemplary embodiment.
[0039] Figure 5 The invention is a flow chart of a time-consuming optimization design scheme of an application control method according to an exemplary embodiment.
[0040] Figure 6 The figure is a main thread time consumption experiment result in a low memory scenario of an application control method according to an exemplary embodiment.
[0041] Figure 7 The following is an experimental result of binder call time consumption in a low memory scenario according to an application control method shown in an exemplary embodiment.
[0042] Figure 8 This is a main thread time consumption experiment result in a large file copy scenario of an application control method according to an exemplary embodiment.
[0043] Fig. 9 The following is an experimental result of binder call time consumption in a large file copy scenario according to an application control method shown in an exemplary embodiment.
[0044] Fig.10 The invention is a block diagram of an application control device according to an exemplary embodiment.
[0045] Fig.11 The invention is a block diagram of an application control device according to an exemplary embodiment.
[0046] Fig.12 The invention is a block diagram of an application control device according to an exemplary embodiment. DETAILED DESCRIPTION
[0047] Exemplary embodiments will be described in detail herein, examples of which are shown in the accompanying drawings. When the following description refers to the drawings, the same numbers in different drawings represent the same or similar elements unless otherwise indicated. The embodiments described in the following exemplary embodiments do not represent all embodiments consistent with the present disclosure. Instead, they are merely examples of devices and methods consistent with some aspects of the present disclosure as detailed in the appended claims.
[0048] When the app is in the foreground, a pop-up window will be displayed through the UI thread, providing the user with the option of killing the app or waiting. This is the native Android detection mechanism for handling unresponsive apps. Currently, major manufacturers still use this native detection logic to handle unresponsive apps. Due to the time-consuming nature of the detection mechanism, there are problems such as lack of corresponding logs or failure to obtain application-side information in complex scenarios.
[0049] In the related technologies, the ANR problem is mainly solved by adding ANR processing procedures to solve the freezing screen problem, or by increasing the detection of electronic devices. For example, the application that has ANR is switched to the background. This solution further disassembles the user prompt window part, and does not change the processing flow of the application unresponsiveness problem; the preset function is used to replace the user to handle the application that has ANR; the cache volume of the target thread task is reduced to reduce the probability of ANR in the application; by detecting the accuracy of ANR, it is determined that there is an application that does not respond to ANR in the method call.
[0050] Existing solutions are all about designing, improving, and optimizing how to obtain logs, but major manufacturers rarely optimize the ANR detection mechanism itself. In response to the problem of not being able to obtain enough logs, Toutiao completed the development of the Raster monitoring tool in 2021 to monitor the main thread message scheduling process. Dewu uses the connected Bugly platform to collect problems and display them on the platform.
[0051] Based on this, an embodiment of the present disclosure provides an application control method, which optimizes the Android native process through a time-consuming optimization design solution (Frozen screen freezes Dialog ahead of time, FDA) to address the time-consuming problem of the ANR detection mechanism itself.
[0052] Through this disclosure, the time for processing ANR is saved, the log is captured more timely, the time for generating tracesFile is saved, the pop-up window is brought forward, the user experience is improved, and the function is controllable and can be adjusted at any time. The technical solution will not affect the system performance, and the architecture design is reasonable. It is also relatively complete in terms of functions, with both time-consuming optimization of the ANR detection mechanism and an early warning mechanism.
[0053] Figure 1 is a flow chart of an application control method according to an exemplary embodiment. Figure 1 As shown, the following steps are included.
[0054] In step S11, in response to an application not responding (ANR) occurring when an application is running on an electronic device, a first type of process and a second type of process are determined.
[0055] In the embodiment of the present disclosure, when an ANR is detected in an application on an electronic device, a first type of process and a second type of process are determined.
[0056] Exemplarily, the first type of process is the process related to the application that generates ANR on the electronic device, that is, the process of the application that generates ANR and the process that communicates with the application that generates ANR. The second type of process is the process that the system pays attention to when the electronic device generates ANR, such as system service processes, recently active processes and other system-related processes.
[0057] In step S12, the stack of the first type of process and the stack of the second type of process are captured in parallel.
[0058] Exemplarily, the process stack associated with the application where the ANR occurs and the process stack associated with the system are captured in parallel.
[0059] In step S13, in response to determining that the capture of the first type of process stack is completed, a pop-up window process is executed, and a pop-up window prompts the processing application.
[0060] In the disclosed embodiment, it is determined that the capture of the first type of process stack is completed, the drawing thread of the system is notified to execute the pop-up process, and a pop-up window prompts the processing application.
[0061] Exemplarily, after the process stack related to the application causing ANR on the electronic device is captured, a box indicating that the application is not responding pops up.
[0062] In the disclosed embodiment, the reason why the ANR occurs in the application is determined, and a prompt indicating the reason is displayed in a pop-up window to prompt the application to be processed according to the reason.
[0063] Among them, in the embodiment of the present disclosure, different pop-up prompt information is used to provide pop-up prompts according to different reasons why ANR occurs in the application.
[0064] For example, when a system failure occurs, a prompt will be displayed that the system is unresponsive, and a prompt will be given to wait or cancel; when an application failure occurs, a prompt will be displayed that the specific application that failed is unresponsive, and a prompt will be given to wait or cancel, for example, prompts such as the security center is unresponsive or the photo album is unresponsive.
[0065] In the disclosed embodiment, by classifying processes, two types of processes are captured in parallel. After the stack of the first type of process is captured, the pop-up window process is continued, thereby shortening the pop-up window time.
[0066] Figure 2 is a flow chart of an application control method according to an exemplary embodiment. Figure 2 As shown, the first type of processes are identified, including:
[0067] In step S21 , a first process identifier and a second process identifier are determined.
[0068] In the embodiment of the present disclosure, when an ANR occurs in an application, a method for processing the ANR is called, and the first process identifier of the application in which the ANR occurs is first determined, and the first process identifier is used to identify the process in which the ANR occurs. The second process identifier is determined by the first process identifier, wherein the second process identifier is used to identify the process communicating with the process in which the ANR occurs.
[0069] Exemplarily, the first process identifier is the process ID of the application where the ANR occurs, and the second process identifier is the process ID of the process communicating with the application where the ANR occurs.
[0070] In step S22, a first type of process is determined based on the processes identified by the first process identifier and the second process identifier respectively.
[0071] Exemplarily, the process of the application where the ANR occurs and the process that communicates with the application where the ANR occurs are determined as first-category processes.
[0072] In the disclosed embodiment, the process related to the application is determined as the first type of process, so as to prepare for the subsequent parallel capture of the stacks of the two types of processes.
[0073] Figure 3 is a flow chart of an application control method according to an exemplary embodiment. Figure 3As shown, determining the first type of process based on the processes respectively identified by the first process identifier and the second process identifier includes:
[0074] In step S31, the non-system-level processes and the system-level processes corresponding to the processes identified by the first process identifier and the second process identifier are determined.
[0075] In the disclosed embodiment, the process type includes a non-system-level process and a system-level process. Among them, the system-level process can be the native level in the Android system. The non-system-level process can be the application layer and the framework layer in the Android system. The processes identified by the first process identifier and the second process identifier are divided into non-system-level processes and system-level processes according to the identifiers.
[0076] In step S32 , non-system-level processes are added to the first array, and system-level processes are added to the second array.
[0077] In step S33, the processes in the first array and the second array are determined as first-category processes.
[0078] Exemplarily, the process of the application where the ANR occurs and the process that communicates with the application where the ANR occurs are determined as first-category processes.
[0079] In the embodiment of the present disclosure, the first category of processes is determined by the processes identified by the first process identifier and the second process identifier respectively, and all the processes collected after the occurrence of ANR are divided into two categories of processes.
[0080] In the disclosed embodiment, the stack of the first type of process and the stack of the second type of process are captured in parallel, the stack of the first type of process is captured with a first stack capture time threshold, and the stack of the second type of process is captured with a second stack capture time threshold, and the first stack capture time threshold is less than the second stack capture time threshold.
[0081] Exemplarily, a time-consuming threshold for capturing the stack of a process of an application that generates an ANR and a stack of a process that communicates with the application that generates an ANR is smaller than a time-consuming threshold for capturing the stack of a process related to the system.
[0082] Exemplarily, the time-consuming threshold for capturing the stack of the process of the application that generates the ANR and the stack of the process that communicates with the application that generates the ANR is 3 seconds, and the time-consuming threshold for capturing the stack of the process related to the system is 17 seconds.
[0083] Figure 4 is a flow chart of an application control method according to an exemplary embodiment. Figure 4 As shown, it is determined that the first type of process stack is captured, including:
[0084] In step S41, in response to each stack capture in the stack of the first type of process, the capture time is determined, and the capture time is subtracted from the first capture stack time threshold to obtain the remaining time;
[0085] In the disclosed embodiment, a threshold for capturing the stack of the first type of process is set. In the stack of the first type of process, each time the stack is captured, the time consumed for this stack capture is subtracted from the set threshold to obtain the remaining time.
[0086] In step S42, if the remaining time is greater than zero, and the capture of all stacks in the first type of process is completed, it is determined that the capture of the first type of process stack is completed.
[0087] In the embodiment of the present disclosure, if the time consumed to capture all stacks in the first category of processes is greater than zero and the capture of all stacks in the first category of processes is completed, it is determined that the capture of the first category of process stacks is completed.
[0088] In the embodiment of the present disclosure, if the time consumed to capture all stacks in the first category of processes is subtracted from the set threshold and is greater than zero, and the capture of all stacks in the first category of processes is not completed, the capture of the first category of process stacks continues.
[0089] In the disclosed embodiment, it is first determined whether the FDA switch of the time-consuming optimization function is turned on. If it is turned on, it means that this model is adapted to the FDA function and executes the time-consuming optimization process.
[0090] The embodiments of the present disclosure illustrate the application control method involved in the above examples in combination with actual applications.
[0091] Figure 5 is a flow chart of a time-consuming optimization design scheme of an application control method according to an exemplary embodiment. Figure 5 As shown, when an ANR occurs in the application, the FDA's time-consuming optimization design scheme first determines the process number (Process Identifier, PID) of the APP that has ANR, that is, the first process identifier, and derives the PID that communicates with the APP through the binder call chain, that is, the second process identifier, and adds it to the first array or the second array for storage according to whether the PID is a Java process (non-system level) or native (system level). The first array can be binderFirstPids, and the second array can be binderNativePids. Add non-system-level processes to the first array, binderFirstPids array, and add system-level processes to the second array, binderNativePids array. This facilitates the subsequent classification and capture of the stack.
[0092] Among them, the processes in the first array and the second array are first-category processes, and the PIDs of the processes related to the system are added to firstpids, nativepids and extrapids respectively for storage, that is, second-category processes.
[0093] The time-consuming threshold for grabbing the stack is set to 20s. The time-consuming threshold for grabbing the stack is distinguished between the internal R&D stage and the commercial stage. The time-consuming threshold for grabbing the stack where ANR occurs is set to 3s, that is, the first time-consuming threshold for grabbing the stack is 3s, and the attribute value of whether to grab the stack of the APP that has ANR is set to false. Then call the method of grabbing the stack in the Activity Manager Service (AMS) to grab the on-site stack of the APP that has ANR, that is, the stack of the first type of process, and calculate the time-consuming of grabbing the stack of the first type of process. When the time-consuming of grabbing the stack of the first type of process is less than the threshold of 3s, and the stack of the first type of process is grabbed, the pop-up process continues to be executed, and the process of grabbing the stack of the second type of process is executed in parallel; when the time-consuming of grabbing the stack of the first type of process is less than the threshold of 3s, and the stack of the first type of process is not grabbed, wait for the stack of the first type of process to be grabbed; when the time-consuming of grabbing the stack of the first type of process is greater than the threshold of 3s, the time-consuming of executing the first type of process is continued to be deducted from the second time-consuming threshold of grabbing the stack until the stack of the first type of process is grabbed.
[0094] When the stack capture of the first type of process is completed, the second type of stack is captured in parallel, while the first type of process continues to execute the pop-up process.
[0095] For example, when a system failure occurs, a prompt will be displayed that the system is unresponsive, and a prompt will be given to wait or cancel; when an application failure occurs, a prompt will be displayed that the specific application that failed is unresponsive, and a prompt will be given to wait or cancel, for example, prompts such as the security center is unresponsive or the photo album is unresponsive.
[0096] Figure 6 is a main thread time consumption experiment result in a low memory scenario of an application control method according to an exemplary embodiment. Figure 6 As shown in the main thread time consumption test in a low memory scenario, for example, when the memory is 8787785K, the time consumption for generating the tracesFile file is reduced from 2610ms to 390ms, saving 85%; the time consumption from the execution of the appNotResponding method to the pop-up window is reduced from 2712ms to 530ms, saving 80.5%; the time consumption from the execution of the appNotResponding method to completion is reduced from 2712ms to 531ms, saving 80.4%.
[0097] Figure 7FIG. 1 is an experimental result of binder call time consumption in a low memory scenario of an application control method according to an exemplary embodiment. Figure 7 As shown in the figure, in the binder call time consumption test in the low memory scenario, for example, when the memory is 8787785K, the time consumption of generating the tracesFile file is reduced from 2430ms to 430ms, saving 82.3%; the time consumption from the execution of the appNotResponding method to the pop-up window is reduced from 2541ms to 554ms, saving 78.2%; the time consumption from the execution of the appNotResponding method to the completion is reduced from 2541ms to 554ms, saving 78.2%.
[0098] Figure 8 is a main thread time consumption experimental result in a large file copy scenario of an application control method according to an exemplary embodiment. Figure 8 As shown in the main thread time consumption test in the large file copy scenario, for example, when the memory is 2G, the time consumption of generating the tracesFile file is reduced from 2843ms to 439ms, saving 84.6%; the time consumption from the execution of the appNotResponding method to the pop-up window is reduced from 2951ms to 546ms, saving 81.5%; the time consumption from the execution of the appNotResponding method to the completion is reduced from 2951ms to 546ms, saving 81.5%.
[0099] Fig. 9 FIG. 1 is an experimental result of binder call time consumption in a large file copy scenario of an application control method according to an exemplary embodiment. Fig. 9 As shown in the binder call time consumption test in the large file copy scenario, for example, when the memory is 2G, the time consumption of generating the tracesFile file is reduced from 2359ms to 488ms, saving 79.3%; the time consumption from the execution of the appNotResponding method to the pop-up window is reduced from 2492ms to 614ms, saving 75.4%; the time consumption from the execution of the appNotResponding method to the completion is reduced from 2492ms to 614ms, saving 75.4%.
[0100] As can be seen from the figure, the time for processing ANR is saved, and logs are captured more timely; the time for generating tracesFile is saved; the pop-up window is brought forward, improving the user product experience; the functions are controllable and can be adjusted at any time.
[0101] In addition to testing the optimization effect of the function itself, for low memory scenarios and large file copy scenarios, the time consumption of ANR detection was tested when the main thread time consumed to trigger ANR and the binder communication time consumed to trigger ANR.
[0102] Judging from the test results, whether in terms of ANR processing time or the time spent on generating tracesFile, the overall time is saved by at least 82%, with obvious benefits.
[0103] Based on the same concept, an embodiment of the present disclosure also provides an application control device.
[0104] It is understandable that, in order to realize the above functions, the application control device provided by the embodiment of the present disclosure includes hardware structures and / or software modules corresponding to the execution of each function. In combination with the units and algorithm steps of each example disclosed in the embodiment of the present disclosure, the embodiment of the present disclosure can be implemented in the form of hardware or a combination of hardware and computer software. Whether a function is executed in the form of hardware or computer software driving hardware depends on the specific application and design constraints of the technical solution. Those skilled in the art may use different methods to implement the described functions for each specific application, but such implementation should not be considered to exceed the scope of the technical solution of the embodiment of the present disclosure.
[0105] Fig.10 FIG. 1 is a block diagram of an application control device according to an exemplary embodiment. Fig.10 The device 200 includes a determining unit 201, a capturing unit 202 and an executing unit 203.
[0106] A determination unit 201 is used to determine a first type of process and a second type of process in response to an application not responding (ANR) occurring when an application is running on an electronic device, wherein the first type of process is a process related to the application, and the second type of process is a process related to the system; a capture unit 202 is used to capture the stack of the first type of process and the stack of the second type of process in parallel; an execution unit 203 is used to execute a pop-up process in response to determining that the capture of the first type of process stack is completed, and to pop up a window prompt to process the application.
[0107] In the embodiment of the present disclosure, the determination unit 201 determines the first type of process in the following manner: determine a first process identifier and a second process identifier, the first process identifier is used to identify the process of the application, and the second identifier is used to identify the process that communicates with the application; determine the first type of process based on the process corresponding to the first process identifier and the second process identifier.
[0108] In the embodiment of the present disclosure, the determination unit 201 determines the first category of processes based on the processes corresponding to the first process identifier and the second process identifier in the following manner: based on the process types corresponding to the processes identified by the first process identifier and the second process identifier, respectively, the first process identifier is added to the first array, and the second process identifier is added to the second array, the process types include non-system layer processes and system layer processes, the first array corresponds to the non-system layer processes, and the second array corresponds to the system layer processes; the processes in the first array and the second array are determined as first category processes.
[0109] In the disclosed embodiment, the capture unit 202 captures the stack of the first type of process and the stack of the second type of process in parallel in the following manner: the stack of the first type of process is captured with a first stack capture time threshold, and the stack of the second type of process is captured with a second stack capture time threshold; the first stack capture time threshold is less than the second stack capture time threshold.
[0110] In the embodiment of the present disclosure, the determination unit 201 determines whether the capture of the first type of process stack is completed in the following manner: in response to each capture of the stack in the first type of process, the capture time is determined, and the capture time is subtracted from the first capture stack time threshold to obtain the remaining time; if the remaining time is greater than zero and the capture of all stacks in the first type of process is completed, it is determined that the capture of the first type of process stack is completed.
[0111] In the embodiment of the present disclosure, the execution unit 203 uses the following method to prompt the application to be processed by popping up a window: determine the reason why the ANR occurs in the application, and pop up a window to prompt prompt information representing the reason to prompt the application to be processed according to the reason.
[0112] Regarding the device in the above embodiment, the specific manner in which each module performs operations has been described in detail in the embodiment of the method, and will not be elaborated here.
[0113] Fig.11 1 is a block diagram of a device 300 for application control according to an exemplary embodiment. The device 300 may be provided as a terminal. For example, the device 300 may be a mobile phone, a computer, a digital broadcast terminal, a messaging device, a game console, a tablet device, a medical device, a fitness device, a personal digital assistant, etc.
[0114] Reference Fig.11 , the device 300 may include one or more of the following components: a processing component 302 , a memory 304 , a power component 306 , a multimedia component 308 , an audio component 310 , an input / output (I / O) interface 312 , a sensor component 314 , and a communication component 316 .
[0115] The processing component 302 generally controls the overall operation of the device 300, such as operations associated with display, phone calls, data communications, camera operations, and recording operations. The processing component 302 may include one or more processors 320 to execute instructions to complete all or part of the steps of the above-mentioned method. In addition, the processing component 302 may include one or more modules to facilitate the interaction between the processing component 302 and other components. For example, the processing component 302 may include a multimedia module to facilitate the interaction between the multimedia component 308 and the processing component 302.
[0116] The memory 304 is configured to store various types of data to support operations on the device 300. Examples of such data include instructions for any application or method operating on the device 300, contact data, phone book data, messages, pictures, videos, etc. The memory 304 can be implemented by any type of volatile or non-volatile storage device or a combination thereof, such as static random access memory (SRAM), electrically erasable programmable read-only memory (EEPROM), erasable programmable read-only memory (EPROM), programmable read-only memory (PROM), read-only memory (ROM), magnetic memory, flash memory, magnetic disk or optical disk.
[0117] The power component 306 provides power to the various components of the device 300. The power component 306 may include a power management system, one or more power supplies, and other components associated with generating, managing, and distributing power for the device 300.
[0118] The multimedia component 308 includes a screen that provides an output interface between the device 300 and the user. In some embodiments, the screen may include a liquid crystal display (LCD) and a touch panel (TP). If the screen includes a touch panel, the screen may be implemented as a touch screen to receive input signals from the user. The touch panel includes one or more touch sensors to sense touch, slide, and gestures on the touch panel. The touch sensor may not only sense the boundaries of the touch or slide action, but also detect the duration and pressure associated with the touch or slide operation. In some embodiments, the multimedia component 308 includes a front camera and / or a rear camera. When the device 300 is in an operating mode, such as a shooting mode or a video mode, the front camera and / or the rear camera may receive external multimedia data. Each front camera and rear camera may be a fixed optical lens system or have a focal length and optical zoom capability.
[0119] The audio component 310 is configured to output and / or input audio signals. For example, the audio component 310 includes a microphone (MIC), and when the device 300 is in an operating mode, such as a call mode, a recording mode, and a speech recognition mode, the microphone is configured to receive an external audio signal. The received audio signal can be further stored in the memory 304 or sent via the communication component 316. In some embodiments, the audio component 310 also includes a speaker for outputting audio signals.
[0120] I / O interface 312 provides an interface between processing component 302 and peripheral interface modules, such as keyboards, click wheels, buttons, etc. These buttons may include but are not limited to: a home button, a volume button, a start button, and a lock button.
[0121] The sensor assembly 314 includes one or more sensors for providing various aspects of the status assessment of the device 300. For example, the sensor assembly 314 can detect the open / closed state of the device 300, the relative positioning of components, such as the display and keypad of the device 300, the sensor assembly 314 can also detect the position change of the device 300 or a component of the device 300, the presence or absence of user contact with the device 300, the orientation or acceleration / deceleration of the device 300, and the temperature change of the device 300. The sensor assembly 314 can include a proximity sensor configured to detect the presence of nearby objects without any physical contact. The sensor assembly 314 can also include an optical sensor, such as a CMOS or CCD image sensor, for use in imaging applications. In some embodiments, the sensor assembly 314 can also include an accelerometer, a gyroscope sensor, a magnetic sensor, a pressure sensor, or a temperature sensor.
[0122] The communication component 316 is configured to facilitate wired or wireless communication between the device 300 and other devices. The device 300 can access a wireless network based on a communication standard, such as WiFi, 2G or 3G, or a combination thereof. In an exemplary embodiment, the communication component 316 receives a broadcast signal or broadcast-related information from an external broadcast management system via a broadcast channel. In an exemplary embodiment, the communication component 316 also includes a near field communication (NFC) module to facilitate short-range communication. For example, the NFC module can be implemented based on radio frequency identification (RFID) technology, infrared data association (IrDA) technology, ultra-wideband (UWB) technology, Bluetooth (BT) technology and other technologies.
[0123] In an exemplary embodiment, the apparatus 300 may be implemented by one or more application-specific integrated circuits (ASICs), digital signal processors (DSPs), digital signal processing devices (DSPDs), programmable logic devices (PLDs), field programmable gate arrays (FPGAs), controllers, microcontrollers, microprocessors or other electronic components to perform the above method.
[0124] In an exemplary embodiment, a non-transitory computer-readable storage medium including instructions is also provided, such as a memory 304 including instructions, which can be executed by a processor 320 of the device 300 to perform the above method. For example, the non-transitory computer-readable storage medium can be a ROM, a random access memory (RAM), a CD-ROM, a magnetic tape, a floppy disk, an optical data storage device, etc.
[0125] Fig.12 4 is a block diagram of a device 400 for application control according to an exemplary embodiment. For example, the device 400 may be provided as a server. Fig.12 , the apparatus 400 includes a processing component 422, which further includes one or more processors, and a memory resource represented by a memory 432 for storing instructions, such as an application, that can be executed by the processing component 422. The application stored in the memory 432 may include one or more modules, each corresponding to a set of instructions. In addition, the processing component 422 is configured to execute the instructions to perform the above method.
[0126] The device 400 may also include a power supply component 426 configured to perform power management of the device 400, a wired or wireless network interface 450 configured to connect the device 400 to a network, and an input / output (I / O) interface 458. The device 400 may operate based on an operating system stored in the memory 432, such as Windows Server™, Mac OS X™, Unix™, Linux™, FreeBSD™, or the like.
[0127] In an exemplary embodiment, a non-transitory computer-readable storage medium including instructions is also provided, such as a memory 432 including instructions, which can be executed by the processing component 422 of the device 400 to perform the above method. For example, the non-transitory computer-readable storage medium can be a ROM, a random access memory (RAM), a CD-ROM, a magnetic tape, a floppy disk, an optical data storage device, etc.
[0128] It is to be understood that in the present disclosure, "plurality" refers to two or more than two, and other quantifiers are similar thereto. "And / or" describes the association relationship of associated objects, indicating that three relationships may exist. For example, A and / or B may represent: A exists alone, A and B exist at the same time, and B exists alone. The character " / " generally indicates that the associated objects before and after are in an "or" relationship. The singular forms "a", "" and "the" are also intended to include plural forms, unless the context clearly indicates other meanings.
[0129] It is further understood that the terms "first", "second", etc. are used to describe various information, but such information should not be limited to these terms. These terms are only used to distinguish the same type of information from each other, and do not indicate a specific order or degree of importance. In fact, the expressions "first", "second", etc. can be used interchangeably. For example, without departing from the scope of the present disclosure, the first information can also be referred to as the second information, and similarly, the second information can also be referred to as the first information.
[0130] It will be further understood that the terms “center”, “longitudinal”, “lateral”, “front”, “back”, “up”, “down”, “left”, “right”, “vertical”, “horizontal”, “top”, “bottom”, “inside”, “outside”, etc., indicating orientations or positional relationships based on the orientations or positional relationships shown in the accompanying drawings, are only for the convenience of describing the present embodiment and simplifying the description, and do not indicate or imply that the device or element referred to must have a specific orientation, be constructed and operated in a specific orientation.
[0131] It can be further understood that, unless otherwise specified, “connection” includes a direct connection without other components between the two, and also includes an indirect connection with other components between the two.
[0132] It is further understood that, although the operations are described in a specific order in the drawings in the embodiments of the present disclosure, it should not be understood as requiring the operations to be performed in the specific order shown or in a serial order, or requiring the execution of all the operations shown to obtain the desired results. In certain environments, multitasking and parallel processing may be advantageous.
[0133] Those skilled in the art will readily appreciate other embodiments of the present disclosure after considering the specification and practicing the invention disclosed herein. This application is intended to cover any modifications, uses or adaptations of the present disclosure, which follow the general principles of the present disclosure and include common knowledge or customary technical means in the art that are not disclosed in the present disclosure.
[0134] It should be understood that the present disclosure is not limited to the precise structures that have been described above and shown in the drawings, and that various modifications and changes may be made without departing from the scope thereof. The scope of the present disclosure is limited only by the scope of the appended claims.
Claims
1. An application control method, characterized in that: include: In response to an application not responding (ANR) occurring when an application is running on the electronic device, determining a first type of process and a second type of process, wherein the first type of process is a process related to the application, and the second type of process is a process related to the system; Capturing the stack of the first type of process and the stack of the second type of process in parallel; In response to determining that the capture of the first type of process stack is completed, a pop-up window process is executed, and a pop-up window prompts processing of the application.
2. The method according to claim 1, characterized in that The determining of the first type of process comprises: Determine a first process identifier and a second process identifier, wherein the first process identifier is used to identify the process of the application, and the second process identifier is used to identify a process communicating with the application; The first-category process is determined based on the processes identified by the first process identifier and the second process identifier.
3. The method according to claim 2, characterized in that The determining the first type of process based on the processes respectively identified by the first process identifier and the second process identifier includes: Determine a non-system-level process and a system-level process corresponding to the processes respectively identified by the first process identifier and the second process identifier; Adding the non-system-level process to a first array, and adding the system-level process to a second array; The processes in the first array and the second array are determined as the first type of processes.
4. The method according to any one of claims 1 to 3, characterized in that The concurrently capturing the stack of the first-type process and the stack of the second-type process includes: Capture the stack of the first type of process at a first time-consuming threshold for capturing stacks, and capture the stack of the second type of process at a second time-consuming threshold for capturing stacks; The first crawl stack time-consuming threshold is smaller than the second crawl stack time-consuming threshold.
5. The method according to claim 4, characterized in that The determining that the capture of the first type of process stack is completed includes: In response to each stack capture in the stack of the first type of process, a capture time is determined, and the capture time is subtracted from the first stack capture time threshold to obtain a remaining time; If the remaining time consumption is greater than zero, and the capture of all stacks in the first-category process is completed, it is determined that the capture of the stacks of the first-category process is completed.
6. The method according to claim 1, characterized in that The pop-up window prompting the application to process includes: The reason why the ANR occurs in the application is determined, and a prompt indicating the reason is displayed in a pop-up window to prompt the application to be processed according to the reason.
7. An application control device, characterized in that: include: A determining unit, configured to determine a first type of process and a second type of process in response to an application not responding (ANR) occurring when an application is running on the electronic device, wherein the first type of process is a process related to the application, and the second type of process is a process related to the system; A capture unit, used for capturing the stack of the first type of process and the stack of the second type of process in parallel; An execution unit is used for executing a pop-up process in response to determining that the capture of the first type of process stack is completed, and popping up a window to prompt processing of the application.
8. The application control device according to claim 7, characterized in that: The determining unit determines the first type of process in the following manner: Determine a first process identifier and a second process identifier, wherein the first process identifier is used to identify the process of the application, and the second process identifier is used to identify a process communicating with the application; The first-category process is determined based on the processes identified by the first process identifier and the second process identifier.
9. The application control device according to claim 7, characterized in that: The determining unit determines the first-category process based on the processes identified by the first process identifier and the second process identifier respectively in the following manner: Determine a non-system-level process and a system-level process corresponding to the processes respectively identified by the first process identifier and the second process identifier; Adding the non-system-level process to a first array, and adding the system-level process to a second array; The processes in the first array and the second array are determined as the first type of processes.
10. The application control device according to any one of claims 7 to 9, characterized in that: The capture unit captures the stack of the first type of process and the stack of the second type of process in parallel in the following manner: Capture the stack of the first type of process at a first time-consuming threshold for capturing stacks, and capture the stack of the second type of process at a second time-consuming threshold for capturing stacks; The first crawl stack time-consuming threshold is smaller than the second crawl stack time-consuming threshold.
11. The application control device according to claim 7, characterized in that: The determining unit determines whether to complete the capture of the first type of process stack in the following manner: In response to each stack capture in the stack of the first type of process, a capture time is determined, and the capture time is subtracted from the first stack capture time threshold to obtain a remaining time; If the remaining time consumption is greater than zero, and the capture of all stacks in the first-category process is completed, it is determined that the capture of the stacks of the first-category process is completed.
12. The application control device according to claim 7, characterized in that: The execution unit uses the following method to pop up a window to prompt the application to process: The reason why the ANR occurs in the application is determined, and a prompt indicating the reason is displayed in a pop-up window to prompt the application to be processed according to the reason.
13. An application control device, characterized in that: include: processor; a memory for storing processor-executable instructions; Wherein, the processor is configured to: execute the application control method described in any one of claims 1 to 6.
14. A storage medium, characterized in that: The storage medium stores instructions, and when the instructions in the storage medium are executed by a processor of the terminal, the terminal is enabled to execute the application control method described in any one of claims 1 to 6.