Display method and device, electronic equipment and storage medium
By inserting a synchronization barrier into the message queue of the target application, the problem of stuck display interface caused by heavy application running load is solved, and the smoothness and response speed of the application are improved.
Patent Information
- Application Number
- CN202310267670.9
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2023-03-14
- Publication Date
- 2024-09-20
AI Technical Summary
In the existing technology, when the application running load is large, the display interface will be stuck, affecting the running smoothness of the application.
After detecting the synchronization vertical signal of the target application, it detects whether lag occurs. If lag occurs, a synchronization barrier is inserted at the head of the message queue to obtain the drawing message and refresh the display interface.
It effectively avoids screen freezes caused by processing thread congestion, improves application running smoothness and real-time operation response, and reduces application running freezes.
Smart Images

Figure CN118672437A
Abstract
Description
Technical Field
[0001] The embodiments of the present disclosure relate to the field of computer technology, and in particular, to a display method, device, electronic device, and storage medium. Background Art
[0002] In the prior art, when the running load of an application is large, the display interface may freeze, affecting the running smoothness of the application. Summary of the invention
[0003] Embodiments of the present disclosure provide a display method, device, electronic device, and storage medium to overcome the problem of display interface freeze.
[0004] In a first aspect, an embodiment of the present disclosure provides a display method, including:
[0005] After detecting the synchronous vertical signal corresponding to the target application, detect whether the target application is stuck; if the target application is stuck, insert a synchronization barrier at the head of the message queue corresponding to the target application to obtain the drawing message in the message queue; in response to obtaining the drawing message, refresh and display the display interface of the target application.
[0006] In a second aspect, an embodiment of the present disclosure provides a display device, including:
[0007] A detection module, configured to detect whether a freeze occurs in the target application after detecting a synchronous vertical signal corresponding to the target application;
[0008] A processing module, configured to insert a synchronization barrier at the head of a message queue corresponding to the target application to obtain a drawing message in the message queue if the target application is stuck;
[0009] The display module is used for refreshing and displaying the display interface of the target application in response to obtaining the drawing message.
[0010] In a third aspect, an embodiment of the present disclosure provides an electronic device, including:
[0011] A processor, and a memory communicatively connected to the processor;
[0012] The memory stores computer-executable instructions;
[0013] The processor executes the computer-executable instructions stored in the memory to implement the display method described in the first aspect and various possible designs of the first aspect.
[0014] In a fourth aspect, an embodiment of the present disclosure provides a computer-readable storage medium, in which computer execution instructions are stored. When a processor executes the computer execution instructions, the display method described in the first aspect and various possible designs of the first aspect is implemented.
[0015] In a fifth aspect, an embodiment of the present disclosure provides a computer program product, including a computer program, which, when executed by a processor, implements the display method described in the first aspect and various possible designs of the first aspect.
[0016] The display method, device, electronic device and storage medium provided in this embodiment detect whether the target application is stuck after detecting the synchronous vertical signal corresponding to the target application; if the target application is stuck, insert a synchronization barrier at the head of the message queue corresponding to the target application to obtain the drawing message in the message queue; in response to obtaining the drawing message, refresh the display interface of the target application. The target application is detected in real time, and after detecting that the application is stuck, the drawing messages in the message queue are processed preferentially by inserting a synchronization barrier in the message queue of the target application, thereby achieving the immediate refresh of the display interface of the target application, avoiding screen stuck caused by the inability to refresh the display interface of the application due to the blocking of the processing thread, improving the running smoothness of the application and the real-time operation response, and reducing the running stuck of the application. BRIEF DESCRIPTION OF THE DRAWINGS
[0017] In order to more clearly illustrate the embodiments of the present disclosure or the technical solutions in the prior art, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are some embodiments of the present disclosure. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative labor.
[0018] Figure 1 An application scenario diagram of the display method provided in the embodiment of the present disclosure;
[0019] Figure 2 A schematic diagram of a display method provided in an embodiment of the present disclosure Figure 1 ;
[0020] Figure 3 for Figure 2 A flowchart of a specific implementation method of step S101 in the illustrated embodiment;
[0021] Figure 4 A schematic diagram of a first message time provided by an embodiment of the present disclosure;
[0022] Figure 5A flow chart for determining an interval duration provided in an embodiment of the present disclosure;
[0023] Figure 6 A schematic diagram of the working principle of a synchronization barrier provided in an embodiment of the present disclosure;
[0024] Figure 7 A schematic diagram of a display method provided in an embodiment of the present disclosure Figure 2 ;
[0025] Figure 8 for Figure 7 A flowchart of a specific implementation method of step S203 in the illustrated embodiment;
[0026] Fig. 9 for Figure 8 A flowchart of a specific implementation method of step S2032 in the illustrated embodiment;
[0027] Fig.10 A timing diagram of inserting a synchronization barrier provided by an embodiment of the present disclosure;
[0028] Fig.11 A structural block diagram of a display device provided in an embodiment of the present disclosure;
[0029] Fig.12 A schematic diagram of the structure of an electronic device provided in an embodiment of the present disclosure;
[0030] Fig.13 A schematic diagram of the hardware structure of an electronic device provided in an embodiment of the present disclosure. DETAILED DESCRIPTION
[0031] In order to make the purpose, technical solution and advantages of the embodiments of the present disclosure clearer, the technical solution in the embodiments of the present disclosure will be clearly and completely described below in conjunction with the drawings in the embodiments of the present disclosure. Obviously, the described embodiments are part of the embodiments of the present disclosure, not all of the embodiments. Based on the embodiments in the present disclosure, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present disclosure.
[0032] It should be noted that the user information and data involved in this disclosure are all information and data authorized by the user or fully authorized by all parties, and the collection, use and processing of relevant data must comply with the relevant laws, regulations and standards of relevant countries and regions, and provide corresponding operation entrances for users to choose to authorize or refuse.
[0033] First, the technical names involved in this disclosure are explained:
[0034] Synchronous vertical technology: Vertical synchronization is also called field synchronization (Vertical synchronization, VSync). From the display principle of the display screen, a single pixel constitutes a horizontal scan line, and the accumulation of horizontal scan lines in the vertical direction forms a complete picture. The display data corresponding to the picture displayed on the display screen is provided by the central processing unit (CPU) or the graphics processing unit (GPU). However, since the operating frequency of the above processor is inconsistent with the display refresh rate of the display screen (the operating frequency of the processor is higher), the refresh of the processor and the display screen will be out of sync, which will lead to the problem of screen tearing (jank) in the screen. In order to solve this problem, after the processor completes the data scan of a frame of image, it will generate a vertical synchronization signal, so that the graphics processor is restricted by the vertical synchronization signal when generating graphics, thereby avoiding the problem of screen tearing.
[0035] Furthermore, in the Android system, the above-mentioned vertical synchronization (Vsync) mechanism for solving the screen tearing problem is provided. Based on the request of the application and according to the corresponding screen refresh rate, the Android system will send a Vsync signal every preset time interval (for example, 16 milliseconds, corresponding to a 60Hz screen refresh rate) to render the application's application interface (User Interface, UI), so that the application's application interface can be refreshed in real time according to the rhythm of the Vsync signal.
[0036] The application scenarios of the embodiments of the present disclosure are explained below:
[0037] Figure 1 This is an application scenario diagram of the display method provided in the embodiment of the present disclosure. The display method provided in the embodiment of the present disclosure can be applied to the use scenarios of application running and application testing. More specifically, for example, it is applied to the application scenario where a terminal device responds to a user operation and displays the corresponding operation result in the application, such as Figure 1 As shown, the method provided by the embodiment of the present disclosure can be applied to a terminal device, wherein the terminal device has a touch screen for displaying and receiving user operation functions, and a target application is running in the terminal device. During the running of the target application, when the terminal device detects that the user applies an input operation in the program interface of the target application, such as the upward sliding gesture operation shown in the figure, the input operation will be converted into a corresponding program instruction and responded to, thereby changing the content displayed in the program interface, such as displaying the content of the next page of the current page.
[0038] In the above process, after detecting the user operation, the terminal device will first generate the image data to be rendered and place it into the cache based on the program instructions corresponding to the user operation, and generate the corresponding drawing message and add it to the message queue of the target application. After that, the main thread of the target application will process the task messages in the message queue in sequence until the drawing message is processed, and then execute the corresponding screen rendering steps to complete the page content display corresponding to the user operation.
[0039] However, in the prior art, for the above process, when the terminal device generates the corresponding drawing message, it is based on the synchronous vertical signal at a fixed time interval, and also generates the drawing message at the corresponding time interval and adds it to the message queue of the target application. In an ideal state, each drawing message will also be consumed (executed) according to the above time interval, but in the actual execution process, when there may be a long and time-consuming task message in the message queue of the target application, the main thread of the target application will spend more time to process the message, resulting in the drawing message cannot be executed on time, and then the content on the display interface of the application is not refreshed, resulting in the screen display freeze, fluency reduction and other problems. The disclosed embodiment provides a display method to solve the above problems.
[0040] refer to Figure 2 , Figure 2 A schematic diagram of a display method provided in an embodiment of the present disclosure Figure 1 The method of this embodiment can be applied in a terminal device, and the display method includes:
[0041] Step S101: After detecting the synchronous vertical signal corresponding to the target application, detecting whether the target application is stuck.
[0042] For example, the embodiment of the present disclosure uses the Android operating system as the operating environment, and for example introduces the provided display method. Figure 1In the schematic diagram of the application scenario shown, the terminal device is, for example, a smart phone, and a target application, such as a short video application, a live video application, etc., is running in the terminal device. During the operation of the target application, the main thread running the target application can detect the vertical synchronization signal. Specifically, for example, the main thread receives and detects the vertical synchronization (Vsync) signal through Choreographer. Among them, the vertical synchronization signal can be a signal sent by the hardware unit corresponding to the screen. Under the Android operating system, the frequency of the Vsync signal is, for example, 24Hz, that is, the Vsync signal is sent every 16.6667 milliseconds to instruct the central processing unit or image processor to synthesize a frame of image. Choreographer is the class responsible for obtaining the Vsync synchronization signal and controlling the application thread (main thread) to complete the image drawing. A Choreographer instance object is saved in the main thread. When the variable is initialized in the main thread, the Choreographer instance object is created and bound to the main thread (loop thread).
[0043] Furthermore, after detecting the synchronous vertical signal corresponding to the target application, it is detected whether the target application is stuck. There are many specific implementation methods for detecting whether the target application is stuck, such as detecting the inter-frame time and drawing messages corresponding to the target application. The inter-frame time refers to the time taken to render a frame of an image in the display interface of the target application, which can be the average or maximum value of multiple timing results; the drawing message refers to the doFrame message. After receiving the doFrame message, Choreographer will consume the doFrame message and execute the doFrame function to draw content on the display interface (screen refresh). Therefore, the interval between consuming the drawing message more than twice is used to determine whether the target application is stuck.
[0044] In one possible implementation, Figure 3 As shown, the specific implementation method of step S101 includes:
[0045] Step S1011: Obtain the first message time, where the first message time is the time when the last drawing message is received.
[0046] Step S1012: Calculate the interval between the first message time and the current time according to the first message time.
[0047] Step S1013: Determine whether the target application is stuck based on the interval duration.
[0048] Exemplarily, the main thread of the target application is a loop thread. During the operation of the main thread, drawing messages (doFrameMessage) are continuously received. Exemplarily, after each drawing message is obtained, the terminal device records the system time when the drawing message is received, that is, the first message time. After that, the interval between the current time and the first message time is determined at each preset interval. If the interval is less than the preset value, it is determined that the terminal device is not currently stuck; otherwise, if the interval is greater than the preset value, it is determined that the terminal device is currently stuck. At the same time, after each drawing message is obtained, the first message time is refreshed, that is, after receiving the drawing message, the first message time is refreshed according to the time when the drawing message is received. Figure 4 A schematic diagram of a first message time provided by an embodiment of the present disclosure. The above step of determining whether the target application is stuck can be performed by a working thread other than the main thread corresponding to the target application. For example, after the working thread is created, the main thread updates the first drawing message each time it receives a drawing message. Specifically, Figure 4 As shown, at time T_1 (i.e., the first message time), the main thread receives the drawing message Message_1, and then the working thread starts to calculate the interval distance between the current time and time T_1 every interval T0. As shown in the reference figure, at time T_11, the interval distance between the current time T_11 and time T_1 is T0; at time T_12, the interval distance between the current time T_12 and time T_1 is 2xT0; at time T_13, the interval distance between the current time T_13 and time T_1 is 3xT0. Among them, the interval distance T0, the interval distance 2xT0, and the interval distance 3xT0 are all less than the preset value. Therefore, until time T_13, it is determined that the target application has no freeze.
[0049] After that, at time T_2, the main thread receives the drawing message Message_2, and then updates the first message time to T_2. The working thread starts to calculate the interval distance based on T_2. As shown in the reference figure, at time T_21, the interval distance between the current time T_21 and time T_2 is T0; at time T_22, the interval distance between the current time T_22 and time T_2 is 2xT0; at time T_23, the interval distance between the current time T_23 and time T_2 is 3xT0, and at time T_24, the interval distance between the current time T_24 and time T_2 is 4xT0, among which the interval distance T0, the interval distance 2xT0 and the interval distance 3xT0 are all less than the preset value, but the interval distance 4xT0 is greater than the interval distance. Therefore, until time T_24, it is determined that the target application is stuck.
[0050] Further, exemplarily, the interval duration may be determined dynamically, for example, the interval duration is determined based on the touch refresh rate and / or display refresh rate of the terminal screen. Figure 5 A flow chart for determining an interval duration is provided in an embodiment of the present disclosure; Figure 5 As shown, before step S101, it also includes:
[0051] Step S1001: Acquire the touch refresh rate and / or display refresh rate of the terminal screen.
[0052] Step S1002: Determine the interval duration according to the touch refresh rate and / or the display refresh rate.
[0053] Specifically, based on the previous introduction, the shorter the interval, the more frequently the working thread of the terminal device will detect the interval distance between the first message time corresponding to the reception of the drawing message and the current time, so that it can more quickly determine whether the drawing message is blocked, and then more quickly execute the subsequent steps of inserting the message barrier, so as to refresh the terminal screen faster and improve the smoothness and dynamic response of the screen. However, this process will increase the consumption of computing resources and cause problems such as increased power consumption. Therefore, in this embodiment, by obtaining the touch refresh rate and / or display refresh rate of the terminal screen, the corresponding interval duration is dynamically set based on the touch refresh rate and / or display refresh rate of the terminal screen. When the touch refresh rate and / or display refresh rate is high, a shorter interval duration is set to match the high touch refresh rate and high display refresh rate, thereby further improving the smoothness of the screen display and the real-time dynamic response; and when the touch refresh rate and / or display refresh rate is low, the terminal device itself has a higher tolerance to freezes, that is, the impact of slight freezes at low refresh rates is smaller than that at higher refresh rates. Therefore, a longer interval duration is set to match the low touch refresh rate and low display refresh rate, thereby further reducing the power effect and improving the battery life of the terminal device.
[0054] Step S102: If the target application freezes, insert a synchronization barrier at the head of the message queue corresponding to the target application to obtain the drawing message in the message queue.
[0055] Exemplarily, after the previous processing steps, if it is determined that the target application is stuck, a synchronization barrier is inserted at the head of the message queue corresponding to the target application to block other messages, so that the main thread can effectively obtain the drawing messages in the message queue, thereby achieving the purpose of improving the processing priority of the drawing messages in the message queue, and then achieving the forced refresh of the display interface of the target application, which is equivalent to "inserting" the display interface. Specifically, under the Android operating system, the main thread maintains a message queue (MessageQueue), and executes the corresponding instructions by reading various messages arranged in order in the message queue (for example, using the next() method to read the next message in the message queue). Therefore, under normal circumstances, the main thread of the target application will execute the messages in the message queue in sequence, including the drawing messages used to refresh the display interface of the target application, as well as other messages. Among them, the other messages here refer to synchronous messages, while the drawing messages belong to asynchronous messages. The synchronization barrier can block the synchronous messages and let the asynchronous messages pass, thereby realizing the priority execution of the drawing messages. After inserting the synchronization barrier (turning on the synchronization barrier), the main thread calls the MessageQueue#next() method in the loop process to fetch messages from the message queue, thereby obtaining drawing messages. The specific principle and use method of the synchronization barrier are prior art and will not be described here.
[0056] Figure 6 A schematic diagram of the working principle of a synchronization barrier provided in an embodiment of the present disclosure is shown in FIG. Figure 6 As shown, the message queue includes messages msg_1, msg_2, msg_3, msg_4 and msg_5, wherein messages msg_1, msg_2, msg_3 and msg_5 are synchronous messages, and message msg_4 is an asynchronous message, i.e., a drawing message; without inserting a synchronization barrier, the main thread of the target application will read the messages in the message queue in sequence, i.e., based on the order of messages msg_1, msg_2, msg_3, msg_4 and msg_5, read each message in sequence and execute the corresponding instructions; and after inserting a synchronization barrier at the head of the message queue, when the main thread reads the messages in the message queue, it will directly read the asynchronous message msg_4, thereby increasing the priority of the drawing message, and achieving the purpose of refreshing the display interface of the target application. Furthermore, after reading and consuming the asynchronous message msg_4, by removing the synchronization barrier, when the terminal device continues to read the messages in the message queue, it will read and consume the messages msg_1, msg_2, msg_3 and msg_5 in the message queue in sequence and execute the corresponding instructions.
[0057] Step S103: in response to obtaining the drawing message, refreshing the display interface of the target application.
[0058] Exemplarily, after obtaining the drawing message, the terminal device executes the method corresponding to the drawing message, such as the doFrame() method, which can trigger Choreographer to draw the display interface of the target application, thereby achieving the purpose of refreshing the display interface of the target application on the terminal screen. The specific image drawing operation steps based on Choreographer are existing technologies and will not be repeated here.
[0059] In this embodiment, after detecting the synchronous vertical signal corresponding to the target application, it is detected whether the target application is stuck; if the target application is stuck, a synchronization barrier is inserted at the head of the message queue corresponding to the target application to obtain the drawing message in the message queue; in response to obtaining the drawing message, the display interface of the target application is refreshed. By performing real-time detection on the target application, and after detecting that the application is stuck, the drawing message in the message queue is processed preferentially by inserting a synchronization barrier in the message queue of the target application, so as to achieve the immediate refresh of the display interface of the target application, avoid the screen stuck caused by the inability to refresh the display interface of the application due to the blockage of the processing thread, improve the running smoothness of the application and the real-time operation response, and reduce the running stuck of the application.
[0060] refer to Figure 7 , Figure 7 A schematic diagram of a display method provided in an embodiment of the present disclosure Figure 2 In this embodiment Figure 2 On the basis of the embodiment shown, step S102 is further refined and a multi-thread processing scheme is added. The display method includes:
[0061] Step S201: Create a first working thread and a second working thread.
[0062] Step S202: If the main thread of the target application detects a synchronous vertical signal corresponding to the target application, step S203 is executed.
[0063] Step S203: Detect whether the target application is stuck by using the first working thread.
[0064] Exemplarily, in this embodiment, while the target application is running based on the main thread, additional working threads, namely, a first working thread and a second working thread, are created to detect and process the jamming of the target application. The first working thread is used to detect the jamming of the target application, and the second working thread is used to process the jamming of the target application. Specifically, after the main thread of the target application detects the vertical synchronization signal, the first working thread detects the jamming of the target application. The specific implementation method of the main thread detecting the vertical synchronization signal is as follows: Figure 2 The above has been introduced in the embodiment shown, and will not be repeated here. Figure 2 In the embodiment shown, a method for detecting the jamming of the target application through a working thread is introduced. For details, see Figure 3 The specific implementation of step S101 corresponding to the illustrated embodiment is introduced. In this embodiment, another implementation of detecting freeze of the target application is provided.
[0065] For example, Figure 8 As shown, the specific implementation steps of step S203 include:
[0066] Step S2031: obtaining the drawing status through the first working thread at intervals of the first preset time, where the drawing status is determined by the number of times the drawing message is received within the first preset time before the current moment.
[0067] Exemplarily, after the main thread detects the synchronous vertical signal, the first working thread is called up to start detecting the target application. Specifically, through the first working thread, each time the detection is performed, the current drawing state is first obtained. The drawing state can represent whether a drawing message has been received within the detection period corresponding to the current moment (i.e., the first preset duration before the current moment). In one possible implementation, the state value of the drawing state can be a Boolean value, that is, the drawing state has two state values 0 and 1, wherein when the state value of the drawing state is 0, it indicates that no drawing message has been received within the detection period corresponding to the current moment; and when the state value of the drawing state is 1, it indicates that a drawing message has been received within the detection period corresponding to the current moment. In another possible implementation, the state value of the drawing state can also be an integer, such as 0, 1, 2, etc., representing the number of drawing messages received within the detection period corresponding to the current moment.
[0068] Optionally, before step S2031, the method further includes:
[0069] Step S2030: Obtain the running load of the target application, and determine a first preset duration according to the running load.
[0070] Exemplarily, the first preset duration is equivalent to the detection period for detecting the jamming of the target application. Therefore, the longer the first preset duration is, the longer the detection period is, and the less likely the target application is to be judged as "jamming"; anyway, the shorter the first preset duration is, the shorter the detection period is, and the more likely the target application is to be judged as "jamming". Since in the subsequent steps, it is necessary to insert a synchronization barrier to prioritize the processing of the drawing messages in the message queue, this step will consume corresponding system resources. Therefore, the shorter the first preset duration is, the more system resources need to be consumed. In order to avoid that the subsequent insertion of the synchronization barrier will affect the operation of other background programs of the target application or the terminal device, in this embodiment, the first preset duration is determined according to the running load of the target application. When the running load is large, the first preset duration also becomes larger, reducing the number of subsequent insertions of the synchronization barrier for forced screen refreshes and reducing resource consumption; anyway, when the running load is small, the first preset duration also becomes smaller, increasing the number of subsequent insertions of the synchronization barrier for forced screen refreshes, and improving the fluency of the target application.
[0071] Step S2032: Based on the drawing status, determine whether the target application is stuck.
[0072] Further, based on the specific implementation of the above drawing state, exemplarily, when the drawing state indicates that within the detection cycle corresponding to the current moment, more than or equal to N drawing messages are received, N is a positive integer, then it can be determined that the target application has not been stuck; anyway, when the drawing state indicates that within the detection cycle corresponding to the current moment, less than N drawing messages are received, then it can be determined that the target application has been stuck, where N is, for example, 1 or 2. Therefore, the drawing state may include a first state, that is, a state when less than N drawing messages are received within the current detection cycle. More specifically, the drawing state is, for example, state. When the state value corresponding to the drawing state is state=0 (first state), it is determined that the target application has been stuck; when the state value corresponding to the drawing state is state=1 (second state), it is determined that the target application has not been stuck.
[0073] Furthermore, if Fig. 9 As shown, illustratively, the specific implementation steps of step S2032 include:
[0074] Step S2032A: Determine the drawing state according to the number of times the drawing message is received within a first preset time period before the current moment.
[0075] Step S2032B: If the drawing state obtained by the first working thread is the first state, the target application is detected by the main thread to obtain the running task detection result. The first state indicates that the number of drawing messages received is greater than the number threshold, and the running task detection result indicates the target task currently executed by the target application.
[0076] Step S2032C: Determine whether the target application is stuck based on the running task detection result.
[0077] Exemplarily, step S2032A, i.e., the process of determining the drawing state, can be referred to the above introduction and will not be described in detail. Afterwards, after determining that the drawing state is the first state through step S2032A, the target application is further detected through the main thread for running tasks. This is because, in some special scenarios, the target application will be in a state where the screen displays static content and does not respond to the operation instructions input by the user, that is, the display interface of the target application does not need to be refreshed in real time, such as application upgrades, application self-checks, etc. In this case, the "stuck" display interface will not affect the user, and because the thread resources are released, the running efficiency of the background program can also be improved. Therefore, if the target application is determined to be stuck only based on the above drawing state, and the drawing message is executed preferentially by inserting a synchronization barrier in the subsequent steps, it will affect the normal execution of the synchronization message corresponding to the background program, resulting in the problem of affecting the running efficiency of the background program and reducing the execution speed of the background task.
[0078] To solve this problem, in this embodiment, after determining that the drawing state is the first state, the target application is further detected by running tasks through the main thread to obtain the running task detection result. The running task detection result represents the target task currently executed by the target application. Afterwards, according to the task detection result, if the target task currently executed by the target application is a background task such as program upgrade, application self-check, etc., in which the display interface of the target application does not need to be refreshed in real time, the target application is determined to be in a non-stuck state, thereby avoiding the subsequent insertion of synchronization barriers and the steps of giving priority to the drawing messages in the message queue, so that the above-mentioned background tasks can be completed efficiently and the execution efficiency of the target tasks can be improved. On the other hand, if the target task currently executed by the target application is a task that requires the display interface of the target application to be refreshed in real time, the target application is determined to be in a stuck state, thereby executing the subsequent insertion of synchronization barriers and the steps of giving priority to the drawing messages in the message queue.
[0079] In this embodiment, when the working thread determines that the drawing state corresponding to the target application is the first state (indicating that a freeze occurs), the main thread further performs a running task detection on the target application. Based on the target task currently executed by the target application represented by the running task detection result, it is further determined whether the target application is in a freeze state that may affect the user's normal use of the application, thereby solving the problem of reducing the execution speed of background tasks and improving the running efficiency of the background program of the target application in special scenarios.
[0080] Step S2033: If the target application does not freeze, return to step S2030 or step S2031; otherwise, end the loop.
[0081] For example, after step S2032, if it is determined based on step S2032 that the target application is not stuck, the process returns to step S2030 or step S2031 to continue looping the above steps until a preset condition is met, and the loop ends. The preset condition is to determine whether the target application is stuck.
[0082] Step S204: If the target application freezes, the queue distance of the drawing message in the message queue is detected through the second working thread, and the queue distance represents the number of messages to be read before the drawing message in the message queue.
[0083] Step S205: If the queue distance is less than the first distance, insert a synchronization barrier at the head of the message queue.
[0084] Step S206: after receiving the drawing message, refresh the display interface of the target application and remove the synchronization barrier.
[0085] Exemplarily, after determining that the target application is stuck, the second working thread created previously is used to first detect whether the message queue contains a drawing message for refreshing the display interface of the target application. If the message queue contains a drawing message, a synchronization barrier is inserted at the head of the message queue to obtain the drawing message in the message queue; if not, it is necessary to wait for the drawing message to appear in the message queue before inserting the synchronization barrier. Afterwards, after obtaining the drawing message, based on the consumption of the drawing message, the display interface of the target application is refreshed, and the synchronization barrier is removed, so that the main thread continues to read and execute each synchronization message in sequence based on the position of the synchronization message in the message queue. The specific implementation steps are described in detail. In a possible implementation, when the position of the drawing message in the message queue is far from the head of the message queue, that is, when the queue distance is large, the synchronization barrier is not inserted, and the synchronization messages in the message queue are still executed in normal order. When the queue distance is less than the first distance, the synchronization barrier is inserted at the head of the message queue, and the drawing message with a distance less than the first distance from the head of the queue is preferentially executed. Through the steps of this embodiment, the priority balance of drawing messages (asynchronous messages) and other synchronous messages in the message queue is achieved. In some high-load application scenarios, by setting the first distance to limit the execution of drawing messages, the execution efficiency of the background program of the target application can be improved to a certain extent, and the refresh display of the display interface and the execution of the background program can be balanced, thereby improving the overall fluency and running speed of the target application. Fig.10 A timing diagram of inserting a synchronization barrier is provided in an embodiment of the present disclosure, such as Fig.10As shown, in the message queue, there are M messages, M is a positive integer, for example, as shown in the figure, the order is msg_1, msg_2... msg_M, where msg_tar is a drawing message. At the first moment, the queue position of the drawing message msg_tar in the message queue is N1. More specifically, N1 represents the number of messages to be read before the drawing message msg_tar in the message queue. At this time, since N1 is greater than the first distance C, no synchronization barrier is inserted, and the main thread reads the messages in the message queue in a normal order. At the second moment, the queue position of the drawing message msg_tar in the message queue is N2. Since N1 is equal to the first distance C, a synchronization barrier is inserted at this time, so that the main thread directly obtains the drawing message msg_tar and executes it, thereby refreshing the display interface of the target application on the terminal screen. After the drawing message msg_tar is executed, the synchronization barrier is removed, and other messages in the message queue are read continuously.
[0086] Furthermore, after step S205, the method in this embodiment further includes: if no drawing message is received within a second preset time period, removing the synchronization barrier.
[0087] Specifically, after the synchronization barrier is inserted at the head of the message queue corresponding to the target application, if no drawing message is received within the second preset time length, for example, no drawing message is received for N consecutive frames (N synchronous vertical information), it means that the message queue is still in a blocked state after the synchronization barrier is inserted. At this time, the synchronization barrier is removed, and the main thread reads and processes the message queue normally.
[0088] Afterwards, after step S206 is completed, return to step S202 and re-execute the above steps to achieve long-term, dynamic jam detection and processing of the target application. Optionally, the above steps also include: displaying no response information on the display interface of the target application to achieve no response prompt of the target application.
[0089] Corresponding to the display method of the above embodiment, Fig.11 This is a structural block diagram of a display device provided by an embodiment of the present disclosure. For ease of explanation, only the parts related to the embodiment of the present disclosure are shown. Fig.11 , the display device 3 comprises:
[0090] A detection module 31 is used to detect whether a target application is stuck after detecting a synchronous vertical signal corresponding to the target application;
[0091] The processing module 32 is used to insert a synchronization barrier at the head of the message queue corresponding to the target application to obtain the drawing message in the message queue if the target application is stuck;
[0092] The display module 33 is used to refresh the display interface of the target application in response to obtaining the drawing message.
[0093] In one embodiment of the present disclosure, the detection module 31 is also used to: create a first working thread; when detecting whether the target application is stuck, the detection module 31 is specifically used to: loop the following steps at every first preset time interval until a preset condition is met: obtain a drawing status through the first working thread, where the drawing status is determined by the number of drawing messages received within the first preset time before the current moment; determine whether the target application is stuck based on the drawing status.
[0094] In one embodiment of the present disclosure, when the detection module 31 determines whether the target application is stuck based on the drawing state, it is specifically used to: if the drawing state obtained by the first working thread is the first state, then the target application is subjected to a running task detection through the main thread detection to obtain a running task detection result, wherein the first state indicates that the number of drawing messages received is greater than a number threshold, and the running task detection result indicates the target task currently executed by the target application; according to the running task detection result, determine whether the target application is stuck.
[0095] In one embodiment of the present disclosure, the detection module 31 is further used to: obtain the running load of the target application; and determine the first preset duration according to the running load.
[0096] In one embodiment of the present disclosure, the processing module 32 is also used to: create a second working thread; when the processing module 32 inserts a synchronization barrier at the head of the message queue corresponding to the target application, it is specifically used to: insert a synchronization barrier at the head of the message queue through the second working thread.
[0097] In one embodiment of the present disclosure, when detecting whether the target application is stuck, the detection module 31 is specifically used to: obtain the first message time, the first message time is the time when the drawing message is last received; according to the first message time, calculate the interval length between the first message time and the current time; according to the interval length, determine whether the target application is stuck.
[0098] In one embodiment of the present disclosure, the detection module 31 is further used to: obtain a touch refresh rate and / or a display refresh rate of the terminal screen; and determine an interval duration according to the touch refresh rate and / or the display refresh rate.
[0099] In one embodiment of the present disclosure, the detection module 31 is further configured to: after receiving the drawing message, refresh the first message time according to the time when the drawing message is received.
[0100] In one embodiment of the present disclosure, when the processing module 32 inserts a synchronization barrier at the head of the message queue corresponding to the target application, it is specifically used to: detect the queue distance of the drawing message in the message queue, the queue distance represents the number of messages to be read in the message queue before the drawing message; if the queue distance is less than the first distance, insert a synchronization barrier at the head of the message queue.
[0101] In one embodiment of the present disclosure, after inserting the synchronization barrier at the head of the message queue, the processing module 32 is further used to: remove the synchronization barrier if a drawing message is received, and / or remove the synchronization barrier if no drawing message is received within a second preset time period.
[0102] The detection module 31, the processing module 32 and the display module 33 are connected in sequence. The display device 3 provided in this embodiment can implement the technical solution of the above method embodiment, and its implementation principle and technical effect are similar, which will not be described in detail in this embodiment.
[0103] Fig.12 A schematic diagram of the structure of an electronic device provided by an embodiment of the present disclosure is shown in FIG. Fig.12 As shown, the electronic device 4 includes:
[0104] A processor 41, and a memory 42 communicatively connected to the processor 41;
[0105] The memory 42 stores computer executable instructions;
[0106] The processor 41 executes the computer execution instructions stored in the memory 42 to implement the following Figure 2-Figure 10 The display method in the illustrated embodiment.
[0107] Optionally, the processor 41 and the memory 42 are connected via a bus 43 .
[0108] For related instructions, please refer to Figure 2-Figure 10 The relevant descriptions and effects corresponding to the steps in the corresponding embodiments can be understood, and no further elaboration is made here.
[0109] The present invention provides a computer-readable storage medium, wherein the computer-readable storage medium stores computer-executable instructions, which are used to implement the present invention when executed by a processor. Figure 2-Figure 10 The display method provided by any one of the corresponding embodiments.
[0110] The present disclosure provides a computer program product, including a computer program, which, when executed by a processor, implements Figure 2-Figure 10 The application program in the illustrated embodiment displays,
[0111] refer to Fig.13, which shows a schematic diagram of the structure of an electronic device 900 suitable for implementing the embodiment of the present disclosure, and the electronic device 900 may be a terminal device or a server. The terminal device may include but is not limited to mobile terminals such as mobile phones, notebook computers, digital broadcast receivers, personal digital assistants (PDAs), tablet computers (Portable Android Devices, PADs), portable multimedia players (PMPs), vehicle terminals (such as vehicle navigation terminals), etc., and fixed terminals such as digital TVs, desktop computers, etc. Fig.13 The electronic device shown is only an example and should not bring any limitation to the functions and scope of use of the embodiments of the present disclosure.
[0112] like Fig.13 As shown, the electronic device 900 may include a processing device (e.g., a central processing unit, a graphics processing unit, etc.) 901, which can perform various appropriate actions and processes according to a program stored in a read-only memory (ROM) 902 or a program loaded from a storage device 908 to a random access memory (RAM) 903. In the RAM 903, various programs and data required for the operation of the electronic device 900 are also stored. The processing device 901, the ROM 902, and the RAM 903 are connected to each other via a bus 904. An input / output (I / O) interface 905 is also connected to the bus 904.
[0113] Typically, the following devices may be connected to the I / O interface 905: input devices 906 including, for example, a touch screen, a touch pad, a keyboard, a mouse, a camera, a microphone, an accelerometer, a gyroscope, etc.; output devices 907 including, for example, a liquid crystal display (LCD), a speaker, a vibrator, etc.; storage devices 908 including, for example, a magnetic tape, a hard disk, etc.; and communication devices 909. The communication device 909 may allow the electronic device 900 to communicate with other devices wirelessly or by wire to exchange data. Although Fig.13 The electronic device 900 is shown with various devices, but it should be understood that it is not required to implement or possess all the devices shown. More or fewer devices may be implemented or possessed instead.
[0114] In particular, according to an embodiment of the present disclosure, the process described above with reference to the flowchart can be implemented as a computer software program. For example, an embodiment of the present disclosure includes a computer program product, which includes a computer program carried on a computer-readable medium, and the computer program contains program code for executing the method shown in the flowchart. In such an embodiment, the computer program can be downloaded and installed from a network through a communication device 909, or installed from a storage device 908, or installed from a ROM 902. When the computer program is executed by the processing device 901, the above-mentioned functions defined in the method of the embodiment of the present disclosure are executed.
[0115] It should be noted that the computer-readable medium disclosed above may be a computer-readable signal medium or a computer-readable storage medium or any combination of the above two. The computer-readable storage medium may be, for example, but not limited to, an electrical, magnetic, optical, electromagnetic, infrared, or semiconductor system, device or device, or any combination of the above. More specific examples of computer-readable storage media may include, but are not limited to: an electrical connection with one or more wires, a portable computer disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the above. In the present disclosure, a computer-readable storage medium may be any tangible medium containing or storing a program that may be used by or in combination with an instruction execution system, device or device. In the present disclosure, a computer-readable signal medium may include a data signal propagated in a baseband or as part of a carrier wave, in which a computer-readable program code is carried. This propagated data signal may take a variety of forms, including but not limited to an electromagnetic signal, an optical signal, or any suitable combination of the above. The computer readable signal medium may also be any computer readable medium other than a computer readable storage medium, which may send, propagate or transmit a program for use by or in conjunction with an instruction execution system, apparatus or device. The program code contained on the computer readable medium may be transmitted using any suitable medium, including but not limited to: wires, optical cables, RF (radio frequency), etc., or any suitable combination of the above.
[0116] The computer-readable medium may be included in the electronic device, or may exist independently without being incorporated into the electronic device.
[0117] The computer-readable medium carries one or more programs. When the one or more programs are executed by the electronic device, the electronic device executes the method shown in the above embodiment.
[0118] Computer program code for performing the operations of the present disclosure may be written in one or more programming languages or a combination thereof, including object-oriented programming languages, such as Java, Smalltalk, C++, and conventional procedural programming languages, such as "C" or similar programming languages. The program code may be executed entirely on the user's computer, partially on the user's computer, as an independent software package, partially on the user's computer and partially on a remote computer, or entirely on a remote computer or server. In the case of a remote computer, the remote computer may be connected to the user's computer via any type of network, including a local area network (LAN) or a wide area network (WAN), or may be connected to an external computer (e.g., via the Internet using an Internet service provider).
[0119] The flow chart and block diagram in the accompanying drawings illustrate the possible architecture, function and operation of the system, method and computer program product according to various embodiments of the present disclosure. In this regard, each square box in the flow chart or block diagram can represent a module, a program segment or a part of a code, and the module, the program segment or a part of the code contains one or more executable instructions for realizing the specified logical function. It should also be noted that in some implementations as replacements, the functions marked in the square box can also occur in a sequence different from that marked in the accompanying drawings. For example, two square boxes represented in succession can actually be executed substantially in parallel, and they can sometimes be executed in the opposite order, depending on the functions involved. It should also be noted that each square box in the block diagram and / or flow chart, and the combination of the square boxes in the block diagram and / or flow chart can be implemented with a dedicated hardware-based system that performs a specified function or operation, or can be implemented with a combination of dedicated hardware and computer instructions.
[0120] The units involved in the embodiments described in the present disclosure may be implemented by software or hardware. The name of a unit does not limit the unit itself in some cases. For example, the first acquisition unit may also be described as a "unit for acquiring at least two Internet Protocol addresses".
[0121] The functions described above herein may be performed at least in part by one or more hardware logic components. For example, without limitation, exemplary types of hardware logic components that may be used include: field programmable gate arrays (FPGAs), application specific integrated circuits (ASICs), application specific standard products (ASSPs), systems on chips (SOCs), complex programmable logic devices (CPLDs), and the like.
[0122] In the context of the present disclosure, a machine-readable medium may be a tangible medium that may contain or store a program for use by or in conjunction with an instruction execution system, device, or equipment. A machine-readable medium may be a machine-readable signal medium or a machine-readable storage medium. A machine-readable medium may include, but is not limited to, an electronic, magnetic, optical, electromagnetic, infrared, or semiconductor system, device, or equipment, or any suitable combination of the foregoing. A more specific example of a machine-readable storage medium may include an electrical connection based on one or more lines, a portable computer disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the foregoing.
[0123] In a first aspect, according to one or more embodiments of the present disclosure, a display method is provided, comprising:
[0124] After detecting the synchronous vertical signal corresponding to the target application, detect whether the target application is stuck; if the target application is stuck, insert a synchronization barrier at the head of the message queue corresponding to the target application to obtain the drawing message in the message queue; in response to obtaining the drawing message, refresh and display the display interface of the target application.
[0125] According to one or more embodiments of the present disclosure, the method also includes: creating a first working thread; detecting whether the target application is stuck, including: looping the following steps at intervals of a first preset time length until a preset condition is met: obtaining a drawing status through the first working thread, the drawing status being determined by the number of drawing messages received within a first preset time length before a current moment; and determining whether the target application is stuck based on the drawing status.
[0126] According to one or more embodiments of the present disclosure, determining whether the target application is stuck based on the drawing state includes: if the drawing state obtained by the first working thread is a first state, performing a running task detection on the target application through the main thread detection to obtain a running task detection result, the first state indicating that the number of drawing messages received is greater than a number threshold, and the running task detection result indicating the target task currently executed by the target application; determining whether the target application is stuck based on the running task detection result.
[0127] According to one or more embodiments of the present disclosure, the method further includes: acquiring an operating load of the target application; and determining the first preset duration according to the operating load.
[0128] According to one or more embodiments of the present disclosure, the method further includes: creating a second working thread;
[0129] The inserting a synchronization barrier at the head position of the message queue corresponding to the target application includes: inserting a synchronization barrier at the head position of the message queue through a second working thread.
[0130] According to one or more embodiments of the present disclosure, detecting whether the target application is stuck includes: obtaining a first message time, the first message time being the time when a drawing message was last received; calculating an interval duration between the first message time and the current time based on the first message time; and determining whether the target application is stuck based on the interval duration.
[0131] According to one or more embodiments of the present disclosure, the method further includes: acquiring a touch refresh rate and / or a display refresh rate of a terminal screen; and determining the interval duration according to the touch refresh rate and / or the display refresh rate.
[0132] According to one or more embodiments of the present disclosure, the method further includes: after receiving the drawing message, refreshing the first message time according to the time when the drawing message is received.
[0133] According to one or more embodiments of the present disclosure, inserting a synchronization barrier at the head of the message queue corresponding to the target application includes: detecting a queue distance of the drawing message in the message queue, the queue distance representing the number of messages to be read in the message queue before the drawing message; if the queue distance is less than a first distance, inserting a synchronization barrier at the head of the message queue.
[0134] According to one or more embodiments of the present disclosure, after inserting the synchronization barrier at the head of the message queue, the method further includes: if the drawing message is received, removing the synchronization barrier, and / or, if the drawing message is not received within a second preset time period, removing the synchronization barrier.
[0135] In a second aspect, according to one or more embodiments of the present disclosure, a display device is provided, including:
[0136] A detection module, configured to detect whether a freeze occurs in the target application after detecting a synchronous vertical signal corresponding to the target application;
[0137] A processing module, configured to insert a synchronization barrier at the head of a message queue corresponding to the target application to obtain a drawing message in the message queue if the target application is stuck;
[0138] The display module is used for refreshing and displaying the display interface of the target application in response to obtaining the drawing message.
[0139] According to one or more embodiments of the present disclosure, the detection module is also used to: create a first working thread; when detecting whether the target application is stuck, the detection module is specifically used to: loop the following steps at intervals of a first preset time length until a preset condition is met: obtain a drawing status through the first working thread, wherein the drawing status is determined by the number of drawing messages received within the first preset time length before the current moment; and determine whether the target application is stuck based on the drawing status.
[0140] According to one or more embodiments of the present disclosure, when the detection module determines whether the target application is stuck based on the drawing state, it is specifically used to: if the drawing state obtained by the first working thread is a first state, perform a running task detection on the target application through the main thread detection to obtain a running task detection result, the first state indicating that the number of drawing messages received is greater than a number threshold, and the running task detection result indicating the target task currently executed by the target application; determine whether the target application is stuck based on the running task detection result.
[0141] According to one or more embodiments of the present disclosure, the detection module is further used to: obtain the running load of the target application; and determine the first preset duration according to the running load.
[0142] According to one or more embodiments of the present disclosure, the processing module is also used to: create a second working thread; when the processing module inserts a synchronization barrier at the head of the message queue corresponding to the target application, it is specifically used to: insert a synchronization barrier at the head of the message queue through the second working thread.
[0143] According to one or more embodiments of the present disclosure, when detecting whether the target application is stuck, the detection module is specifically used to: obtain a first message time, where the first message time is the time when the last drawing message is received; based on the first message time, calculate the interval duration between the first message time and the current time; and based on the interval duration, determine whether the target application is stuck.
[0144] According to one or more embodiments of the present disclosure, the detection module is further used to: obtain a touch refresh rate and / or a display refresh rate of a terminal screen; and determine the interval duration according to the touch refresh rate and / or the display refresh rate.
[0145] According to one or more embodiments of the present disclosure, the detection module is further configured to: after receiving the drawing message, refresh the first message time according to the time when the drawing message is received.
[0146] According to one or more embodiments of the present disclosure, when the processing module inserts a synchronization barrier at the head of the message queue corresponding to the target application, it is specifically used to: detect the queue distance of the drawing message in the message queue, the queue distance representing the number of messages to be read in the message queue before the drawing message; if the queue distance is less than the first distance, insert a synchronization barrier at the head of the message queue.
[0147] According to one or more embodiments of the present disclosure, after the synchronization barrier is inserted at the head of the message queue, the processing module is further used to: remove the synchronization barrier if the drawing message is received, and / or remove the synchronization barrier if the drawing message is not received within a second preset time period.
[0148] In a third aspect, according to one or more embodiments of the present disclosure, there is provided an electronic device, comprising: a processor, and a memory communicatively connected to the processor;
[0149] The memory stores computer-executable instructions;
[0150] The processor executes the computer-executable instructions stored in the memory to implement the display method described in the first aspect and various possible designs of the first aspect.
[0151] In a fourth aspect, according to one or more embodiments of the present disclosure, a computer-readable storage medium is provided, wherein the computer-readable storage medium stores computer execution instructions. When a processor executes the computer execution instructions, the display method described in the first aspect and various possible designs of the first aspect is implemented.
[0152] In a fifth aspect, an embodiment of the present disclosure provides a computer program product, including a computer program, which, when executed by a processor, implements the display method described in the first aspect and various possible designs of the first aspect.
[0153] The above description is only a preferred embodiment of the present disclosure and an explanation of the technical principles used. Those skilled in the art should understand that the scope of disclosure involved in the present disclosure is not limited to the technical solutions formed by a specific combination of the above technical features, but should also cover other technical solutions formed by any combination of the above technical features or their equivalent features without departing from the above disclosed concept. For example, the above features are replaced with the technical features with similar functions disclosed in the present disclosure (but not limited to) by each other to form a technical solution.
[0154] In addition, although each operation is described in a specific order, this should not be understood as requiring these operations to be performed in the specific order shown or in a sequential order. Under certain circumstances, multitasking and parallel processing may be advantageous. Similarly, although some specific implementation details are included in the above discussion, these should not be interpreted as limiting the scope of the present disclosure. Some features described in the context of a separate embodiment can also be implemented in a single embodiment in combination. On the contrary, the various features described in the context of a single embodiment can also be implemented in multiple embodiments individually or in any suitable sub-combination mode.
[0155] Although the subject matter has been described in language specific to structural features and / or methodological logical actions, it should be understood that the subject matter defined in the appended claims is not necessarily limited to the specific features or actions described above. On the contrary, the specific features and actions described above are merely example forms of implementing the claims.
Claims
1. A display method, characterized in that: include: After detecting the synchronous vertical signal corresponding to the target application, detecting whether the target application is stuck; If the target application is stuck, inserting a synchronization barrier at the head of the message queue corresponding to the target application to obtain the drawing message in the message queue; In response to obtaining the drawing message, a display interface of the target application is refreshed and displayed.
2. The method according to claim 1, characterized in that The method further comprises: Create a first working thread; The detecting whether the target application is stuck includes: At each first preset time interval, the following steps are executed repeatedly until the preset condition is met: Obtaining a drawing state through the first working thread, where the drawing state is determined by the number of drawing messages received within a first preset time period before a current moment; Based on the drawing state, it is determined whether the target application is stuck.
3. The method according to claim 2, characterized in that Determining whether the target application is stuck based on the drawing state includes: If the drawing state obtained by the first working thread is the first state, performing a running task detection on the target application through the main thread detection to obtain a running task detection result, wherein the first state indicates that the number of drawing messages received is greater than a number threshold, and the running task detection result indicates the target task currently executed by the target application; Determine whether the target application is stuck according to the running task detection result.
4. The method according to claim 2, characterized in that: The method further comprises: Obtaining the running load of the target application; The first preset duration is determined according to the operating load.
5. The method according to claim 2, characterized in that: The method further comprises: Create a second worker thread; The inserting a synchronization barrier at the head position of the message queue corresponding to the target application includes: A synchronization barrier is inserted at the head of the message queue through the second working thread.
6. The method according to claim 1, characterized in that The detecting whether the target application is stuck includes: Obtaining a first message time, where the first message time is the time when a drawing message is received last time; Calculate the time interval between the first message time and the current time according to the first message time; Determine whether the target application is stuck according to the interval duration.
7. The method according to claim 6, characterized in that The method further comprises: Obtaining the touch refresh rate and / or display refresh rate of the terminal screen; The interval duration is determined according to the touch refresh rate and / or the display refresh rate.
8. The method according to claim 6, characterized in that The method further comprises: After receiving the drawing message, the first message time is refreshed according to the time when the drawing message is received.
9. The method according to claim 1, characterized in that: The inserting a synchronization barrier at the head position of the message queue corresponding to the target application includes: detecting a queue distance of the drawing message in the message queue, wherein the queue distance represents the number of messages to be read before the drawing message in the message queue; If the queue distance is less than the first distance, a synchronization barrier is inserted at the head position of the message queue.
10. The method according to claim 9, characterized in that After inserting the synchronization barrier at the head of the message queue, the method further includes: If the drawing message is received, removing the synchronization barrier, and / or, If no drawing message is received within the second preset time period, the synchronization barrier is removed.
11. A display device, characterized in that: include: A detection module, configured to detect whether a freeze occurs in the target application after detecting a synchronous vertical signal corresponding to the target application; A processing module, configured to insert a synchronization barrier at the head of a message queue corresponding to the target application to obtain a drawing message in the message queue if the target application is stuck; The display module is used for refreshing and displaying the display interface of the target application in response to obtaining the drawing message.
12. An electronic device, characterized in that: include: A processor, and a memory communicatively connected to the processor; The memory stores computer-executable instructions; The processor executes the computer-executable instructions stored in the memory to implement the display method according to any one of claims 1 to 10.
13. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores computer-executable instructions, and when the processor executes the computer-executable instructions, the display method according to any one of claims 1 to 10 is implemented.
14. A computer program product, characterized in that The invention comprises a computer program, which implements the display method according to any one of claims 1 to 10 when being executed by a processor.
Citation Information
Cited By
Event processing method, electronic equipment, storage medium and program product
CN120670101A
An event processing method, electronic device, storage medium and program product
CN120670101B
