Rendering method and electronic device
By pausing the rendering of complex application screens on electronic devices and using screenshots or snapshots to render motion effects, the problem of motion lag is solved and the smoothness and user experience of motion effects are improved.
Patent Information
- Application Number
- CN202410416817.0
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-04-08
- Publication Date
- 2024-09-17
- Estimated Expiration
- 2044-04-08
AI Technical Summary
In electronic devices, the rendering of complex application screens results in prolonged animation rendering time, and animation freezes may occur.
During the process of displaying motion effects, pause the rendering of the application screen and render the motion effects through screenshots or snapshots to reduce the GPU load and improve the smoothness of the motion effects.
It effectively avoids the freeze of motion effects caused by rendering application screens, and improves the smoothness of motion effects and user experience.
Smart Images

Figure CN118092728B
Abstract
Description
Technical Field
[0001] The embodiments of the present application relate to the field of image processing technology, and in particular to a rendering method and an electronic device. Background Art
[0002] When the electronic device executes a motion effect (such as a motion effect executed during the process of launching an application), the electronic device simultaneously renders the motion effect screen and the application screen of the application.
[0003] If the application screen of the application is complex, it will take a long time for the electronic device to render the application screen, and the time waiting for the animation screen to be rendered will be long, which may cause the animation to appear stuck. Summary of the invention
[0004] An embodiment of the present application provides a rendering method and an electronic device. When the electronic device displays a motion effect, the rendering of an application screen of an application is paused, thereby improving the smoothness of the motion effect.
[0005] In a first aspect, an embodiment of the present application provides a rendering method, which is applied to an electronic device.
[0006] The rendering method includes: the electronic device displays a first interface, the first interface includes application information of a first application in the electronic device. The electronic device detects a target event in the first interface for triggering the electronic device to display a first motion effect, wherein the screen content of the first motion effect includes an application screen of the first application.
[0007] In response to the end of the target event, the electronic device does not render the application screen of the first application within a first time interval, and then renders the first animation based on the first image, wherein the first image includes a screenshot when the first application ends running in the foreground of the electronic device or the application screen of the first application when the target event ends.
[0008] Among them, the target event may include an operation event of sliding upward from the bottom of the first interface in the electronic device, a click event on the first interface in the multi-tasking interface, a click event on the application icon of the first application in the main interface of the electronic device, etc.; the first animation may include an animation of sliding upward, an animation of starting the first application from the multi-tasking interface, an animation of starting the first application from the main interface of the electronic device, an animation of entering the multi-tasking interface from the first interface, etc.
[0009] The target event is an operation event of sliding upward from the bottom of the first interface of the electronic device, the first animation is the animation of entering the multi-tasking interface, and the first application is a map application as an example. Figure 2In the animation process of entering the multi-tasking interface from the map application shown in interface 201 to interface 202, the screen content of the animation of entering the multi-tasking interface includes: the application screen content in the thumbnail interface 2011 of the map application, and the animation of the application screen content in the thumbnail interface 2011 of the map application gradually shrinking and changing its method.
[0010] For example, the target event is a click event on the first interface in the multitasking interface, the first animation is an animation of launching an application, and the first application is a map application. Fig.16 In the process of displaying the dynamic effect of launching the map application on the electronic device, the electronic device is based on the screenshot of the map application (such as Fig.16 The screenshot of the map application is a screenshot taken when the map application ends running in the foreground of the electronic device.
[0011] In this way, the electronic device can display the first image of the first application in the display area of the first application during the display of the first motion effect, without causing the display area of the first application (such as Fig.16 The thumbnail interface 15011 of the map application in the middle interface 1501 is blank.
[0012] In response to the end of the first animation, or the length of the first time interval reaching the first duration, the electronic device renders the application screen of the first application. The first duration is the duration during which the electronic device performs rendering control operations on the first application (i.e., the duration during which the first application is not rendered). Exemplarily, when the first animation is the animation for entering the multi-tasking interface, the first animation can be set to the execution duration of the animation for entering the multi-tasking interface. For example, the execution duration of the animation for entering the multi-tasking interface is 600ms, and the corresponding first animation is 600ms. When the duration of the first time interval during which the electronic device does not render the application screen of the first application reaches 600ms, the electronic device can render the application screen of the first application.
[0013] By adopting the above method, the electronic device may not render the application screen of the first application when the target event that triggers the display of the first motion effect ends, thereby improving the efficiency of the electronic device in rendering the first motion effect, so that the first motion effect is displayed smoothly without lag.
[0014] In a possible design manner of the first aspect, the electronic device does not render the application screen of the first application, including: the electronic device controls the interface view Surface View component of the first application not to send a first rendering task to a graphics processor GPU in the electronic device.
[0015] It should be understood that the thread of the interface view SurfaceView component in the first application is generally used to generate the first rendering task of the first application with relatively complex screen content. For example, the map image thread of the map application view component (SurfaceView) in the map application is generally used to generate the map image in the map application (see Figure 6 Rendering task 1 of the area shown as 6012 in the middle interface 601).
[0016] That is to say, the electronic device controls the interface view component of the first application not to send the first rendering task to the graphics processor GPU in the electronic device, which can reduce the load of the GPU and enable the GPU to quickly render the first motion effect without affecting the normal operation of other threads in the first application.
[0017] In a possible design of the first aspect, the first interface includes application information of the first application in the electronic device, specifically: the first interface includes an application interface of the first application running in the foreground. Taking the first application as a map application as an example, the first interface can be an application interface when the map application is running in the foreground as shown in interface 101 of FIG. 4.
[0018] The target event includes an event of sliding upward from the bottom of the first interface, and the first image includes an application screen of the first application when the event of sliding upward from the bottom of the first interface ends.
[0019] For example, the target event includes an event of sliding upward from the bottom of the application interface of the map application when the map application is running in the foreground in the interface 101 as shown in FIG. 4 , and the first image includes the application screen of the map application when the above sliding upward event ends, see Figure 5 The content displayed in the thumbnail interface 5011 of the map application in the middle interface 501.
[0020] In this way, in response to the end of the event of sliding upward from the bottom of the first interface, the electronic device may not render the application screen of the first application during the process of displaying the first motion effect, but instead end the event of sliding upward from the bottom of the first interface (such as Figure 5 When the user slides upward from the bottom of the first interface to point B and then lets go), the application screen of the first application is taken as a snapshot of the first application, and the first motion effect is rendered based on the snapshot of the first application.
[0021] It should be understood that, generally, in response to the completion of the event of sliding upward from the bottom of the first interface, the first animation displayed by the electronic device includes an animation of entering the multitasking interface.
[0022] In a possible design method of the first aspect, in response to the end of the first animation effect or the time length of the first time interval reaching a first time length, when the electronic device renders the application screen of the first application, if at a first moment, the electronic device switches the first application from foreground operation to background operation, the electronic device does not render the application screen of the first application.
[0023] Exemplarily, in response to the completion of an event of sliding upward from the bottom of a first interface, the electronic device displays an animation of entering a multitasking interface. In response to the completion of the animation of entering the multitasking interface or after the length of the first time interval reaches a first length of time, while the electronic device is rendering an application screen of a map application, if at a first moment, the electronic device switches the map application from foreground operation to background operation, the electronic device does not render the application screen of the map application.
[0024] In this way, the electronic device can stop rendering the application screen of the first application after completing the animation and switching the first application to the background, thereby reducing the load on the GPU.
[0025] In a possible design of the first aspect, the first interface includes application information of the first application in the electronic device, specifically: the first interface includes a thumbnail interface of the first application running in the background of the electronic device. Taking the first application as a map application as an example, the first interface includes a thumbnail interface of the map application when the map application is running in the background of the electronic device, see Figure 6 The middle interface 203 displays a thumbnail interface 2031 of the map application in the multitasking interface.
[0026] The target event includes a click event on the thumbnail interface of the first application, and the first image includes a screenshot when the first application ends running in the foreground of the electronic device.
[0027] It should be understood that, in general, the click event on the thumbnail interface of the first application indicates the launch of the first application, and the corresponding electronic device displays the animation of launching the first application. In the process of displaying the animation of launching the first application, the electronic device does not render the application screen of the first application, but renders the first animation based on the screenshot of the first application when it ends running in the foreground of the electronic device. Take launching the first application from the multitasking interface as an example, taking the first application as a map application, see Fig.16 The screenshot displayed in the thumbnail interface 15011 of the map application in the middle interface 1501 is a screenshot when the map application ends running in the foreground of the electronic device. Fig.16 The dynamic effect of starting the map application in the middle interface 1501 includes a dynamic effect of gradually enlarging the screenshot displayed in the thumbnail interface 15011 of the map application, and a dynamic effect of changing the orientation of the screenshot displayed in the thumbnail interface 15011 of the map application.
[0028] It should be understood that in the process of launching the first application from the main interface of the electronic device, the rendering method executed by the electronic device is similar to the process of launching the first application from the multi-tasking interface, which will not be repeated here.
[0029] In this way, the electronic device may not render the application screen of the first application during the process of starting the first application, thereby reducing the load on the GPU, obtaining a screenshot of the first application when it finishes running in the foreground of the electronic device, and rendering the first animation effect based on the screenshot of the first application when it finishes running in the foreground of the electronic device, thereby avoiding the problem of a blank display area of the first application due to not rendering the application screen of the first application.
[0030] For example, the display area of the first application is as follows: Fig.16 In the area of the thumbnail interface 15011 of the map application, further, the display area of the first application is as follows Fig.16 The area shown in 15012 in the thumbnail interface 15011 of the map application. The screenshot when the first application ends running in the foreground of the electronic device can be a screenshot when the electronic device switches the first application from the foreground to the background after the animation effect of entering the multitasking interface ends.
[0031] It should be noted that the above design method is combined with the scenario of "the target event includes an event of sliding upward from the bottom of the first interface, and the first image includes the application screen of the first application when the event of sliding upward from the bottom of the first interface ends" in the above text. That is to say, the electronic device can first respond to the event of sliding upward from the bottom of the first interface, display the dynamic effect of entering the multi-task interface, and in this process, the application screen of the first application is not rendered, but the dynamic effect of entering the multi-task interface is rendered based on the application screen of the first application when the event of sliding upward from the bottom of the first interface ends. When the dynamic effect of entering the multi-task interface ends or the time length of the first time interval reaches the first time length, the electronic device renders the application screen of the first application. At the first moment, the electronic device switches the first application from the foreground to the background, and the electronic device does not render the application screen of the first application. At this time, the electronic device can obtain a screenshot of the first application when it ends running in the foreground of the electronic device, and display it in the thumbnail interface of the first application. Then, in response to the click event of the thumbnail interface of the first application, the electronic device displays the dynamic effect of starting the first application. In this process, the electronic device does not render the application screen of the first application, but renders the dynamic effect of starting the first application based on the screenshot of the first application when it ends running in the foreground of the electronic device.
[0032] In a possible design of the first aspect, within a first time interval, the electronic device controls the main thread of the first application to send a second rendering task to the GPU. That is, in response to the end of the target event, the electronic device only controls the interface view component of the first application not to send the first rendering task to the GPU, while the main thread of the first application can normally send the second rendering task to the GPU, and the GPU can execute the second rendering task. After rendering the first frame image in response to the second rendering task, the electronic device does not delete the first image. Based on this, the electronic device can continue to render the first motion effect based on the first image that has not been deleted.
[0033] Take launching the first application from the multitasking interface as an example, where the first application is a map application. Fig.19 , the electronic device executes the dynamic effect of starting the map application as shown in interface 1801 (in this process, the electronic device controls the main thread of the map application to send rendering task 2 to the GPU, and the GPU renders the taxi-hailing, public transportation and other controls shown in the startup window 18011 of the map application). In response to the end of the dynamic effect of starting the map application or the duration of the first time interval reaching the first duration, the electronic device exits the rendering control operation (i.e., does not render the application screen of the map application). At this time, the GPU has completed rendering the taxi-hailing, public transportation and other controls in the startup window 18011 of the map application, but the electronic device does not delete the screenshot displayed in the startup window 18011 of the map application. In addition, the electronic device renders the first dynamic effect based on the above screenshot, see Fig.19 The startup window 18021 of the map application in the middle interface 1802 still displays a screenshot of the map application.
[0034] With the above design, the electronic device can continue to render the first motion effect based on the first image that has not been deleted, without deleting the image of the first application (specifically, a screenshot of the first application) after the second rendering task of the main thread of the first application is rendered. In this way, before the first motion effect ends, the electronic device continues to not render the application screen of the first application, and will not cause the display area of the first application to be blank, thereby improving the user's viewing experience.
[0035] In a possible design of the first aspect, the electronic device includes a control list. When the electronic device determines that the control list includes a first application, in response to an end of a target event, the electronic device does not render an application screen of the first application within a first time interval, and renders a first animation effect based on the first image.
[0036] It should be understood that the control list includes at least one package name of an application that may cause the first animation to be stuck. For example, if the map application has a complex screen, when the GPU in the electronic device simultaneously renders the application screen of the above application and the animation screen of the first animation, the GPU load is heavy, which may cause the first animation to be stuck. The electronic device can store the package name of the map application in the control list so as not to render the application screen of the map application during the display of the first animation.
[0037] The electronic device pre-sets a control list, and when detecting a target event on the first interface, determines that the control list includes the first application (specifically, includes the package name of the first application), in response to the end of the target event, within a first time interval, the electronic device does not render the application screen of the first application, but renders the first animation effect based on the first image.
[0038] In a possible design of the first aspect, when the electronic device determines that the control list does not include the first application, in response to the end of the target event, the electronic device renders an application screen of the first application within a first time interval, and renders a first animation effect based on the application screen of the first application.
[0039] With the above design, the electronic device does not render the application screen of the first application during the display of the first animation only when the control list includes the first application. For the first application not in the control list, the electronic device can normally render the application screen of the first application during the display of the first animation.
[0040] In a possible design of the first aspect, before the target event ends, the electronic device responds to detecting the target event in the first interface, and within the second time interval, the electronic device does not render the application screen of the first application, and simultaneously obtains the image of the first application when the target event is detected as the second image (also referred to as a snapshot of the first application), and renders the first motion effect based on the second image, and the second image includes the image of the first application when the target event is detected. The second time interval is before the first time interval.
[0041] In this way, the electronic device may not render the application screen of the first application before the end of the target event, and render the first motion effect based on the second image, so that during the display of the first motion effect, the display area of the first application can display the second image without any blank space.
[0042] In a possible design of the first aspect, in response to detecting a target event in the first interface, the electronic device does not render the application screen of the first application within the second time interval, and after rendering the first motion effect based on the second image, in response to the time length of the second time interval reaching the second time length and the target event not ending, the electronic device renders the application screen of the first application, and renders the first motion effect based on the application screen of the first application. The second time length is the maximum display time length of the first motion effect. In this way, the electronic device may not render the application screen of the first application within the second time length, and render the first motion effect based on the application screen of the first application when the target event has not ended but the time length of the second time interval reaches the second time length. This avoids the problem of abnormality in the main thread of the first application due to the second time interval not rendering the application screen of the first application being too long.
[0043] In a possible design of the first aspect, within a first time interval, the electronic device does not render an application screen of the first application, and renders a first motion effect based on the first image, and the electronic device can display a second interface, the second interface includes the first motion effect, the first motion effect includes a first image, and the first image is a screenshot of the first application when it ends running in the foreground of the electronic device or the application screen of the first application when the target event ends. That is, within the first time interval, the image content of the first image remains unchanged.
[0044] With the above design, the electronic device only acquires the first image once, and in the process of displaying the motion effect, the first motion effect is always rendered based on the same first image, without repeatedly acquiring the first image multiple times.
[0045] In a possible design manner of the first aspect, the electronic device detecting a target event in the first interface includes: a desktop application in the electronic device detecting the target event in the first interface.
[0046] In response to the end of the target event, within a first time interval, the electronic device does not render the application screen of the first application, and renders a first motion effect based on the first image, including: in response to the end of the target event, the desktop application sends a first instruction to the interface view Surface View component of the first application, and the desktop application sends a second instruction to the image processor GPU of the electronic device.
[0047] In response to the first instruction, within the first time interval, the interface view Surface View component of the first application does not send the first rendering task to the GPU. In response to the second instruction, within the first time interval, the GPU renders the first motion effect based on the first image.
[0048] Using the above design method, when the target event ends, the desktop application in the electronic device sends a first instruction to the interface view component of the first application to achieve non-rendering of the application screen of the first application (specifically, the application screen corresponding to the first rendering task generated by the thread of the interface view component), and at the same time sends a second instruction to the GPU to achieve rendering and display of the first animation effect.
[0049] In a possible design manner of the first aspect, the first instruction includes a first duration.
[0050] In response to the first motion effect ending or the time length of the first time interval reaching the first time length, the electronic device renders the application screen of the first application, including: in response to the first motion effect ending, the desktop application sends a third instruction to the interface view Surface View component of the first application. In response to the third instruction, the interface view Surface View component of the first application sends a first rendering task to the GPU.
[0051] Alternatively, in response to the time length of the first time interval reaching the first time length, the electronic device (which may be controlled by a desktop application or an interface) sends a fourth instruction to the interface view Surface View component of the first application. In response to the fourth instruction, the interface view Surface View component of the first application sends a first rendering task to the GPU. The third instruction and / or the fourth instruction are used to instruct the Surface View component to send the first rendering task to the GPU.
[0052] Based on this, when the first motion effect ends, the electronic device can send a third instruction through the desktop application to instruct the interface view Surface View component of the first application to send a first rendering task to the GPU, so that the GPU can render the application screen of the first application. Alternatively, when the time length of the first time interval reaches the first duration, the electronic device sends a fourth instruction to instruct the interface view Surface View component of the first application to send the first rendering task to the GPU, so that the GPU can render the application screen of the first application. Based on different conditions, the rendering control of the application screen of the first application within the first duration or during the display of the first motion effect is achieved, so that the first motion effect can be displayed smoothly within the first duration or the entire display process of the first motion effect is smooth and without lag.
[0053] It should be understood that, among the two conditions of the first motion effect ending and the first time interval reaching the first time length, the electronic device performs the corresponding operation according to the condition that is satisfied first.
[0054] Exemplarily, when the first animation ends, if the duration of the first time interval does not reach the first duration, the desktop application sends a third instruction to instruct the interface view Surface View component of the first application to send a first rendering task to the GPU so that the GPU can render the application screen of the first application.
[0055] In a possible design manner of the first aspect, the electronic device controls a main thread of the first application to send a second rendering task to a GPU, and after rendering a first frame of image in response to the second rendering task, the electronic device does not delete the first image, including:
[0056] In the first time interval: the electronic device sends a fifth instruction to the main thread of the first application; in response to the fifth instruction, the main thread of the first application sends a second rendering task to the GPU;
[0057] After obtaining the first frame image by rendering in response to the second rendering task, the electronic device does not delete the first image.
[0058] After the first frame image is obtained by rendering in response to the second rendering task, the window service of the electronic device does not delete the first image until the first frame image is obtained by rendering the first rendering task, at which time the window service deletes the first image.
[0059] By adopting the above design method, the electronic device deletes the first image only after the second rendering task of the main thread of the first application and the first rendering task of the interface view component are rendered. This avoids the problem that part of the first application appears blank due to the electronic device not rendering the first rendering task during the display of the motion effect. The motion effect is displayed completely, improving the user's viewing experience.
[0060] In a second aspect, an embodiment of the present application provides an electronic device, which includes a memory and one or more processors, and the memory is coupled to the processor; computer program code is stored in the memory, and the computer program code includes computer instructions. When the computer instructions are executed by the processor, the electronic device executes the method in the above-mentioned first aspect and any possible design method thereof.
[0061] In a third aspect, an embodiment of the present application further provides a computer-readable storage medium on which computer instructions are stored. When the computer instructions are executed on an electronic device, the electronic device executes the method in the first aspect and any possible design thereof.
[0062] In a fourth aspect, an embodiment of the present application further provides a computer program product, including computer instructions, which, when the computer program product runs on an electronic device, enables the electronic device to execute the method in the first aspect and any possible design thereof.
[0063] It can be understood that the beneficial effects that can be achieved by the electronic device, computer-readable storage medium, and computer program product provided above can refer to the beneficial effects in the first aspect and any possible design method thereof, and will not be repeated here. BRIEF DESCRIPTION OF THE DRAWINGS
[0064] Figure 1 One of the schematic diagrams of an interface for executing motion effects on a mobile phone provided in an embodiment of the present application;
[0065] Figure 2 The second schematic diagram of an interface for executing motion effects on a mobile phone provided in an embodiment of the present application;
[0066] Figure 3 A third schematic diagram of an interface for executing motion effects on a mobile phone provided in an embodiment of the present application;
[0067] Figure 4 A fourth schematic diagram of an interface for executing motion effects on a mobile phone provided in an embodiment of the present application;
[0068] Figure 5 A fifth schematic diagram of an interface for executing motion effects on a mobile phone provided in an embodiment of the present application;
[0069] Figure 6 A sixth schematic diagram of an interface for executing motion effects on a mobile phone provided in an embodiment of the present application;
[0070] Figure 7 A diagram of the software and hardware architecture of a mobile phone provided in an embodiment of the present application;
[0071] Figure 8 A class and interface diagram provided for an embodiment of the present application;
[0072] Fig. 9 A schematic diagram of a rendering architecture provided in an embodiment of the present application;
[0073] Fig.10 One of the business track diagrams of a rendering method provided in an embodiment of the present application;
[0074] Fig.11 One of the interactive diagrams of a rendering method provided in an embodiment of the present application;
[0075] Fig.12 The second interactive diagram of a rendering method provided in an embodiment of the present application;
[0076] Fig.13 A flowchart of a rendering method provided in an embodiment of the present application;
[0077] Fig.14 An operating state diagram provided for an embodiment of the present application;
[0078] Fig.15 A second business track diagram of a rendering method provided in an embodiment of the present application;
[0079] Fig.16 The seventh schematic diagram of an interface for executing motion effects on a mobile phone provided in an embodiment of the present application;
[0080] Fig.17 The third interactive diagram of a rendering method provided in an embodiment of the present application;
[0081] Fig.18 A third business track diagram of a rendering method provided in an embodiment of the present application;
[0082] Fig.19 The eighth schematic diagram of an interface for executing motion effects on a mobile phone provided in an embodiment of the present application;
[0083] Fig. 20 This is a fourth interactive diagram of a rendering method provided in an embodiment of the present application. DETAILED DESCRIPTION
[0084] The technical solutions in the embodiments of the present application are described below in conjunction with the drawings in the embodiments of the present application. Among them, in the description of the embodiments of the present application, the terms used in the following embodiments are only for the purpose of describing specific embodiments, and are not intended to be used as limitations on the present application. As used in the specification and the appended claims of the present application, the singular expressions "a", "said", "above", "the" and "this" are intended to also include expressions such as "one or more", unless there is a clear contrary indication in the context. It should also be understood that in the following embodiments of the present application, "at least one", "one or more" refer to one or more (including two). The term "and / or" is used to describe the association relationship of associated objects, indicating that three relationships can 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 associated objects before and after are in an "or" relationship.
[0085] References to "one embodiment" or "some embodiments" etc. described in this specification mean that one or more embodiments of the present application include specific features, structures or characteristics described in conjunction with the embodiment. Thus, the statements "in one embodiment", "in some embodiments", "in some other embodiments", "in some other embodiments", etc. that appear in different places in this specification do not necessarily refer to the same embodiment, but mean "one or more but not all embodiments", unless otherwise specifically emphasized in other ways. The terms "including", "comprising", "having" and their variations all mean "including but not limited to", unless otherwise specifically emphasized in other ways. The term "connection" includes direct connection and indirect connection, unless otherwise specified. "First" and "second" are used for descriptive purposes only and cannot be understood as indicating or implying relative importance or implicitly indicating the number of technical features indicated.
[0086] In the embodiments of the present application, the words "exemplarily" or "for example" are used to indicate examples, illustrations or explanations. Any embodiment or design described as "exemplarily" or "for example" in the embodiments of 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 "exemplarily" or "for example" is intended to present related concepts in a specific way.
[0087] The rendering method provided in the embodiment of the present application can be applied to electronic devices. For example, the electronic device can be a mobile phone, a tablet computer, a desktop computer, a laptop computer, a handheld computer, a notebook computer, an ultra-mobile personal computer (UMPC), a netbook, a cellular phone, a personal digital assistant (PDA), an augmented reality (AR), a virtual reality (VR) device, etc. The embodiment of the present application does not impose any special restrictions on the specific type of the electronic device.
[0088] The rendering method is mainly described below by taking a mobile phone as an example of an electronic device.
[0089] The above rendering control method can be applied to the scene of dynamic rendering. Figure 1 , the scene of dynamic effect rendering can be: in the process of the user sliding upward from the bottom of interface 101 (such as sliding from point A in interface 101 to point B in interface 103), the mobile phone renders a dynamic effect scene from interface 101 to interface 102 and then to interface 103. See Figure 2, the scene of dynamic effect rendering can be: in response to the user raising his hand from interface 103, the mobile phone renders a scene of dynamic effect from interface 103 to interface 201, then to interface 202, and finally to interface 203. Figure 3 , the scene of dynamic effect rendering can be: in response to the user's click operation on the thumbnail interface 2031 of the map application in the interface 203, the mobile phone renders the scene of dynamic effect from the interface 203 to the interface 301, then to the interface 302, and finally to the interface 303. For the convenience of explanation, Figure 2 Middle interface 103, Figure 3 The middle interface 203 may also be referred to as the first interface, and the application interface 101 of the map application, the thumbnail interface 1031, and 2031 of the map application may also be referred to as the application information of the first application in the electronic device. The above-mentioned sliding upward from the bottom of the interface 101, the click operation on the thumbnail interface 2031 of the map application in the interface 203, etc. may also be referred to as target events. Furthermore, the sliding upward from the bottom of the interface 101 may also be referred to as an event of sliding upward from the bottom of the first interface. The click operation on the thumbnail interface 2031 of the map application in the interface 203 may also be referred to as a click event on the thumbnail interface of the first application.
[0090] Of course, in addition to the above Figure 1-Figure 3 In addition to the example of , the scene of dynamic effect rendering can also be the scene of other mobile phone rendering to obtain dynamic effects, and the embodiments of the present application do not specifically limit this. For example, the scene of dynamic effect rendering can also be: in response to the user clicking the application icon of an application on the desktop of the mobile phone, the scene of rendering to obtain the dynamic effect of opening the application (such as the dynamic effect of the application interface changing from small to large).
[0091] Generally speaking, animations can be divided into the following two categories: The first category is animations that respond to user operations, such as Figure 1 The second type is the animation effect after the user's operation is completed, such as Figure 2 The animation effect after the user finishes sliding upward from the interface 103 (same as after releasing the finger as described above), Figure 3 The animation after the user clicks the thumbnail interface 2031 of the map application in the interface 203. For the convenience of explanation, the above two types of animation can also be referred to as the first animation.
[0092] When rendering each frame of the first or second type of animation, the mobile phone needs to render the application screen and the animation screen.
[0093] The application screen refers to the screen of the target application targeted by the user operation. Figure 1, the user starts to perform a sliding operation in interface 101, and interface 101 is the application interface of the map application. The target application is the map application. Accordingly, the rendering of the application screen includes rendering the thumbnail interface 1021 of the map application in interface 102 and the thumbnail interface 1031 of the map application in interface 103. For example, after rendering, the position of the positioning icon 1022 in the thumbnail interface 1021 moves to the position of the positioning icon 1032 in the thumbnail interface 1031. Similarly, Figure 2 The upward swipe operation ended in Figure 3 The click operations ended in are all for the map application, so the target application is also the map application, which will not be repeated here.
[0094] Among them, the dynamic effect picture refers to the picture with visual effects such as size change (such as zooming in and out), position change (such as left and right movement). Figure 1 , the thumbnail interface 1021 of the map application in interface 102 is reduced to the thumbnail interface 1031 of the map application in interface 103, and the thumbnail interface 1023 of other background applications in interface 102 is reduced to the thumbnail interface 1033 of other background applications in interface 103, that is, the size of the animation has changed. Also, the application interface of the map application in full screen in interface 101 changes to the thumbnail interface 1023 of other background applications exposed in interface 102 and the thumbnail interface 1033 of other background applications exposed in interface 103, that is, the direction of the animation has changed. Similarly, Figure 2 In the animation process shown, the thumbnail interface 2011 of the map application in the interface 201 is also reduced to the thumbnail interface 2031 of the map application in the interface 203, and the partial thumbnail interface 2012 of other background applications is exposed in the interface 201 to the complete thumbnail interface 2032 of other background applications is exposed in the interface 203. Figure 3 In the animation shown, the thumbnail interface 3011 of the map application in the interface 301 is enlarged to the full screen display of the application interface of the map application in the interface 303. And the thumbnail interface 3012 of other background applications is exposed in the interface 301 to the thumbnail interface 303 of other background applications is not displayed.
[0095] However, if the application screen is complex, the mobile phone will spend a long time using the GPU to render the application screen during the processing of each frame of the animation, causing the GPU to be blocked. The animation screen will take a long time to wait for GPU rendering, resulting in the phenomenon of animation screen freeze and frame loss. Figure 1 The more complex the thumbnail interface 1021 of the map application in the interface 102 is, the longer it takes for the mobile phone to execute the dynamic effect screen of shrinking the thumbnail interface 1021 of the map application to the thumbnail interface 1031 of the map application, and the mobile phone will experience lag when switching from the interface 102 to the interface 103.
[0096] In response to the above problems, an embodiment of the present application proposes a rendering method, which can be applied to mobile phones. Using the method of the embodiment of the present application, in the above-mentioned motion effect rendering scenario, the mobile phone can render the motion effect screen through the GPU, but suspend the rendering of the application screen. After the above-mentioned motion effect ends, the mobile phone implements the rendering of the application screen through the GPU. In this way, when the mobile phone is executing the motion effect, the GPU may not perform the application screen rendering task of the application, reduce the load of the GPU, and improve the smoothness of the motion effect. For the sake of convenience, the time interval from the time when the mobile phone suspends the rendering of the application screen to the time when the mobile phone starts to implement the rendering of the application screen through the GPU after the motion effect ends can also be referred to as the first time interval.
[0097] For example, see Figure 4 In response to the user performing an upward sliding operation from the bottom of interface 101 (such as from point A in interface 101) to the beginning, the mobile phone uses the GPU to render the dynamic effect from interface 101 to interface 401 and then to interface 402 (also referred to as the dynamic effect of sliding upward), and the mobile phone pauses the rendering of the target application screen (such as the rendering of the thumbnail interface 4011 of the map application in interface 401). In response to the end of the upward sliding operation (such as the upward sliding operation reaching point B in interface 101), the mobile phone uses the GPU to render the map application screen to obtain the thumbnail interface 4021 of the map application in interface 402. In this way, the dynamic effect of the upward sliding of the mobile phone from interface 101 to interface 401 and then to interface 402 will not be stuck. For the sake of convenience, the image shown in the thumbnail interface 4011 of the map application in interface 401 can also be referred to as the image of the first application when the target event is detected, and can also be further referred to as the second image. Among them, the target event is an event of sliding upward from the bottom of the first interface, and the first application is a map application.
[0098] See also Figure 5 In response to the user raising his hand from interface 103, the mobile phone starts to use the GPU to render the dynamic effect from interface 103 to interface 501, then to interface 502, and finally to interface 503 (also known as the dynamic effect of entering the multi-tasking interface). At the same time, the mobile phone pauses the rendering of the target application screen (such as the thumbnail interface 5011 of the map application in interface 501 and the thumbnail interface 5021 of the map application in interface 502). In response to the end of the above-mentioned dynamic effect of entering the multi-tasking interface, the mobile phone renders the map application screen through the GPU to obtain the thumbnail interface 5031 of the map application in interface 503. In this way, the dynamic effect of the mobile phone entering the multi-tasking interface from interface 103 to interface 501, then to interface 502, and finally to interface 503 will not be stuck. For the sake of explanation, Figure 1 The content displayed in the application interface 101 of the map application can be called the screen content of the first animation effect.
[0099] See also Figure 6In response to the user clicking on the thumbnail interface 2031 of the map application in interface 203, the mobile phone starts to render the dynamic effect from interface 203 to interface 601 and then to interface 602 through the GPU (also known as the dynamic effect of starting the application), and the mobile phone pauses the rendering of the target application screen (such as the rendering of the thumbnail interface 6011 of the map application in interface 601). In response to the end of the dynamic effect of starting the application, the mobile phone renders the map application screen through the GPU to obtain the application interface of the map application shown in interface 602. In this way, the dynamic effect of starting the application from interface 203 to interface 601 and then to interface 602 will not be stuck.
[0100] Specifically, considering that the scenarios of some applications are not complicated, when the mobile phone executes the animation, there will be no blocking problem when the GPU renders the application screen and the animation screen at the same time, which will not affect the smoothness of the animation screen. The mobile phone can first determine the application that will cause the animation to be stuck during the execution of the animation as the control application, determine the package name of the control application and store it in the control package name list. In this way, after receiving the user operation, the mobile phone determines the package name of the target application targeted by the above user operation (such as the user in Figure 1 The upward sliding operation starts in the middle interface 101, and the interface 101 is the application interface of the map application, then the target application refers to the map application). When the package name of the above target application matches any package name in the control package name list, the above target application is determined to be a control application. While the mobile phone is rendering the dynamic effect screen through the GPU, it sends a pause rendering instruction to the control application to control the control application to pause sending the application screen rendering task to the GPU, thereby reducing the load on the GPU and improving the smoothness of the dynamic effect. Until the dynamic effect ends, the mobile phone sends a resume rendering instruction to the control application to control the control application to resume sending the application screen rendering task to the GPU, and the mobile phone executes the application screen rendering task of the application through the GPU. For the sake of convenience, the above control package name list may also be referred to as a control list.
[0101] It should be noted that when the control application is started, after the mobile phone controls the control application to stop sending rendering tasks to the GPU, the mobile phone can obtain the last frame of image data before the control application stops sending rendering tasks to the GPU as a snapshot of the control application. Figure 4 4011 in the middle interface 401, Figure 5 5011 in middle interface 501, 5021 in interface 502). Or in the process of starting the control application, after the mobile phone controls the control application to stop sending rendering tasks to the GPU, the mobile phone can obtain a screenshot of the application screen when the control application ends running in the foreground, and the screenshot of the control application can be displayed during the execution of the dynamic effect by the mobile phone (such as Figure 66011 in the middle interface 601 is the startup window of the map application, which can display a screenshot of the map application when it ends in the foreground). After the animation ends, the mobile phone sends a resume rendering instruction to the control application, and the mobile phone executes the application screen rendering task of the control application through the GPU, and the mobile phone displays the application interface of the control application (such as Figure 4 4021 in the middle interface 402, Figure 5 In the middle interface 503, 5031 is a thumbnail interface of the rendered map application. Figure 6 The middle interface 602 is the application interface of the rendered map application. For ease of explanation, the above snapshot may also be referred to as the application screen of the first application when the target event ends, that is, the first image.
[0102] Generally speaking, control applications include key controls and non-key controls. Figure 6 The taxi service 1011 and parking service 1012 of the map application in the middle interface 203 are key controls, and the controls such as the positioning icon 1014 in the area 1013 of the map application in the interface 203 are all non-key controls. Among them, the control application generally uses the main thread to render the above-mentioned key controls. Performing rendering control operations on the key controls of the control application may cause the main thread of the control application to be abnormal, thereby causing the control application to display abnormally. In addition, the key controls are less complex and have less impact on the GPU load. Therefore, GPU rendering of key controls will not affect the smoothness of the dynamic effects. Taking the above into account, the mobile phone can perform rendering control operations on the non-key controls of the control application instead of rendering control operations on the key controls of the control application, so as to avoid the problem of abnormal display of the control application on the mobile phone due to affecting the main thread of the control application.
[0103] For example, the map application includes a map application key component and a map application view component (SurfaceView). The map application key component is used to create the main thread of the map application and send a rendering task 2 of the main image in the map application to the GPU. The main image may include: Figure 6 The middle interface 203 shows key controls such as taxi service 1011, public transportation, air tickets, tourist attractions, shopping malls, car rental services, parking services 1012, food, and more.
[0104] The map application view component is used to create a map image thread and send the map image in the map application to the GPU (such as Figure 6 The map image may include non-critical controls such as the positioning icon 1014. Therefore, the desktop application may specifically perform rendering control operations on the map application view component to implement rendering control operations on non-critical controls in the map application.
[0105] That is to say, when the mobile phone is executing the animation, it can send the animation screen rendering task to the GPU and control the key components of the map application to send rendering task 2 to the GPU. At the same time, the mobile phone can control the map application view component to suspend sending rendering task 1 to the GPU until the animation ends.
[0106] Continue to see Figure 6 , during the process of executing the animation of launching the application, the mobile phone can control the map application view component to stop sending the map image to the GPU (such as Figure 6 At the same time, the key component of the map application still sends the rendering task 2 of the main portrait to the GPU. Area 6011 in interface 601 can display a screenshot of the map application. Until the animation ends, the mobile phone controls the map application view component to send the rendering task 1 of the map portrait to the GPU, and obtains the application interface of the map application shown in interface 602. For the sake of convenience, the screenshot of the map application displayed in area 6011 in the above interface 601 can also be called a screenshot when the first application ends running in the foreground of the electronic device, and further, it can also be called a first image.
[0107] See also Figure 7 , which is a software and hardware structure diagram of a mobile phone provided in an embodiment of the present application.
[0108] Among them, the software system in the mobile phone can adopt a layered architecture, an event-driven architecture or a cloud architecture. The embodiment of the present application takes the Android™ system with a layered architecture as an example to illustrate the software structure of the mobile phone. The layered architecture can divide the software of the mobile phone into several layers, and 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 is divided into four layers, from top to bottom, namely, the application layer (Application layer), the application framework layer (Framework), the system library (native) and the kernel layer (Kernel).
[0109] The application layer 701 may include a variety of application packages, such as a desktop application (launcher) 7011 and a map application 7012 .
[0110] Exemplarily, the desktop application 7011 can implement the management business of the data display of the mobile phone 100. For example, when the mobile phone 100 executes the animation, the desktop application 7011 can control the rendering of the map application to manage the display data of the map application window in the mobile phone 100.
[0111] For example, a map application can implement positioning services (such as map navigation, taxi hailing, etc.).
[0112] The map application 7012 includes multiple components, such as a map application key component 70121 and a map application view component 70122. The map application 7012 uses the above multiple components to draw image data related to the positioning service. For example, the application interface of the map application 7012 (such as Figure 6 The interface 602 in FIG. 7 includes a map image and a main image. The map application view component 70122 is used to create an independent map image thread and send a map image (such as Figure 6 The map application key component 70121 is used to create an independent main image thread and send the main image (such as the area shown in 1013 in the middle interface 203) to the GPU. Figure 6 Rendering task 2 of the key controls such as taxi service 1011, public transportation, air tickets, tourist attractions, shopping malls, car rental services, parking services 1012, food, and more shown in the middle interface 203. For the sake of convenience, the main image thread of the above map application can also be called the main thread of the first application.
[0113] In response to the user's upward swipe operation on the multitasking interface, the desktop application 7011 sends a pause rendering instruction to the map application view component 70122 in the map application 7012, and the pause rendering instruction is used to instruct the map application view component to pause sending the rendering task 1 of the map image to the GPU. Alternatively, the desktop application 7011 can send a resume rendering instruction of the map image to the map application view component 70122 in response to the end of the animation effect.
[0114] In some embodiments, the desktop application 7011 can call classes and interfaces to implement rendering control operations on the map application 7012. The classes that can be called by the desktop application 7011 include APP PauseAction, APP Pause Wrapper, APP Pause provider, and Pause Render Provider.
[0115] See also Figure 8 The application pause action includes multiple methods such as swiping up to start (SWIPE_START), swiping up to end (SWIPE_HOME), entering multitasking (SWIPE_RECENT), entering multitasking (folding screen state) (SWIPE_RECENT_SINGLE), launching the application in the multitasking interface (RECENT_CLICK), and clicking the desktop icon to start (ICON_CLICK). In response to different user operations, the desktop application 7011 can call different methods in the application pause action.
[0116] For example, in response to the user starting an upward swipe operation in the interface of the map application 7012, the desktop application can call the upward swipe start method in the application pause action, and perform rendering control operations on the map application view component 70122 while the mobile phone 100 executes the upward swipe animation.
[0117] As another example, in response to the user completing the upward swiping operation on the interface of the map application 7012, the desktop application can call the entering multitasking method in the application pause action to implement the rendering control operation of the map application view component 70122 while the mobile phone 100 executes the animation of entering the multitasking interface.
[0118] The application pause action includes functions such as control start (start), control end (end) and gap (gap). When the control start function is called, it indicates the start of the rendering control operation, and when the control end function is called, it indicates the end of the rendering control operation.
[0119] The application pause action includes properties such as package name (packageName: String), control duration (duration: long), and trigger time (time: long). In response to any user operation, the method in the application pause action is called to perform initialization, and obtain the package name of the application corresponding to the user operation, the control duration, and the trigger time of the user operation. For example, in response to the user starting an upward swipe operation in the interface of the map application 7012, the desktop application can call the upward swipe start method in the application pause action to obtain the package name of the map application corresponding to the upward swipe operation, the control duration of the upward swipe animation, and the start time of the upward swipe operation.
[0120] The application pause action is used to call a wrapper. For example, the wrapper that can be called by the application pause action is the application pause wrapper (APP Pause Wrapper).
[0121] The application pause wrapper includes functions such as sending start animation (setIsLiteAnimation), desktop application pause (launcherOnStop), control start (start), control end (end) and get (get). Among them, when the control start function is called, it indicates that the rendering control operation encapsulation starts, and when the control end function is called, it indicates that the rendering control operation encapsulation ends. The application pause wrapper includes properties such as start animation (isLiteStartAnimation) and package name list (PKG_List).
[0122] The application pause wrapper is used to call the provider and counter. For example, the provider that the application pause wrapper can call is the APP Pause provider. The application pause wrapper can also be used to receive and store the control package name list returned by the pause provider.
[0123] The pause provider is used to call the pause rendering provider, receive the list of controlled package names returned by the pause rendering provider, and send it to the application pause wrapper. The pause provider includes functions such as pause (pause), store (restore), start (isEnabled), and get the list of controlled package names (getPkgList). When the pause function is called, the pause rendering instruction can be transmitted, and when the store function is called, the package name of the application can be stored. When the get the list of controlled package names function is called, the list of controlled package names can be obtained.
[0124] The pause rendering provider includes functions such as pause, store, start, get control package name list, pause rendering (pauseRendering), pause rendering list (initPauseRenderList), etc. When the pause rendering function is called, the pause rendering instruction can be transmitted. When the pause rendering list is called, the acquisition of the control package name list can be stopped. Exemplarily, when the get control package name list function in the pause rendering provider is called by the pause provider, the pause rendering provider can obtain the control package name list from the agp graphics service and send it to the pause provider.
[0125] Counters are used to manage the rendering control process. Counters include running actions (runningActions).
[0126] The counter also includes functions such as increase, decrease, empty, isExpired, and toString.
[0127] Exemplarily, the counter can call the control start function and the control end function based on the application pause action and the upward sliding operation end action to manage the rendering control process of the dynamic effect of entering the multi-tasking interface.
[0128] The application framework layer 702 may include a window manager service (wms), an agp graphics service (Agp Service), and a surface control (Surface Control), etc.
[0129] The Agp graphics service provides resources for applications, such as a list of managed package names. The window service provides windows for applications, for example, in response to user Figure 3The click operation of the thumbnail interface 2031 of the map application in the middle interface 203 is completed, and the window service creates a map application window. The interface control can provide management services of the display interface for the application program. For example, in response to the call of the desktop application, the interface control sends a pause rendering instruction to the map application view component 70122, and controls the map application view component to pause sending the rendering task 1 to the GPU to manage the display data of the mobile phone 100.
[0130] The system library 703 may include multiple functional modules. For example: Media Libraries, graphics processing library (for example: OpenGL ES), etc. The media library supports playback and recording of a variety of commonly used audio and video formats, as well as static image files, etc. The media library can support a variety of audio and video encoding formats, such as: MPEG4, H.264, MP3, AAC, AMR, JPG, PNG, etc. The graphics processing library is used to implement graphics drawing, image rendering, synthesis and layer processing, etc. In the process of image rendering, the graphics processing library can be used to convert rendering commands into graphics commands. In a specific implementation method, the GPU can determine the content of the application screen based on the graphics commands converted by the graphics processing library (such as the GPU converts the rendering task 1 to obtain graphics commands based on the graphics processing library, and can determine the complexity of the map image in the map application, etc.).
[0131] In some embodiments, the system library 703 also includes an image synthesis processing service (Surface Flinger) 7031. The image synthesis processing service 7031 can synthesize each frame of rendered image data and send it for display. For example, the image synthesis processing service 7031 can synthesize each frame of rendered image data into the dynamic effect of the multi-tasking interface, the main image of the map application, and the map image, and send them for display.
[0132] For example, the map application allocates a surface through window management, wherein the map application allocates a drawing image buffer (dequeueBuffer) to draw the map image. After drawing and rendering are completed, the queue buffer (queueBuffer) is pushed to the image synthesis processing service 7031 for synthesis and display.
[0133] In some specific embodiments, the desktop application 7011 may use the image synthesis processing service 7031 to send instructions to other applications. For example, the desktop application 7011 may use the image synthesis processing service 7031 to send a pause rendering instruction or a resume rendering instruction to the map application view component 70122.
[0134] The kernel layer 704 is a layer between hardware and software. The kernel layer 704 may include display drivers, camera drivers, CPU drivers, etc.
[0135] The hardware layer 705 includes a central processing unit (CPU) and a graphics processing unit (GPU).
[0136] The image data processing process includes a series of operations such as drawing, rendering, synthesis, and display.
[0137] In some embodiments, the image data in each frame pipeline displayed by the mobile phone 100 is drawn and rendered by the CPU and GPU, and finally synthesized and displayed by the image synthesis processing service.
[0138] See also Fig. 9 The CPU is used to perform drawing operations, including input, refresh, measure, layout, record, execute, display list, etc. The GPU performs resterization operations to render the image data in each frame pipeline, and then synthesizes it through the image synthesis processing service and sends it to the display screen for display.
[0139] The present application embodiment will be combined with Figure 7 The hardware and software architecture is also based on Figure 5 Take the process of entering the multitasking interface from the map application on a mobile phone as an example, combined with Fig.10 The business track diagram shown is further explained.
[0140] When the phone is running the map application in the foreground, the display is as follows: Figure 5 The middle interface 103 shows a thumbnail interface of a map application. At this time, the map application view component sends a rendering task 1 to the GPU, resulting in a high load on the GPU.
[0141] In response to the user completing the upward swipe operation on the thumbnail interface of the map application, the desktop application executes the dynamic effect of entering the multi-tasking interface, sends the rendering task 3 of the dynamic effect of entering the multi-tasking interface to the GPU, and at the same time sends a pause rendering instruction to the map application view component of the map application through the image synthesis processing service. Exemplarily, the desktop application can call the puaseRender() function to issue a pause rendering instruction. The pause rendering instruction includes the package name and control duration of the map application. In this way, the mobile phone can display the following: Figure 5 The animation of entering the multi-tasking interface shown in interface 501 and interface 502, wherein 5011 in interface 501 and 5021 in interface 502 are both thumbnail interfaces of the map application, used to display snapshots of the map application.
[0142] In response to receiving the pause rendering instruction, the map application view component pauses sending rendering task 1 to the GPU, at which point the GPU load is relatively light. In response to the end of the animation for entering the multitasking interface, the desktop application enters the foreground and sends a resume rendering instruction to the map application view component of the map application through the image synthesis processing service. Exemplarily, the desktop application can call the pauseRender function to issue a resume rendering instruction, which includes the package name and control duration of the map application, where the control duration is 0, indicating that exiting rendering control is smooth.
[0143] In response to receiving the resume rendering instruction, the map application view component sends rendering task 1 to the GPU, and the GPU is heavily loaded. The mobile phone can display Figure 5 In the interface 503, 5031 in the interface 503 is a thumbnail interface of the rendered map application.
[0144] In response to the mobile phone successfully switching the map application to background operation, the map application view component no longer sends rendering task 1 to the GPU, and the GPU load is relatively light. For ease of explanation, the moment when the mobile phone switches the map application to background operation can also be called the first moment.
[0145] Combination Fig.10 It can be seen that when the mobile phone is executing the animation of entering the multi-tasking interface, the desktop application is used to perform rendering control operations on the map application view component of the map application, which can reduce the load on the GPU, thereby improving the efficiency of the GPU rendering of the animation of entering the multi-tasking interface, making the multi-tasking interface animation display smooth.
[0146] It should be understood that the animation executed by the mobile phone has a certain execution time. If the mobile phone executes a certain animation for a long time, it may be that an abnormality occurred in the process of executing the animation, which made the animation unable to end. During this period, if the mobile phone has been performing rendering control operations on the control application, it may affect the normal operation of the main thread of the control application and cause abnormalities in the mobile phone display interface. Based on this, the mobile phone can set a control duration 1, and the control duration 1 can be the execution duration of the animation. The mobile phone performs a rendering control operation on the control application with a timing of control duration 1. In this way, the mobile phone can perform rendering control operations on the control application only within the animation duration. For the sake of convenience, the above-mentioned control duration 1 can also be referred to as the first duration.
[0147] Still taking the scenario of entering the multitasking interface from the map application as an example, the execution time of the animation for entering the multitasking interface is 600ms, then the mobile phone can set the control time 1 to 600ms. The timing starts from the moment the mobile phone executes the animation for entering the multitasking interface. If the duration of the mobile phone's execution of the animation for entering the multitasking interface reaches the control time 1, the mobile phone exits the rendering control process for the map application view component. For ease of explanation, the map application can also be referred to as the first application, and the map application view component of the map application can also be referred to as the interface view Surface View component of the first application.
[0148] The following still takes the scenario of entering the multi-tasking interface from the map application as an example, combining the content of determining whether to execute the rendering control process according to the control package name list, displaying the snapshot of the map application when pausing the rendering of the map portrait, and managing the rendering control process according to the control duration 1. Fig.11 This section describes how to implement the control process for the map application view component during the animation of the mobile phone entering the multi-tasking interface:
[0149] S000. The map application view component sends rendering task 1 to the GPU.
[0150] Specifically, when the mobile phone runs a map application in the foreground, the map application view component of the map application sends a rendering task 1 of a map image to the GPU.
[0151] It is understandable that, when the mobile phone runs a map application in the foreground, the map application key component of the map application can continuously send the rendering task 2 of the main image to the GPU to instruct the GPU to render the main image of the map application.
[0152] S001. In response to receiving rendering task 1, the GPU renders a map image.
[0153] Specifically, in response to receiving the rendering task 1 of the map image, the GPU executes the rendering task 1 to render the map image.
[0154] S002. GPU sends a map image to the display screen.
[0155] Specifically, when the GPU completes rendering of the map image, it sends the map image to the display screen frame by frame.
[0156] S003. The display screen displays interface 1, where interface 1 includes an application interface of a map application.
[0157] Specifically, when the mobile phone runs the map application in the foreground, the display screen displays interface 1 in response to receiving the main image and map image of the map application, and interface 1 includes the application interface of the map application, and the application interface of the map application includes the main image and the map image, see Figure 5 The interface 103 in.
[0158] S004. In response to receiving operation a, the desktop application obtains a list of control package names from the Agp graphics service.
[0159] Specifically, when the user performs operation a on the application interface of the map application, operation a is an upward sliding operation performed by the user on the application interface of the map application. The display screen sends the received desktop application operation a so that the desktop application responds to operation a.
[0160] S005. In response to the completion of operation a, the desktop application determines that the map application package name is in the management and control package name list.
[0161] Specifically, in response to receiving operation a, the desktop application can obtain the control package name list by calling the class and interface, and match the map application package name with the package names in the control package name list one by one. If there is a package name in the control package name list that matches the map application package name, the desktop application determines that the map application package name is in the control package name list and executes step S005.
[0162] It is understandable that if there is no package name matching the package name of the map application in the control package name list, the desktop application determines that the package name of the map application is not in the control package name list and exits the rendering control process.
[0163] It should be noted that between steps S004-S005, when the user performs operation a, when the mobile phone executes the upward sliding animation in response to operation a, the process of performing rendering control operations on the map application is also similar (for example, the desktop application determines that the package name of the map application is in the control package name list, the GPU renders the upward sliding animation, the desktop application controls the map application view component to send rendering task 1 to the GPU, etc.), which will not be repeated here.
[0164] S006. The desktop application sends rendering task 3 to the GPU. Rendering task 3 instructs the GPU to render a dynamic effect of entering the multi-task interface.
[0165] Specifically, after the desktop application determines that the map application package name is in the control package name list, it sends a rendering task 3 for entering the multi-task interface to the GPU, and the rendering task 3 instructs the GPU to render the dynamic effect of entering the multi-task interface.
[0166] S007 . In response to receiving rendering task 3 , the GPU renders an animation of entering the multi-task interface.
[0167] Specifically, in response to receiving rendering task 3, the GPU executes rendering task 3 to render a dynamic effect of entering the multi-tasking interface.
[0168] S008, the GPU sends an animation of entering the multi-task interface to the display screen. For the sake of convenience, the above rendering task 3 can also be called a second instruction.
[0169] Specifically, after the GPU completes rendering of the first frame of the dynamic effect of entering the multi-tasking interface, it sends the dynamic effect of entering the multi-tasking interface to the display screen frame by frame.
[0170] It should be noted that when the mobile phone displays the dynamic effect of entering the multitasking interface, it will display the dynamic effect of zooming out from the application interface of the map application to the thumbnail interface of the map application, as well as the dynamic effect of the orientation change of the thumbnail interface of the map application. Among them, the display content of the map application includes the snapshot of the map application (that is, the image data of the last frame sent by the map application when the desktop application sends a pause rendering instruction to the map application view component, see Figure 5 In the example, the thumbnail interface 5011 of the map application in the interface 501 and the thumbnail interface 5021 of the map application in the interface 502 are both used to display the snapshot of the map application). Based on this, the GPU rendering of the dynamic effect of entering the multi-tasking interface includes the process of the snapshot of the map application shrinking from the interface 501 to the interface 502 and the change of the orientation.
[0171] It should be understood that during the rendering control process of the mobile phone executing the dynamic effect of entering the multi-tasking interface, the snapshot only needs to be obtained once.
[0172] S009. The display screen displays interface 2, where interface 2 includes a dynamic effect for entering a multi-tasking interface.
[0173] Specifically, in response to receiving the first frame of the dynamic effect of entering the multi-task interface, the display screen displays interface 2, and interface 2 includes the dynamic effect of entering the multi-task interface. The dynamic effect of entering the multi-task interface includes Figure 5 The process from the middle interface 103 to the interface 501, and then to the interface 502. For the convenience of explanation, the above interface 2 can also be called the second interface.
[0174] S010. In response to the completion of operation a, the desktop application generates a pause rendering instruction 1, where the pause rendering instruction 1 includes a control duration 1.
[0175] Specifically, in response to the end of operation a, the desktop application obtains the package name and control duration 1 of the map application, and generates a pause rendering instruction 1 based on the package name and control duration 1 of the map application. For ease of explanation, the above-mentioned pause rendering instruction 1 may also be referred to as a first instruction.
[0176] It should be understood that in response to the end of operation a, the desktop application also needs to determine that the package name of the map application is in the control package name list. If there is no package name matching the package name of the map application in the control package name list, the desktop application determines that the package name of the map application is not in the control package name list and exits the rendering control process.
[0177] S011. The desktop application sends a pause rendering instruction 1 to the map application view component, and the pause rendering instruction 1 indicates to pause rendering of the map image.
[0178] Specifically, the desktop application sends a pause rendering instruction 1 to the map application view component to instruct the map application view component to pause sending the rendering task 1 to the GPU, thereby suspending the rendering of the map image.
[0179] S012. In response to receiving the pause rendering instruction 1, the map application view component pauses sending the rendering task 1 to the GPU.
[0180] Specifically, in response to receiving the pause rendering instruction 1, the map application view component pauses sending rendering task 1 to the GPU. In this way, when the mobile phone executes the multi-task interface animation, the GPU only executes the rendering task 3 of the multi-task interface animation and the rendering task 2 of the main image of the map application, which is light in load and improves the efficiency of GPU rendering.
[0181] S013. After receiving the pause rendering instruction 1, when the duration a reaches the control duration 1, the interface control generates the resume rendering instruction 1, and the duration a indicates the duration for the map application view component to suspend sending the rendering task 1.
[0182] Specifically, the interface control starts timing to obtain duration a when receiving the pause rendering instruction. Duration a can indicate the duration of the map application view component receiving the pause rendering instruction and suspending sending rendering task 1 to the GPU. When duration a reaches control duration 1, it is determined that the duration of the mobile phone's rendering control operation on the map application view component reaches the execution duration of the animation for entering the multi-tasking interface. The desktop application can stop entering the multi-tasking animation, and the interface control generates a resume rendering instruction 1 to control the map application view component to re-send rendering task 1 to the GPU. For the sake of convenience, the above-mentioned duration a can also be referred to as the time length of the first time interval. Rendering task 1 can also be referred to as the first rendering task. Rendering task 2 can also be referred to as the second rendering task. For the sake of convenience, the above-mentioned resume rendering instruction 1 can also be referred to as the fourth instruction.
[0183] For example, the control duration 1 is 600ms. When the duration a reaches 600ms, the mobile phone determines that it can exit the rendering control process. The interface controls the generation of a resume rendering instruction 1 to control the map application view component to continue to send rendering task 1 to the GPU to obtain a rendered map image.
[0184] It should be noted that if the multi-task interface animation has not been completed at this time, the interface control can return information about the multi-task interface animation exception to the desktop application.
[0185] In the above embodiment of determining the control duration 1, the example in which the mobile phone directly uses the execution duration of the dynamic effect of entering the multi-tasking interface as the control duration 1 is used for explanation. However, in actual applications, this is not used as an example. Exemplarily, the mobile phone can also select the execution duration with the largest value among all the execution durations of the dynamic effects as the control duration 1. Alternatively, the mobile phone can also increase the execution duration after determining the execution duration of the dynamic effect of entering the multi-tasking interface to obtain the control duration 1. Alternatively, the mobile phone can also increase the execution duration to obtain the control duration 1 after selecting the execution duration with the largest value among all the execution durations of the dynamic effects.
[0186] Taking the execution time of the multi-tasking interface animation as 600ms as an example, on this basis, the mobile phone can increase the control time by 1 to 700ms.
[0187] Alternatively, when the mobile phone determines that the maximum execution time of all animation effects is 750ms, the control time 1 is set to 750ms.
[0188] Alternatively, when the mobile phone determines that the maximum execution time of all animation effects is 750ms, the mobile phone can increase the control time by 1 to 1000ms.
[0189] The mobile phone increases the execution time based on the execution time of the animation (such as the multi-tasking animation) as the control time 1, or increases the execution time based on the execution time with the largest value among all the animations as the control time 1, so that the control time 1 can meet the execution time requirements of more animations. In this way, the time for the mobile phone to perform rendering control operations on the control application (such as the map application) can be increased, and the GPU will not be blocked during the execution of the animation by the mobile phone, so that the animation is displayed smoothly.
[0190] S014. The interface control sends a resume rendering instruction 1 to the map application view component, and the resume rendering instruction 1 instructs rendering of the map image.
[0191] Specifically, the interface controls sending a resume rendering instruction 1 to the map application view component, and the resume rendering instruction 1 is used to control the map application view component to resend the rendering task 1 to the GPU so that the GPU renders the map image.
[0192] S015. In response to receiving the resume rendering instruction 1, the map application view component sends the rendering task 1 to the GPU.
[0193] Specifically, when the map application is not switched to the background running state, the mobile phone still needs to display the thumbnail interface of the rendered map application (including the main image and the map image). Therefore, the map image thread created by the map application view component is still generating rendering task 1. In response to receiving the resume rendering instruction 1, the map application view component sends rendering task 1 to the GPU.
[0194] It is understandable that if the map application has been switched to the background running state when the map application view component suspends sending rendering task 1 to the GPU for a duration a that reaches the control duration 1, then the map application will no longer generate rendering task 1 in the map image thread created by the map application view component. In this case, in response to receiving the resume rendering instruction 1, the map application view component does not send rendering task 1 to the GPU, and the mobile phone can execute step S028.
[0195] S016. In response to the end of the animation of entering the multi-tasking interface, the desktop application generates a resume rendering instruction 2, and the resume rendering instruction 2 includes the package name of the map application.
[0196] Specifically, in response to the end of the animation of entering the multi-tasking interface, the desktop application exits the rendering control process of the map application view component and generates a resume rendering instruction 2, which includes the package name of the map application.
[0197] It can be understood that step S016 is a step executed in response to the end of the multi-task interface animation, and step S013 is a step executed in response to the map application view component suspending the sending of rendering task 1 to the GPU after the duration a reaches the control duration 1. Since the time point when the multi-task interface animation ends may arrive first, or the time point when the duration a reaches the control duration 1 may arrive first. The corresponding step can be executed in whichever step of step S013 and step S016 has the triggering condition met first.
[0198] For example, if the time point at which the multi-task interface animation ends arrives first, step S016 and associated steps S017-S018 are executed, but steps S013-S015 are not executed.
[0199] S017. The desktop application sends a resume rendering instruction 2 to the map application view component, and the resume rendering instruction 2 instructs rendering of the map image.
[0200] Specifically, the desktop application sends a resume rendering instruction 2 to the map application view component based on the package name of the map application, instructing the map application view component to send a rendering task 1 to the GPU so that the GPU renders the map image. For ease of explanation, the resume rendering instruction 2 may also be referred to as a third instruction.
[0201] It is understandable that when the mobile phone executes the rendering control process for the map application view component, it does not perform rendering control operations on the map application key components. That is to say, in response to the end of operation a, the electronic device can send map instructions to the map application key components so that the map application key components can continue to send rendering task 2 to the GPU. The GPU executes rendering task 2 and renders the main portrait of the map application but does not display it.
[0202] S018. In response to receiving the resume rendering instruction 2, the map application view component sends the rendering task 1 to the GPU.
[0203] Specifically, when entering the end of the multi-tasking animation, in response to receiving the resume rendering instruction 2, the map application view component sends the rendering task 1 to the GPU until the map application is switched to the background running state.
[0204] S019. In response to receiving rendering task 1, the GPU renders a map image.
[0205] Specifically, after the multi-task interface animation ends, in response to receiving the rendering task 1 sent by the map application view component, the GPU executes the rendering task 1 to render the map image.
[0206] S020. GPU sends the map image to the display screen.
[0207] Specifically, in response to completing the rendering of the first frame of the map image, the GPU may send the map image to the display screen frame by frame.
[0208] S021. The display screen displays interface 3, where interface 3 includes a multi-task interface, and the multi-task interface includes a thumbnail interface of a map application.
[0209] Specifically, when the multitasking interface animation ends, the interface 3 displayed on the display screen of the mobile phone includes the multitasking interface. At this time, the map application has not successfully switched to the background running state, so the interface 3 also includes the thumbnail interface of the map application. Among them, the thumbnail interface of the map application includes the map image and the main image obtained by GPU rendering, see Figure 5 Middle interface 503.
[0210] S022. In response to the map application switching to background operation, the desktop application generates a screenshot acquisition instruction.
[0211] Specifically, in response to the map application switching to background operation, the desktop application no longer displays the application screen of the map application, but can display a screenshot of the map application, where the screenshot of the map application is an image of the map application displayed on the display screen when the map application ends running in the foreground.
[0212] For example, see Figure 5The thumbnail interface 5031 of the map application in the interface 503 shows: after the animation of entering the multi-tasking interface ends, the application screen of the map application rendered by the GPU (including the map image and the main image); if the map application is switched to the background at this time, the desktop application captures the image of the area where the thumbnail interface 5031 of the map application in the interface 503 is located as a screenshot of the map application in the multi-tasking interface.
[0213] S023. The desktop application sends a screenshot acquisition instruction to the window service.
[0214] Specifically, the desktop application sends a screenshot acquisition instruction to the window service to instruct the window service to capture a screenshot of the map application.
[0215] S024. In response to receiving the screenshot acquisition instruction, the window service captures the image displayed in the thumbnail interface of the map application when the map application ends running in the foreground, as a screenshot of the map application.
[0216] S025. The window service sends a screenshot of the map application to the display screen.
[0217] Specifically, after the window service captures the screenshot of the map application, it sends it to the display screen.
[0218] S026. The window service stores the screenshot in memory.
[0219] Specifically, the window service stores the screenshot of the map application in the memory.
[0220] S027. Screenshots of the memory storage map application.
[0221] S028. The display screen displays interface 4, where interface 4 includes a multi-tasking interface, and the multi-tasking interface includes a screenshot of a map application.
[0222] Specifically, in response to the map application switching to background operation, the GPU no longer renders the main image and the map image of the map application. In this case, the display screen displays interface 4, which includes a multi-tasking interface. Among them, the multi-tasking interface includes a screenshot of the map application.
[0223] It should be understood that the operation of the mobile phone switching the map application from the foreground to the background may be completed while the mobile phone is executing the animation of entering the multitasking interface. Alternatively, the mobile phone completes the operation of switching the map application from the foreground to the background after the mobile phone completes the animation of entering the multitasking interface. This embodiment is only explained by taking the example that the mobile phone successfully switches the map application from the foreground to the background after executing the animation of entering the multitasking interface, and does not constitute a limit on the time for switching the map application to the background.
[0224] Based on this, the execution order of step S016 and step S022 is not based on Fig.11 For restriction.
[0225] The following still takes the scenario of entering the multitasking interface from the map application as an example. Fig.12 Detailed description of the process in which the desktop application 6011 calls classes and interfaces to implement the rendering control process of the map application view component when the mobile phone executes the animation effect of entering the multi-tasking interface:
[0226] S000. The map application view component sends rendering task 1 to the GPU.
[0227] S001. In response to receiving rendering task 1, the GPU renders a map image.
[0228] S002. GPU sends a map image to the display screen.
[0229] S003. The display screen displays interface 1, where interface 1 includes an application interface of a map application.
[0230] It can be understood that steps S000 to S003 can refer to the relevant description in the previous embodiment and will not be repeated here.
[0231] S103. In response to receiving operation a, the desktop application calls an application pause action.
[0232] Specifically, in response to receiving operation a, the desktop application calls the application pause action, executes the multi-tasking interface animation and the corresponding rendering control process.
[0233] Exemplarily, the desktop application calls a SWIPE_START action in the application pause action.
[0234] S104: Initialize application pause action.
[0235] Specifically, in response to the call of the desktop application, the application pause action executes an initialization process to create a callable application pause encapsulator and a pause rendering provider.
[0236] S105: The application pause action calls the application pause wrapper.
[0237] Specifically, the application pause action calls the application pause wrapper to instruct the application pause wrapper to obtain the control package name list.
[0238] Exemplarily, the application pause action may call the application pause wrapper get() function to instruct the application pause wrapper to obtain a list of control package names.
[0239] S106: The application pauses the initialization of the encapsulator.
[0240] Specifically, in response to the call of the application pause action class, the application pause encapsulator performs initialization, creates a provider (specifically, the application pause encapsulator), and calls the pause rendering provider.
[0241] Specifically, the application pause wrapper may call a new() function to create a provider.
[0242] S107: The application pause encapsulator calls the pause rendering provider.
[0243] Specifically, the application pause encapsulator calls the pause rendering provider to instruct the pause rendering provider to obtain the control package name list from the AGP graphics service.
[0244] In some embodiments, when the pause rendering provider is initialized, a function parameter is called to indicate whether the pause rendering function (transact) is started. The above function parameters may include started and not started. Exemplarily, the function parameter for calling the control package name list is ro.vendor.display.anim_pauseRender.config. When ro.vendor.display.anim_pauseRender.config==0, it indicates that the pause rendering function is not started. When ro.vendor.display.anim_pauseRender.config==1, it indicates that the pause rendering function is started. That is, when ro.vendor.display.anim_pauseRender.config==1, the pause rendering provider can call the pause rendering function to obtain the control package name list from the Agp service.
[0245] S108. In response to the call of the application pause wrapper, the pause rendering provider obtains a management package name list from the AGP graphics service.
[0246] Specifically, in response to the call of the application pause wrapper, the pause rendering provider obtains the control package name list PKG_LIST from the AGP graphics service.
[0247] S109. The pause rendering provider sends the control package name list and the pause rendering provider to the application pause encapsulator.
[0248] Specifically, the pause rendering provider sends the control package name list to the application pause encapsulator, so that the application pause encapsulator can store the control package name list. At the same time, the pause rendering provider sends the pause rendering provider provider to the application pause encapsulator, so that the application pause encapsulator can call the pause rendering provider next time.
[0249] S110: The application suspension encapsulator sends the application suspension encapsulator to the application suspension action class.
[0250] Specifically, the application pause wrapper sends the application pause wrapper to the application pause action class, so that the application pause action class can call the application pause wrapper next time.
[0251] It can be understood that the above steps SS03 to S110 are call operations performed during the initialization of the desktop application, which can be seen in Fig.11 Step S003 in .
[0252] S111. In response to the completion of operation a, the desktop application sends a rendering task 3 to the GPU, where the rendering task 3 indicates rendering a dynamic effect of entering a multi-tasking interface.
[0253] It can be understood that, for steps S111 to S114, reference can be made to the relevant descriptions of steps S006 to S009 in the previous embodiment, and will not be repeated here.
[0254] S112 . In response to receiving rendering task 3 , the GPU renders an animation of entering the multi-task interface.
[0255] S113. The GPU sends the animation of the multi-tasking interface to the display screen.
[0256] S114. The display screen displays interface 2, where interface 2 includes a dynamic effect for entering a multi-tasking interface.
[0257] S115. In response to the completion of operation a, the desktop application generates a calling instruction 1, which includes the package name of the map application and the control duration 1.
[0258] Specifically, in response to the completion of operation a, the desktop application obtains the package name and control duration 1 of the map application, and generates a call instruction 1 based on the package name and control duration 1 of the map application, and the call instruction 1 includes the package name and control duration 1 of the map application.
[0259] In some embodiments, the calling instruction 1 also includes a triggering time 1 of the animation effect of entering the multi-tasking interface, and the triggering time 1 of the animation effect of entering the multi-tasking interface can also be called the end time of operation a.
[0260] It can be understood that both step S110 and step S115 are steps executed by the desktop application in response to the completion of operation a, and the execution order of the above two steps is not based on Fig.12 Similarly, steps S111-S114 associated with step S110 and steps S116-S122 associated with step S115 are not limited to the order shown in FIG. Fig.12 The order shown is a limitation.
[0261] S116. The desktop application sends a call instruction 1 to the application pause action.
[0262] Specifically, the desktop application calls the application pause action and sends a call instruction 1 to the application pause action.
[0263] Exemplarily, the desktop application calls the start() function in the swipe up to end (SWIPE_RECNET) action in the application pause action, and sends a call instruction 1 (that is, including the package name of the map application and the control duration 1) to the application pause action.
[0264] S117 , the application suspension action sends a call instruction 1 to the application suspension encapsulator.
[0265] Specifically, the application suspension action calls the application suspension encapsulator to send a call instruction 1 to the application suspension encapsulator.
[0266] Exemplarily, the swipe up to end (SWIPE_RECNET) action in the application pause action executes the start() function, calls the start() function of the application pause wrapper, and sends a call instruction 1 to the application pause wrapper.
[0267] Exemplarily, the application pause action calls the start() function to send a call instruction 1 to the application pause wrapper.
[0268] S118. In response to receiving the call instruction 1, the application suspension packager determines that the application package name is in the control package name list.
[0269] Specifically, in response to receiving the call instruction 1, the application suspension encapsulator matches each package name in the control package name list with the package name of the map application one by one. If there is a package name in the control package name list that matches the package name of the map application, it is determined that the package name of the map application is in the control package name list. If there is no package name in the control package name list that matches the package name of the map application, it is determined that the package name of the map application is not in the control package name list.
[0270] For example, the application pause wrapper can determine whether the pause rendering function is enabled. If the pause rendering function is enabled, the application pause wrapper is executed to match each package name in the control package name list with the package name of the map application one by one.
[0271] S119. The application pause encapsulator sends a pause rendering instruction 1 to the pause rendering provider. The pause rendering instruction 1 includes the package name of the map application and the control duration 1.
[0272] Specifically, the application pause encapsulator calls the pause rendering provider and sends a pause rendering instruction 1 to the pause rendering provider. The pause rendering instruction 1 includes the package name of the map application and the control duration 1.
[0273] Exemplarily, the application pause encapsulator calls the pause() function of the pause rendering provider to send a pause rendering instruction 1 to the pause rendering provider, where the pause rendering instruction 1 includes the package name of the map application and the control duration 1.
[0274] S120. The pause rendering provider sends a pause rendering instruction 1 to the interface control.
[0275] Specifically, in response to the call of the application pause wrapper, the pause rendering provider calls the interface control and sends a pause rendering instruction 1 to the interface control.
[0276] Exemplarily, the pause rendering provider calls the sendAnimationState() function of the interface control to send a pause rendering instruction 1 to the interface control.
[0277] S121. The interface control sends a pause rendering instruction 1 to the map application view component.
[0278] Specifically, in response to receiving the pause rendering instruction 1, the interface control sends the pause rendering instruction 1 to the map application view component according to the package name of the map application carried by the pause rendering instruction.
[0279] S122. In response to receiving the pause rendering instruction 1, the map application view component pauses sending the rendering task 1 to the GPU.
[0280] S123. After receiving the pause rendering instruction 1, when the duration a reaches the control duration 1, a resume rendering instruction 1 is generated, and the duration a indicates the duration for which the map application view component pauses sending the rendering task 1.
[0281] S124. The interface control sends a resume rendering instruction 1 to the map application view component, where the resume rendering instruction 1 instructs rendering of the map image.
[0282] S125. In response to receiving the resume rendering instruction 1, the map application view component sends the rendering task 1 to the GPU.
[0283] It is understandable that if the map application has been switched to the background running state when the map application view component suspends sending rendering task 1 to the GPU for a duration a that reaches the control duration 1, then the map application will no longer generate rendering task 1 in the map image thread created by the map application view component. In this case, in response to receiving the resume rendering instruction 1, the map application view component does not send rendering task 1 to the GPU, and the mobile phone can execute step S143.
[0284] It can be understood that the above steps S122-S125 can refer to the relevant description of steps S012-015 in the previous embodiment, and will not be repeated here.
[0285] S126. In response to the end of the animation of entering the multi-tasking interface, the desktop application generates a resume rendering instruction 2, and the resume rendering instruction 2 includes the package name of the map application.
[0286] It can be understood that step S126 is a step executed in response to the end of the multi-task interface animation, and step S123 is a step executed in response to the time length a reaching the control time length 1. The time point at which the multi-task interface animation ends may arrive first, or the time point at which the time length a reaches the control time length 1 may arrive first. Step S123 and step S126 are not based on Fig.12 The order shown is a limitation.
[0287] For example, in response to the end of operation a, the upward sliding animation ends, and the desktop application can call the upward sliding end method in the application pause action to execute the control start end() function and transmit the package name of the map application.
[0288] S127. The desktop application sends a resume rendering instruction 2 to the application pause action.
[0289] Exemplarily, the desktop application may call the end() function of the upward sliding end method in the application pause action to send a resume rendering instruction 2 to the application pause action.
[0290] S128. The application pause action sends a resume rendering instruction 2 to the application pause encapsulator.
[0291] Exemplarily, the upward sliding end method execution control starts the end() function to call the end() function of the application pause wrapper to send the resume rendering instruction 2 to the application pause wrapper.
[0292] S129. In response to receiving the resume rendering instruction 2, the application pause packager determines that the package name of the map application is in the control package name list.
[0293] Specifically, the application pause encapsulator obtains the package name of the map application. The application pause encapsulator matches each package name in the control package name list with the package name of the map application one by one. When there is a package name in the control package name list that matches the package name of the map application, it is determined that the package name of the map application is in the control package name list, and the pause rendering provider is called.
[0294] For example, the application pause wrapper can determine whether the pause rendering function is enabled. If the pause rendering function is enabled, the application pause wrapper is executed to match each package name in the control package name list with the package name of the map application one by one.
[0295] S130: The application pause encapsulator sends a resume rendering instruction 2 to the pause rendering provider.
[0296] Exemplarily, when it is determined that the package name of the map application is in the control package name list, the application pause encapsulator calls the restore() function of the pause rendering provider to transmit the resume rendering instruction 2 to the pause rendering provider.
[0297] S131. The pause rendering provider sends a resume rendering instruction 2 to the interface control, and the resume rendering instruction 2 instructs rendering of the map image.
[0298] Specifically, the pause rendering provider sends a resume rendering instruction 2 to the interface control to instruct the interface control to end the rendering control. The interface control can control the map application view component to re-send the rendering task 1 to the GPU.
[0299] Exemplarily, the pause rendering provider calls the interface control sendAnimationState() function to send a resume rendering instruction 2 to the interface control, where the resume rendering instruction 2 includes the package name of the map application and the control duration 3. The control duration 3 is set to 0 to indicate exiting the rendering control process.
[0300] S132. The interface controls sending a resume rendering instruction 2 to the map application view component.
[0301] Specifically, in response to receiving the resume rendering instruction 2, the interface control determines the package name of the map application carried by the resume rendering instruction 2, and resumes the rendering instruction 2 to the map application view component according to the package name of the map application.
[0302] S133. In response to receiving the resume rendering instruction 2, the map application view component sends the rendering task 1 to the GPU.
[0303] S134. In response to receiving rendering task 1, the GPU renders a map image.
[0304] S135. GPU sends the map image to the display screen.
[0305] S136. The display screen displays interface 3, where interface 3 includes a multi-task interface, and the multi-task interface includes a thumbnail interface of a map application.
[0306] It should be noted that during the rendering control operation of the map application view component by the mobile phone, the key component of the map application can continuously send the rendering task 2 of the main image to the GPU, and the GPU executes the rendering task 2 to obtain the above main image and send it for display. Based on this, the multi-task interface displayed on the display screen includes the thumbnail interface of the map application, and the thumbnail interface of the map application only includes the above main image.
[0307] S137. In response to the map application switching to background operation, the desktop application generates a screenshot acquisition instruction.
[0308] S138. The desktop application sends a screenshot acquisition instruction to the window service.
[0309] S139. In response to receiving the screenshot acquisition instruction, the window service captures the image displayed in the thumbnail interface of the map application when the map application ends running in the foreground as a screenshot of the map application.
[0310] S140. The window service sends a screenshot of the map application to the display screen.
[0311] Specifically, after the window service captures the screenshot of the map application, it sends it to the display screen.
[0312] S141. The window service stores the screenshot of the map application in memory.
[0313] Specifically, the window service sends the screenshot to memory and stores it
[0314] S142. Screenshots of the map application stored in memory.
[0315] S143. The display screen displays interface 4, where interface 4 includes a multi-task interface, and the multi-task interface includes a screenshot of a map application.
[0316] Specifically, for steps S133 to S142, reference may be made to the relevant descriptions of steps S018 to S028 in the previous embodiments, which will not be repeated here.
[0317] It is understandable that, for the same reasons as step S020 and step S026, the execution order of step S131 and step S142 is not in the order of Fig.12 For restriction.
[0318] By adopting the above rendering control process, the desktop application can control the map application view component to suspend sending rendering task 1 to the GPU when the mobile phone executes the animation effect of entering the multi-tasking interface. After the map application view component suspends sending rendering task 1 to the GPU for a period of time a that reaches the control period 1, or after the animation effect of entering the multi-tasking interface ends, the desktop application controls the map application view component to continue sending rendering task 1 to the GPU. In this way, when the mobile phone executes the animation effect of entering the multi-tasking interface, the GPU load is reduced, the rendering speed of the animation effect of entering the multi-tasking interface is improved, and the animation effect of entering the multi-tasking interface is smooth.
[0319] In the previous article Figure 10-12 In the embodiment of rendering control, the process of executing the dynamic effect of entering the multi-tasking interface on a mobile phone is mainly used as an example to illustrate. In actual application, in response to the user's upward sliding operation (such as Figure 5In the example of the user raising his hand from the interface 103), the process of the mobile phone executing the upward sliding effect is similar to the process of executing the dynamic effect of entering the multi-tasking interface described above, and will not be repeated here. Fig.13 The overall process of combining the two is illustrated as follows:
[0320] S201. In response to starting to receive an upward sliding operation, the desktop application is initialized and a list of management package names is obtained.
[0321] Specifically, when the mobile phone runs the map application in the foreground, the desktop application displays the application interface of the map application (such as Figure 1 When the user performs an upward sliding operation from the bottom to the top in the application interface of the map application, the desktop application initializes and obtains the control package name list in response to receiving the upward sliding operation of the user.
[0322] Exemplarily, the desktop application calls the SWIPE_START action in the application pause action, the SWIPE_START action executes the start() function, calls the start() function of the application pause wrapper, and determines the package name and control duration 2 of the map application.
[0323] Specifically, the desktop application can call the application pause action, application pause wrapper, pause provider and pause rendering provider to perform initialization and obtain the control package name list from the Agp graphics service.
[0324] S202: The desktop application determines whether the package name of the map application is in the managed package name list.
[0325] Specifically, the desktop application determines the package name of the map application, and matches the package name of the map application with the package names in the control package name list one by one. If there is a package name matching the package name of the map application in the control package name list, it is determined that the package name of the map application is in the control package name list, and the desktop application executes step S203. If there is no package name matching the package name of the map application in the control package name list, it is determined that the package name of the map application is not in the control package name list, and the desktop application executes step S207.
[0326] S203. The desktop application sends a pause rendering instruction 2 to the map application view component, where the pause rendering instruction 2 includes a control duration 2.
[0327] Specifically, if there is a package name in the control package name list that matches the package name of the map application, the desktop application performs a rendering control operation on the map application. Therefore, the desktop application can generate a pause rendering instruction 2 based on the user's upward swipe operation, and send a pause rendering instruction 2 to the map application view component. The pause rendering instruction 2 is used to control the map application to pause sending rendering task 1 to the GPU. Control duration 2 is the maximum duration for the desktop application to perform a rendering control operation on the map application during the upward swipe animation. Exemplarily, control duration 2 can be 2000ms, or control duration 2 can be 2500ms. For ease of explanation, the above-mentioned control duration 2 may also be referred to as the second duration.
[0328] For example, when the start() function in the application pause wrapper is called, it can be determined whether the pause rendering function is started. If the pause rendering function is started, the application pause wrapper is executed to match each package name in the control package name list with the package name of the map application one by one. Then, when it is determined that the package name of the map application is in the control package name list, the pause() function of the pause rendering provider is called, and the pause rendering provider calls the sendAnimationState() function of the interface control to transmit the package name of the map application and the control duration 2.
[0329] In response to receiving the pause rendering instruction 2, the map application executes step S204.
[0330] S204. The map application view component suspends sending rendering task 1 to the GPU.
[0331] Specifically, when the map application view component receives the pause rendering instruction 1, it pauses sending the rendering task 1 to the GPU.
[0332] It should be understood that when the mobile phone is executing the sliding-up animation, the desktop application performs rendering control on the map application view component. The mobile phone can obtain the last frame of the map application as a snapshot of the map application when the desktop application sends a pause rendering instruction 2 to the map application view component. The GPU rendering of the sliding-up animation includes rendering the animation of the snapshot of the map application (see Figure 4 The thumbnail interface 4011 of the map application in the middle interface 401 displays a snapshot of the map application). In the dynamic effect of the mobile phone display sliding upward from the interface 101 to the interface 401, the size of the snapshot of the map application is reduced and the orientation is changed.
[0333] S205. When the duration a reaches the control duration 1 or the control duration 2, the desktop application sends a resume rendering instruction 1 to the map application view component.
[0334] Considering that when the mobile phone performs the rendering control operation on the map application view component for a long time (i.e., time length a) during the process of sliding up, the main thread of the desktop application may be affected, and the mobile phone may have display abnormalities. The mobile phone can set a control time length 2, which can be the longest execution time of the sliding up animation. The mobile phone performs a rendering control operation on the map application view component with a timing of control time length 2. In this way, the mobile phone can perform the rendering control operation on the map application view component only within the longest execution time of the sliding up animation. When the time for the mobile phone to perform the rendering control operation on the map application view component reaches the control time length 2, even if the user's sliding up operation has not ended, the mobile phone exits the rendering control process for the map application view component. For the sake of convenience, the time interval for the mobile phone to perform the rendering control operation on the map application view component during the process of sliding up can also be referred to as the second time interval, and the time (i.e., time length a) for the mobile phone to perform the rendering control operation on the map application view component during the process of sliding up can also be referred to as the time length of the second time interval.
[0335] Specifically, when the map application suspends sending rendering tasks to the GPU for a duration a that reaches a control duration 2, the desktop application stops executing the upward sliding animation, and the desktop application sends a resume rendering instruction 1 to the map application, so that the main thread of the desktop application runs normally.
[0336] Specifically, the desktop application starts timing when the map application view component suspends sending rendering tasks to the GPU, which is taken as duration a. When the duration a during which the map application view component suspends sending rendering tasks to the GPU reaches the control duration 2, the desktop application stops executing the operation animation, and the desktop application sends a resume rendering instruction 1 to the map application view component. The resume rendering instruction 1 is used to control the map application view component to send rendering task 1 to the GPU. Alternatively, when the control duration 2 is first reached, the desktop application stops executing the animation of entering the multi-tasking interface, and the desktop application sends a resume rendering instruction 1 to the map application view component.
[0337] In response to receiving the resume rendering instruction 1, the map application view component executes step S206.
[0338] S206. The map application view component sends rendering task 1 to the GPU.
[0339] Specifically, in response to receiving the resume rendering instruction 1, the map application view component sends the rendering task 1 to the GPU, and the desktop application executes step S207.
[0340] S207: The desktop application exits the rendering control process.
[0341] Specifically, when the duration that the map application view component suspends sending rendering tasks to the GPU (also known as the duration that the desktop application performs rendering control operations on the map application view component) reaches control duration 1 or control duration 2, stop performing rendering control on the map application view component in a timely manner and exit the rendering control process.
[0342] When the user's upward sliding operation ends, the desktop application executes step S208.
[0343] S208. In response to the upward sliding operation being completed, the desktop application executes an animation of entering the multi-tasking interface.
[0344] Specifically, in response to the user's upward sliding operation ending, the desktop application executes the animation of entering the multi-tasking interface, and the desktop application sends rendering task 3 to the GPU.
[0345] S209: The desktop application determines whether the package name of the map application is in the managed package name list.
[0346] Specifically, the desktop application determines the package name of the map application, and matches the package name of the map application with the package names in the control package name list. If there is a package name matching the package name of the map application in the control package name list, the desktop application executes step S210. If there is no package name matching the package name of the map application in the control package name list, the desktop application executes step S207.
[0347] S210. The desktop application sends a pause rendering instruction 1 to the map application view component, where the pause rendering instruction 1 includes a control duration 1.
[0348] Specifically, if there is a package name matching the package name of the map application in the control package name list, the desktop application performs a rendering control operation on the map application view component. The desktop application sends a pause rendering instruction 1 to the map application view component, and the pause rendering instruction 1 includes a control duration 1. The pause rendering instruction 1 is used to instruct the map application view component to pause sending rendering task 1 to the GPU.
[0349] In response to receiving the second pause rendering instruction, the map application executes step S204.
[0350] S211. In response to the end of the animation of entering the multi-tasking interface, the desktop application sends a resume rendering instruction 2 to the map application view component.
[0351] Specifically, in response to the end of the animation of entering the multi-tasking interface, the desktop application sends a resume rendering instruction 2 to the map application view component, and the resume rendering instruction 2 is used to instruct the map application view component to re-send the rendering task to the GPU.
[0352] In response to receiving the resume rendering instruction 2, the map application view component executes step S206, and then the desktop application executes step S207.
[0353] When the mobile phone starts the upward sliding operation, the map application matching the control package name list is controlled to enter the rendering control process, which reduces the load on the GPU during the execution of the upward sliding animation, so that the upward sliding animation is displayed smoothly. When the upward sliding operation ends, the map application matching the control package name list continues to be controlled to enter the rendering control process, which reduces the load on the GPU during the execution of the animation of entering the multitasking interface, so that the animation of entering the multitasking interface is displayed smoothly.
[0354] See also Fig.14 In the running status trace diagram of the mobile phone shown in 1401, in general, in response to the user's upward sliding operation, the main thread of the desktop application in the mobile phone includes multiple frames of dynamic effects for entering the multi-task interface (such as fps1, fps2, fps3, fps4, fps5, frame 1 can also be called rendering task 3). The above-mentioned dynamic effects for entering the multi-task interface need to perform drawing, rendering, synthesis and other operations before being sent to display. The map application view component thread created by the map application view component (Surface View) includes multiple frames of map images (also called rendering task 1). The image synthesis processing service (SurfaceFlinger) includes a queue buffer, which is used to send the above-mentioned dynamic effects for entering the multi-task interface and multiple frames of map images to the GPU in queue order, so that the GPU can render the dynamic effects and map images for entering the multi-task interface. Due to the complex scene of the map image, the GPU load is high, blocking occurs, and the multi-task interface dynamic effects of fps3 in the main thread of the desktop application wait for a long time to be rendered, resulting in a longer frame length of the multi-task interface dynamic effects of fps3 (such as the frame length of fps3 is 56ms). In this case, it indicates that there is a frame loss problem in the main thread of the desktop application, and the animation effect of entering the multitasking interface is stuck.
[0355] After using the rendering method, the running status trace of the mobile phone is as follows Fig.14 As shown in 1402, in response to the user's upward sliding operation, the main thread of the desktop application in the mobile phone includes the dynamic effects of multiple frames entering the multi-tasking interface (such as fps6, fps7, fps8, fps9, fps10, fps11). After the desktop application sends a pause rendering instruction to the map application view component, the map application view component pauses sending rendering task 1 to the GPU. In this way, the queue buffer of the image synthesis processing service can send the above-mentioned dynamic effects of multiple frames entering the multi-tasking interface to the GPU in queue order, so that the GPU completes the rendering operation of the dynamic effects of multiple frames entering the multi-tasking interface. In this case, the map portrait thread is in a state of waiting for the GPU.
[0356] according to Fig.14 It can be seen from the running status diagrams in 1401-1402 that after adopting the rendering method, the map application view component controls the map portrait thread to no longer send rendering task 1 to the GPU, the load on the GPU is reduced, and the waiting time for rendering task 3 of the dynamic effect of entering the multi-tasking interface sent by the desktop application main thread to the GPU is reduced, thereby reducing the frame length and improving the smoothness of the dynamic effect of entering the multi-tasking interface.
[0357] above Figure 10-Figure 14 The embodiment of the present invention mainly takes the process of a mobile phone entering a multi-task interface from a map application as an example for explanation. The process of a mobile phone starting a map application in a multi-task interface is similar. Fig.15 The business track diagram shown is further explained:
[0358] In response to a user in a multitasking interface (such as Fig.16 Middle interface 203) for map application thumbnail interface (such as Fig.16 The click operation of 2031 in the inner interface 203 is completed, and the desktop application receives the event of starting the map application. The desktop application sends a command to start the map application to the window service. In response to the command to start the map application, the window service adds a map application window and obtains a map application screenshot from the memory. In response to the completion of adding the map application window, the window service sends an instruction to execute the dynamic effect of starting the application to the desktop application, instructing the desktop application to send a rendering task 4 of the dynamic effect of starting the application to the GPU. In this way, the mobile phone can display the following Fig.16 In the middle interface 1501, 15011 in the interface 1501 is a map application window, which is used to display a screenshot of the map application.
[0359] At the same time, in response to the completion of adding the map application window, the desktop application sends a start map application instruction to the map application key component and the map application view component. After receiving the start map application instruction, the map application key component hot starts and creates the main image thread of the map application. The main image thread of the map application creates the layer of the map application and sends the rendering task 2 of the main image to the GPU to instruct the GPU to render the main image. After receiving the start map application instruction, the map application view component creates a map image thread in the map application.
[0360] In response to the completion of adding the map application window, the desktop application sends a pause rendering instruction 3 to the map application view component. After receiving the pause rendering instruction 3, the map application view component controls the map image thread to enter the rendering control state and pauses sending the map image to the GPU (such as Fig.16 Rendering task 1 of the area shown as 15012 in the middle interface 1501.
[0361] When the rendering of the first frame main image is completed, the main image thread of the map application sends a first message indicating that the rendering of the first frame main image is completed to the window service. In response to receiving the first message, the window service removes the window of the map application and deletes the screenshot of the map application. It can be understood that in this case, the thumbnail interface of the map application displayed on the display screen (see Fig.16 The middle interface 15021) includes only the main image. In this case, the area of the map image in the thumbnail interface 15021 of the map application appears transparent. For ease of explanation, the first frame main image can also be referred to as the first frame image rendered by the second rendering task.
[0362] Then, in response to the end of the animation effect of launching the application, the desktop application sends a resume rendering instruction 3 to the map application view component. In response to receiving the resume rendering instruction 3, the map application view component controls the map image thread to send a map image rendering task 1 to the GPU. When the GPU completes rendering the first frame of the map image, the GPU sends it to the display. It can be understood that in this case, the display screen can display the application interface of the map application including the main image and the map image, such as Fig.16 Middle interface 1503.
[0363] Below, combined with the attached Fig.17 Detailed description of the rendering control process performed by the mobile phone during the execution of the animation effect of launching the application:
[0364] S303: In response to the received operation b being completed, the desktop application generates an instruction to start the map application.
[0365] Specifically, the display screen of the mobile phone displays interface 4, which includes a multi-tasking interface (see Fig.16 The multitasking interface includes a thumbnail interface of a map application, and a screenshot of the map application is displayed in the thumbnail interface of the map application (see Fig.16 The thumbnail interface 2031 of the map application in the interface 203 is used to display a screenshot of the map application). The user performs operation b on the thumbnail interface of the map application in the multitasking interface, and the display screen receives operation b. Operation b is a click operation on the thumbnail interface of the map application. The display screen sends operation b to the desktop application to trigger the desktop application to perform a rendering control operation.
[0366] It should be noted that when the mobile phone receives the end of the user's click operation on the map application interface in the multitasking interface, the mobile phone hot starts the map application. Hot start means that the application is started again in the already started (background running) state.
[0367] It is understood that the multitasking interface displayed by the mobile phone includes a screenshot of each application in the multitasking interface. Fig.16The multitasking interface shown in the middle interface 203 includes a screenshot of the camera application (eg Fig.16 Screenshots of the interface 203 in 2032) and map applications (such as Fig.16 The screenshot of the camera application is the last frame of the image sent when the camera application ends running in the foreground.
[0368] Specifically, in response to receiving the completion of operation b performed by the user on the thumbnail interface of the map application in the multitasking interface, the desktop application generates a start map application instruction. The start map application instruction can be used to instruct the window service to add a start window of the map application and instruct each component of the map application to create a corresponding thread.
[0369] Exemplarily, starting a map application may be used to instruct a map application view component to create a map image thread, and instruct a map application key component to create a main image thread.
[0370] S304: The desktop application sends a start map application instruction to the window service.
[0371] Exemplarily, the desktop application calls the statActivityFromRecents() function to start the application and sends a start map application instruction to the window service.
[0372] S305: In response to receiving the instruction to start the map application, the window service adds a map application window and reads a screenshot of the map application from the memory.
[0373] Specifically, in response to receiving the map application start instruction, the mobile phone executes the map application start application animation. At this time, the window service can add a map application start window and read a screenshot of the map application from the memory.
[0374] It is understandable that, when the mobile phone executes the animation of launching the application, the launch window of the map application is used to display the screenshot of the map application.
[0375] Exemplarily, the window service calls the function of getting screenshots startactivity() to read the screenshots of the map application, and calls the function of adding window addStartingWindow() to add the starting window of the map application.
[0376] S306. The window service sends a map application start instruction and a map application screenshot to the map application key component.
[0377] Specifically, in response to obtaining a screenshot of the map application, the window service sends a start map application instruction and a screenshot of the map application to the map application. The start map application instruction is used to instruct the key component of the map application to create a main image thread to complete the start operation of the map application.
[0378] S307 . In response to receiving the instruction to start the map application, the key component of the map application creates a layer and generates a rendering task 2 .
[0379] Specifically, in response to receiving the instruction to start the map application, the key component of the map application creates a main image thread, which is used to create a layer of the map application and generate a rendering task 2 of the main image.
[0380] Exemplarily, the key component of the map application calls the relayoutWindow.doFrame() function to create a layer.
[0381] S308. The key component of the map application sends rendering task 2 and a screenshot of the map application to the GPU, where rendering task 2 instructs rendering of the main portrait.
[0382] Specifically, the key component of the map application sends the rendering task 2 of the main image to the GPU frame by frame to instruct the GPU to render the main image.
[0383] S309 , in response to receiving rendering task 2 , the GPU renders the main portrait.
[0384] Specifically, in response to receiving the rendering task 2 of the main image sent by the key component of the map application, the GPU executes the rendering task 2 to render the main image of the map application.
[0385] S310. The window service sends a start map application instruction to the map application view component.
[0386] Specifically, the window service sends a start map application instruction to the map application view component to instruct the map application view component to create a map image thread.
[0387] S311. In response to receiving an instruction to start a map application, the map application view component creates a map image thread.
[0388] Specifically, in response to receiving the instruction to start the map application, the map application view component creates a map image thread. The map image thread is used to generate a rendering task 1 of a map image.
[0389] Exemplarily, the map application view component may call the drawMap() function to draw a map and send a rendering task 1 to the GPU.
[0390] S312. In response to completion of adding the map application window, the desktop application sends a pause rendering instruction 3 to the map application view component, where the pause rendering instruction 3 indicates pausing rendering of the map image.
[0391] Specifically, in response to the completion of adding the map application window, the mobile phone executes the animation of launching the application and displays a screenshot of the map application in the map application window. The desktop application can send a pause rendering instruction 3 to the map application view component, so that when the mobile phone executes the animation of launching the application, the GPU can not execute the rendering task 1 of the map image, thereby avoiding the problem of GPU blocking caused by the map image being too complex.
[0392] Exemplarily, the desktop application may call the pauseRendering() function to send a pause rendering instruction 3 to the map application view component.
[0393] It is understandable that the desktop application does not send a pause rendering instruction to the key components of the map application. In other words, during the process of the mobile phone executing the animation of the startup application, the GPU can execute the rendering task 4 of the animation of the startup application and the rendering task 2 of the main image of the map application. Since the main image of the map application is not complicated, it will not cause the GPU blocking problem. Therefore, the animation of the startup application will not be stuck.
[0394] In some embodiments, the pause rendering instruction 3 also includes a control duration 3. When the map application view component pauses sending the rendering task 1 to the GPU for a duration of 3, the desktop application can send a resume rendering instruction to the map application to control the map application view component to send the rendering task 1 to the GPU.
[0395] S313. In response to receiving the pause rendering instruction 3, the map application view component pauses sending the rendering task 1 to the GPU.
[0396] Specifically, in response to receiving the pause rendering instruction, the map application view component pauses sending rendering task 1 to the GPU.
[0397] It is understandable that when the map application view component pauses sending rendering task 1 to the GPU, the map portrait thread is still generating rendering task 1 frame by frame.
[0398] In some embodiments, the map application view component may discard each frame of rendering task 1 after pausing sending rendering task 1 to the GPU until receiving a resume rendering instruction.
[0399] In other embodiments, the map application view component may store the rendering task 2 for each frame after pausing sending the rendering task 2 to the GPU until receiving a resume rendering instruction, and then send the stored rendering task 2 to the GPU frame by frame.
[0400] S314. In response to the completion of adding the map application window, the desktop application sends a rendering task 4 to the GPU, where the rendering task 4 indicates rendering an animation of starting the application.
[0401] Specifically, in response to completion of adding the map application window, the desktop application executes the animation of launching the application, and sends a rendering task 4 of the animation of launching the application to the GPU to instruct the GPU to render the animation of launching the application.
[0402] For example, the desktop application can call the start animation IRemoteTransition:startAnimation() function to execute the animation of starting the application.
[0403] It can be understood that step S306 and step S310 are steps executed by the window service after the map application window is added, and step S314 is a step executed by the desktop application in response to the map application window being added. This embodiment is only described by first executing step S306, then executing step S310 and step S314. In actual applications, therefore, the execution order of step S306, step S310, and step S314 is not based on Fig.17 Similarly, the execution order of steps S307-S309 associated with step S306, steps S311-S313 associated with step S310, and steps S315-S317 associated with step S314 is not limited to the order in which ...15-S317 associated with step S314 is not limited to the order in which the execution order of steps S315-S317 associated with step S314 is not limited to the Fig.17 For restriction.
[0404] S315 . In response to receiving rendering task 4 , the GPU renders and starts the dynamic effect of the application.
[0405] Specifically, in response to receiving the rendering task 4, the GPU executes the rendering task 4 of rendering the dynamic effect of starting the application, so as to render the dynamic effect of starting the application.
[0406] It is understandable that the GPU can execute rendering task 2 of the main image in the map application while executing rendering task 4 of rendering the dynamic effect of starting the application.
[0407] S316. The GPU sends an animation of starting the application to the display screen.
[0408] Specifically, after the GPU performs rendering task 4 and completes the animation effect of starting the application in the first frame, it sends the animation effect of starting the application to the display screen frame by frame.
[0409] Exemplarily, in response to the completion of rendering the first frame of the application startup dynamic effect, the GPU sends the rendered application startup dynamic effect to the image synthesis processing service. The image synthesis processing service synthesizes the rendered application startup dynamic effect with the map application startup window (including the map application screenshot) to obtain interface 4.
[0410] S317. The display screen displays interface 5, where interface 5 includes a dynamic effect for starting an application.
[0411] Specifically, in response to receiving the dynamic effect of starting the application, the display screen displays interface 5, which includes the dynamic effect of starting the application. During the dynamic effect of starting the application, the startup window of the map application is used to display a screenshot of the map application. Fig.16 Middle interface 1501. 15011 in interface 1501 is a startup window of a map application, which displays a screenshot of the map application.
[0412] S318: In response to the completion of rendering the first frame of the main image, the GPU sends first information to the window service.
[0413] Specifically, in response to the GPU rendering the first frame of the main image being completed, the GPU sends a first message (finish draw) to the window service indicating that the first frame of the main image has been rendered. The first message is used to prompt the window service that the key component of the map application can be framed and displayed.
[0414] S319. GPU sends the main image to the display screen.
[0415] Specifically, in response to the GPU completing rendering of the first frame of the main image, the GPU may send the main image to the display screen frame by frame.
[0416] It is understandable that step S318 and step S319 are steps executed by the GPU after rendering the first frame of the main image. This embodiment is only described by taking the order of executing step S318 first and then executing step S319 as an example. Fig.17 For restriction.
[0417] S320, the display screen displays interface 6, where interface 6 includes a dynamic effect for starting the application and a main portrait of the first frame.
[0418] Specifically, when the dynamic effect of starting the application has not ended, in response to receiving the first frame main image, the display screen displays interface 6, which includes the dynamic effect of starting the application, and the dynamic effect of starting the application includes a window of the map application (such as Fig.16 1502 in the figure), wherein the window of the map application includes a main image in the map application.
[0419] S321. In response to receiving the first information, the window service deletes the map application window and the screenshot.
[0420] Specifically, in response to receiving the first information, the window service deletes the start window and the screenshot of the map application. In this way, the display screen of the mobile phone can be used to display the thumbnail interface of the map application.
[0421] Exemplarily, the window service may call the removeStartingWindow() function to delete the screenshot of the map application.
[0422] S322. The display screen displays interface 7, where interface 7 includes an application interface of a map application, and the application interface of the map application includes a main image of the map application.
[0423] Specifically, in response to the end of the dynamic effect of starting the application, the display screen displays interface 7, which includes the application interface of the map application. Since the map image has not been rendered, the application interface of the map application only includes the main image of the map application (such as Fig.16 (as shown in the middle interface 1502).
[0424] It is understandable that in some possible situations, the end time of the dynamic effect of starting the application may be before the GPU completes rendering of the first frame of the main image. This embodiment only takes the end of the dynamic effect of starting the application after the GPU completes rendering of the first frame of the main image as an example. In actual applications, the execution order of steps S318, S319, and S322 is not based on Fig.17 Similarly, the execution order of steps S320 and S321 associated with step S318 is not limited to Fig.17 For restriction.
[0425] S323. In response to the end of the animation of launching the application, the desktop application sends a resume rendering instruction 3 to the map application view component, and the resume rendering instruction 3 instructs rendering the map image.
[0426] Specifically, in response to the end of the animation of launching the application, the desktop application pauses and stops sending rendering task 4 to the GPU. At this time, the load of the GPU is reduced, and the desktop application can send a resume rendering instruction 3 to the map application view component, so that the map application view component sends a rendering task 1 to the GPU to instruct the GPU to render the map image.
[0427] Exemplarily, in response to the end of the animation effect of starting the application, the desktop application calls the restore rendering restoreRendering() function to send a restore rendering instruction 3 to the map application view component. The desktop application calls the completion callback RemoteTransitionFinishedCallback::onTransitionFinished() function to obtain the application interface of the map application.
[0428] It is understandable that both step S322 and step S323 are steps executed after the dynamic effect of starting the application ends. This embodiment is only described by taking step S322 as the first step and then step S323 as an example. In actual applications, the execution order of step S322 and step S323 is not based on the order of execution. Fig.17 For restriction.
[0429] It should be understood that in some embodiments, step S323 may also be in response to the desktop application sending the pause rendering instruction 3 to the map application view component for a duration b that reaches the control duration 1, the desktop application sending the resume rendering instruction 3 to the map application view component. The control duration 1 indicates the execution duration of the dynamic effect of starting the application. In this way, the mobile phone can implement the rendering control operation with the execution timing of the control duration 1 during the startup process of the map application started by the multi-tasking interface.
[0430] For example, if the execution time of the animation of starting the application is 500ms, the control time 1 is 500ms. When the time b for the desktop application to send the pause rendering instruction 3 to the map application view component reaches 500ms, the desktop application sends the resume rendering instruction 3 to the map application view component.
[0431] S324. In response to receiving the resume rendering instruction 3, the map application view component sends the rendering task 1 to the GPU.
[0432] Specifically, in response to receiving the resume rendering instruction 3 sent by the desktop application, the map application view component controls the map portrait main thread to send the rendering task 1 to the GPU.
[0433] In combination with the above content, it can be known that the rendering task 1 may include all rendering tasks 1 generated frame by frame by the map image thread after receiving the resume rendering instruction 3. Alternatively, the rendering task 1 may include all rendering tasks 1 generated by the map image thread after receiving the pause rendering instruction 3.
[0434] S325. In response to receiving rendering task 1, the GPU renders a map image.
[0435] Specifically, in response to receiving rendering task 1, the GPU executes rendering task 1 to render a map image of the map application.
[0436] S326. The GPU sends the map image to the display screen.
[0437] Specifically, in response to completing the rendering of the first frame of the map image, the GPU may send the map image to the display screen frame by frame.
[0438] S327. The display screen displays interface 8, where interface 8 includes an application interface of a map application, and the application interface of the map application includes a main image and a map image.
[0439] Specifically, in response to receiving the map image and the main image of the map application, the display screen displays interface 8, which includes an application interface of the map application, and the application interface of the map application includes the main image and the map image of the map application, such as Fig.16 Middle interface 1503.
[0440] For example, when the GPU completes rendering of the first frame of the map image, the map application view component can call the window update SurfaceView::updateSurface() function to update the display interface of the display screen to display interface 8.
[0441] However, in the above-mentioned mobile phone executing the dynamic effect of launching the map application by hot launching the map application through the multi-tasking interface, in the scheme of executing the rendering control process for the map application view component, the mobile phone directly deletes the screenshot of the map application after the GPU completes rendering of the main portrait of the first frame of the map application, and the mobile phone performs rendering control operations on the map application view component of the map application until the dynamic effect of launching the application ends. This results in that the map application view component starts to send rendering task 1 to the GPU after the dynamic effect of launching the application ends. Then, when the mobile phone displays the application interface of the map application (such as executing step S322), the map portrait area will have a transparent problem (such as Fig.16 (as shown in the middle interface 1502).
[0442] In response to the above problems, an embodiment of the present application proposes a rendering control optimization method. When executing the animation effect of hot-starting the map application from the multi-tasking interface, the mobile phone can only pause the rendering of the map image and display the screenshot of the map application. After the animation effect of starting the application ends, the mobile phone resumes the rendering of the map image. After the GPU completes the rendering of the application interface of the entire map application, the mobile phone deletes the screenshot of the map application.
[0443] In this way, the mobile phone performs rendering control operations on the map application view component during the execution of the dynamic effect of launching the application, which can reduce the load on the GPU and make the dynamic effect of launching the application display smooth. At the same time, the mobile phone deletes the screenshot of the map application only after the dynamic effect of launching the application ends and all contents in the application interface of the map application (such as the main image and the map image) are rendered, avoiding the problem of transparent areas in the display interface caused by the rendering control operation of the map application view component during the hot launch of the map application from the multi-tasking interface.
[0444] The following still takes the hot start of the map application from the multitasking interface as an example. Fig.18 Detailed description of the business process of implementing the rendering control optimization method in the process of executing the animation of launching the application on the mobile phone:
[0445] In response to a user in a multitasking interface (such as Fig.19In the middle interface 203), the click operation on the map application icon is completed, and the desktop application receives the start map application event. The desktop application sends a start map application instruction to the window service. In response to the start map application instruction, the window service adds a map application window and obtains a map application screenshot from the memory. In response to the completion of the map application window addition, the window service sends an instruction to the desktop application to execute the dynamic effect of the start application, instructing the desktop application to send the rendering task 4 of the dynamic effect of the start application to the GPU. After the GPU executes the rendering task 4 and sends it to the display, the display interface of the mobile phone can be seen. Fig.19 Middle interface 1801, wherein area 18011 in interface 1801 is a map application window for displaying map application screenshots.
[0446] At the same time, in response to the completion of adding the map application window, the desktop application sends a start map application instruction to the map application key component and the map application view component. After receiving the start map application instruction, the map application key component hot starts and creates the main image thread of the map application. The main image thread of the map application creates the layer of the map application and sends the rendering task 2 of the main image to the GPU to render the main image. After receiving the start map application instruction, the map application view component creates a map image thread in the map application.
[0447] In response to the completion of adding the map application window, the desktop application sends a pause rendering instruction 3 to the map application view component. After receiving the pause rendering instruction, the map application view component controls the map image thread to enter the rendering control state and suspends sending the rendering task 1 of the map image to the GPU. When the rendering of the first frame main image is completed, the main image thread of the map application sends a first message to the window service. In response to receiving the first message, the window service enters a waiting state until it receives a second message. At this time, the window service does not delete the map application screenshot, and the display interface of the mobile phone is shown in Fig.19 In the middle interface 1802, 18021 in the interface 1802 is a thumbnail interface of the map application, which is used to display the screenshot of the map application.
[0448] In response to the end of the animation effect of launching the application, the desktop application sends a resume rendering instruction 3 to the map application view component. In response to receiving the resume rendering instruction 3, the map application view component controls the map image thread to send a rendering task 1 of the map image to the GPU. When the GPU completes the rendering of the first frame of the map image, the second information that the rendering of the first frame of the map image is completed is sent to the window service. It can be understood that at this time, the GPU can send the display (including the main image and the map image) to the display screen.
[0449] The window service deletes the map application window and the screenshot only when it receives the second message after receiving the first message. In this way, the mobile phone can display the application interface of the map application with the main image and the map image after the map application window is deleted. Fig.19Middle interface 1803.
[0450] Combination Fig.18 and Fig.19 It can be seen that by adopting the above rendering control optimization process, the mobile phone performs rendering control operations on the map application view component in the process of executing the animation of launching the application, and will not cause the problem of partial transparency in the display interface.
[0451] Combine the following Fig. 20 Detailed description of the process of implementing the rendering control optimization method when the mobile phone executes the dynamic effect of launching the map application from the multi-tasking interface:
[0452] S303: In response to the received operation b being completed, the desktop application generates an instruction to start the map application.
[0453] S304: The desktop application sends a start map application instruction to the window service.
[0454] S305: In response to receiving the instruction to start the map application, the window service adds a map application window and reads a screenshot of the map application from the memory.
[0455] S306. The window service sends a map application start instruction and a map application screenshot to the map application key component.
[0456] S307 . In response to receiving the instruction to start the map application, the key component of the map application creates a layer and generates a rendering task 2 .
[0457] S308. The key component of the map application sends rendering task 2 and a screenshot of the map application to the GPU, where rendering task 2 instructs rendering of the main portrait.
[0458] S309 , in response to receiving rendering task 2 , the GPU renders the main portrait.
[0459] S310. The window service sends a start map application instruction to the map application view component.
[0460] S311. In response to receiving an instruction to start a map application, the map application view component creates a map image thread.
[0461] S312. In response to completion of adding the map application window, the desktop application sends a pause rendering instruction 3 to the map application view component, where the pause rendering instruction 3 indicates pausing rendering of the map image.
[0462] S313. In response to receiving the pause rendering instruction 3, the map application view component pauses sending the rendering task 1 to the GPU.
[0463] S314. In response to the completion of adding the map application window, the desktop application sends a rendering task 4 to the GPU, where the rendering task 4 indicates rendering an animation of starting the application.
[0464] S315 . In response to receiving rendering task 4 , the GPU renders and starts the dynamic effect of the application.
[0465] S316. The GPU sends an animation of starting the application to the display screen.
[0466] S317. The display screen displays interface 5, where interface 5 includes a dynamic effect for starting an application.
[0467] S318: In response to the completion of rendering the first frame of the main image, the GPU sends first information to the window service.
[0468] It can be understood that the above steps S303 to S318 can refer to the relevant description in the previous embodiment and will not be repeated here.
[0469] S401: In response to receiving first information, the window service enters a waiting state.
[0470] Specifically, in response to receiving the first information, the window service enters a waiting state until the window service receives the second information indicating that the rendering of the first frame map image is completed.
[0471] Exemplarily, the window service calls the waitSurfaceDrawFinished() function to enter a waiting state and receive the second information.
[0472] S402: GPU sends the main image to the display screen.
[0473] Specifically, in response to the GPU completing rendering of the first frame of the main image, the GPU may send the main image to the display screen frame by frame.
[0474] It is understandable that both step S318 and step S402 are steps executed by the GPU after rendering the first frame of the main image. This embodiment is described here by taking the order of executing step S318 first and then executing step S402 as an example. Fig.18 For restriction.
[0475] S403: In response to the end of the dynamic effect of starting the application, the display screen displays interface 9, which includes a multi-tasking interface and a screenshot of the map application.
[0476] Specifically, in response to the end of the animation effect of launching the application, the display screen switches the interface to interface 9, which includes a multi-task interface. The thumbnail interface of the map application in the multi-task interface is used to display a screenshot of the map application. Fig.19The middle interface 1802, wherein 18021 is a thumbnail interface of the map application.
[0477] S404: In response to the end of the animation of launching the application, the desktop application sends a resume rendering instruction 3 to the map application view component.
[0478] It is understandable that both step S403 and step S404 are steps executed after the animation effect of starting the application ends. Here, the example of executing step S403 first and then step S404 is used for illustration, and does not constitute a restriction on the execution order of step S403 and step S404. In actual application, step S404 may also be executed first and then step S403.
[0479] S405. In response to receiving the resume rendering instruction 3, the map application view component sends the rendering task 1 to the GPU.
[0480] S406 . In response to receiving the rendering task 1 , the GPU renders a map image.
[0481] S407. The GPU sends the map image to the display screen.
[0482] It can be understood that the above steps S404 to S407 can refer to the relevant descriptions of steps S323 to S326 in the previous embodiment, and will not be repeated here.
[0483] S408. In response to the completion of rendering the first frame of the map image, the GPU sends second information to the window service.
[0484] Specifically, in response to completing the rendering of the first frame of the map image, the GPU sends a second message to the window service to instruct the window service to delete the map application window and the screenshot.
[0485] S409: In response to receiving the second information, the window service deletes the map application window and the screenshot.
[0486] Specifically, in response to receiving the first information and the second information, the window service deletes the window of the map application and the screenshot of the map application. In this way, the mobile phone can display the application interface of the map application including the main image and the map image.
[0487] Exemplarily, the image synthesis processing service may call the surfaceViewDrawFinished() function to delete the map application window and the screenshot.
[0488] S410. The display screen displays interface 8, where interface 8 includes an application interface of a map application, and the application interface of the map application includes a main image and a map image.
[0489] Specifically, when receiving the main image and the map image sent by the GPU, the display screen displays interface 8, which includes an application interface of the map application, see Fig.19 Middle interface 1803.
[0490] By adopting the above rendering control optimization process, the mobile phone can pause the map application view component of the map application to send rendering task 1 to the GPU during the execution of the dynamic effect of launching the application, thereby improving the smoothness of the dynamic effect of launching the application. After the dynamic effect of launching the application ends, the mobile phone exits the rendering control operation of the map application view component, and deletes the screenshot of the map application only after the GPU completes the rendering of the first frame main portrait and the first frame map portrait of the map application. In this way, the display interface of the mobile phone can display the complete application interface of the rendered map application without the problem of partial transparency.
[0491] Some other embodiments of the present application provide an electronic device, which may include: a memory and one or more processors. The memory and the processor are coupled. The memory is used to store computer program code, and the computer program code includes computer instructions. When the processor executes the computer instructions, the electronic device may perform each step in the above method embodiment.
[0492] An embodiment of the present application also provides a computer-readable storage medium, which includes computer instructions. When the computer instructions are executed on the above-mentioned electronic device, the electronic device executes each step in the above-mentioned method embodiment.
[0493] The embodiment of the present application also provides a computer program product. When the computer program product is run on a computer, the computer is enabled to execute each step in the above method embodiment.
[0494] Through the description of the above implementation methods, technical personnel in the relevant field can clearly understand that for the convenience and simplicity of description, only the division of the above-mentioned functional modules is used as an example. In actual applications, the above-mentioned functions can be assigned to different functional modules as needed, that is, the internal structure of the device can be divided into different functional modules to complete all or part of the functions described above.
[0495] In the several embodiments provided in the present application, it should be understood that the disclosed devices and methods can be implemented in other ways. For example, the device embodiments described above are only schematic. For example, the division of the modules or units is only a logical function division. There may be other division methods in actual implementation, such as multiple units or components can be combined or integrated into another device, or some features can be ignored or not executed. Another point is that the mutual coupling or direct coupling or communication connection shown or discussed can be through some interfaces, indirect coupling or communication connection of devices or units, which can be electrical, mechanical or other forms.
[0496] The units described as separate components may or may not be physically separated, and the components shown as units may be one physical unit or multiple physical units, that is, they may be located in one place or distributed in multiple different places. Some or all of the units may be selected according to actual needs to achieve the purpose of the present embodiment.
[0497] In addition, each functional unit in each embodiment of the present application may be integrated into one processing unit, or each unit may exist physically separately, or two or more units may be integrated into one unit. The above-mentioned integrated unit may be implemented in the form of hardware or in the form of software functional units.
[0498] If the integrated unit is implemented in the form of a software functional unit and sold or used as an independent product, it can be stored in a readable storage medium. Based on this understanding, the technical solution of the embodiment of the present application is essentially or the part that contributes to the prior art or all or part of the technical solution can be embodied in the form of a software product, which is stored in a storage medium, including several instructions to enable a device (which can be a single-chip microcomputer, chip, etc.) or a processor (processor) to execute all or part of the steps of the method described in each embodiment of the present application. The aforementioned storage medium includes: U disk, mobile hard disk, read only memory (ROM), random access memory (RAM), disk or optical disk and other media that can store program code.
[0499] The above contents are only specific implementation methods of the present application, but the protection scope of the present application is not limited thereto. Any changes or substitutions within the technical scope disclosed in the present application shall be included in the protection scope of the present application. Therefore, the protection scope of the present application shall be subject to the protection scope of the claims.
Claims
1. A rendering method, characterized in that: Applied to electronic equipment, the method comprises: The electronic device displays a first interface, where the first interface includes application information of a first application in the electronic device; The electronic device detects a target event in the first interface, the target event is used to trigger the electronic device to display a first motion effect, and the screen content of the first motion effect includes an application screen of the first application; In response to the target event ending, within a first time interval, the electronic device does not render an application screen of the first application, and renders the first motion effect based on a first image, where the first image includes a screenshot of the first application when it ends running in the foreground of the electronic device or an application screen of the first application when the target event ends; In response to the first motion effect ending or the duration of the first time interval reaching a first duration, the electronic device renders an application screen of the first application; Among them, not rendering the application screen of the first application includes: the electronic device controls the interface view Surface View component of the first application not to send a first rendering task to a graphics processor GPU in the electronic device, where the first rendering task is a rendering task for rendering a part of the screen content of the application screen; The method also includes: within the first time interval, the electronic device controls the main thread of the first application to send a second rendering task to the GPU, where the second rendering task is a rendering task for rendering another part of the screen content of the application screen.
2. The method according to claim 1, characterized in that The first interface includes application information of a first application in the electronic device, specifically: the first interface includes an application interface of the first application running in the foreground; The target event includes an event of sliding upward from the bottom of the first interface, and the first image includes an application screen of the first application when the event of sliding upward from the bottom of the first interface ends.
3. The method according to claim 2, characterized in that In response to the first motion effect ending or the duration of the first time interval reaching a first duration, the electronic device rendering an application screen of the first application includes: At a first moment, the electronic device switches the first application from the foreground to the background, and the electronic device does not render an application screen of the first application.
4. The method according to any one of claims 1 to 3, characterized in that The first interface includes application information of a first application in the electronic device, specifically: the first interface includes a thumbnail interface of the first application running in the background of the electronic device; The target event includes a click event on a thumbnail interface of the first application, and the first image includes a screenshot taken when the first application stops running in the foreground of the electronic device.
5. The method according to claim 4, characterized in that In the first time interval, after the electronic device controls the main thread of the first application to send the second rendering task to the GPU, the method further includes: After obtaining a first frame of image in response to rendering of the second rendering task, the electronic device does not delete the first image; The rendering of the first motion effect based on the first image includes: rendering the first motion effect based on the first image that has not been deleted.
6. The method according to any one of claims 1 to 3, characterized in that In response to the target event ending, within a first time interval, the electronic device does not render the application screen of the first application, and renders the first motion effect based on the first image, including: When it is determined that the control list includes the first application, in response to the end of the target event, within a first time interval, the electronic device does not render the application screen of the first application, and renders the first motion effect based on the first image.
7. The method according to claim 6, characterized in that The method further comprises: When it is determined that the control list does not include the first application, in response to the end of the target event, within the first time interval, the electronic device renders an application screen of the first application, and renders the first animation effect based on the application screen of the first application.
8. The method according to any one of claims 1 to 3, characterized in that Before the target event ends, the method further includes: In response to detecting a target event in the first interface, within a second time interval, the electronic device does not render the application screen of the first application, and renders the first motion effect based on a second image, wherein the second image includes an image of the first application when the target event is detected.
9. The method according to claim 8, characterized in that In response to detecting the target event in the first interface, the electronic device does not render the application screen of the first application within a second time interval, and renders the first motion effect based on the second image, the method further includes: In response to the time length of the second time interval reaching a second time length and the target event not ending, the electronic device renders an application screen of the first application, and renders the first motion effect based on the application screen of the first application.
10. The method according to any one of claims 1 to 3, characterized in that: The method further comprises: During the first time interval, the electronic device displays a second interface, the second interface includes the first motion effect, and the first motion effect includes the first image; wherein, during the first time interval, the image content of the first image remains unchanged.
11. The method according to any one of claims 1 to 3, characterized in that: The electronic device detects a target event in the first interface, including: The desktop application in the electronic device detects a target event in the first interface; In response to the target event ending, within a first time interval, the electronic device does not render the application screen of the first application, and renders the first motion effect based on the first image, including: In response to the target event ending, the desktop application sends a first instruction to the interface view Surface View component of the first application, and the desktop application sends a second instruction to the graphics processor GPU of the electronic device; In response to the first instruction, within the first time interval, the interface view SurfaceView component of the first application does not send a first rendering task to the GPU; In response to the second instruction, within the first time interval, the GPU renders the first motion effect based on the first image.
12. The method according to claim 11, characterized in that The first instruction includes the first duration; In response to the first motion effect ending or the duration of the first time interval reaching a first duration, the electronic device rendering an application screen of the first application includes: In response to the end of the first motion effect, the desktop application sends a third instruction to the interface view Surface View component of the first application; in response to the third instruction, the interface view Surface View component of the first application sends a first rendering task to the GPU; or, In response to the time length of the first time interval reaching the first duration, the electronic device sends a fourth instruction to the interface view Surface View component of the first application; in response to the fourth instruction, the interface view Surface View component of the first application sends a first rendering task to the GPU.
13. The method according to claim 5, characterized in that The step of: controlling the main thread of the first application to send a second rendering task to the GPU within the first time interval, and not deleting the first image after rendering a first frame of image in response to the second rendering task, comprises: In the first time interval: the electronic device sends a fifth instruction to the main thread of the first application; in response to the fifth instruction, the main thread of the first application sends a second rendering task to the GPU; After obtaining the first frame image by rendering in response to the second rendering task, the electronic device does not delete the first image.
14. An electronic device, characterized in that: The electronic device includes a memory and one or more processors; the memory and the processor are coupled; the memory is used to store computer program code, and the computer program code includes computer instructions. When the computer instructions are executed by the processor, the electronic device executes the method described in any one of claims 1-13.
15. A computer-readable storage medium, wherein computer instructions are stored in the computer-readable storage medium, characterized in that: When the computer instructions are executed on an electronic device, the electronic device is caused to execute the method as claimed in any one of claims 1 to 13.
16. A computer program product comprising computer instructions, characterized in that When the computer program product is executed on an electronic device, the electronic device is enabled to execute the method according to any one of claims 1 to 13.
