Display method and related device
By adjusting the call order of Surfaceflinger and drawing threads in the terminal device, the frame drop and lag problems when sliding upwards into the multitasking animation function are solved, and the smoothness of animation is improved.
Patent Information
- Application Number
- CN202310821474.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2023-07-05
- Publication Date
- 2025-01-07
AI Technical Summary
When the terminal device slides into the multitasking function, it is easy to cause frame loss or lag.
When the terminal device does not turn on the screen projection or screen recording function, first call the preset thread of Surfaceflinger, then call the drawing thread; when the screen projection or screen recording function is turned on, do not call the preset before calling the drawing thread first Thread to reduce frame drop or lag.
It effectively avoids frame loss or lag, and improves the fluency and stability of multi-task animation.
Smart Images

Figure CN119271315A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of terminal technology, and in particular to a display method and related devices. Background Art
[0002] With the development of technology, mobile phones and other terminal devices have more and more functions. For example, when a mobile phone or other terminal device displays the interface of an application, it detects that the user presses the screen and slides up, and in response to the user pressing the screen and sliding up, a multitasking interface is displayed, and the multitasking interface includes at least one card, and the at least one card includes the card corresponding to this application, and may also include cards corresponding to other applications running in the background. Mobile phones and other terminal devices detect the user's lifting operation, and in response to the user's lifting operation, the at least one card is moved to a specific position in the multitasking interface. The process of moving at least one card to a specific position in the multitasking interface can be called an animation, and the function of displaying animations on mobile phones and other terminal devices can be called the swipe up to enter multitasking animation function.
[0003] Currently, when a terminal device swipes up to enter the multi-tasking animation function, frame loss or freeze may occur. Summary of the invention
[0004] The embodiments of the present application provide a display method and a related device, which are applied to the field of terminal technology. When swiping up to enter a multi-tasking animation function, it is helpful to reduce frame loss or freeze.
[0005] In the first aspect, the embodiment of the present application proposes a display method, which can be applied to a terminal device. The method includes: when the terminal device does not turn on the screen projection or screen recording function, displaying the interface of the first application; receiving the user's press and slide operation, and in response to the user's lift operation, displaying the first animation between the first time point and the second time point; wherein, after the first time point, first call the preset thread of Surfaceflinger, and then call the drawing thread, and the second time point is after the first time point; at the second time point, display the multi-task management interface; after the second time point, the terminal device turns on the screen recording or screen projection function, and displays the interface of the first application; receiving the user's press and slide operation, and in response to the user's lift operation, displaying the first animation between the third time point and the fourth time point; wherein, after the third time point, before calling the drawing thread, the preset thread is not called, and the fourth time point is after the third time point; at the fourth time point, display the multi-task management interface.
[0006] The terminal device does not turn on the screen projection or screen recording function, which can be understood as the terminal device being in a non-screen projection and non-screen recording scenario. The first application can be an information application, a setting application, a chat application, or the like. Between the first time point and the second time point, the first animation is displayed, and the second time point is after the first time point, which can indicate that the display duration of the first animation is the time difference between the second time point and the first time point. At the second time point, the multi-task management interface is displayed, which can indicate that the last frame of the first animation is the multi-task management interface. The multi-task management interface may also be referred to as a multi-task interface, which is not limited in this application. In the process of displaying the first animation, the preset thread of Surfaceflinger is called first, and then the drawing thread is called. This can indicate that when the terminal device does not turn on the screen projection or screen recording function, the terminal device uses the swipe up to enter the multi-task animation sinking function provided in the embodiment of the present application involved in the specific embodiment.
[0007] When the terminal device turns on the screen recording or screen projection function, it can be understood that the terminal device is in a screen projection or screen recording scene. Between the third time point and the fourth time point, the first animation is displayed, and the fourth time point is after the third time point, which can indicate that the display duration of the first animation is the time difference between the fourth time point and the third time point. At the fourth time point, the multi-task management interface is displayed, which can indicate that the last frame of the first animation is the multi-task management interface. In the process of displaying the first animation, the preset thread is not called before the drawing thread is called, which can indicate that when the terminal device turns on the screen projection or screen recording function, the terminal device uses the existing swipe up to enter the multi-task animation function involved in the specific embodiment.
[0008] In this way, when the terminal device does not have the screen projection or screen recording function turned on, in the process of displaying the first animation, the preset thread of Surfaceflinger is called first, and then the drawing thread is called, and the sliding up to enter the multi-tasking dynamic effect sinking function provided by the embodiment of the present application involved in the specific embodiment is used, which is conducive to avoiding frame loss or jamming. When the terminal device has the screen projection or screen recording function turned on, in the process of displaying the first animation, before calling the drawing thread, the preset thread is not called, and the existing sliding up to enter the multi-tasking dynamic effect function involved in the specific embodiment is used, which is conducive to reducing the probability of no animation.
[0009] In a possible implementation, the method further includes: between the first time point and the second time point, before calling the drawing thread, calling the thread for obtaining the frame rate; between the third time point and the fourth time point, not calling the thread for obtaining the frame rate.
[0010] During the process of displaying the first animation between the first time point and the second time point, the thread for obtaining the frame rate, the preset thread, and the drawing thread are called. This indicates that when the screen projection or screen recording function is not turned on in the terminal device, the terminal device uses the swipe up to enter the multi-tasking animation sinking function provided in the embodiment of the present application involved in the specific embodiment.
[0011] Between the third time point and the fourth time point, in the process of displaying the first animation, the thread for obtaining the frame rate is not called, and the preset thread is not called, but the drawing thread is called. This may indicate that when the screen projection or screen recording function is turned on in the terminal device, the terminal device uses the existing swipe-up to enter multi-tasking animation function involved in the specific embodiment.
[0012] In this way, when the terminal device does not have the screen projection or screen recording function turned on, during the display of the first animation, the thread for obtaining the frame rate is also called to obtain the frame rate. The frame rate is related to the number of frames included in the first animation, which is conducive to calculating the number of frames included in the first animation. When the terminal device has the screen projection or screen recording function turned on, during the display of the first animation, the thread for obtaining the frame rate is not called to obtain the frame rate, which is conducive to reducing the load.
[0013] In a possible implementation, the method further includes: displaying an interface of a second application; and displaying a second animation in response to a user operation of returning to the desktop; wherein, during the display of the second animation, the rendering thread is not called.
[0014] The interface of the second application may be the same as or different from the interface of the first application, and this application does not limit this. When the terminal device displays the interface of the second application, it detects the user's operation of returning to the desktop, and displays the second animation in response to the user's operation of returning to the desktop. The second animation is the conversion process of the interface of the second application to the desktop. In the process of displaying the second animation, the terminal device does not call the rendering thread, and the rendering thread is the render Thread.
[0015] The terminal device does not call the rendering thread during the display of the second animation, which can indicate that the terminal device uses the swipe up to enter multi-tasking dynamic effect sinking function provided in the embodiment of the present application involved in the specific embodiment.
[0016] In this way, in scenes where other animations are displayed, such as the second animation, the rendering thread is not called, which can indicate that the terminal device has used the swipe-up to enter multi-tasking animation sinking function provided in the embodiment of the present application involved in the specific embodiment, which is helpful in avoiding frame loss or freezes.
[0017] In one possible implementation, the first animation includes M frames of images, each of the M frames of images includes a card of the first application, and M is an integer greater than 0; the above method also includes: after the first time point, calling the thread of the desktop application to calculate the parameters of the card of the first application included in each frame of the M frames of images, and obtaining M groups of first parameters; calling the thread of the desktop application to transmit the M groups of first parameters together to Surfaceflinger; calling the preset thread and the drawing thread to draw based on the M groups of first parameters.
[0018] The card of the first application is referred to as the main card in the specific embodiment. The first animation includes M frames of images, each of which includes the card of the first application, which is described as all frames of the main card in the animation in the specific embodiment. The M groups of first parameters are described as parameters of all frames of the main card in the specific embodiment.
[0019] In this way, when the terminal device calls the thread of the desktop application to calculate the parameters of the card of the first application, it calculates the parameters of all the cards of the first application and transmits these parameters together to Surfaceflinger. When the terminal device calls Surfaceflinger for drawing, it can obtain all the parameters to facilitate drawing of all the parameters. This is helpful to avoid the desktop application thread failing to successfully calculate the parameters of one or more frames of the card of the first application due to excessive load, resulting in frame loss or freeze of the card of the first application in the first animation.
[0020] In one possible implementation, each frame of the M frames also includes a card of at least one application running in the background of the terminal device, and at least one application is different from the first application; the above method also includes: after the first time point, calling the thread of the desktop application to calculate the parameters of the card of at least one application included in the Nth frame of the image to obtain a second parameter, the Nth frame of the image is any frame of the M frames of the image, N is an integer greater than 0 and less than or equal to M; calling the thread of the desktop application to draw based on the second parameter.
[0021] The card of at least one application running in the background of the terminal device is referred to as other cards in the specific embodiment.
[0022] In this way, when the terminal device calls the thread of the desktop application to calculate the parameters of the card of at least one application, it calculates the parameters of the card of at least one application in one frame, such as the parameters of the card of at least one application included in the Nth frame image, and draws one frame. At this time, the thread of the desktop application basically does not need to calculate the parameters of the card of the first application, which is beneficial to reduce the occupation of the thread of the desktop application, and thereby reduce the probability of frame loss or freeze in the card of at least one application in the first animation.
[0023] In one possible implementation, the thread that calls the desktop application calculates the parameters of the card of at least one application in the Nth frame image to obtain the second parameter, including: the thread that calls the desktop application obtains the Nth group of parameters in the M groups of first parameters, and the Nth group of parameters is the parameters of the card of the first application included in the Nth frame image; the thread that calls the desktop application calculates the second parameter based on the Nth group of parameters and preset card position relationship parameters.
[0024] The preset card position relationship parameters include the position relationship between the card of the first application and the card of at least one application.
[0025] In this way, the parameters (second parameters) of the card of at least one application in the Nth frame image are determined based on the parameters of the card of the first application in the Nth frame image (i.e., the Nth group of parameters) and the preset card position relationship parameters, which is conducive to the synchronization of the card of the first application with the card of at least one application in the first animation.
[0026] In a possible implementation, M groups of first parameters are stored in an array, and the thread calling the desktop application obtains the Nth group of parameters in the M groups of first parameters, including: the thread calling the desktop application obtains the Nth group of parameters from the array.
[0027] In this way, the parameters of the card of the first application included in each frame of the M frames in the first animation (i.e., M groups of first parameters) are stored in an array. When using any group of parameters, such as the Nth group of parameters, the thread of the desktop application can be called to obtain them from the array, which is conducive to quickly obtaining parameters and thus improving drawing efficiency.
[0028] In a possible implementation, a preset thread and a drawing thread are called to perform drawing based on M groups of first parameters, and the obtained drawing parameters are stored in a buffer; a thread of a desktop application is called to perform drawing based on a second parameter, and the obtained drawing parameters are stored in a buffer; the method also includes: calling Surfaceflinger to obtain a first drawing parameter of a first application card in the Nth frame and a second drawing parameter of a card of at least one application in the Nth frame from the buffer; calling Surfaceflinger to synthesize the first drawing parameter and the second drawing parameter to obtain synthesized information; and calling Surfaceflinger to display the synthesized information.
[0029] The buffer in the specific embodiment is buffer, which can be used to store drawing parameters.
[0030] In this way, calling Surfaceflinger obtains the first drawing parameter of the first application card in the Nth frame and the second drawing parameter of the card of at least one application in the Nth frame from the buffer, synthesizes them and sends them for display, which is conducive to displaying the Nth frame image in the animation.
[0031] In a possible implementation, M is positively correlated with the screen refresh rate of the terminal device. M is the number of frames, which can be represented by the symbol frameCount in a specific embodiment.
[0032] In this way, the number of frames M included in the first animation is positively correlated with the screen refresh rate of the terminal device, which is conducive to better adaptation of the first animation to the screen refresh rate and smoother displayed animation.
[0033] In a possible implementation, M and the screen refresh rate satisfy the following relationship: M=duratioM*1.0 / (1000*1.0 / frameRate), where durationM is the total duration of displaying the first animation, and frameRate is the screen refresh rate.
[0034] In this way, calculating the number of frames M through this formula is conducive to quickly determining the number of frames.
[0035] In a possible implementation, the above method also includes: after the second time point, calling the desktop application to calculate the parameters of the card of the first application included in the Lth frame image in the first animation, and obtain a third parameter, where N is an integer greater than 0 and less than or equal to M; calling the desktop application to transmit the third parameter to Surfaceflinger; calling the drawing thread to draw based on the third parameter.
[0036] In this way, when the terminal device opens screen recording or projection, after the second time point, the parameters of a frame of the first application's card, such as the parameters of the first application's card included in the Lth frame image, are calculated, and a frame is drawn, which helps reduce the probability of the first application's card appearing without animation.
[0037] In a possible implementation, the preset thread is used to set the properties of a layer in any frame image included in the first animation.
[0038] Before drawing through the drawing thread, the terminal device sets various attribute values of the layer through the preset thread.
[0039] In the second aspect, the embodiment of the present application proposes a display method, which can be applied to a terminal device. The method includes: displaying the interface of a first application; receiving a user's press and slide operation, and in response to the user's lift operation, displaying a first animation between a first time point and a second time point; wherein, after the first time point, calling a thread for obtaining a frame rate, and the second time point is after the first time point; at the second time point, displaying a multitasking management interface; after the second time point, in response to the user's return to the desktop operation; displaying a third animation; wherein, in the process of displaying the third animation, the rendering thread is not called.
[0040] During the process of displaying the first animation between the first time point and the second time point, calling the thread for obtaining the frame rate can indicate that the terminal device has used the swipe-up to enter multi-tasking animation sinking function provided in the embodiment of the present application involved in the specific embodiment.
[0041] When the terminal device displays the third animation, the rendering thread is not called, and the rendering thread is renderThread. This indicates that the terminal device uses the swipe-up to enter multi-tasking dynamic effect sinking function provided in the embodiment of the present application involved in the specific embodiment.
[0042] In this way, after the first time point, the thread for obtaining the frame rate is called to obtain the frame rate, and the frame rate is related to the number of frames included in the first animation, which is conducive to calculating the number of frames included in the first animation; in response to the user's operation of returning to the desktop, the third animation is displayed. In the process of displaying the third animation, the rendering thread is not called, which can indicate that the terminal device uses the swipe up to enter the multi-tasking animation sinking function provided in the embodiment of the present application involved in the specific embodiment, which is conducive to avoiding frame loss or freeze.
[0043] In a third aspect, an embodiment of the present application provides a terminal device, which may also be referred to as a terminal, user equipment (UE), mobile station (MS), mobile terminal (MT), etc. The terminal device may be a mobile phone, a smart TV, a wearable device, a tablet computer (Pad), a computer with wireless transceiver function, a virtual reality (VR) terminal device, an augmented reality (AR) terminal device, a wireless terminal in industrial control, a wireless terminal in self-driving, a wireless terminal in remote medical surgery, a wireless terminal in smart grid, a wireless terminal in transportation safety, a wireless terminal in smart city, a wireless terminal in smart home, etc.
[0044] The terminal device comprises: a processor and a memory; the memory stores computer-executable instructions; the processor executes the computer-executable instructions stored in the memory, so that the terminal device executes the method of the first aspect.
[0045] In a fourth aspect, an embodiment of the present application provides a computer-readable storage medium, wherein the computer-readable storage medium stores a computer program. When the computer program is executed by a processor, the method of the first aspect is implemented.
[0046] In a fifth aspect, an embodiment of the present application provides a computer program product, which includes a computer program. When the computer program is executed, the computer executes the method of the first aspect.
[0047] In a sixth aspect, an embodiment of the present application provides a chip, the chip including a processor, the processor being used to call a computer program in a memory to execute the method described in the first aspect.
[0048] It should be understood that the third to sixth aspects of the present application correspond to the technical solution of the first aspect of the present application or the technical solution of the second aspect of the present application, and the beneficial effects achieved by each aspect and the corresponding feasible implementation methods are similar and will not be repeated. BRIEF DESCRIPTION OF THE DRAWINGS
[0049] Figure 1 A schematic diagram of a terminal device executing a swipe-up-to-enter-multitasking animation function;
[0050] Figure 2 A schematic diagram of the structure of a terminal device provided in an embodiment of the present application;
[0051] Figure 3 A software structure block diagram of a terminal device according to an embodiment of the present application;
[0052] Figure 4 A schematic diagram of module interaction of a display method provided in an embodiment of the present application;
[0053] Figure 5 A schematic diagram of not displaying the main card animation provided in an embodiment of the present application;
[0054] Figure 6 A schematic diagram of a thread operation provided in an embodiment of the present application;
[0055] Figure 7 A schematic diagram of an animation display process provided in an embodiment of the present application;
[0056] Figure 8 A schematic diagram of another animation display process provided in an embodiment of the present application;
[0057] Fig. 9 A schematic diagram of an animation display method provided in an embodiment of the present application;
[0058] Fig.10A schematic flow chart of calculation and drawing of a main card and other cards provided in an embodiment of the present application;
[0059] Fig.11 A schematic diagram of another thread operation provided in an embodiment of the present application;
[0060] Fig.12 A schematic diagram of the structure of a chip provided in an embodiment of the present application. DETAILED DESCRIPTION
[0061] 1. Other terms
[0062] In the embodiments of the present application, words such as "first" and "second" are used to distinguish the same or similar items with substantially the same functions and effects. For example, the first chip and the second chip are only used to distinguish different chips, and their order is not limited. Those skilled in the art can understand that words such as "first" and "second" do not limit the quantity and execution order, and words such as "first" and "second" do not necessarily limit them to be different.
[0063] It should be noted that in the embodiments of the present application, words such as "exemplary" or "for example" are used to indicate examples, illustrations or descriptions. Any embodiment or design described as "exemplary" or "for example" in the present application should not be interpreted as being more preferred or more advantageous than other embodiments or designs. Specifically, the use of words such as "exemplary" or "for example" is intended to present related concepts in a specific way.
[0064] In the embodiments of the present application, "at least one" refers to one or more, and "more than one" refers to two or more. "And / or" describes the association relationship of associated objects, indicating that three relationships may exist. For example, A and / or B can represent: A exists alone, A and B exist at the same time, and B exists alone, where A and B can be singular or plural. The character " / " generally indicates that the previous and next associated objects are in an "or" relationship. "At least one of the following" or similar expressions refers to any combination of these items, including any combination of single or plural items. For example, at least one of a, b, or c can represent: a, b, c, ab, a--c, bc, or abc, where a, b, c can be single or multiple.
[0065] 2. Terminal equipment
[0066] The terminal device of the embodiment of the present application may also be any form of electronic device. For example, the electronic device may include a handheld device, a vehicle-mounted device, etc. with a gesture recognition function. For example, some electronic devices are: mobile phones, tablet computers, PDAs, laptop computers, mobile internet devices (MIDs), wearable devices, virtual reality (VR) devices, augmented reality (AR) devices, wireless terminals in industrial control, wireless terminals in self driving, wireless terminals in remote medical surgery, wireless terminals in smart grids, wireless terminals in transportation safety, wireless terminals in smart cities, wireless terminals in smart homes, cellular phones, cordless phones, session initiation protocol (SIP) phones, wireless local loop (WLL) stations, personal digital assistants (PDAs), handheld devices with wireless communication capabilities, computing devices or other processing devices connected to wireless modems, vehicle-mounted devices, wearable devices, terminal devices in 5G networks or future evolved public land mobile communication networks (public land mobile The embodiments of the present application do not limit this.
[0067] As an example but not limitation, in the embodiments of the present application, the electronic device may also be a wearable device. Wearable devices may also be referred to as wearable smart devices, which are a general term for wearable devices that are intelligently designed and developed using wearable technology for daily wear, such as glasses, gloves, watches, clothing, and shoes. A wearable device is a portable device that is worn directly on the body or integrated into the user's clothes or accessories. Wearable devices are not only hardware devices, but also powerful functions achieved through software support, data interaction, and cloud interaction. Broadly speaking, wearable smart devices include full-featured, large-sized, and fully or partially independent of smartphones, such as smart watches or smart glasses, as well as devices that only focus on a certain type of application function and need to be used in conjunction with other devices such as smartphones, such as various types of smart bracelets and smart jewelry for vital sign monitoring.
[0068] In addition, in the embodiments of the present application, the electronic device can also be a terminal device in the Internet of Things (IoT) system. IoT is an important part of the future development of information technology. Its main technical feature is to connect objects to the network through communication technology, thereby realizing an intelligent network that interconnects people and machines and things.
[0069] The electronic devices in the embodiments of the present application may also be referred to as: terminal equipment, user equipment (UE), mobile station (MS), mobile terminal (MT), access terminal, user unit, user station, mobile station, mobile station, remote station, remote terminal, mobile device, user terminal, terminal, wireless communication equipment, user agent or user device, etc.
[0070] In an embodiment of the present application, the electronic device or each network device includes a hardware layer, an operating system layer running on the hardware layer, and an application layer running on the operating system layer. The hardware layer includes hardware such as a central processing unit (CPU), a memory management unit (MMU), and a memory (also called main memory). The operating system can be any one or more computer operating systems that implement business processing through processes, such as Linux operating system, Unix operating system, Android operating system, iOS operating system, or Windows operating system. The application layer includes applications such as browsers, address books, word processing software, and instant messaging software.
[0071] 3. Main card and other cards
[0072] The main card refers to a card in the multitasking interface, which is an interface displayed by the terminal device in response to the user pressing the screen and swiping up. The main card is the card corresponding to the application displayed when the terminal device detects the user pressing the screen and swiping up. The main card can be a window, but this is not limited in the embodiments of the present application.
[0073] Other cards refer to cards other than the main card in the multitasking interface, or in other words, other cards are cards corresponding to other applications other than the displayed application when the terminal device detects that the user presses the screen and swipes up, where other applications other than the displayed application can be applications running in the background when the terminal device detects that the user presses the screen and swipes up. Other cards can be a view, so they can also be called view cards, but this is not limited in the embodiments of the present application.
[0074] For example, the terminal device displays the interface of application 1, and the terminal device detects that the user presses the screen and swipes up. In response to the user clicking the screen and swiping up, the terminal device displays a multitasking interface, which includes a card corresponding to application 1 and a card corresponding to application 2, wherein the card corresponding to application 1 is the main card, and the card corresponding to application 2 is an other card, and application 2 is an application running in the background of the terminal device.
[0075] With the development of technology, mobile phones and other terminal devices have more and more functions. For example, when a mobile phone or other terminal device displays the interface of an application, it detects that the user presses the screen and slides up. In response to the user pressing the screen and sliding up, a multitasking interface is displayed, and the multitasking interface includes at least one card. The at least one card includes the card corresponding to this application and may also include cards corresponding to other applications running in the background. Mobile phones and other terminal devices detect the user's lifting operation, and in response to the user's lifting operation, the at least one card is moved to a specific position in the multitasking interface. The process of moving at least one card to a specific position in the multitasking interface can be called animation or motion effect, and the function of displaying animation or motion effect on mobile phones and other terminal devices can be called the swipe up to enter multitasking motion effect function. For the convenience of description, animation is used as an example for explanation in the following.
[0076] Currently, when a terminal device swipes up to enter the multi-tasking animation function, frame loss or freeze may occur.
[0077] For example, Figure 1 A schematic diagram showing a terminal device executing a swipe up to enter a multi-tasking animation function. Figure 1 As shown in FIG, the terminal device is a mobile phone. Figure 1 As shown in the interface a in FIG, the interface currently displayed by the mobile phone is the interface of the information application. The mobile phone detects the operation of the user pressing the screen and sliding up, and in response to the operation of the user pressing the screen and sliding up, displays a multitasking interface, which includes a card 110 corresponding to the information application and a card 120 corresponding to the setting application, as shown in FIG. Figure 1 The mobile phone detects the user's lifting operation, and in response to the user's lifting operation, moves the card 110 corresponding to the information application and the card 120 corresponding to the setting application to a specific position in the multitasking interface, and displays Figure 1 d interface in which, Figure 1 The c interface in FIG. 1 is an interface in the process of moving the card 110 corresponding to the information application and the card 120 corresponding to the setting application. In the multitasking interface, the card 110 corresponding to the information application is the main card, and the card 120 corresponding to the setting application is the other card. Figure 1 The b interface in Figure 1 In the c interface to Figure 1The process of the d interface in the video is an animation. When the phone is displaying the animation, frame loss or freeze may occur, affecting the user experience.
[0078] It should be noted that the above Figure 1 The interface shown is only an example. In another example, if no setting application is running in the background of the mobile phone, the multitasking interface displayed by the mobile phone may only display the card 110 corresponding to the information application, that is, the multitasking interface only includes the main card.
[0079] When the terminal device displays an animation, frame loss or freeze may occur. This is because when the terminal device draws the main card in the animation, the main thread (UIThread) in the desktop application (Launcher) can calculate the parameters of a frame of the main card. The parameters of the main card include parameters such as position and size for drawing the main card, and the interface sender (Surfaceflinger) draws a frame of the main card based on the parameters of a frame of the main card, and so on, until all frames of the main card in the animation are drawn. In this way, if the main thread fails to successfully calculate the parameters of one or more frames of the main card due to excessive load during the calculation process, it will cause the main card in the animation to lose frames or freeze.
[0080] In view of this, an embodiment of the present application provides a display method and a related device. When the terminal device calculates the parameters of the main card in the animation through the main thread in the Launcher, the parameters of all frames of the main card in the animation can be calculated at one time, and the parameters of all frames of the main card are sent to Surfaceflinger through the main thread. Surfaceflinger then draws the main card frame by frame based on the parameters of all frames of the main card, rather than calculating the parameters of one frame of the main card through the main thread and drawing one frame of the main card through Surfaceflinger. This is beneficial for obtaining the parameters of all frames of the main card in the animation when drawing the main card through Surfaceflinger, so as to facilitate drawing all frames of the main card in the animation, and is beneficial for reducing the frame loss or freeze of the main card caused by the inability to calculate the parameters of the main card due to excessive load of the main thread during the animation.
[0081] For ease of understanding, the hardware structure of the terminal device is described below. Figure 2 A schematic diagram of the structure of a terminal device provided in an embodiment of the present application. Figure 2As shown, the terminal device includes: the terminal device may include a processor 110, an external memory interface 120, an internal memory 121, a universal serial bus (USB) interface 130, a charging management module 140, a power management module 141, a battery 142, an antenna 1, an antenna 2, a mobile communication module 150, a wireless communication module 160, an audio module 170, a speaker 170A, a receiver 170B, a microphone 170C, an earphone interface 170D, a sensor module 180, a button 190, a motor 191, an indicator 192, a camera 193, a display screen 194, and a subscriber identification module (SIM) card interface 195, etc. The sensor module 180 may include a pressure sensor 180A, a gyroscope sensor 180B, an air pressure sensor 180C, a magnetic sensor 180D, an acceleration sensor 180E, a distance sensor 180F, a proximity light sensor 180G, a fingerprint sensor 180H, a temperature sensor 180J, a touch sensor 180K, an ambient light sensor 180L, a bone conduction sensor 180M, etc.
[0082] It is to be understood that the structure illustrated in the embodiment of the present invention does not constitute a specific limitation on the terminal device. In other embodiments of the present application, the terminal device may include more or fewer components than shown in the figure, or combine certain components, or split certain components, or arrange the components differently. The components shown in the figure may be implemented in hardware, software, or a combination of software and hardware.
[0083] The processor 110 may include one or more processing units, for example: the processor 110 may include an application processor (application processor, AP), a modem processor, a graphics processor (graphics processing unit, GPU), an image signal processor (image signal processor, ISP), a controller, a video codec, a digital signal processor (digital signal processor, DSP), a baseband processor, and / or a neural network processor (neural-network processing unit, NPU), etc. Among them, different processing units can be independent devices or integrated in one or more processors. Exemplarily, the terminal device can execute the method provided in the embodiment of the present application through the processor 110.
[0084] The terminal device implements the display function through the GPU, the display screen 194, and the application processor. For example, the terminal device can display the above through the GPU, the display screen 194, and the application processor. Figure 1 The interface shown. The GPU is a microprocessor for image processing, which is connected to the display screen 194 and the application processor. The GPU is used to perform mathematical and geometric calculations for graphics rendering. The processor 110 may include one or more GPUs, which execute program instructions to generate or change display information.
[0085] The display screen 194 is used to display images, videos, etc. The display screen 194 includes a display panel. The display panel can be a liquid crystal display (LCD), an organic light-emitting diode (OLED), an active-matrix organic light-emitting diode or an active-matrix organic light-emitting diode (AMOLED), a flexible light-emitting diode (FLED), Miniled, MicroLed, Micro-oLed, a quantum dot light-emitting diode (QLED), etc. In some embodiments, the terminal device may include 1 or N display screens 194, where N is a positive integer greater than 1.
[0086] The internal memory 121 can be used to store computer executable program codes, and the executable program codes include instructions. The internal memory 121 can include a program storage area and a data storage area. Exemplarily, the internal memory 121 can store the code corresponding to the method provided in the embodiment of the present application.
[0087] In addition, on top of the above components, the device also runs an operating system, such as an iOS operating system, an Android operating system, or a Windows operating system, etc. Applications can be installed and run on the operating system.
[0088] The software system of the terminal device can adopt a layered architecture, an event-driven architecture, a microkernel architecture, a microservice architecture, or a cloud architecture, etc., which will not be elaborated here.
[0089] The embodiment of the present application takes the Android system with a layered architecture as an example to illustrate the software structure of the terminal device.
[0090] Figure 3: is a software structure block diagram of the terminal device of the embodiment of the present application. The layered architecture divides the software into several layers, each layer has a clear role and division of labor. The layers communicate with each other through software interfaces. In some embodiments, the Android system can be divided into five layers, from top to bottom, namely, the application layer, the framework layer, the hardware abstraction layer (HAL), the kernel layer, and the hardware layer.
[0091] The application layer can include a series of application packages. The application layer runs applications by calling the application programming interface (API) provided by the framework layer. Figure 3 As shown, the application package may include applications such as camera, calendar, map, phone, system UI, and Launcher. Among them, the main thread in Launcher can be used to calculate the parameters of the main card and other cards in the multitasking interface, and draw other cards based on the parameters of other cards, and can support the normal operation of the desktop of the terminal device, etc.
[0092] The framework layer provides an application programming interface (API) and a programming framework for the applications in the application layer. The framework layer includes some predefined functions.
[0093] like Figure 3As shown, the framework layer may include a window manager (window manager service), a display manager (display manager service), Surfaceflinger, an input module (input) and an activity management module (ActivityManagerService, AMS). Among them, the window manager is used to manage window programs. The window manager can obtain the size of the display screen, determine whether there is a status bar, lock the screen, touch the screen, drag the screen, capture the screen, etc. The display manager is used to manage the life cycle of the display. It determines how to control its logical display according to the currently connected physical display device, and sends notifications to the system and application when the state changes, etc. In some embodiments, the display manager can also perform logical screen mapping switching, screen resolution switching, etc. Surfaceflinger is used to draw the main card based on the parameters of the main card, and can obtain other cards that have been drawn, and synthesize the main card and other cards. The input module is used to detect user operations, for example, detecting user touch, press, click, double-click, slide and drag operations. AMS is the core service in Android, which is mainly responsible for the startup, switching, scheduling of components in the system and the management and scheduling of application processes. For example, AMS can be used to start desktop components.
[0094] The purpose of the HAL layer is to abstract the hardware and provide a unified interface for querying hardware devices for upper-layer applications, or to provide data storage services for upper-layer applications. Figure 3 As shown, the HAL layer may include a display driver module and a sensor hardware abstraction (sensor hidl). The display driver module is used to control the display driver to display pictures, interfaces, notification information and other contents on the display screen. The sensor hardware abstraction can control the sensor and monitor the event change notification of the sensor driver. The multiple modules in the HAL layer may follow the hardware abstraction layer interface description language (HAL interface definition language, HIDL) or AIDL.
[0095] The kernel layer is the layer between hardware and software. Figure 3 As shown, the kernel layer may include one or more of the following: sensor driver, display driver, etc. In the embodiment of the present application, the sensor driver includes a sensor subsystem framework and a sensor subsystem driver, which are located in the coprocessor (SCP).
[0096] It is understandable that the terminal device may include an application processor (AP) and a coprocessor (CP). The application processor includes the above-mentioned framework layer, hardware abstraction layer, kernel layer, etc.; the coprocessor includes a sensor hub.
[0097] The hardware layer may include hardware such as microphones, cameras, and displays.
[0098] It should be understood that in some embodiments, the layers implementing the same function may be called by other names, or the layers that can implement the functions of multiple layers may be regarded as one layer, or the layers that can implement the functions of multiple layers may be divided into multiple layers. The embodiments of the present application are not limited to this.
[0099] Combine the following Figure 4 For the above Figure 3 The specific interactions of the modules in are described.
[0100] Figure 4 FIG. 1 is a schematic diagram showing the module interaction of a display method provided by an embodiment of the present application. Figure 4 As shown, the method may include the following steps:
[0101] S401. When the terminal device displays the interface of the first application, the input module of the framework layer responds to the user pressing the screen operation and transmits (or sends) the user pressing the screen operation to the main thread of the Launcher.
[0102] The input module of the framework layer may include a monitoring mechanism for monitoring touch events, such as a down event, an up event, and a move event. The user's operation of pressing the screen may be a down event. When the input module monitors the down event, it may inform the main thread of the Launcher that it has detected the down event. The first application may be the above Figure 3 Camera, Calendar, Maps, or Phone app as shown. Figure 1 In the example shown, the interface of the first application displayed by the terminal device may be as follows: Figure 1 As shown in the a interface.
[0103] It should be noted that in the present application, the sending and transmission between modules are implemented through function calls, and the embodiments of the present application do not limit the specific functions called.
[0104] S402: The main thread can start the desktop through AMS.
[0105] The main thread of Launcher can restart the desktop through AMS based on the down event. It can be understood that the terminal device displays the interface of the first application, and the desktop is in the startup state. The input module passes the down event to the main thread. The main thread can start the desktop based on the down event by calling the startActivityRecents() interface of AMS. Starting the desktop this time can be understood as restarting the desktop.
[0106] S403: In response to the user's upward sliding operation, the input module transmits the user's upward sliding operation to the main thread.
[0107] In response to the user's upward sliding operation, the input module passes the user's upward sliding operation to the main thread, which may include two possible implementations. In one possible implementation, when the user slides upward, the input module passes the user's upward sliding operation to the main thread. In this implementation, the embodiment of the present application does not limit whether the input module passes the user's upward sliding operation to the main thread based on the user's upward sliding operation. In another possible implementation, based on the user's upward sliding, the input module passes the user's upward sliding operation to the main thread. In this implementation, the embodiment of the present application limits the input module passing the user's upward sliding operation to the main thread based on the user's upward sliding operation.
[0108] It should be noted that the user's upward sliding operation occurs based on the user pressing the screen. The user's upward sliding operation may be a move event. The input module monitors the move event and can inform the main thread that it has detected the move event.
[0109] S404. The main thread sends instruction information for drawing the main card (ie, the card corresponding to the first application displayed on the terminal device) to the Surfaceflinger of the framework layer based on the user sliding upward. Correspondingly, Surfaceflinger receives the instruction information for drawing the main card.
[0110] The main thread can instruct Surfaceflinger to draw the main card by calling the draw() interface in Surfaceflinger.
[0111] S405. Surfaceflinger draws the main card based on the instruction information for drawing the main card.
[0112] Surfaceflinger can draw the main card based on the instruction information of drawing the main card through the draw() interface.
[0113] S406, Surfaceflinger stores the main card into the buffer.
[0114] Surfaceflinger can save the drawn main card to buffer through the queuebuffer() interface, where buffer is a buffer at the framework layer.
[0115] S407. The main thread may draw other cards based on the user sliding upwards, where the other cards are cards other than the main card (ie, cards corresponding to at least one application running in the background).
[0116] The number of other cards is related to the number of applications running in the background. If the number of applications running in the background is one, the number of other cards is one. If the number of applications running in the background is multiple, the number of other cards is multiple.
[0117] S408, the main thread can store other cards into the buffer.
[0118] The main thread can save other drawn cards to the buffer through the queuebuffer() interface. The buffer for saving the main card and the buffer for saving other cards can be one buffer.
[0119] S409. Surfaceflinger may obtain the main card and other cards from the buffer, and synthesize the main card and other cards.
[0120] The buffer that saves the main card and the buffer that saves other cards are the same buffer. Surfaceflinger can get the main card and other cards from the buffer and synthesize the main card and other cards.
[0121] Surfaceflinger can get the main card and other cards from the buffer through the dequeuebuffer() interface and synthesize the main card and other cards. At this time, synthesis means combining the main card and other cards without modifying the main card and other cards.
[0122] S410 , Surfaceflinger may send the synthesized information to the display driver module of the HAL layer. Correspondingly, after receiving the synthesized information, the display driver module may display the synthesized information.
[0123] Surfaceflinger sends the synthesized information to the display driver module of the HAL layer, which can be understood as sending to display. In one example, Surfaceflinger can call the presentAndGetFrameFences() interface to send the synthesized information to the display driver module of the HAL layer.
[0124] It can be understood that the display driver module displays the synthesized information. Figure 1 In the example shown, the interface displayed by the terminal device can be as follows Figure 1 As shown in interface b.
[0125] It is also understandable that in the above Figure 1 In the example shown, in response to the user's sliding operation, the interface displayed by the terminal device changes from Figure 1 The a interface in the program slowly changes to Figure 1 This process can be called hand-following operation, that is, as the user slides upward, the interface displayed on the terminal device changes accordingly. Figure 1 The a interface in the program slowly changes to Figure 1 The specific implementation method of the b interface may be as shown in S403 to S410 above.
[0126] S411. The input module responds to the user's lifting operation and transmits the user's lifting operation to the main thread.
[0127] It should be noted that the user's lifting operation occurs on the basis of the user sliding up. The user's lifting operation can be understood as an up event. The input module monitors the up event and can inform the main thread that it has detected the up event.
[0128] The input module detects the user's lifting operation, which indicates that the swipe-up multi-tasking animation function has been triggered.
[0129] S412: The main thread may set the value of frameCount to 0.
[0130] frameCount can be used to indicate the number of frames included in the animation. Based on the up event, the main thread sets the value of frameCount to 0, which is equivalent to assigning an initial value to frameCount.
[0131] S413. The main thread obtains the configuration item and determines whether the configuration item is true.
[0132] The configuration item can be true or false. The value of the configuration item is preset in the terminal device and can be changed when the terminal device updates its version, and is generally not changed at other times. If the configuration item is true, the swipe up to enter multi-tasking animation function provided in the embodiment of the present application can be used. If the configuration item is false, the existing swipe up to enter multi-tasking animation function can be used. For the sake of distinction, the swipe up to enter multi-tasking animation function provided in the embodiment of the present application is referred to as the swipe up to enter multi-tasking animation sinking function.
[0133] Exemplarily, the main thread may call the localAnemationEnabled() interface to obtain the configuration item and determine whether the configuration item is true.
[0134] S414: If the configuration item is true, the main thread may send a request message for obtaining the frame rate to Surfaceflinger, and correspondingly, Surfaceflinger receives the request message for obtaining the frame rate.
[0135] The frame rate value can be the same as the screen refresh rate value of the terminal device. Before the main thread executes the swipe up to enter the multi-tasking dynamic effect sinking function, it needs to calculate the number of displayed frames, and the number of frames is related to the frame rate, so the main thread can first obtain the frame rate from Surfaceflinger, that is, send a request message to obtain the frame rate to obtain the frame rate.
[0136] Exemplarily, the main thread can obtain the frame rate from Surfaceflinger through the getAGPFrameRate() interface.
[0137] S415. Surfaceflinger sends the frame rate to the main thread based on the request message for obtaining the frame rate. Correspondingly, the main thread receives the frame rate.
[0138] Surfaceflinger can store and update the screen refresh rate of the terminal device. The screen refresh rate of the terminal device is the same as the frame rate, so based on the request message for obtaining the frame rate, the current screen refresh rate can be sent to the main thread. If the terminal device is not in screen projection and is not in screen recording, the screen refresh rate of the terminal device stored by Surfaceflinger is greater than 0. If the terminal device is in screen projection or screen recording, the screen refresh rate stored by Surfaceflinger is -1.
[0139] S416. The main thread calculates the number of frames based on the frame rate, and assigns the number of frames to frameCount.
[0140] The frame rate can be represented by the symbol refreshRate or frameRate, and the unit of frame rate is generally frames per second (fps). The number of frames can be represented by the symbol frameCount.
[0141] The time displayed for one frame can be represented by the symbol frameDuration, frameDuration = 1 / refreshRate, or frameDuration = 1 / refreshRate. At this time, the unit of frameDuration is seconds, and the data type can be integer (int) or floating point (float). If the unit of frameDuration is milliseconds, then frameDuration = 1000*1.0 / refreshRate, or frameDuration = 1000*1.0 / frameRate, where the data type of frameDuration is floating point. If the total duration of the animation displayed in the swipe up multi-tasking dynamic effect sinking function is represented by the symbol duration, the number of frames that can be displayed within the total duration is equal to the total duration divided by the time displayed for one frame, that is, frameCount = duration*1.0 / frameDuration, where the data type of frameCount is floating point. The main thread can assign the number of frames to frameCount, that is, the value of frameCount is equal to the number of frames.
[0142] Exemplarily, when the terminal device is not in screen projection and is not in a screen recording scene, if the frame rate frameRate = 60fps, the time displayed for one frame frameDuration = 1000*1.0 / 60 milliseconds, if the total duration of the animation display is duration = 100 milliseconds, then the number of frames frameCount = 100*1.0 / (1000*1.0 / 60) = 6. It can be seen that the animation in the swipe up multi-tasking dynamic effect sinking function can display 6 frames. When the terminal device is in a screen projection or screen recording scene, the frame rate is -1, then the time displayed for one frame frameDuration = 1000*1.0 / (-1) milliseconds = -1000 milliseconds, which means there is no frame, then frameCount = 0, and the terminal device does not display the animation.
[0143] S417, the main thread determines whether frameCount is less than or equal to 0.
[0144] If the value of frameCount is greater than 0, you can use the swipe up to enter the multi-task dynamic effect sinking function provided in the embodiment of the present application. If frameCount is less than or equal to 0, it means that the terminal device may be in a screen projection or screen recording scene. If you use the swipe up to enter the multi-task dynamic effect sinking function provided in the embodiment of the present application, frameCount is less than or equal to 0, indicating that there is no frame, which will cause no animation. Therefore, you can use the existing swipe up to enter the multi-task dynamic effect function. In this implementation method, frameCount is less than or equal to 0, which will not affect the display of the animation, which is conducive to the normal display of the main card animation of the terminal device in the screen projection or screen recording scene, and reduces the probability of no animation of the main card in the screen projection or screen recording scene.
[0145] For example, if the swipe up to enter the multi-tasking dynamic sinking function provided in the embodiment of the present application is used, frameCount is less than or equal to 0, indicating that there is no frame, which will result in no animation. Figure 5 A schematic diagram showing a main card without animation is shown. Figure 5 As shown, the terminal device may be a tablet. The tablet detects an operation of a user pressing the screen and sliding upwards. In response to the operation of the user pressing the screen and sliding upwards, a multitasking interface may be displayed, such as Figure 5 As shown in interface a in , the multitasking interface displays card 510 corresponding to application 1, card 520 corresponding to application 2, card 530 corresponding to application 3, card 540 corresponding to application 4, card 550 corresponding to application 5, and card 560 corresponding to application 6. Among them, card 510 corresponding to application 1 is the main card, and the cards corresponding to other applications are other cards. The tablet detects the user's lift operation, that is, detects the upward swipe to enter the multitasking animation, and in response to the user's lift operation, detects that the tablet is in the screen projection or recording state, that is, the value of frameCount is less than or equal to 0, then the animation of the main card (that is, card 510 corresponding to application 1) will not be displayed, that is, the movement process of the main card will not be displayed, and the specific position of the main card in the multitasking interface will be directly displayed, such as Figure 5 As shown in the b interface in the figure. In this process, if you check the thread running diagram, you can find that no thread is running in Surfaceflinger during the animation display time.
[0146] Figure 6 FIG. 1 shows a schematic diagram of thread operation. Figure 6 As shown, the tablet displays Figure 5In the a interface in the Surfaceflinger, the thread can run normally. After detecting the user's lift operation, in response to the user's lift operation, it detects that the frameCount value is less than or equal to 0. The main thread of the tablet calls the animator interface to calculate the parameters of the main card during the animation process, but a part of the Surfaceflinger is empty, that is, the obtained data (the parameters of the main card) is empty and cannot be drawn. Then the animation of the main card is not displayed, and it is directly displayed. Figure 5 In the b interface.
[0147] If frameCount is less than or equal to 0, the existing swipe up to enter multi-task dynamic effect function can be used, that is, S426 to S435 can be executed. If frameCount is greater than 0, the swipe up to enter multi-task dynamic effect sinking function provided in the embodiment of the present application can be used, that is, S418 to S425 can be executed.
[0148] For example, if the sliding up to enter multi-task dynamic effect sinking function provided in the embodiment of the present application is implemented through the doSwipeEnterMultiSurfaceSkinAnim(frameCount) interface, and the existing sliding up to enter multi-task dynamic effect function is implemented through the animator.play(windowAnim) interface, the code implementation can be expressed as:
[0149] if(frameCount>0){
[0150] doSwipeEnterMultiSurfaceSkinAnim(frameCount);
[0151] }else if(windowAnim!=null){
[0152] animator.play(windowAnim);
[0153] }
[0154] That is, if frameCount is greater than 0, the doSwipeEnterMultiSurfaceSkinAnim(frameCount) interface is called to implement the swipe up to enter multi-task animation sinking function provided in the embodiment of the present application. If frameCount is less than or equal to 0, the animator.play(windowAnim) interface is called to implement the existing swipe up to enter multi-task animation function.
[0155] S418. If frameCount is greater than 0, the main thread calculates the parameters of all frames of the main card in the animation.
[0156] If frameCount is greater than 0, it means that the terminal device is not in the screen projection and recording scenario. The main thread can calculate the parameters of all frames of the main card in the animation through the getRecentsAnimdata() interface and save the parameters of all frames of the main card through the Animdata interface.
[0157] Exemplarily, if the animation includes 40 frames of main cards, the main thread can calculate the parameters of each of the 40 frames of main cards through the getRecentsAnimdata() interface. The parameters of each frame of the main card may include animation progress (animatedFraction), animation playback rate (catualInterpolator), interpolator (FractionAfterInterpolation), and surface parameters of the frame (surfaceParams). Among them, the animation progress is used to indicate the time from the first frame of the animation, and the interpolator is used to indicate the change process of the calculated animation. The surface parameters of the frame may include a matrix and a clipping value. The matrix (mTmpMatrix) is used to indicate the content and position of the frame, and the clipping value (mTmpRect) is used to indicate the size of the frame.
[0158] It should be noted that the main thread calculating the parameters of all frames of the main card in the animation may be one example. In another example, the main thread may calculate the parameters of at least two frames of the main card in the animation.
[0159] S419, the main thread sends the parameters of all frames of the main card to Surfaceflinger, and correspondingly, Surfaceflinger receives the parameters of all frames of the main card.
[0160] The main thread can obtain the parameters of all frames of the main card from the Animdata interface and send the parameters of all frames of the main card to Surfaceflinger.
[0161] For example, the main thread can send the frame number of all frames of the main card to Surfaceflinger through the SurfaceControlEx.setAnimFrameNum() interface, and send the matrix matrixArr corresponding to all frames to Surfaceflinger through the SurfaceControlEx.setAnimMatrix() interface, and the matrix matrixArr includes the content of all frames. The main thread can also send the main card rounded value to Surfaceflinger through the SurfaceControlEx.setCornerRadiusArray() interface, send the main card cropping value to Surfaceflinger through the SurfaceControlEx.setWindowCropArray() interface, and send the current animation state to Surfaceflinger through the SurfaceControlEx.setAnimState() interface.
[0162] S420. Surfaceflinger draws the main card frame by frame according to the parameters of all frames of the main card.
[0163] Surfaceflinger draws the main card frame by frame, which can be understood as Surfaceflinger draws the main card frame by frame according to the order in which the parameters of all frames of the main card are stored in the buffer. Surfaceflinger draws the main card frame by frame, which can also be understood as drawing the main card frame by frame in the order in which the animation is displayed. In one example, Surfaceflinger can draw the main card frame by frame through the draw() interface.
[0164] S421, Surfaceflinger saves the drawn main card to the buffer frame by frame.
[0165] After Surfaceflinger finishes drawing a frame of the main card, it can save the frame of the main card to the buffer until all frames of the drawn main card are saved to the buffer. Surfaceflinger can save the drawn main card to the buffer frame by frame through the queuebuffer() interface.
[0166] S422. The main thread may also obtain the parameters of the main card frame by frame based on the calculated parameters of all frames of the main card, calculate the parameters of other cards based on the parameters of the main card, and draw the other cards.
[0167] It can be understood that the positions of other cards are related to the position of the main card. When drawing other cards, it is necessary to determine the parameters of the main card. Therefore, the main thread can obtain the parameters of the main card of the first frame, and based on the parameters of the main card of the first frame, calculate the parameters of other cards in the first frame, and draw the other cards in the first frame, then obtain the parameters of the main card of the second frame, and based on the parameters of the main card of the second frame, calculate the parameters of other cards in the second frame, and draw the other cards in the second frame. This cycle is repeated to draw all frames of other cards in the animation.
[0168] The parameters of other cards may include the parameters of the main card. For example, if the parameters of the main card of the first frame include shrinking by 2%, the parameters of other cards of the first frame may also include shrinking by 2%. If the parameters of the main card of the first frame include moving 3 mm to the right, the parameters of other cards of the first frame may also include moving 3 mm to the right.
[0169] S423, the main thread saves other cards to the buffer frame by frame. Surfaceflinger can save other drawn cards to the buffer through the queuebuffer() interface.
[0170] S424. Surfaceflinger may obtain the main card and other cards from the buffer frame by frame, and synthesize the main card and other cards.
[0171] Surfaceflinger can get the main card and other cards from the buffer through the dequeuebuffer() interface according to the order in which they are stored in the buffer, and synthesize the main card and other cards. At this time, synthesis means combining the main card and other cards without modifying them.
[0172] S425 . Surfaceflinger may send the synthesized information to the display driver module. Correspondingly, after receiving the synthesized information, the display driver module may display the synthesized information.
[0173] The display driver module can display frame by frame to form an animation. The image of the last frame can be Figure 1 As shown in the d interface.
[0174] S426. If the configuration item is false, or frameCount is less than or equal to 0, the main thread creates an animator object.
[0175] The main thread creates an animator object and implements the animation process through the animator object and surfaceflinge.
[0176] S427, the main thread calculates the parameters of the main card of the Nth frame and other cards of the Nth frame.
[0177] The parameters of the main card of the Nth frame are used to represent the parameters required to display the main card of any frame in the animation. The parameters of other cards of the Nth frame are used to represent the parameters required for other cards of any frame in the animation. The main thread can calculate the parameters of the main card of the Nth frame and other cards of the Nth frame by calling the addUpdateListener interface in windowAnim.strart().
[0178] It should be noted that the main thread can calculate the parameters of the main card of any frame and other cards of any frame by calling the addUpdateListener interface in windowAnim.strart(). Among them, the parameters of the main card of any frame and other cards of any frame may include animation progress (animatedFraction), animation playback rate (catualInterpolator), interpolator (FractionAfterInterpolation) and surface parameters of the frame (surfaceParams). Among them, the animation progress is used to indicate the time from the first frame of the animation, and the interpolator is used to indicate the change process of the calculated animation. The surface parameters of the frame may include a matrix and a clipping value. The matrix (mTmpMatrix) is used to indicate the content and position of the frame, and the clipping value (mTmpRect) is used to indicate the size of the frame.
[0179] S428. The main thread sends the parameters of the main card of the Nth frame to Surfaceflinger. Correspondingly, Surfaceflinger receives the parameters of the main card of the Nth frame.
[0180] S429. Surfaceflinger draws the main card of the Nth frame based on the parameters of the main card of the Nth frame.
[0181] Surfaceflinger can draw the main card of the Nth frame in the animation through the draw() interface, or the main thread draws the main card of the Nth frame based on the parameters of the main card of the Nth frame by calling the draw() interface in Surfaceflinger.
[0182] S430, Surfaceflinger stores the Nth frame main card into the buffer.
[0183] Surfaceflinger can save the drawn Nth frame main card to the buffer through the queuebuffer() interface.
[0184] S431. The main thread may draw other cards of the Nth frame based on the parameters of other cards of the Nth frame.
[0185] S432: The main thread may store other cards drawn in the Nth frame into a buffer.
[0186] The main thread can save other cards drawn in the Nth frame to the buffer through the queuebuffer() interface.
[0187] S433. Surfaceflinger may obtain the main card of the Nth frame and other cards of the Nth frame from the buffer, and synthesize the main card of the Nth frame and other cards of the Nth frame.
[0188] Surfaceflinger can obtain the main card of the Nth frame and other cards of the Nth frame from the buffer through the dequeuebuffer() interface, and synthesize the main card of the Nth frame and other cards of the Nth frame. At this time, synthesis means combining the main card of the Nth frame and other cards of the Nth frame, and does not modify the main card of the Nth frame and other cards of the Nth frame.
[0189] S434. Surfaceflinger may send the synthesized information to the display driver module. Correspondingly, after receiving the synthesized information, the display driver module may display the synthesized information.
[0190] It can be understood that the synthesized information is the Nth frame of the animation. Surfaceflinger sends the synthesized information to the display driver module, which can be understood as sending to display. In an example, Surfaceflinger can call the presentAndGetFrameFences() interface to send the synthesized information to the display driver module.
[0191] S435. Synthesize all frames in the animation according to the process from S427 to S434.
[0192] The display driver module can display all frames of the synthesized animation to form an animation. The image of the last frame can be Figure 1 As shown in the d interface.
[0193] from Figure 4 It can be seen from the method shown that when the configuration item is true and the value of frameCount is greater than 0, S418 to S425 are executed, that is, the swipe up to enter the multi-tasking animation sinking function provided in the embodiment of the present application is used; when the configuration item is flase, or the configuration item is true and the value of frameCount is less than or equal to 0, S426 to S435 are executed, that is, the existing swipe up to enter the multi-tasking animation function is used.
[0194] The display method provided by the embodiment of the present application, when executing the swipe up to enter the multi-task dynamic effect function, when the configuration item is true and frameCount is greater than 0, when the main thread calculates the parameters of the main card in the animation, the parameters of all frames of the main card in the animation can be calculated at one time, and the parameters of all frames of the main card are sent to Surfaceflinger. Surfaceflinger draws the main card frame by frame based on the parameters of all frames of the main card, instead of the main thread calculating the parameters of one frame of the main card and Surfaceflinger drawing one frame of the main card. In this way, it is beneficial for Surfaceflinger to obtain the parameters of all frames of the main card in the animation when drawing, and draw all frames of the main card in the animation, which is beneficial to reduce the main card frame loss or jamming caused by the main thread being unable to calculate the parameters of the main card due to excessive load during the animation process. In addition, when drawing other cards in the animation, the main thread calculates the parameters of one frame of other cards based on the parameters of one frame of the main card, and draws one frame of other cards based on the parameters of one frame of other cards. The calculation and drawing of each frame is conducive to the reasonable arrangement of the display position of the main card and the display position of other cards in each frame, avoiding position intersection or overlap, and is also conducive to the synchronization of the main card and other cards. In addition, in the screen recording or projection scenario, when frameCount is less than or equal to 0, the main thread calculates the parameters of a frame of the main card and Surfaceflinger draws a frame of the main card. This is conducive to displaying the animation of the main card and reducing the probability of no animation of the main card.
[0195] Above Figure 4 The method shown is applicable to the scenario where the terminal device displays an application interface and at least one application is running in the background of the terminal device. Figure 4 The method shown may be similarly applied except for steps related to other cards.
[0196] The above describes in detail the method provided in the embodiment of the present application from the software interaction level, and the following describes the method provided in the embodiment of the present application from the function implementation level.
[0197] 1. Existing swipe up to enter multitasking animation function
[0198] The existing swipe up to enter multitasking animation function, that is, the above Figure 4S426 to S435 in the existing swipe up to enter multi-tasking animation function, when displaying the animation, the main thread can calculate the parameters of each frame of the main card and each frame of other cards, and surfaceflinger can draw each frame of the main card and each frame of other cards based on the parameters of each frame of the main card and each frame of other cards. In other words, the parameters of one frame are calculated and drawn, and the cycle is repeated until all frames of the main card and other cards in the animation are drawn.
[0199] For example, Figure 7 A schematic diagram of an animation display process is shown. Figure 7 As shown, when the terminal device executes the swipe up to enter the multi-tasking animation function, the main thread of the terminal device can calculate the parameters of the main card in each frame of the animation through the animator, where the parameters of the main card can be represented by the matrix Matrix, and the matrix Matrix can include the horizontal displacement, vertical displacement and size of the main card. In one example, the animator can calculate the horizontal displacement (offsetX) of the main card through timePassed = AnimationUtils.currentAnimationTimeMillis()-mStartTime, and calculate the size (scale) and vertical displacement (offsetY) of the main card based on the horizontal displacement (offsetX).
[0200] The main thread of the terminal device can obtain the parameters of the main card in each frame of the animation through the animator, calculate the parameters of other cards in each frame based on the parameters of the main card in each frame, and draw other cards in each frame based on the parameters of other cards in each frame. The Surfaceflinger of the terminal device can make each main card based on the parameters of the main card in each frame. The main thread and Surfaceflinger can achieve synchronous drawing to achieve the purpose of synchronizing the main card with other cards.
[0201] 2. The sliding up to enter multi-tasking dynamic sinking function provided in the embodiment of the present application
[0202] The sliding up to enter multi-tasking dynamic sinking function provided in the embodiment of the present application is the above Figure 4 S418 to S425 in. The swipe up to enter multi-tasking dynamic effect sinking function provided in the embodiment of the present application, when displaying the animation, the main thread can calculate the parameters of all frames of the main card during the animation at one time, and can obtain the parameters of the main card frame by frame, and calculate the parameters of other cards based on the parameters of the main card. The main thread can draw each frame of other cards based on the parameters of each frame of other cards. Surfaceflinger can obtain the parameters of all frames of the main card during the animation from the main thread, and draw each frame of the main card based on the parameters of each frame of the main card.
[0203] For example, Figure 8 A schematic diagram of an animation display process is shown. Figure 8 As shown, when the terminal device executes the swipe up to enter the multi-tasking animation function, the main thread of the terminal device calculates the parameters of all frames of the main card during the animation process, and the Surfaceflinger of the terminal device can obtain the parameters of all frames of the main card during the animation process from the main thread, and draw each frame of the main card based on the parameters of each frame of the main card. At the same time, the main thread of the terminal device can obtain the parameters of each frame of the main card, calculate the parameters of each frame of other cards based on the parameters of each frame of the main card, and draw each frame of other cards based on the parameters of each frame of other cards.
[0204] The specific calculation process can be as follows Fig. 9 As shown, the main thread can calculate the horizontal displacement (offsetX) of the main card through the timePassed() interface, and then calculate the parameters of all frames of the main card. In one example, timePassed = num*(1000*1.0 / frameRate), where num is used to indicate the frame number of the animation, and frameRate is used to indicate the frame rate. The main thread can represent the parameters of all frames of the main card during the animation in the form of a matrix. The main thread can send the parameters of all frames of the main card to Surfaceflinger, and Surfaceflinger can receive the parameters of all frames of the main card, and obtain the parameters of the main card frame by frame, and draw the main card frame by frame. It should be noted that the embodiment of the present application redefines timePassed(), which is different from the existing calculation method.
[0205] The main thread can convert the parameters of all frames of the main card during the animation process from matrix form to array form, and take the parameters of one frame of the main card each time, calculate the parameters of one frame of other cards based on the parameters of one frame of the main card, and draw one frame of other cards, and repeat this cycle until all frames of other cards are drawn.
[0206] In order to better understand the calculation and drawing of the main card and other cards, the calculation and drawing of the main card and other cards are introduced in detail below.
[0207] Fig.10 A schematic flow chart of the calculation and drawing of a main card and other cards is shown. Fig.10 The method shown can be applied to a terminal device. Fig.10 As shown, the method comprises the following steps:
[0208] S1001. The terminal device detects a swipe up to enter a multitasking animation.
[0209] The terminal device detects the sliding up to enter the multi-tasking animation, that is, the subsequent execution of the animation process. Figure 1 In the example shown, the terminal device detects the swipe up to enter the multitasking animation, and the interface displayed at this time is Figure 1 In the b interface.
[0210] In the above Figure 4 In the method shown, the terminal device has completed S401 to S416.
[0211] S1002. The terminal device may calculate parameters of all frames of the main card during the animation process through the main thread.
[0212] The terminal device can calculate the horizontal displacement of the main card by calling the timePassed() interface through the main thread, and then calculate the parameters of all frames of the main card. In one example, the parameters of all frames of the main card can be stored in the form of a matrix.
[0213] This step is the same as the above-mentioned S418 and will not be described in detail here.
[0214] S1003. The terminal device can save the parameters of all frames of the main card into an array through the main thread.
[0215] If the parameters of all frames of the main card are stored in the form of a matrix, the terminal device can convert the matrix into an array through the main thread.
[0216] S1004. The terminal device can obtain the frame number of the main card through the main thread.
[0217] The number of frames of the main card is the number of frames that can be displayed during the main card animation. If the terminal device has calculated the number of frames of the main card, it can be directly obtained. Figure 4 It can be seen from the process shown that before this, the frame number of the main card has been calculated in S416, and the frame number of the main card can be directly obtained here.
[0218] S1005. The terminal device can read parameters of a frame of main cards from the array through the main thread.
[0219] The terminal device can read the parameters of the main card frame by frame from the array through the main thread.
[0220] S1006. The terminal device may increase the number of times parameter 1 is read by 1 through the main thread.
[0221] The number of times parameter 1 is read is used to indicate the number of times the parameters of the main card are read from the array. The initial value can be 0. When one frame of main card parameters is read from the array, the number of times parameter 1 is read is increased by 1.
[0222] S1007. The terminal device may determine through the main thread whether the number of times parameter 1 is read is greater than the number of frames of the main card.
[0223] If the number of times parameter 1 is read is greater than the number of frames of the main card, it means that the parameters of all frames of the main card have been read. If the number of times parameter 1 is read is less than or equal to the number of frames of the main card, it means that the parameters of all frames of the main card have not been read. If the number of times parameter 1 is read is greater than the number of frames of the main card, the method can be terminated. If the number of times parameter 1 is read is less than or equal to the number of frames of the main card, the parameters of one frame of other cards can be calculated based on the parameters of one frame of the main card, that is, S1008 is executed.
[0224] S1008. The terminal device may calculate parameters of one frame of other cards based on parameters of one frame of the main card through the main thread.
[0225] S1009. The terminal device may draw a frame of other cards based on parameters of a frame of other cards through the main thread.
[0226] After the terminal device draws a frame of other cards through the main thread, it can continue to read the parameters of a frame of the main card, that is, execute S1005 until the number of times the parameter 1 is read is greater than the number of frames of the main card.
[0227] The above S1004 to S1009 are the above Figure 4 A specific implementation of S422.
[0228] S1010. The terminal device may send parameters of all frames of the main card in the animation process calculated by the main thread to Surfaceflinger, and read parameters of one frame of the main card from the parameters of all frames of the main card through Surfaceflinger.
[0229] S1010 is after the above-mentioned S1002, and S1003 is after S1002. The embodiment of the present application does not limit the execution order of S1010 and the above-mentioned S1003.
[0230] The terminal device can transmit the parameters of all frames of the main card to Surfaceflinger through the main thread, and read the parameters of one frame of the main card from the parameters of all frames of the main card through Surfaceflinger.
[0231] S1011. The terminal device may increase the number of times parameter 2 is read by 1 through Surfaceflinger.
[0232] The number of times the parameters are read 2 is used to indicate the number of times the parameters of the main card are read. The initial value may be 0. When one frame of the parameters of the main card is read, the number of times the parameters are read 2 is increased by 1.
[0233] S1012. The terminal device may determine through Surfaceflinger whether the number of times parameter 2 is read is greater than the number of frames of the main card.
[0234] If the number of times parameter 2 is read is greater than the number of frames of the main card, it means that the parameters of all frames of the main card have been read. If the number of times parameter 2 is read is less than or equal to the number of frames of the main card, it means that the parameters of all frames of the main card have not been read. If the number of times parameter 2 is read is greater than the number of frames of the main card, the method can be terminated. If the number of times parameter 2 is read is less than or equal to the number of frames of the main card, a frame of the main card can be drawn based on the parameters of a frame of the main card, that is, S1013 is executed.
[0235] S1013. The terminal device may draw a frame of main card based on the parameters of a frame of main card through Surfaceflinger.
[0236] After the terminal device draws a frame of the main card through Surfaceflinger, it can continue to read parameters of a frame of the main card from the parameters of all frames of the main card, that is, execute S1010 until the number of times parameter 2 is read is greater than the number of frames of the main card.
[0237] S1010 to S1013 are the above Figure 4 A specific implementation of S419 and S420 in .
[0238] It can be understood that the above S1001 to S1009 are implemented by the terminal device through the main thread, and S1010 to S1013 are implemented by the terminal device through Surfaceflinger.
[0239] In this implementation, the terminal device calculates the parameters of all frames of the main card during the animation process at one time through the main thread, and sends the parameters of all frames of the main card calculated by the main thread to Surfaceflinger, and then draws them frame by frame through Surfaceflinger, instead of the main thread calculating the parameters of one frame of the main card and Surfaceflinger drawing one frame of the main card. In this way, Surfaceflinger can obtain the parameters of all frames of the main card during the animation process when drawing, and draw all frames of the main card during the animation process, which is conducive to reducing the frame loss or jamming caused by the main thread being unable to calculate the parameters of the main card due to excessive load during the animation process. In addition, when drawing other cards, the main thread calculates the parameters of one frame of other cards based on the parameters of one frame of the main card, and draws one frame of other cards based on the parameters of one frame of other cards. The calculation and drawing of each frame is conducive to the reasonable arrangement of the display position of the main card and the display position of other cards, avoiding the intersection or overlap of positions, and is also conducive to the synchronization of the main card and other cards.
[0240] In addition, in order to distinguish the existing swipe up to enter multi-tasking dynamic effect function and the swipe up to enter multi-tasking dynamic effect sinking function provided in the embodiment of the present application, the terminal device can set a flag when executing the swipe up to enter multi-tasking dynamic effect sinking function provided in the embodiment of the present application. If the terminal device has this flag during the animation display process, it means that the terminal device is executing the swipe up to enter multi-tasking dynamic effect sinking function provided in the embodiment of the present application. If the terminal device does not have this flag during the animation display process, it means that the terminal device is executing the existing swipe up to enter multi-tasking dynamic effect function.
[0241] Exemplarily, the flag may be a SetsurfaceflingerAnimation thread. If the terminal device calls the SetsurfaceflingerAnimation thread during the animation display process, it indicates that the terminal device is executing the swipe up to enter multi-task animation sinking function provided by the embodiment of the present application. If the terminal device does not call the SetsurfaceflingerAnimation thread during the animation display process, it indicates that the terminal device is executing the existing swipe up to enter multi-task animation function.
[0242] The SetsurfaceflingerAnimation thread can be a thread in Setsurfaceflinger. This thread is a custom method of this application, that is, a preset method, which can set various attribute values of the layer before drawing begins. If the terminal device executes the swipe up to enter the multi-task dynamic sinking function provided in the embodiment of this application, the SetsurfaceflingerAnimation thread in Setsurfaceflinger can be called first, and then the drawing thread can be called.
[0243] For example, Fig.11 FIG. 1 shows a schematic diagram of thread operation. Fig.11 As shown, during the animation display process, the terminal device calls the SetsurfaceflingerAnimation thread to set various attribute values of the layer before drawing starts, and requests a vertical synchronization (vsync) signal through the scheduleFrame thread, and then draws and preprocesses the graphic data and records the time when drawing starts through the commit thread in the dotted box.
[0244] The above describes the method provided in the embodiment of the present application from the functional implementation level, and the following describes the method provided in the embodiment of the present application in detail from the thread aspect.
[0245] The embodiment of the present application provides a display method, which can be applied to a terminal device. The method includes: when the terminal device does not turn on the screen projection or screen recording function, displaying the interface of the first application; receiving the user's press and slide operation, and in response to the user's lift operation, displaying the first animation between the first time point and the second time point; wherein, after the first time point, first call the preset thread of Surfaceflinger, and then call the drawing thread, and the second time point is after the first time point; at the second time point, display the multi-task management interface; after the second time point, the terminal device turns on the screen recording or screen projection function, and displays the interface of the first application; receiving the user's press and slide operation, and in response to the user's lift operation, displaying the first animation between the third time point and the fourth time point; wherein, after the third time point, before calling the drawing thread, the preset thread is not called, and the fourth time point is after the third time point; at the fourth time point, display the multi-task management interface.
[0246] The first application may be a message application, a setting application, or a chat application, etc. The operation of the user pressing and sliding up may also be referred to as the operation of the user pressing and sliding up, which is not limited in the present embodiment. The multitasking management interface is the multitasking interface in the above embodiment, and the name of the interface is not specifically limited in the present embodiment.
[0247] In the above Figure 1 In the example shown, the interface of the first application can be Figure 1 In the a interface. Figure 1 In the example shown, the multi-task management interface can be Figure 1 In the b interface. Figure 1 In the example shown, the first animation is Figure 1 The b interface in Figure 1 In the c interface to Figure 1 The conversion process of the d interface.
[0248] The terminal device does not have the screen projection or screen recording function turned on, which can be understood as the terminal device being in a non-screen projection and non-screen recording scenario. Between the first time point and the second time point, the first animation is displayed, and the second time point is after the first time point, which can indicate that the display duration of the first animation is the time difference between the second time point and the first time point. At the second time point, the multi-task management interface is displayed, which can indicate that the last frame of the first animation is the multi-task management interface. In the process of displaying the first animation, the preset thread of Surfaceflinger is called first, and then the drawing thread is called, which can indicate that when the terminal device does not have the screen projection or screen recording function turned on, the terminal device uses the swipe up to enter the multi-task animation sinking function provided in the embodiment of the present application involved in the specific embodiment.
[0249] When the terminal device turns on the screen recording or screen projection function, it can be understood that the terminal device is in a screen projection or screen recording scene. Between the third time point and the fourth time point, the first animation is displayed, and the fourth time point is after the third time point, which can indicate that the display duration of the first animation is the time difference between the fourth time point and the third time point. At the fourth time point, the multi-task management interface is displayed, which can indicate that the last frame of the first animation is the multi-task management interface. In the process of displaying the first animation, the preset thread is not called before the drawing thread is called, which can indicate that when the terminal device turns on the screen projection or screen recording function, the terminal device uses the existing swipe up to enter the multi-task animation function involved in the specific embodiment.
[0250] The preset thread may be a predefined thread. Fig.11 In the example shown, the preset thread may be SetsurfaceflingerAnimation.
[0251] In this way, when the terminal device does not have the screen projection or screen recording function turned on, in the process of displaying the first animation, the preset thread of Surfaceflinger is called first, and then the drawing thread is called, and the sliding up to enter the multi-tasking dynamic effect sinking function provided by the embodiment of the present application involved in the specific embodiment is used, which is conducive to avoiding frame loss or jamming. When the terminal device has the screen projection or screen recording function turned on, in the process of displaying the first animation, before calling the drawing thread, the preset thread is not called, and the existing sliding up to enter the multi-tasking dynamic effect function involved in the specific embodiment is used, which is conducive to reducing the probability of no animation.
[0252] Optionally, the method further includes: between the first time point and the second time point, before calling the drawing thread, calling the thread for obtaining the frame rate; between the third time point and the fourth time point, not calling the thread for obtaining the frame rate.
[0253] In the above Figure 4 In the method shown, the main thread of the terminal device can obtain the frame rate from Surfaceflinger, and the thread used to obtain the frame rate can be getAGPFrameRate(). Between the first time point and the second time point, the terminal device can call the thread for obtaining the frame rate, such as getAGPFrameRate(), to obtain the frame rate, so as to calculate the number of frames included in the first animation, and then call the preset thread of Surfaceflinger and call the drawing thread.
[0254] During the process of displaying the first animation between the first time point and the second time point, the thread for obtaining the frame rate, the preset thread, and the drawing thread are called. This indicates that when the screen projection or screen recording function is not turned on in the terminal device, the terminal device uses the swipe up to enter the multi-tasking animation sinking function provided in the embodiment of the present application involved in the specific embodiment.
[0255] Between the third time point and the fourth time point, in the process of displaying the first animation, the thread for obtaining the frame rate is not called, and the preset thread is not called, but the drawing thread is called. This may indicate that when the screen projection or screen recording function is turned on in the terminal device, the terminal device uses the existing swipe-up to enter multi-tasking animation function involved in the specific embodiment.
[0256] In this way, when the terminal device does not have the screen projection or screen recording function turned on, during the display of the first animation, the thread for obtaining the frame rate is also called to obtain the frame rate. The frame rate is related to the number of frames included in the first animation, which is conducive to calculating the number of frames included in the first animation. When the terminal device has the screen projection or screen recording function turned on, during the display of the first animation, the thread for obtaining the frame rate is not called to obtain the frame rate, which is conducive to reducing the load.
[0257] Optionally, the method further includes: displaying an interface of a second application; and displaying a second animation in response to a user operation of returning to the desktop; wherein, during the display of the second animation, the rendering thread is not called.
[0258] The first application and the second application may be the same application or different applications, and the comparison of the embodiments of the present application is not limited thereto. When the terminal device displays the interface of the second application, it detects the user's operation of returning to the desktop, and displays the second animation in response to the user's operation of returning to the desktop. The second animation is the conversion process of the interface of the second application to the desktop. In the process of displaying the second animation, the terminal device does not call the rendering thread (e.g., render Thread).
[0259] The terminal device does not call the rendering thread during the display of the second animation, which can indicate that the terminal device uses the swipe up to enter multi-tasking dynamic effect sinking function provided in the embodiment of the present application involved in the specific embodiment.
[0260] In this way, in scenes where other animations are displayed, such as the second animation, the rendering thread is not called, which can indicate that the terminal device has used the swipe-up to enter multi-tasking animation sinking function provided in the embodiment of the present application involved in the specific embodiment, which is helpful in avoiding frame loss or freezes.
[0261] Optionally, the first animation includes M frames of images, each of the M frames of images includes a card of the first application, and M is an integer greater than 0; the above method also includes: after the first time point, calling the thread of the desktop application to calculate the parameters of the card of the first application included in each frame of the M frames of images, and obtaining M groups of first parameters; calling the thread of the desktop application to transmit the M groups of first parameters together to Surfaceflinger; calling the preset thread and the drawing thread to draw based on the M groups of first parameters.
[0262] The card of the first application can be called the main card. The first animation includes M frames of images, each of which includes a card of the first application. Figure 4 In the example shown, all frames of the main card in the animation are described. After the first time point, the terminal device calls the thread of the desktop application to calculate the parameters of the card of the first application included in each frame of the M frame image, and obtains M groups of first parameters, that is, Figure 4 In S418, the parameters of all frames of the main card in the animation are calculated. The terminal device calls the thread of the desktop application to transmit the M groups of first parameters to Surfaceflinger together, that is, Figure 4 In S419, the main thread sends the parameters of all frames of the main card to Surfaceflinger, and correspondingly, Surfaceflinger receives the parameters of all frames of the main card. The terminal device calls the preset thread and the drawing thread to draw based on the M group of first parameters, that is, Figure 4 In S420, Surfaceflinger draws the main card frame by frame through the parameters of all frames of the main card.
[0263] In this way, when the terminal device calls the thread of the desktop application to calculate the parameters of the card of the first application, it calculates the parameters of all the cards of the first application and transmits these parameters together to Surfaceflinger. When the terminal device calls Surfaceflinger for drawing, it can obtain all the parameters to facilitate drawing of all the parameters. This is helpful to avoid the desktop application thread failing to successfully calculate the parameters of one or more frames of the card of the first application due to excessive load, resulting in frame loss or freeze of the card of the first application in the first animation.
[0264] Optionally, each frame image in the M frame images also includes a card of at least one application running in the background of the terminal device, and at least one application is different from the first application; the above method also includes: after the first time point, calling the thread of the desktop application to calculate the parameters of the card of at least one application included in the Nth frame image to obtain a second parameter, the Nth frame image is any frame image in the M frame images, N is an integer greater than 0 and less than or equal to M; calling the thread of the desktop application to draw based on the second parameter.
[0265] The card of at least one application running in the background of the terminal device can be called other cards. Based on such a method, the terminal device can calculate the parameters of the card of at least one application included in each frame of the M frames of images, and draw it accordingly.
[0266] In this way, when the terminal device calls the thread of the desktop application to calculate the parameters of the card of at least one application, it calculates the parameters of the card of at least one application in one frame, such as the parameters of the card of at least one application included in the Nth frame image, and draws one frame. At this time, the thread of the desktop application basically does not need to calculate the parameters of the card of the first application, which is beneficial to reduce the occupation of the thread of the desktop application, and thereby reduce the probability of frame loss or freeze in the card of at least one application in the first animation.
[0267] Optionally, the thread calling the desktop application calculates the parameters of the card of at least one application in the Nth frame image to obtain the second parameter, including: the thread calling the desktop application obtains the Nth group of parameters in the M groups of first parameters, the Nth group of parameters being the parameters of the card of the first application included in the Nth frame image; the thread calling the desktop application calculates the second parameter based on the Nth group of parameters and preset card position relationship parameters.
[0268] The preset card position relationship parameter includes the position relationship between the card of the first application and the card of at least one application. For example, the horizontal distance between the position of the card of at least one application and the position of the card of the first application is 3 mm.
[0269] In the above Figure 4 In the method shown, the terminal device calls the thread of the desktop application to calculate the parameters of the card of at least one application in the Nth frame image. The method for obtaining the second parameter can be as shown in S422, that is, the main thread can also obtain the parameters of the main card frame by frame, and calculate the parameters of other cards based on the parameters of the main card.
[0270] In this way, the parameters (second parameters) of the card of at least one application in the Nth frame image are determined based on the parameters of the card of the first application in the Nth frame image (i.e., the Nth group of parameters) and the preset card position relationship parameters, which is conducive to the synchronization of the card of the first application with the card of at least one application in the first animation.
[0271] Optionally, the M groups of first parameters are stored in an array, and the thread calling the desktop application obtains the Nth group of parameters in the M groups of first parameters, including: the thread calling the desktop application obtains the Nth group of parameters from the array.
[0272] The thread of the terminal device calling the desktop application can obtain the Nth group of parameters from the array as described above. Fig. 9As shown, the main thread can convert the parameters of all frames of the main card during the animation from the matrix form to the array form, and take the parameters of one frame of the main card each time, and calculate the parameters of one frame of other cards based on the parameters of one frame of the main card.
[0273] In this way, the parameters of the card of the first application included in each frame of the M frames in the first animation (i.e., M groups of first parameters) are stored in an array. When using any group of parameters, such as the Nth group of parameters, the thread of the desktop application can be called to obtain them from the array, which is conducive to quickly obtaining parameters and thus improving drawing efficiency.
[0274] Optionally, a preset thread and a drawing thread are called to perform drawing based on M groups of first parameters, and the obtained drawing parameters are stored in a buffer; a thread of a desktop application is called to perform drawing based on a second parameter, and the obtained drawing parameters are stored in a buffer; the method also includes: calling Surfaceflinger to obtain a first drawing parameter of a first application card in the Nth frame and a second drawing parameter of a card of at least one application in the Nth frame from the buffer; calling Surfaceflinger to synthesize the first drawing parameter and the second drawing parameter to obtain synthesized information; calling Surfaceflinger to display the synthesized information.
[0275] The buffer zone is the above Figure 4 The buffer is used to store drawing parameters, that is, Figure 4 The terminal device calls Surfaceflinger to obtain the first drawing parameter of the first application card of the Nth frame and the second drawing parameter of the card of at least one application of the Nth frame from the buffer; calls Surfaceflinger to synthesize the first drawing parameter and the second drawing parameter to obtain synthesized information; calls Surfaceflinger to send the synthesized information to the display, Figure 4 In the method shown, namely S424 and S425, Surfaceflinger can obtain the main card and other cards from the buffer frame by frame, and synthesize the main card and other cards. Surfaceflinger can send the synthesized information to the display driver module. Correspondingly, after the display driver module receives the synthesized information, it can display the synthesized information.
[0276] In this way, calling Surfaceflinger obtains the first drawing parameter of the first application card in the Nth frame and the second drawing parameter of the card of at least one application in the Nth frame from the buffer, synthesizes them and sends them for display, which is conducive to displaying the Nth frame image in the animation.
[0277] Optionally, M is positively correlated with the screen refresh rate of the terminal device. Figure 4 It is represented by the symbol frameCount.
[0278] In this way, the number of frames M included in the first animation is positively correlated with the screen refresh rate of the terminal device, which is conducive to better adaptation of the first animation to the screen refresh rate and smoother displayed animation.
[0279] Optionally, M and the screen refresh rate satisfy the following relationship: M=duratioM*1.0 / (1000*1.0 / frameRate), where durationM is the total duration of displaying the first animation, and frameRate is the screen refresh rate. Thus, calculating the frame number M by this formula is conducive to quickly determining the frame number.
[0280] Optionally, the above method also includes: after the second time point, calling the desktop application to calculate the parameters of the card of the first application included in the Lth frame image in the first animation, to obtain a third parameter, where N is an integer greater than 0 and less than or equal to M; calling the desktop application to transmit the third parameter to Surfaceflinger; calling the drawing thread to perform drawing based on the third parameter.
[0281] In this way, in the screen recording or projection scenario, after the second time point, the parameters of a frame of the first application's card, such as the parameters of the first application's card included in the Lth frame image, are calculated, and a frame is drawn. The existing swipe up to enter the multi-tasking animation function is used to help reduce the probability of the first application's card appearing without animation.
[0282] In a possible implementation, the preset thread is used to set the properties of a layer in any frame image included in the first animation.
[0283] Before drawing through the drawing thread, the terminal device sets various attribute values of the layer through the preset thread.
[0284] The embodiment of the present application also provides a display method, which can be applied to a terminal device. The method includes: displaying the interface of a first application; receiving a user's press and slide operation, and in response to the user's lift operation, displaying a first animation between a first time point and a second time point; wherein, after the first time point, calling a thread for obtaining a frame rate, and the second time point is after the first time point; at the second time point, displaying a multitasking management interface; after the second time point, in response to the user's return to the desktop operation; displaying a third animation; wherein, in the process of displaying the third animation, the rendering thread is not called.
[0285] During the process of displaying the first animation between the first time point and the second time point, calling the thread for obtaining the frame rate can indicate that the terminal device has used the swipe-up to enter multi-tasking animation sinking function provided in the embodiment of the present application involved in the specific embodiment.
[0286] When the terminal device displays the third animation, the rendering thread is not called, and the rendering thread is renderThread. This indicates that the terminal device uses the swipe-up to enter multi-tasking dynamic effect sinking function provided in the embodiment of the present application involved in the specific embodiment.
[0287] In this way, after the first time point, the thread for obtaining the frame rate is called to obtain the frame rate, and the frame rate is related to the number of frames included in the first animation, which is conducive to calculating the number of frames included in the first animation; in response to the user's operation of returning to the desktop, the third animation is displayed. In the process of displaying the third animation, the rendering thread is not called, which can indicate that the terminal device uses the swipe up to enter the multi-tasking animation sinking function provided in the embodiment of the present application involved in the specific embodiment, which is conducive to avoiding frame loss or freeze.
[0288] It should be noted that the module names involved in the embodiments of the present application can be defined as other names as long as the functions of each module can be achieved, and there is no specific restriction on the names of the modules.
[0289] The method of the embodiment of the present application has been described above, and the device for executing the above method provided by the embodiment of the present application is described below. Those skilled in the art can understand that the method and the device can be combined and referenced with each other, and the relevant device provided by the embodiment of the present application can execute the steps in the above method.
[0290] In order to achieve the above functions, the device for implementing the above display method includes hardware structures and / or software modules corresponding to the execution of each function. It should be easily appreciated by those skilled in the art that, in combination with the method steps of each example described in the embodiments disclosed herein, the present application 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. Professional and technical personnel can use different methods to implement the described functions for each specific application, but such implementation should not be considered to be beyond the scope of this application.
[0291] The embodiment of the present application can divide the functional modules of the device for implementing the display method according to the above method example. For example, each functional module can be divided according to each function, or two or more functions can be integrated into one processing module. The integrated module can be implemented in the form of hardware or in the form of software functional modules. It should be noted that the division of modules in the embodiment of the present application is schematic and is only a logical function division. There may be other division methods in actual implementation.
[0292] like Fig.12A schematic diagram of the structure of a chip provided in an embodiment of the present application. The chip 120 includes one or more (including two) processors 1201 , a communication line 1202 , a communication interface 1203 and a memory 1204 .
[0293] In some implementations, the memory 1204 stores the following elements: executable modules or data structures, or a subset thereof, or an extended set thereof.
[0294] The method described in the above embodiment of the present application can be applied to the processor 1201, or implemented by the processor 1201. The processor 1201 may be an integrated circuit chip with signal processing capabilities. In the implementation process, each step of the above method can be completed by an integrated logic circuit of hardware in the processor 1201 or an instruction in the form of software. The above processor 1201 can be a general-purpose processor (for example, a microprocessor or a conventional processor), a digital signal processor (digital signal processing, DSP), an application specific integrated circuit (application specific integrated circuit, ASIC), a field-programmable gate array (field-programmable gate array, FPGA) or other programmable logic devices, discrete gates, transistor logic devices or discrete hardware components. The processor 1201 can implement or execute the methods, steps and logic block diagrams related to each processing disclosed in the embodiment of the present application.
[0295] The steps of the method disclosed in the embodiment of the present application can be directly embodied as being executed by a hardware decoding processor, or can be executed by a combination of hardware and software modules in the decoding processor. Among them, the software module can be located in a mature storage medium in the field such as a random access memory, a read-only memory, a programmable read-only memory, or an electrically erasable programmable read only memory (EEPROM). The storage medium is located in the memory 1204, and the processor 1201 reads the information in the memory 1204 and completes the steps of the above method in combination with its hardware.
[0296] The processor 1201 , the memory 1204 , and the communication interface 1203 may communicate with each other via the communication line 1202 .
[0297] In the above embodiments, the instructions stored in the memory for execution by the processor may be implemented in the form of a computer program product, wherein the computer program product may be pre-written in the memory, or may be downloaded and installed in the memory in the form of software.
[0298] The embodiment of the present application also provides a computer program product including one or more computer instructions. When the computer program instructions are loaded and executed on a computer, the process or function according to the embodiment of the present application is generated in whole or in part. The computer can be a general-purpose computer, a special-purpose computer, a computer network or other programmable device. The computer instructions can be stored in a computer-readable storage medium, or transmitted from one computer-readable storage medium to another computer-readable storage medium. For example, the computer instructions can be transmitted from one website site, computer, server or data center to another website site, computer, server or data center by wired (e.g., coaxial cable, optical fiber, digital subscriber line (digital subscriber line, DSL) or wireless (e.g., infrared, wireless, microwave, etc.) mode. The computer-readable storage medium can be any available medium that a computer can store or a data storage device such as a server or data center that includes one or more available media integrated. For example, the available medium can include a magnetic medium (e.g., a floppy disk, a hard disk or a tape), an optical medium (e.g., a digital versatile disc (digital versatile disc, DVD)), or a semiconductor medium (e.g., a solid state drive (solid state disk, SSD)), etc.
[0299] The present application also provides a computer-readable storage medium. The methods described in the above embodiments can be implemented in whole or in part by software, hardware, firmware, or any combination thereof. Computer-readable media may include computer storage media and communication media, and may also include any medium that can transfer a computer program from one place to another. The storage medium may be any target medium that can be accessed by a computer.
[0300] As a possible design, the computer readable storage medium may include a compact disc read-only memory (CD-ROM), RAM, ROM, EEPROM or other optical disc storage; the computer readable medium may include a magnetic disk storage or other magnetic disk storage device. Moreover, any connection line may also be appropriately referred to as a computer readable medium. For example, if the software is transmitted from a website, server or other remote source using a coaxial cable, fiber optic cable, twisted pair, DSL or wireless technology (such as infrared, radio and microwave), the coaxial cable, fiber optic cable, twisted pair, DSL or wireless technology such as infrared, radio and microwave is included in the definition of medium. Disk and disc as used herein include compact disc (CD), laser disc, optical disc, digital versatile disc (DVD), floppy disk and Blu-ray disc, where disks usually reproduce data magnetically, while optical discs reproduce data optically using lasers.
[0301] The embodiments of the present application are described with reference to the flowcharts and / or block diagrams of the methods, devices (systems), and computer program products according to the embodiments of the present application. It should be understood that each process and / or box in the flowchart and / or block diagram, as well as the combination of the processes and / or boxes in the flowchart and / or block diagram, can be implemented by computer program instructions. These computer program instructions can be provided to a processing unit of a general-purpose computer, a special-purpose computer, an embedded processor, or other programmable data processing device to generate a machine, so that the instructions executed by the processing unit of the computer or other programmable data processing device generate instructions for implementing the processes in the flowchart and / or block diagram. Figure 1 A process or multiple processes and / or boxes Figure 1 A device that provides the functions specified in a block or multiple blocks.
Claims
1. A display method, characterized in that: Applied to terminal equipment, including: When the screen projection or screen recording function is not turned on on the terminal device, display the interface of the first application; Receive a user's press and slide operation, and in response to the user's lift operation, display a first animation between a first time point and a second time point; wherein, after the first time point, first call a preset thread of Surfaceflinger, and then call a drawing thread, and the second time point is after the first time point; At the second time point, displaying a multitasking management interface; After the second time point, the terminal device turns on the screen recording or screen projection function and displays the interface of the first application; receiving the user's press and slide operation, and in response to the user's lift operation, displaying the first animation between a third time point and a fourth time point; wherein after the third time point, before calling the drawing thread, the preset thread is not called, and the fourth time point is after the third time point; At the fourth time point, the multitasking management interface is displayed.
2. The method according to claim 1, characterized in that The method further comprises: Between the first time point and the second time point, before calling the drawing thread, a thread for obtaining the frame rate is also called; Between the third time point and the fourth time point, the thread for obtaining the frame rate is not called.
3. The method according to claim 1 or 2, characterized in that: The method further comprises: Displaying the interface of the second application; In response to the user's operation of returning to the desktop, a second animation is displayed; wherein, during the process of displaying the second animation, a rendering thread is not called.
4. The method according to any one of claims 1 to 3, characterized in that The first animation includes M frames of images, each of the M frames of images includes a card of the first application, and M is an integer greater than 0; The method further comprises: After the first time point, calling the thread of the desktop application to calculate the parameters of the card of the first application included in each frame of the M frames of images to obtain M groups of first parameters; The thread calling the desktop application transmits the M groups of first parameters to Surfaceflinger together; The preset thread and the drawing thread are called to perform drawing based on the M groups of first parameters.
5. The method according to claim 4, characterized in that Each of the M frames of images further includes a card of at least one application running in the background of the terminal device, and the at least one application is different from the first application; The method further comprises: After the first time point, calling the thread of the desktop application to calculate the parameters of the card of the at least one application included in the Nth frame image to obtain a second parameter, the Nth frame image is any frame image of the M frame images, and N is an integer greater than 0 and less than or equal to M; The thread that calls the desktop application performs drawing based on the second parameter.
6. The method according to claim 5, characterized in that The thread calling the desktop application calculates the parameters of the card of the at least one application in the Nth frame image to obtain the second parameter, including: Calling the thread of the desktop application to obtain an Nth group of parameters in the M groups of first parameters, where the Nth group of parameters is the parameters of the card of the first application included in the Nth frame image; The thread that calls the desktop application calculates the second parameter based on the Nth group of parameters and preset card position relationship parameters.
7. The method according to claim 6, characterized in that The M groups of first parameters are stored in an array, and the thread calling the desktop application obtains the Nth group of parameters in the M groups of first parameters, including: The thread that calls the desktop application obtains the Nth group of parameters from the array.
8. The method according to any one of claims 5 to 7, characterized in that The calling of the preset thread and the drawing thread performs drawing based on the M groups of first parameters, and the obtained drawing parameters are stored in a buffer; the calling of the thread of the desktop application performs drawing based on the second parameters, and the obtained drawing parameters are stored in the buffer; The method further comprises: Calling Surfaceflinger to obtain, from the buffer, a first drawing parameter of the first application card in the Nth frame and a second drawing parameter of a card of the at least one application in the Nth frame; Calling Surfaceflinger to synthesize the first drawing parameter and the second drawing parameter to obtain synthesized information; Call Surfaceflinger to display the synthesized information.
9. The method according to any one of claims 4 to 8, characterized in that The M is positively correlated with the screen refresh rate of the terminal device.
10. The method according to claim 9, characterized in that The M and the screen refresh rate satisfy the following relationship: M = durationM*1.0 / (1000*1.0 / frameRate) Among them, durationM is the total duration of displaying the first animation, and frameRate is the screen refresh rate.
11. The method according to any one of claims 1 to 10, characterized in that The method further comprises: After the second time point, the thread of the desktop application is called to calculate the parameters of the card of the first application included in the Lth frame image in the first animation to obtain a third parameter, where N is an integer greater than 0 and less than or equal to M; The thread calling the desktop application transmits the third parameter to Surfaceflinger; The drawing thread is called to perform drawing based on the third parameter.
12. The method according to any one of claims 1 to 11, characterized in that The preset thread is used to set the properties of the layer in any frame image included in the first animation.
13. A terminal device, characterized in that: include: Processor and memory; The memory stores computer-executable instructions; The processor executes the computer-executable instructions stored in the memory, so that the terminal device executes the method according to any one of claims 1 to 12.
14. A computer-readable storage medium storing a computer program, characterized in that: When the computer program is executed by a processor, the method according to any one of claims 1 to 12 is implemented.
15. A computer program product, characterized in that The method comprises a computer program, which, when being executed, enables a computer to execute the method according to any one of claims 1 to 12.
Citation Information
Cited By
Display method and related apparatus
EP4660797A1