Dynamic effect display method and electronic equipment

By adjusting the priority of GC threads or GC waterline, the problem of desktop animation stuttering when the application starts or exits is solved, achieving a smoother animation display effect.

CN120066689APending Publication Date: 2025-05-30HONOR DEVICE CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202311582110.9
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2023-11-23
Publication Date
2025-05-30

AI Technical Summary

Technical Problem

In the prior art, desktop animation effects are prone to stuttering when the application starts or exits, affecting the user experience.

Method used

Ensure a smooth display of animation by detecting user operations and adjusting the priority or GC waterline of the garbage collection (GC) thread to avoid running during the animation or increasing its priority.

Benefits of technology

It effectively avoids desktop animation lag, improves the animation effect when the application starts or exits, and improves the user experience.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120066689A_ABST
    Figure CN120066689A_ABST
Patent Text Reader

Abstract

The embodiment of the invention provides a dynamic effect display method and electronic equipment, in the method, the electronic equipment displays a desktop dynamic effect in response to a detected first user operation, and the first user operation is used for indicating to start a first application or exit the first application; when the electronic equipment detects a first user operation, if a garbage collection GC thread of the launcher is not in an execution state, a GC waterline value of the GC thread is increased to a second waterline value from a first waterline value, and the first waterline value is a current GC waterline of the GC thread; or when the electronic equipment detects the first user operation, if the GC thread is in the execution state, the priority of the GC thread is improved to the second priority from the first priority, and the first priority is the current priority of the GC thread. According to the method, the desktop dynamic effect can be prevented from being blocked when the application program is started or quitted, and the display effect of the desktop dynamic effect can be improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the field of electronic technologies, and in particular, to an animation display method and an electronic device. Background Art

[0002] The development of user experience design is becoming increasingly perfect. Excellent animations are an essential part of improving the user experience. Excellent interface dynamic design can make the user experience of the product even better.

[0003] Currently, electronic devices often install different application programs to meet the needs of users. When an application program is started or exited, the animation during the switch between the desktop and the application interface is crucial for the visual experience of users. How to improve the display effect of the animation when an application program is started or exited is an urgent problem to be solved in the industry. Summary of the Invention

[0004] This application provides an animation display method and an electronic device, which can avoid the stuttering of the desktop animation when an application program is started or exited, and can improve the display effect of the desktop animation.

[0005] In a first aspect, this application provides an animation display method applied to an electronic device. The method includes: the electronic device displays a desktop animation in response to a detected first user operation, where the first user operation is used to indicate starting a first application or exiting a first application; when the garbage collection (GC) thread of the desktop launcher is not in an execution state when the first user operation is detected, the electronic device raises the GC waterline of the GC thread from a first waterline value to a second waterline value, where the second waterline value is greater than the first waterline value, and the first waterline value is the current GC waterline of the GC thread; or, when the GC thread is in an execution state when the first user operation is detected, the electronic device raises the priority of the GC thread from a first priority to a second priority, where the second priority is higher than the first priority, and the first priority is the current priority of the GC thread.

[0006] In the embodiments of the present application, when the electronic device detects a first user operation indicating the start or exit of a first application, it can determine the execution status of the GC thread of the desktop launcher. If the GC thread is not in the execution state, the current GC waterline of the GC thread is increased to prevent the memory occupancy from exceeding the GC waterline and triggering the operation of the GC thread. If the GC thread is in the execution state, the current priority of the GC thread is increased to prevent the GC thread from not being able to run due to its low priority. By increasing the GC waterline of the GC thread, this method can prevent the operation of the GC thread from affecting the display of the desktop animation of the desktop launcher; or, by increasing the priority of the GC thread, it can prevent the GC thread from not being able to run and affecting the display of the desktop animation of the desktop launcher, thereby reducing the impact of the GC thread on the display of the desktop animation of the desktop launcher, avoiding stuttering of the desktop animation when the first application starts or exits, and improving the display effect of the desktop animation.

[0007] In a possible implementation manner, the drawing of the desktop animation can be responsible by the main thread (i.e., the UI thread) of the desktop launcher.

[0008] Combined with the first aspect, in a possible implementation manner, the first user operation is used to indicate the start of a first application; before the electronic device displays the desktop animation in response to the detected first user operation, the method further includes: the electronic device displays the desktop of the electronic device, and the desktop animation is the picture displayed during the process of switching the desktop of the electronic device to the first interface of the first application.

[0009] The embodiments of the present application can avoid stuttering during the display process from the desktop to the application interface (i.e., the above-mentioned first interface) of the first application when starting from the desktop, and can improve the display effect of the desktop animation.

[0010] Combined with the first aspect, in a possible implementation manner, the first user operation is used to indicate the exit of a first application; before the electronic device displays the desktop animation in response to the detected first user operation, the method further includes: the electronic device displays the second interface of the first application, and the desktop animation is the picture displayed during the process of switching the second interface of the first application to the desktop of the electronic device.

[0011] Wherein, the second interface can be any application interface in the first application; the above-mentioned first interface and the second interface can be the same application interface or different user interfaces.

[0012] The embodiments of the present application can avoid stuttering during the display process from the application interface (i.e., the above-mentioned second interface) of the first application to the desktop when the first application exits, and can improve the display effect of the desktop animation.

[0013] In combination with the first aspect, in a possible implementation, elevating the priority of the GC thread from the first priority to the second priority includes: when the electronic device executes a target function, elevating the priority of the GC thread from the first priority to the second priority.

[0014] In the embodiment of the present application, only when the target function is executed, the priority of the GC thread is elevated, which can reduce unnecessary operations.

[0015] In combination with the first aspect, in a possible implementation, the method further includes: after the electronic device executes the target function, restoring the priority of the GC thread from the second priority to the first priority.

[0016] In the embodiment of the present application, the priority of the GC thread can be restored after the target function is executed to avoid affecting other threads.

[0017] In combination with the first aspect, in a possible implementation, the second waterline value is the heap memory limit value of the GC thread.

[0018] In combination with the first aspect, in a possible implementation, when the electronic device detects a first user operation and the GC thread is in an execution state, elevating the priority of the GC thread from the first priority to the second priority includes: the desktop launcher of the electronic device sends a first status value to the virtual machine corresponding to the desktop launcher of the electronic device before displaying the desktop animation; the first status value is used to indicate that the desktop animation is being executed; after receiving the first status value, when determining that the GC thread is not in an execution state, the virtual machine elevates the GC waterline of the GC thread from the first waterline value to the second waterline value.

[0019] In combination with the first aspect, in a possible implementation, the method further includes: the desktop launcher of the electronic device sends a second status value to the virtual machine after displaying the desktop animation; the second status value is used to indicate that the display of the desktop animation has ended.

[0020] In combination with the first aspect, in a possible implementation, the method further includes: after receiving the first status value, the virtual machine sets the status identifier of the desktop animation to a first attribute value, and the first attribute value is used to indicate that the desktop animation is being executed; after receiving the second status value, the virtual machine sets the status identifier to a second attribute value, and the second attribute value is used to indicate that the display of the desktop animation has ended.

[0021] In combination with the first aspect, in a possible implementation, when the GC thread is in an execution state when the electronic device detects a first user operation, the priority of the GC thread is increased from a first priority to a second priority, including: before the GC thread of the electronic device executes the target function, obtaining a status identifier of the desktop animation effect; when the GC thread of the electronic device determines that the status flag is a first attribute value, increasing the priority of the GC thread from the first priority to the second priority; after the GC thread of the electronic device executes the target function, restoring the priority of the GC thread from the second priority to the first priority.

[0022] In a second aspect, the present application provides an electronic device, which includes one or more processors and one or more memories; wherein, the one or more memories are coupled to the one or more processors, and the one or more memories are used to store computer program code, and the computer program code includes computer instructions. When the one or more processors execute the computer instructions, the electronic device is caused to execute the method described in the first aspect and any possible implementation manner in the first aspect.

[0023] In a third aspect, an embodiment of the present application provides a chip system, which is applied to an electronic device. The chip system includes one or more processors, and the processors are used to call computer instructions to cause the electronic device to execute the method described in the first aspect and any possible implementation manner in the first aspect.

[0024] In a fourth aspect, the present application provides a computer-readable storage medium, including instructions. When the above instructions run on an electronic device, the above electronic device is caused to execute the method described in the first aspect and any possible implementation manner in the first aspect.

[0025] In a fifth aspect, the present application provides a computer program product containing instructions. When the above computer program product runs on an electronic device, the above electronic device is caused to execute the method described in the first aspect and any possible implementation manner in the first aspect.

[0026] It can be understood that the electronic device provided in the second aspect, the chip system provided in the third aspect, the computer storage medium provided in the fourth aspect, and the computer program product provided in the fifth aspect are all used to execute the method provided in the present application. Therefore, the beneficial effects that can be achieved can refer to the beneficial effects in the corresponding method, and will not be elaborated here. BRIEF DESCRIPTION OF THE DRAWINGS

[0027] Figure 1A and Figure 1B is a schematic diagram of animation jamming during an animation effect exemplarily provided by an embodiment of the present application;

[0028] Figure 2Schematic diagram of an animation display method exemplarily provided by an embodiment of the present application;

[0029] Figure 3A and Figure 3B User interface displayed on an electronic device exemplarily provided by an embodiment of the present application;

[0030] Figure 4 Schematic diagram of another animation display method exemplarily provided by an embodiment of the present application;

[0031] Figure 5 Schematic diagram of the hardware structure of an electronic device exemplarily provided by an embodiment of the present application;

[0032] Figure 6 Schematic diagram of the software architecture of an electronic device exemplarily provided by an embodiment of the present application;

[0033] Figure 7 Schematic diagram of an animation display method when an application is started exemplarily provided by an embodiment of the present application;

[0034] Figure 8A and Figure 8B Schematic diagram of the process of triggering GC optimization exemplarily provided by an embodiment of the present application;

[0035] Figure 9 Schematic diagram of the processing flow of a virtual machine performing GC optimization exemplarily provided by an embodiment of the present application;

[0036] Figure 10 Schematic diagram of the process of a virtual machine delaying GC exemplarily provided by an embodiment of the present application;

[0037] Figure 11 Schematic diagram of the process of GC thread promotion and restoration of GC priority exemplarily provided by an embodiment of the present application. Detailed implementation manners

[0038] The terms used in the following embodiments of the present application are only for the purpose of describing specific embodiments, and are not intended to limit the present application. As used in the specification and appended claims of the present application, the singular forms "a", "an", "the", "above", "said", "this" are also intended to include the plural forms, unless the context clearly indicates otherwise. It should also be understood that the term "and / or" used in the present application refers to and includes any or all possible combinations of one or more of the listed items.

[0039] In the following embodiments of this application, the term "user interface (UI)" refers to the media interface for interaction and information exchange between an application or an operating system and a user. It realizes the conversion between the internal form of information and the form acceptable to the user. The user interface is the source code written in specific computer languages such as Java and Extensible Markup Language (XML). The interface source code is parsed and rendered on an electronic device and finally presented as content recognizable by the user. The common manifestation form of the user interface is the graphical user interface (GUI), which refers to the user interface related to computer operations displayed in a graphical manner. It can be visual interface elements such as text, icons, buttons, menus, tabs, text boxes, dialog boxes, status bars, navigation bars, and Widgets displayed on the display screen of an electronic device.

[0040] To facilitate the understanding of the technical solutions of the embodiments of this application, a brief introduction to the related technologies and terms of this application is given first.

[0041] 1. Animation effects

[0042] Taking the Android system as an example, the process corresponding to the desktop in an electronic device installed with the Android system is the Launcher process. When the user clicks on a certain application icon on the desktop to start or swipes up to exit and return to the desktop in the displayed application interface, the overall animation effect can be disassembled into two parts: one is the view animation, and the other is the window animation. The two are transmitted to the composition process (SurfaceFlinger) for combined display. Among them, the main animation effect drawing is responsible for the main thread (i.e., the UI thread) of the Launcher.

[0043] The animation effect in this application refers to the desktop animation effect, specifically, it can refer to the animation effect during the switching between the desktop and the application interface when an application is started or exited.

[0044] In this application, the desktop animation effect can include the startup animation effect of an application (abbreviated as startup animation effect) and the exit animation effect of an application (abbreviated as exit animation effect). Among them, the startup animation effect refers to the interface change process when the desktop switches to the application interface when the application is started, and the exit animation effect refers to the interface change process when the desktop switches to the application interface when the application is exited.

[0045] It should be understood that the desktop animation effect can specifically include multiple frames of images. In the state of no frame loss, the electronic device can play multiple frames of images at a preset frame rate to display the desktop animation effect. If frame loss occurs, there may be a phenomenon of stuttering during the display process of the desktop animation effect.

[0046] 2. Garbage collection (GC)

[0047] Each process will correspond to a virtual machine, and each process contains a HeapTaskDaemon thread, which is mainly responsible for performing the function of garbage collection (GC). Correspondingly, this thread can be called the GC thread. This GC thread is responsible for monitoring the usage of the virtual machine heap memory corresponding to this process, and determining whether to start the GC operation according to the usage of the heap memory corresponding to this process.

[0048] Among them, the GC operation refers to, for the already allocated memory space, when the program no longer needs to use this memory space, destroying the object and releasing the memory resources it occupies, so that this memory space can be reused.

[0049] It should be understood that the GC thread has a corresponding heap memory (target_footprint) and a heap memory limit value (growth_limit). Among them, the heap memory (target_footprint) represents the value of the heap memory allocated by the virtual machine for the current process. The GC waterline represents the threshold value that the current process needs to reach to trigger GC. The heap memory limit value (growth_limit) represents the maximum heap memory that the current process can allocate. When the occupied memory exceeds the GC waterline, the current process triggers the GC thread to recycle the garbage memory.

[0050] The virtual machine in this application refers to the virtual machine corresponding to the Launcher process; the GC thread in this application is responsible for monitoring the usage of the virtual machine heap memory corresponding to the Launcher process, and determining whether to start the GC operation according to the usage of the heap memory corresponding to this process.

[0051] 3. The GC thread blocks other threads

[0052] During the execution of the GC thread, to ensure the consistency of the object state, it is necessary to pause other threads in some stages or cause other threads to be blocked by holding locks.

[0053] The inventor of this application found through research data that during the process of clicking on an icon on the desktop to launch an application and the animation effect of swiping up the application to return to the desktop, there will be a situation where the GC thread of the Launcher process blocks the UI thread probabilistically, resulting in animation stuttering. The inventor counted the big data of animation stuttering in the above scenarios and found that the problem of animation stuttering caused by the GC thread of the Launcher process blocking the UI thread accounted for more than 50% of all animation stuttering problems caused by GC operations.

[0054] Figure 1A and Figure 1B is a schematic diagram of animation stuttering during an animation effect exemplarily provided for an embodiment of this application. As Figure 1A and Figure 1BAs shown in the figure, the Launcher process includes a Heap Task Daemon thread and a UI thread. Among them, the Heap Task Daemon can be used to execute the GC thread; the UI thread is the main thread and is responsible for the display of animations. Figure 1A and Figure 1B In the UI thread, the gray rectangle is used to represent the processing duration of each frame image in the animation. The position of the animation stutter is caused by the GC thread blocking the UI thread, resulting in a longer processing duration for the corresponding image frame and causing the animation to stutter.

[0055] Among them, according to the timing of the GC operation occurring in the Launcher process during the animation, it can include: (1) As Figure 1A shown in the figure, when the application starts or the animation of exiting the application starts, the Launcher process is performing a GC operation, blocking the UI thread and causing the animation to stutter; (2) As Figure 1B shown in the figure, during the animation of the application starting or exiting the application, the Launcher process performs a GC operation, blocking the UI thread and causing the animation to stutter.

[0056] In view of this, the embodiment of the present application provides an animation display method. This method delays the GC operation if the GC thread is not running when the desktop animation starts, so that no GC operation occurs during the desktop animation; and, if there is a GC thread running when the animation starts, it raises the GC priority during the desktop animation and reduces the probability that the GC thread cannot run (Runable) and blocks the main thread (i.e., the UI thread). By avoiding the impact of the GC thread on the desktop animation display, this method can effectively avoid situations such as desktop animation stuttering, thereby improving the display effect during the desktop animation display when the application starts or exits.

[0057] It should be understood that the application startup in this application refers to starting the application from the desktop. For the convenience of description, hereinafter, starting the application from the desktop will be simply referred to as starting the application; the application exit in this application refers to displaying the desktop after exiting the application interface. For the convenience of description, hereinafter, displaying the desktop after exiting the application interface will be simply referred to as exiting the application. It should be noted that if the first application is in the background running state and the user interface of the current electronic device displays the desktop, at this time, the user operation indicating the display of the application interface of the first application (such as clicking on the application icon of the first application on the desktop or displaying the application interface of the first application through the voice assistant) is also called the user operation of starting the first application.

[0058] The following takes starting the first application and exiting the first application as examples to illustrate the animation display method provided by the present application.

[0059] Figure 2 Shows an animation display method provided by an embodiment of the present application.

[0060] In an exemplary embodiment of the present application, taking the case of starting a first application by clicking on the application icon of the first application on the desktop as an example, the process of GC optimization when the electronic device displays the startup animation of the first application is introduced. The type of the first application is not limited in the present application, and the first application can be a system application or a third-party application.

[0061] It should be noted that in the embodiments of the present application, the user operation can be a touch operation of the user (such as a click operation, a long-press operation, a swipe-up operation, a swipe-down operation, or a side-swipe operation), a non-contact operation (such as an air gesture), or a voice command of the user. The embodiments of the present application do not make specific limitations on this.

[0062] The method may include the following partial or all steps:

[0063] Step S201: The electronic device displays the desktop, and the desktop includes the application icon of the first application.

[0064] Exemplarily, the desktop of the electronic device may include icons of one or more application programs, where the icons of one or more application programs include the application icon of the first application.

[0065] Exemplarily, the desktop displayed by the electronic device may be as Figure 3A shown in the user interface 31.

[0066] Figure 3A Fig. shows an exemplary user interface 31 of the electronic device for displaying installed application programs. The user interface 31 displays: a status bar, a calendar indicator, a weather indicator, a tray with icons of common application programs, an icon 311 of a video application, an icon of a camera application, and icons of other application programs, etc. Among them, the status bar may include: one or more signal strength indicators 312A and 312B of mobile communication signals (also known as cellular signals), an operator name (such as "China Mobile"), one or more signal strength indicators 312C of Wi-Fi signals, a battery status indicator 312D, a time indicator 312E, etc. In some embodiments, Figure 3A The exemplary user interface 31 (i.e., the desktop) shown can be referred to as the home screen.

[0067] Step S202: The electronic device responds to a user operation on the application icon of the first application and displays a startup animation, where the startup animation is an interface change process from the desktop to the application interface of the first application.

[0068] Exemplarily, the user can click on the application icon of the first application displayed on the electronic device. Correspondingly, the electronic device detects the user operation of clicking on the application icon of the first application. In response to this user operation, a startup animation is displayed. The startup animation is the interface change process from the desktop to the application interface of the first application. It should be understood that the startup animation can specifically include multiple frames of images. In the non-frame-drop state, the electronic device can play the multiple frames of images at a preset frame rate to display the startup animation. If frame drops occur, there may be a lag phenomenon during the display of the startup animation.

[0069] For example, the first application is Figure 3A the video application shown. The electronic device can detect the user operation on the icon 311 of the video application and, in response to this user operation, display a startup animation (not shown in the figure). Finally, it displays Figure 3B the user interface 32 shown. Among them, the user interface 32 is the application interface of the first application provided exemplarily in the embodiments of the present application. The present application does not limit the duration of the startup animation and the interface change. Exemplarily, the interface change process corresponding to the startup animation can include the application icon of the first application gradually becoming larger, covering other contents of the desktop, and finally displaying the startup interface of the first application.

[0070] It should be understood that the above user operation on the application icon of the first application is only an example provided in the embodiments of the present application and should not limit the present application. Any user operation that starts the first application when the electronic device displays the desktop can trigger the electronic device to display the above startup animation. The present application does not limit the above user operation for starting the first application. Exemplarily, the user can also, when the electronic device displays the desktop, request to start the first application through a voice command. Furthermore, the electronic device, in response to this voice command, displays the above startup animation.

[0071] Step S203: The electronic device, in response to the user operation on the application icon of the first application, determines the execution state of the GC thread corresponding to the desktop launcher.

[0072] Among them, the execution state of the GC thread can include being in the execution state and not being in the execution state.

[0073] In some embodiments, in response to a user operation on the application icon of the first application, the electronic device starts to execute a startup animation effect. The electronic device can determine the execution status of the GC thread corresponding to the desktop launcher when the startup animation effect starts to be executed. Exemplarily, the desktop launcher of the electronic device calls the first function (such as beginDetect()) of the animation effect detection module to transfer the application startup / exit status information (such as a first status value, which is used to indicate that the current status is during the startup animation effect or the exit animation effect) to the virtual machine corresponding to the desktop launcher; after receiving the first status value, the virtual machine determines the execution status of the GC thread corresponding to the desktop launcher; if the GC thread is in the execution state, execute the following step S204; if the GC thread is not in the execution state, execute the following step S205.

[0074] Step S204: When the electronic device determines that the GC thread is in the execution state, during the execution of the target function, the GC priority is raised from the first priority to the second priority, the second priority is higher than the first priority, and the first priority is the current GC priority of the GC thread.

[0075] In some embodiments, when the electronic device starts to execute the startup animation effect, if it is determined that the current GC thread is in the execution state, the electronic device can raise the GC priority from the first priority to the second priority when the GC thread executes to the target function, and can restore the GC priority from the second priority to the first priority after the execution of the target function is completed. For exemplary reference, see the relevant content below Figure 11 below.

[0076] Exemplarily, the target function is a function that requires holding a lock or pausing other threads during runtime. It should be understood that since the target function has characteristics that may affect the execution of other threads, the GC thread may block the UI thread when executing the target function. For example, the functions in the following three stages can all be set as the target function: The first stage is some functions during the GC marking process, such as CaptureThreadRootsRorMarking(), which is responsible for marking the root objects of the thread; ProcessMarkStackForMarkingAndCompteLiveBytes(), which is responsible for marking the objects in the marking stack as reachable objects; The second stage is some functions before GC copying, such as GrayAllDirtyImmuneObjects(), which is responsible for processing dirty immune objects; FlipThreadRoots(), which is responsible for flipping the thread roots; The third stage is the functions used when cleaning up garbage, such as Sweep(), which is responsible for cleaning up unreferenced objects; SwapBitmaps(), which is responsible for swapping the memory-mapped bitmaps; UnBindBitmaps(), which is responsible for unbinding the bitmaps. It should be understood that each thread in the electronic device corresponds to a priority, and the electronic device determines the allocation of Central Processing Unit (CPU) resources for the thread based on the priority of the thread. The thread with a higher priority is more likely to be allocated CPU resources, which can avoid the situation where the thread cannot be executed. In the embodiment of the present application, when the electronic device determines that the GC thread is in the execution state, the GC priority is increased during the execution of the target function, which can avoid the situation where the GC thread cannot be executed and blocks the main thread, thereby avoiding the stuttering of the startup animation effect.

[0077] Step S205: When the electronic device determines that the GC thread is not in the execution state, it raises the GC waterline of the GC thread from the first waterline value to the second waterline value, where the second waterline value is greater than the first waterline value, and the first waterline value is the current GC waterline of the GC thread.

[0078] Exemplarily, the preset waterline value can be the maximum waterline value of the GC thread.

[0079] In some embodiments, when the virtual machine corresponding to the Android launcher of the electronic device determines that the current is the start time of application startup, it can record the current heap memory (for convenience of description, referred to as the first memory value), expand the heap memory (target_footprint) to the maximum value (i.e., growth_limit), and set the GC waterline (concurrent_start_bytes) according to the expanded heap memory. At this time, the increased GC waterline is the maximum value. Among them, the heap memory is the GC waterline plus a preset memory. Then, the electronic device can determine the increased GC waterline based on the expanded heap memory and the preset memory. For example, refer to the relevant content in the following text Figure 10 for relevant content.

[0080] Step S206: After the electronic device raises the GC waterline to the preset waterline value, after a preset duration, it restores the GC waterline of the GC thread from the second waterline value to the first waterline value.

[0081] Among them, the preset time can be determined based on the animation duration of the startup animation. For example, the preset time is greater than or equal to the animation duration of the startup animation.

[0082] In some embodiments, after the virtual machine corresponding to the Android launcher of the electronic device raises the GC waterline, it can set the GC delay time to a preset duration, create a recovery task, and add the recovery task to the task queue. The recovery task is used to restore the heap memory and the GC waterline; after the preset duration, the recovery task is executed, that is, the heap memory is restored to the first memory value, and the GC waterline is restored from the second waterline value to the first waterline value. For example, refer to the relevant content in the following text Figure 10 for relevant content.

[0083] In the embodiments of the present application, when the electronic device determines that the GC thread is not in the execution state when starting to execute the startup animation, it raises the GC waterline of the GC thread to avoid the GC thread running during the animation display of the startup animation, thereby avoiding the situation that the startup animation lags due to the running of the GC thread.

[0084] Figure 4 Another animation display method provided by the embodiments of the present application is shown.

[0085] In the embodiments of the present application, taking the example of exiting the first application from the application interface, the process of GC optimization when the electronic device displays the exit animation of the first application is introduced. The present application does not limit the type of the first application. The first application can be a system application or a third-party application.

[0086] It should be noted that in the embodiments of the present application, the user operation can be a touch operation of the user (such as a click operation, a long - press operation, a swipe - up operation, a swipe - down operation, or a side - swipe operation), can also be a non - contact operation (such as an air gesture), or can also be a voice command of the user. The embodiments of the present application do not make specific limitations on this.

[0087] The method includes the following steps in part or in whole:

[0088] Step S401: The electronic device displays the application interface of the first application.

[0089] For example, the first application is Figure 3A the video application shown, Figure 3B The user interface 32 shown is the application interface of the video application (i.e., the application interface of the first application) provided exemplarily in the embodiments of the present application. Among them, the user interface 32 can be the main interface provided by the video application. The user interface 32 may include information bars corresponding to multiple contacts. The information bar may include an icon of the contact's avatar, the contact's name, and a call control.

[0090] Step S402: In response to a user operation to exit the first application, the electronic device displays an exit animation effect, and the exit animation effect is the interface change process from the application interface of the first application to the desktop.

[0091] Exemplarily, the user can perform a swipe - up operation on the application interface of the first application. Correspondingly, the electronic device detects the swipe - up operation. In response to the swipe - up operation, it can display an exit animation effect, and the exit animation effect is the interface change process from the application interface of the first application to the desktop.

[0092] For example, the application interface of the first application is as Figure 3B shown in the user interface 32. The electronic device detects the swipe - up operation acting on the user interface 32. In response to the swipe - up operation, it can display an exit animation effect (not shown in the figure). Finally, it displays Figure 3A the desktop shown. The present application does not limit the duration and interface change of the exit animation effect. Exemplarily, the interface change process corresponding to the exit animation effect may include the application interface of the first application shrinking to the application icon of the first application, and other contents of the desktop gradually appearing, and finally the desktop is displayed.

[0093] It should be understood that the above - mentioned user operation to exit the first application is only an example provided in the embodiments of the present application and should not limit the present application. Any user operation that switches to the display of the desktop when the electronic device displays the application interface can only trigger the electronic device to display the above - mentioned exit animation effect.

[0094] This application does not limit the user operation of switching to the display desktop when the electronic device displays the application interface. This user operation can be a touch operation of the user (such as a click operation, a long - press operation, a swipe - up operation, a swipe - down operation, or a side - swipe operation), or a non - contact operation (such as an air gesture), or a voice command of the user, etc. Exemplarily, when the electronic device displays the application interface of the first application, the user can also request to display the desktop (or exit the application) through a voice command. Furthermore, the electronic device responds to the voice command and displays the above - mentioned exit animation effect.

[0095] Step S403: The electronic device determines the execution status of the GC thread corresponding to the desktop launcher in response to the user operation of exiting the first application.

[0096] Among them, the execution status of the GC thread can include being in the execution state and not being in the execution state.

[0097] Step S404: When the electronic device determines that the GC thread is in the execution state, it raises the GC priority from the first priority to the second priority during the execution of the target function. The second priority is higher than the first priority, and the first priority is the current GC priority of the GC thread.

[0098] Exemplarily, for the specific implementation of step S404, reference can be made to the relevant content of step S204, which will not be elaborated here.

[0099] In the embodiment of this application, when the electronic device determines that the GC thread is in the execution state and raises the GC priority during the execution of the target function, it can avoid the situation where the GC thread cannot be executed and blocks the main thread, thereby avoiding the lag of the exit animation effect.

[0100] Step S405: When the electronic device determines that the GC thread is not in the execution state, it raises the GC waterline of the GC thread from the first waterline value to the second waterline value. The second waterline value is greater than the first waterline value, and the first waterline value is the GC waterline of the current GC thread.

[0101] Exemplarily, for the specific implementation of step S405, reference can be made to the relevant content of step S205, which will not be elaborated here.

[0102] Step S406: After the electronic device raises the GC waterline to the preset waterline value, it restores the GC waterline of the GC thread from the second waterline value to the first waterline value after a preset duration.

[0103] Exemplarily, for the specific implementation of step S406, reference can be made to the relevant content of step S206, which will not be elaborated here.

[0104] In the embodiments of the present application, when the electronic device determines that the GC thread is not in the execution state at the start of executing the exit animation effect, it raises the GC waterline of the GC thread to avoid the GC thread from running during the animation display of the exit animation effect, thereby avoiding the situation where the GC thread runs and causes the exit animation effect to freeze.

[0105] Next, the form and software and hardware architecture of the electronic device provided in the embodiments of the present application are introduced.

[0106] The electronic device may be a portable terminal device equipped with or other operating systems, such as mobile phones, tablet computers, desktop computers, laptop computers, handheld computers, notebook computers, ultra-mobile personal computers (UMPCs), netbooks, as well as cellular phones, personal digital assistants (PDAs), augmented reality (AR) devices, virtual reality (VR) devices, artificial intelligence (AI) devices, wearable devices, in-vehicle devices, smart home devices, and / or smart city devices, and so on.

[0107] Figure 5 Exemplarily shows the hardware structure of the electronic device in the embodiments of the present application. As Figure 5 shown, the electronic device may include: a processor 110, an external memory interface 120, an internal memory 126, a camera 130, a display screen 140, an audio module 150, a speaker 150A, a receiver 150B, a microphone 150C, a headphone jack 150D, and a sensor module 160. Among them, the sensor module 160 may include a pressure sensor 160A, a distance sensor 160F, a proximity light sensor 160G, a touch sensor 160K, an ambient light sensor 160L, etc.

[0108] Among them, the processor 110 may include one or more processing units. For example, the processor 110 may include an application processor (AP), a modem processor, a graphics processing unit (GPU), an image signal processor (ISP), a controller, a memory, a video codec, a digital signal processor (DSP), a baseband processor, and / or a neural-network processing unit (NPU), etc. Among them, different processing units may be independent devices or integrated in one or more processors.

[0109] Among them, the controller may be the nerve center and command center of the electronic device. The controller may generate operation control signals according to the instruction operation code and timing signal to complete the control of fetching and executing instructions.

[0110] A memory may also be provided in the processor 110 for storing instructions and data. In some embodiments, the memory in the processor 110 is a cache memory. This memory may save the instructions or data that the processor 110 has just used or recycled. If the processor 110 needs to use the instruction or data again, it can directly call it from the memory. This avoids repeated accesses, reduces the waiting time of the processor 110, and thus improves the efficiency of the system.

[0111] In some embodiments, the processor 110 may include one or more interfaces. The interfaces may include an inter-integrated circuit (I2C) interface, an inter-integrated circuit sound (I2S) interface, a pulse code modulation (PCM) interface, a universal asynchronous receiver / transmitter (UART) interface, a mobile industry processor interface (MIPI), a general-purpose input / output (GPIO) interface, a subscriber identity module (SIM) interface, and / or a universal serial bus (USB) interface, etc.

[0112] It can be understood that the interface connection relationships between the modules illustrated in the embodiments of the present application are only illustrative descriptions and do not constitute a structural limitation on the electronic device. In other embodiments of the present application, the electronic device may also adopt different interface connection methods in the above embodiments, or a combination of multiple interface connection methods.

[0113] The internal memory 126 may include one or more random access memories (RAM) and one or more non-volatile memories (NVM).

[0114] The random access memory may include static random access memory (SRAM), dynamic random access memory (DRAM), synchronous dynamic random access memory (SDRAM), double data rate synchronous dynamic random access memory (DDR SDRAM, for example, the fifth generation of DDR SDRAM is generally referred to as DDR5 SDRAM), etc.;

[0115] The non-volatile memory may include disk storage devices, flash memory.

[0116] Flash memory can be classified into NOR FLASH, NAND FLASH, 3D NAND FLASH, etc. according to the operating principle, and can be classified into single-level cell (SLC), multi-level cell (MLC), triple-level cell (TLC), quad-level cell (QLC), etc. according to the number of potential levels of the storage unit. According to the storage specification, it can include universal flash storage (UFS), embedded multi media Card (eMMC), etc.

[0117] The random access memory can be directly read and written by the processor 110, and can be used to store the operating system or executable programs (such as machine instructions) of other running programs, and can also be used to store data of users and application programs, etc.

[0118] The non-volatile memory can also store executable programs and data such as user and application program data, which can be pre-loaded into the random access memory for direct reading and writing by the processor 110.

[0119] The external memory interface 120 can be used to connect to an external non-volatile memory to expand the storage capacity of the electronic device. The external non-volatile memory communicates with the processor 110 through the external memory interface 120 to implement the data storage function. For example, files such as music and videos are saved in the external non-volatile memory.

[0120] The electronic device realizes the display function through the GPU, the display screen 140, and the application processor, etc. The GPU is a microprocessor for image processing, connecting the display screen 140 and the application processor. The GPU is used to execute mathematical and geometric calculations for graphics rendering. The processor 110 may include one or more GPUs, which execute program instructions to generate or change the display information.

[0121] The display screen 140 is used to display images, videos, etc. The display screen 140 includes a display panel. The display panel can adopt a liquid crystal display (LCD). The display screen panel can also adopt an organic light-emitting diode (OLED), an active-matrix organic light-emitting diode or an active-matrix organic light-emitting diode (AMOLED), a flexible light-emitting diode (FLED), a miniled, a microLed, a micro-oled, a quantum dot light-emitting diode (QLED), etc. for manufacturing. In some embodiments, the electronic device may include 1 or N display screens 140, where N is a positive integer greater than 1.

[0122] The electronic device can realize the shooting function through the ISP, the camera 130, the video codec, the GPU, the display screen 140, and the application processor, etc.

[0123] The ISP is used to process the data fed back by the camera 130. For example, when taking a photo, the shutter is opened, and the light passes through the lens and is transmitted to the camera sensor. The optical signal is converted into an electrical signal, and the camera sensor transmits the electrical signal to the ISP for processing and converts it into an image visible to the naked eye. The ISP can also perform algorithm optimization on the noise and brightness of the image. The ISP can also optimize parameters such as the exposure and color temperature of the shooting scene. In some embodiments, the ISP can be set in the camera 130.

[0124] The camera 130 is used to capture static images or videos. An object generates an optical image through a lens and projects it onto a photosensitive element. The photosensitive element can be a charge coupled device (CCD) or a complementary metal-oxide-semiconductor (CMOS) phototransistor. The photosensitive element converts the optical signal into an electrical signal, and then transfers the electrical signal to the ISP to be converted into a digital image signal. The ISP outputs the digital image signal to the DSP for processing. The DSP converts the digital image signal into an image signal in a standard format such as RGB or YUV. In some embodiments, the electronic device may include one or N cameras 130, where N is a positive integer greater than 1.

[0125] In the embodiments of the present application, the camera 130 may be a telephoto camera, a main camera, a wide-angle camera, etc.

[0126] The digital signal processor is used to process digital signals. In addition to processing digital image signals, it can also process other digital signals. For example, when the electronic device selects a frequency point, the digital signal processor is used to perform a Fourier transform on the frequency point energy, etc.

[0127] The video codec is used to compress or decompress digital videos. The electronic device may support one or more video codecs. In this way, the electronic device can play or record videos in multiple coding formats, such as Moving Picture Experts Group (MPEG) 1, MPEG2, MPEG3, MPEG4, etc.

[0128] The NPU is a neural-network (NN) computing processor. By referring to the structure of a biological neural network, such as the transmission pattern between human brain neurons, it can quickly process input information and can also continuously self-learn. Through the NPU, applications such as intelligent cognition of the electronic device can be realized, such as image recognition, face recognition, speech recognition, text understanding, etc.

[0129] The electronic device can implement audio functions through the audio module 150, the speaker 150A, the receiver 150B, the microphone 150C, the headphone jack 150D, and the application processor, etc. For example, music playback, recording, etc.

[0130] The audio module 150 is used to convert digital audio information into an analog audio signal for output, and is also used to convert an analog audio input into a digital audio signal. The audio module 150 can also be used for encoding and decoding audio signals. In some embodiments, the audio module 150 can be disposed in the processor 110, or some functional modules of the audio module 150 can be disposed in the processor 110.

[0131] The speaker 150A, also known as the "loudspeaker", is used to convert an audio electrical signal into a sound signal. The electronic device can listen to music or hands-free calls through the speaker 150A.

[0132] The receiver 150B, also known as the "earpiece", is used to convert an audio electrical signal into a sound signal. When the electronic device answers a call or a voice message, the voice can be listened to by placing the receiver 150B close to the human ear.

[0133] The microphone 150C, also known as the "microphone" or "transmitter", is used to convert a sound signal into an electrical signal. When making a call or sending a voice message, the user can speak by placing the mouth close to the microphone 150C to input the sound signal into the microphone 150C. The electronic device can be provided with at least one microphone 150C. In some other embodiments, the electronic device can be provided with two microphones 150C, which can not only collect sound signals but also implement a noise reduction function. In some other embodiments, the electronic device can also be provided with three, four or more microphones 150C to collect sound signals, reduce noise, identify the sound source, and implement functions such as directional recording.

[0134] The headphone jack 150D is used to connect a wired headphone. The headphone jack 150D can be a USB interface, or a 3.5 mm open mobile terminal platform (OMTP) standard interface, or a cellular telecommunications industry association of the USA (CTIA) standard interface.

[0135] The structure illustrated in the embodiments of this application does not specifically limit the electronic device. In other embodiments of this application, the electronic device may include more or fewer components than shown in the figures, or combine certain components, or split certain components, or have different component arrangements. The components shown in the figures may be implemented in hardware, software, or a combination of software and hardware. For example, the electronic device may further include keys, motors, indicators, and a subscriber identification module (SIM) card interface, etc. Also for example, the sensor module may further include: gyroscope sensors, barometric pressure sensors, magnetic sensors, acceleration sensors, fingerprint sensors, temperature sensors, bone conduction sensors, and so on.

[0136] Figure 6 Exemplarily shows the software architecture of the electronic device according to the embodiments of this application.

[0137] Figure 6 It is a software structure block diagram of the electronic device provided by the embodiments of this application.

[0138] The layered architecture divides the software 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 system is divided into four layers, from top to bottom are the application layer, the application framework layer, the Runtime and system libraries, and the kernel layer.

[0139] The application layer may include a series of application packages.

[0140] Such as Figure 6 shown, the application packages at least include a desktop launcher and a first application, where the first application may be applications such as a camera, a gallery, a calendar, a call, a map, a navigation, a WLAN, a Bluetooth, music, a video, a short message, etc. (which may also be referred to as an app).

[0141] In some embodiments, the first application may be a system application or a third-party application.

[0142] The application framework layer provides application programming interfaces (APIs) and programming frameworks for the applications in the application layer. The application framework layer includes some predefined functions.

[0143] Such as Figure 6 shown, the application framework layer may include a window manager, a content provider, a view system, a telephone manager, a resource manager, a notification manager, etc.

[0144] In this application, the application framework layer may further include system services ( Figure 6 not shown) and an animation detection module (Figure 6 not shown).

[0145] Among them, the desktop launcher can call functions in the animation detection module when executing desktop animations. For example, the desktop launcher can call the first function in the animation detection module when starting to execute the desktop animation, and can call the second function in the animation detection module when ending the execution of the desktop function. Therefore, the present application can use the first function and the second function as the staking points for the start and end of the desktop animation, that is, the animation detection module is used to detect the start and end of the desktop animation.

[0146] The system service is responsible for providing core functions for Android, such as managing the application life cycle, handling communications, managing resources, providing system settings, etc.

[0147] The window manager is used to manage window programs. The window manager can obtain the display screen size, determine whether there is a status bar, lock the screen, capture the screen, etc.

[0148] The content provider is used to store and obtain data, and make this data accessible to application programs. The data may include videos, images, audio, dialed and answered calls, browsing history and bookmarks, phone books, etc.

[0149] The view system includes visible controls, such as controls for displaying text, controls for displaying pictures, etc. The view system can be used to build application programs. The display interface can be composed of one or more views. For example, a display interface including a text message notification icon may include a view for displaying text and a view for displaying pictures.

[0150] The phone manager is used to provide the communication function of the electronic device. For example, the management of call states (including answering, hanging up, etc.).

[0151] The resource manager provides various resources for application programs, such as localized strings, icons, pictures, layout files, video files, etc.

[0152] The notification manager enables application programs to display notification information in the status bar, can be used to convey notification-type messages, can automatically disappear after a short stay without user interaction. For example, the notification manager is used to notify the completion of a download, message reminder, etc. The notification manager can also be a notification that appears in the system top status bar in the form of a chart or scroll bar text, such as a notification of a background-running application program, and can also be a notification that appears on the screen in the form of a dialogue interface. For example, prompt text information in the status bar, emit a prompt sound, the electronic device vibrates, the indicator light flashes, etc.

[0153] The Runtime includes the core libraries and the virtual machine. The Runtime is responsible for the scheduling and management of the system. The core libraries consist of two parts: one part is the functional functions that the programming language (e.g., Java language) needs to call, and the other part is the core libraries of the system.

[0154] The application layer and the application framework layer run in the virtual machine. The virtual machine executes the programming files (e.g., Java files) of the application layer and the application framework layer as binary files. The virtual machine is used to perform functions such as the management of the object lifecycle, stack management, thread management, security and exception management, and garbage collection.

[0155] The system libraries can include multiple functional modules. For example: surface manager, Media Libraries, 3D graphics processing library (e.g., OpenGL ES), 2D graphics engine (e.g., SGL), etc.

[0156] The surface manager is used to manage the display subsystem and provides the fusion of 2D (2-Dimensional) and 3D (3-Dimensional) layers for multiple applications. The media library (media decoder) supports the playback and recording of multiple common audio and video formats, as well as static image files, etc. The media library can support multiple audio and video coding formats, such as: MPEG4, H.264, MP3, AAC, AMR, JPG, PNG, etc. The 3D graphics processing library is used to implement 3D graphics drawing, image rendering, synthesis, and layer processing, etc. The 2D graphics engine is the drawing engine for 2D drawing.

[0157] The software architecture may also include Figure 6 the hardware abstract layer (HAL), not shown in the figure. The hardware abstract layer is an interface layer located between the application framework layer and the kernel layer, providing a virtual hardware platform for the operating system.

[0158] The kernel layer is the layer between the hardware and the software. The kernel layer at least includes a display driver, a camera driver, an audio driver, and a sensor driver.

[0159] Based on the software and hardware architecture of the above electronic device, the following will Figures 7 to 11 describe in detail the dynamic effect display methods provided by each embodiment of the present application through the architecture.

[0160] Figure 7 A dynamic effect display method during application startup in an embodiment of the present application is shown. The method includes the following partial or all steps:

[0161] S701: The desktop launcher receives a user operation of clicking on the application icon of the first application.

[0162] S702: The desktop launcher transmits a task notification to the system service through an inter-process communication method (such as binder).

[0163] In one implementation, when the desktop launcher receives a user operation of clicking on the application icon of the first application, it transmits a task notification to the system service through an inter-process communication method (such as binder).

[0164] Among them, binder can be located in the kernel layer; this task notification is used to indicate the execution of starting the first application.

[0165] S703: The system service starts to execute a task (StartActivity), and this task is to execute a startup animation effect.

[0166] In one implementation, after receiving the above task notification, the system service starts to execute the task.

[0167] S704: When the system service prepares the startup interface of the first application, it notifies the desktop launcher to execute a startup animation effect (RemoteAnimation).

[0168] S705: The desktop launcher starts to execute the startup animation effect.

[0169] S706: The desktop launcher calls a first function.

[0170] Among them, the first function can be beginDetect() in the animation effect detection module (FluencyDetector) in the application framework layer.

[0171] S707: The desktop launcher transmits a first status value to the virtual machine corresponding to the desktop launcher, and the first status value is used to indicate that the current status is during the startup animation effect or the exit animation effect (that is, the desktop animation effect is being executed).

[0172] In the embodiment of the present application, the desktop launcher can call the first function to transmit the first status value to the virtual machine corresponding to the desktop launcher, and the first status value is used to indicate that the current status is during the startup animation effect or the exit animation effect.

[0173] S708: The virtual machine corresponding to the desktop launcher performs a postponed GC operation (abbreviation: postponed GC).

[0174] In one implementation, after receiving the above first status value, the virtual machine corresponding to the desktop launcher starts to perform a postponed GC.

[0175] Exemplarily, for the specific process of the virtual machine corresponding to the desktop launcher performing a postponed GC, reference can be made to the following text.Figure 10 The relevant content will not be elaborated here for the time being.

[0176] S709: When the virtual machine identifier corresponding to the desktop launcher is in the current state of startup animation or exit animation, this state identifier is used to increase the GC priority during the animation.

[0177] In one implementation, the virtual machine corresponding to the desktop launcher points to Figure 10 After the postponed GC shown in the figure or when receiving the above first state value, it indicates that the current state is during startup animation or exit animation, and this state identifier is used to increase the GC priority during the animation.

[0178] Exemplarily, the specific process of using the state identifier to increase the GC priority during the animation can be seen in the relevant content below Figure 11 The relevant content will not be elaborated here for the time being.

[0179] S710: The desktop launcher executes the startup animation.

[0180] S711: The desktop launcher finishes executing the startup animation.

[0181] S712: The desktop launcher calls the second function.

[0182] In one implementation, the desktop launcher calls the second function when it finishes executing the startup animation.

[0183] Among them, the second function can be endDetect() in the animation detection module of the application framework layer.

[0184] It should be understood that whether the application is launched by clicking the icon on the desktop or the desktop is swiped up to exit the application, the desktop animation (i.e., startup animation and exit animation) will both go to the FluencyDetector module. When the desktop launcher starts to execute the desktop animation, beginDetect() in the module will be executed, and when the desktop animation ends, endDetect() in the module will be executed. Therefore, in the embodiments of this application, these two functions are selected as the instrumentation points for optimizing the GC during the desktop animation.

[0185] S713: The desktop launcher passes the second state value to the virtual machine corresponding to the desktop launcher, and the second state value is used to indicate the period other than the application startup and exit animation.

[0186] In the embodiments of this application, the desktop launcher can call the second function to pass the second state value to the virtual machine corresponding to the desktop launcher, and the second state value is used to indicate the period other than the application startup and exit animation (or, used to indicate the end of the desktop animation display).

[0187] S714: When the virtual machine identifier corresponding to the desktop launcher is in a state other than the startup animation or exit animation, this status identifier is used to restore the GC priority.

[0188] In the embodiments of the present application, the virtual machine corresponding to the desktop launcher can, after receiving the second status value, identify the current state as during the non-startup animation or exit animation.

[0189] The following is an example of Figure 8A and Figure 8B introducing the process of triggering GC optimization.

[0190] As Figure 8A shown, the triggering process includes the following steps:

[0191] S11: The desktop launcher starts to execute the desktop animation.

[0192] S12: The desktop launcher calls the first function (such as beginDetect()) of the animation detection module.

[0193] Exemplarily, the desktop launcher starts to create the startup animation StartAnimation, calls the function onAnimationStart, and executes the animation detection module; when the startup animation starts to be triggered and executed, the beginDetect() in the animation detection module is executed.

[0194] S13: The desktop launcher determines whether the current state is the state starting from the application starting from the desktop or swiping up and returning to the desktop.

[0195] S14: When the desktop launcher determines that the current state is the state starting from the application starting from the desktop or swiping up and returning to the desktop, it passes the first status value to the virtual machine through Java Native Interface (JNI call), and the first status value is used to indicate that the current state is during the startup animation or exit animation.

[0196] S15: When the desktop launcher determines that the current state is not the state starting from the application starting from the desktop or swiping up and returning to the desktop, it continues to execute the desktop animation.

[0197] As Figure 8B shown, the triggering process includes the following steps:

[0198] S21: The desktop launcher finishes executing the desktop animation.

[0199] S22: The desktop launcher calls the second function (such as endDetect()) of the animation detection module.

[0200] Exemplarily, when the desktop launcher finishes executing the start-up animation effect EndAnimation, it calls the function onAnimationEnd and executes the animation detection module; after the start-up animation effect ends, it executes endDetect() in the animation detection module.

[0201] S23: The desktop launcher determines whether the current state is the end state of an application starting from the desktop or swiping up and returning to the desktop.

[0202] S24: When the desktop launcher determines that the current state is the start state of an application starting from the desktop or swiping up and returning to the desktop, it passes a second state value to the virtual machine through a JNI call. The second state value is used to indicate that the current state is not during the start-up animation effect or the exit animation effect.

[0203] S25: When the desktop launcher determines that the current state is not the start state of an application starting from the desktop or swiping up and returning to the desktop, it ends the execution of the desktop animation effect.

[0204] In this application, when the virtual machine receives the state value passed from the upper layer, it can execute the GC optimization scheme. If there is no GC being executed when the desktop animation effect starts, the GC is postponed for a preset time (such as 1s) to prevent blocking. If there is a GC being executed when the desktop animation effect starts and postponing the GC is ineffective, the priority of the GC occurring during the animation effect is increased to reduce the probability of the GC blocking the Launcher main thread.

[0205] The following is an exemplary introduction to Figure 9 the processing flow for GC optimization of the virtual machine corresponding to the desktop launcher (abbreviated as the virtual machine).

[0206] S901: The virtual machine receives the target state value passed from the application framework layer. The target state value includes the first state value or the second state value.

[0207] Among them, the first state value is used to indicate that the current state is during the start-up animation effect or the exit animation effect; the second state value is used to indicate that the current state is not during the start-up animation effect or the exit animation effect.

[0208] S902: Based on the target state value, the virtual machine determines whether it is the start moment of an application start or exit.

[0209] In one implementation, if the target state value is the first state value, the virtual machine determines that the current is the start moment of an application start or exit, and then executes step S904; otherwise, it executes step S903. For example, if the target state value is the second state value, the virtual machine determines that the current is not the start moment of an application start or exit, and then executes step S903.

[0210] S903: Based on the target state value, the virtual machine determines whether it is the end moment of an application start or exit animation effect.

[0211] In one implementation, if the target state value is the second state value, the virtual machine determines that the current is the end moment of the application startup or exit animation effect, and then executes step S906; otherwise, it executes step S907.

[0212] S904: The virtual machine attempts to postpone GC.

[0213] Exemplarily, for the specific implementation of step S904, reference can be made to Figure 10 the detailed description, which will not be elaborated here.

[0214] S905: The virtual machine sets the status flag to the first attribute value, and the first attribute value is used to indicate that the desktop animation effect is being executed.

[0215] Exemplarily, this status flag can be a flag bit, for example, it can be is_animation_excute_. The virtual machine can set the value of the is_animation_excute_ attribute to true (i.e., the above first attribute value is true). Here, the value of the is_animation_excute_ attribute being true is used to indicate that the desktop animation effect is being executed.

[0216] Among them, the first attribute value is used to increase the GC priority during the animation effect.

[0217] S906: The virtual machine sets the status flag to the second attribute value, and the second attribute value is used to indicate the end of the desktop animation effect execution (that is, the end of the desktop animation effect display).

[0218] Exemplarily, this status flag can be a flag bit, for example, it can be is_animation_excute_. The virtual machine can set the value of the is_animation_excute_ attribute to false (i.e., the above second attribute value is false). Here, the value of the is_animation_excute_ attribute being false is used to indicate the end of the desktop animation effect execution.

[0219] S907: The virtual machine ends the GC optimization.

[0220] Next, the process of the virtual machine postponing GC will be described exemplarily through Figure 10 the following.

[0221] S1: The virtual machine starts to execute GC postponement.

[0222] In some embodiments, when the virtual machine receives the first state value passed by the application framework layer, it starts to execute GC postponement. Among them, the first state value is used to indicate that the current state is during the startup animation effect or the exit animation effect.

[0223] S2: The virtual machine determines whether the GC thread corresponding to the desktop launcher is running.

[0224] S3: When the virtual machine determines that the GC thread corresponding to the desktop launcher is not running, it expands the heap memory (target_footprint) to the maximum value (growth_limit).

[0225] S4: The virtual machine sets the GC waterline (concurrent_start_bytes) according to the expanded heap memory, and the set GC waterline is the maximum value.

[0226] It should be understood that target_footprint is concurrent_start_bytes plus a preset memory. Since the preset memory remains unchanged, after expanding target_footprint to the maximum value (growth_limit), the GC waterline set based on the heap memory is the maximum value.

[0227] S5: The virtual machine creates a recovery task, which is used to recover the heap memory and the GC waterline after a preset duration.

[0228] In one implementation, the virtual machine can set the GC delay time to a preset duration, create a recovery task, and add it to the task queue. This recovery task is used to recover the heap memory and the GC waterline after a preset duration.

[0229] Exemplarily, the virtual machine can set the GC delay time to 1s, create a recovery task, and add it to the task queue through AddTask.

[0230] S6: The virtual machine executes the recovery task after the preset duration.

[0231] S7: The virtual machine ends the GC delay.

[0232] In the embodiments of the present application, at the start moment of the application startup or exit animation, GC will be tried to be postponed first; if there is currently a GC running, the postponed GC will be ended, otherwise the GC waterline can be adjusted to the maximum value, and the GC waterline recovery task will be executed after 1s. In this way, it can be ensured that no GC will run during the animation.

[0233] The following exemplarily describes Figure 11 the process of promoting the GC thread and restoring the GC priority.

[0234] S1: The GC thread starts running.

[0235] S2: When the GC thread executes to the target function, it determines whether it is currently during the startup animation or the exit animation based on the status flag.

[0236] In one implementation, when the GC thread executes to the target function, it determines that the status flag is the first attribute value, and the first attribute value is used to indicate that the desktop animation is being executed. Then the GC thread executes step S3; otherwise, it executes step S4.

[0237] Exemplarily, when the GC thread executes to the target function, it can determine whether the value of the is_animation_excute_ attribute is true. If so, it executes step S3; otherwise, it executes step S4.

[0238] S3: The GC thread raises the GC priority from the first priority to the second priority, where the first priority is the current priority of the GC thread.

[0239] In one implementation, when the GC thread executes to the target function and determines that it is currently during the startup animation or the exit animation, the GC thread can record the current GC priority and raise the first priority to the second priority, where the second priority is higher than the first priority.

[0240] S4: The GC thread executes the target function.

[0241] S5: When the GC thread finishes executing the target function, it determines whether the GC priority has been raised.

[0242] In one implementation, when the GC thread finishes executing the target function and determines that the GC priority has been raised, the GC thread executes step S6; otherwise, it executes step S7.

[0243] S6: The GC thread restores the GC priority from the second priority to the first priority.

[0244] S7: The GC thread continues to run.

[0245] When implementing this application, if the traces of starting an application by clicking on the desktop icon or swiping up to exit the application and returning to the desktop are captured multiple times, the animation range can be found based on the timestamps. It can be seen that if no GC occurs at the start of the desktop animation, then no GC occurs during the animation, and after a preset time (such as 1 s), the GC thread runs (Running) and executes the GC waterline restoration task; if GC occurs at the start of the desktop animation, the stage of raising the GC priority can be seen in the trace, and it can be observed that the priority is raised during its operation.

[0246] The term "user interface (UI)" in the specification, claims, and drawings of this application is a media interface for interaction and information exchange between an application or operating system and a user, which realizes the conversion between the internal form of information and the form acceptable to the user. The user interface of an application is source code written in specific computer languages such as Java and Extensible Markup Language (XML). The interface source code is parsed and rendered on a terminal device and finally presented as content recognizable by the user, such as controls like pictures, texts, and buttons. A control (also known as a widget) is a basic element of the user interface. Typical controls include a toolbar, a menu bar, a text box, a button, a scrollbar, pictures, and texts. The attributes and content of the controls in the interface are defined through tags or nodes. For example, XML passes through <textview> 、 <imgview> 、 <videoview>Nodes and the like are used to define the controls included in the interface. One node corresponds to one control or property in the interface, and after being parsed and rendered, the node presents as visible content to the user. In addition, in the interfaces of many applications, such as hybrid applications, there are usually web pages included. A web page, also known as a page, can be understood as a special control embedded in the application interface. A web page is source code written in a specific computer language, such as hyper text markup language (HTML), cascading style sheets (CSS), JavaScript (JS), etc. The web page source code can be loaded and displayed as recognizable content to the user by a browser or a web page display component similar to the browser function. The specific content included in the web page is also defined by tags or nodes in the web page source code. For example, HTML uses 、 、 <video> 、 <canvas>to define the elements and attributes of a web page.

[0247] A commonly used form of the user interface is the graphical user interface (GUI), which refers to the user interface related to computer operations displayed in a graphical manner. It can be an interface element such as an icon, window, or control displayed on the display screen of an electronic device, where the control can include visible interface elements such as icons, buttons, menus, tabs, text boxes, dialog boxes, status bars, navigation bars, and Widgets.

[0248] It should be understood that each step in the above method embodiments provided by this application can be completed by the integrated logic circuit of the hardware in the processor or the instructions in the form of software. The method steps disclosed in combination with the embodiments of this application can be directly embodied as being executed and completed by the hardware processor, or executed and completed by the combination of the hardware and software modules in the processor.

[0249] This application also provides an electronic device, which may include: a memory and a processor. Among them, the memory can be used to store computer programs; the processor can be used to call the computer programs in the memory so that the electronic device executes the method in any one of the above embodiments.

[0250] This application also provides a chip system, which includes at least one processor for implementing the functions involved in the method executed by the electronic device in any one of the above embodiments. In a possible design, the chip system also includes a memory for storing program instructions and data, and the memory is located inside or outside the processor. The chip system can be composed of chips or can include chips and other discrete devices.

[0251] Optionally, the processor in the chip system can be one or more. The processor can be implemented by hardware or by software. When implemented by hardware, the processor can be a logic circuit, an integrated circuit, etc. When implemented by software, the processor can be a general-purpose processor that realizes it by reading the software code stored in the memory.

[0252] Optionally, the memory in the chip system can also be one or more. The memory can be integrated with the processor or can be separately arranged from the processor, and the embodiments of this application do not limit this. Exemplarily, the memory can be a non-transitory processor, such as a read-only memory ROM, which can be integrated with the processor on the same chip or can be separately arranged on different chips. The embodiments of this application do not make specific limitations on the type of the memory and the setting manner of the memory and the processor.

[0253] Exemplarily, the chip system may be a field programmable gate array (FPGA), may be an application specific integrated circuit (ASIC), may also be a system on chip (SoC), may also be a central processor unit (CPU), may also be a network processor (NP), may also be a digital signal processor (DSP), may also be a micro controller unit (MCU), may also be a programmable logic device (PLD) or other integrated chips.

[0254] The present application also provides a computer program product, which includes: a computer program (which may also be referred to as code or instruction). When the computer program is run, it causes the computer to execute the method performed by the electronic device in any of the above embodiments.

[0255] The present application also provides a computer-readable storage medium, which stores a computer program (which may also be referred to as code or instruction). When the computer program is run, it causes the computer to execute the method performed by the electronic device in any of the above embodiments.

[0256] The various embodiments of the present application can be combined arbitrarily to achieve different technical effects.

[0257] In the above embodiments, it can be implemented in whole or in part by software, hardware, firmware, or any combination thereof. When implemented using software, it can be implemented in whole or in part in the form of a computer program product. The computer program product includes one or more computer instructions. When the computer program instructions are loaded and executed on a computer, the processes or functions according to the present application are generated in whole or in part. The computer can be a general-purpose computer, a special-purpose computer, a computer network, or other programmable devices. The computer instructions can be stored in a computer-readable storage medium or transmitted from one computer-readable storage medium to another. For example, the computer instructions can be transmitted from one website, computer, server, or data center to another website, computer, server, or data center by wire (such as coaxial cable, optical fiber, digital subscriber line) or wirelessly (such as infrared, wireless, microwave, etc.). The computer-readable storage medium can be any available medium that the computer can access or a data storage device such as a server or data center that includes one or more integrated available media. The available medium can be a magnetic medium (such as a floppy disk, hard disk, magnetic tape), an optical medium (such as a DVD), or a semiconductor medium (such as a solid state disk).

[0258] Those of ordinary skill in the art can understand that all or part of the processes in the methods of the above embodiments can be completed by relevant hardware instructed by a computer program. The program can be stored in a computer-readable storage medium. When the program is executed, it can include the processes of the above method embodiments. The aforementioned storage medium includes various media that can store program codes, such as ROM or random access memory RAM, magnetic disks, or optical discs.

[0259] In summary, the above are only embodiments of the technical solution of the present invention and are not intended to limit the protection scope of the present invention. Any modifications, equivalent replacements, improvements, etc. made according to the disclosure of the present invention shall be included within the protection scope of the present invention.< / canvas> < / video> < / videoview> < / imgview> < / textview>

Claims

1. A dynamic effect display method, characterized in that, the method includes: The electronic device responds to a detected first user operation and displays a desktop dynamic effect, where the first user operation is used to indicate starting the first application or exiting the first application; When the electronic device detects the first user operation, if the garbage collection (GC) thread of the desktop launcher is not in an execution state, the electronic device raises the GC waterline of the GC thread from a first waterline value to a second waterline value, where the second waterline value is greater than the first waterline value, and the first waterline value is the current GC waterline of the GC thread; or, When the electronic device detects the first user operation, if the GC thread is in an execution state, the electronic device raises the priority of the GC thread from a first priority to a second priority, where the second priority is higher than the first priority, and the first priority is the current priority of the GC thread.

2. The method according to claim 1, characterized in that, the first user operation is used to indicate starting the first application; Before the electronic device responds to the detected first user operation and displays the desktop dynamic effect, the method further includes: The electronic device displays the desktop of the electronic device, and the desktop dynamic effect is a picture displayed during the process of the desktop of the electronic device switching to the first interface of the first application.

3. The method according to claim 1, characterized in that, the first user operation is used to indicate exiting the first application; Before the electronic device responds to the detected first user operation and displays the desktop dynamic effect, the method further includes: The electronic device displays the second interface of the first application, and the desktop dynamic effect is a picture displayed during the process of the second interface of the first application switching to the desktop of the electronic device.

4. The method according to any one of claims 1-3, characterized in that, raising the priority of the GC thread from a first priority to a second priority includes: When the electronic device executes the target function, the electronic device raises the priority of the GC thread from the first priority to the second priority.

5. The method according to claim 4, characterized in that, the method further includes: After the electronic device executes the target function, the electronic device restores the priority of the GC thread from the second priority to the first priority.

6. The method according to any one of claims 1-5, characterized in that, the second waterline value is the heap memory limit value of the GC thread.

7. The method according to any one of claims 1-6, characterized in that, When the electronic device detects the first user operation and the GC thread is in an execution state, raising the priority of the GC thread from a first priority to a second priority includes: Before the desktop launcher of the electronic device displays the desktop dynamic effect, the desktop launcher of the electronic device sends a first status value to the virtual machine corresponding to the desktop launcher of the electronic device; the first status value is used to indicate that the desktop dynamic effect is being executed; After receiving the first status value, when determining that the GC thread is not in an execution state, the virtual machine raises the GC waterline of the GC thread from the first waterline value to the second waterline value.

8. The method according to claim 7, wherein, the method further includes: The desktop launcher of the electronic device sends a second status value to the virtual machine after displaying the desktop animation effect; the second status value is used to indicate the end of the display of the desktop animation effect.

9. The method according to claim 8, wherein, the method further includes: After receiving the first status value, the virtual machine sets the status identifier of the desktop animation effect to a first attribute value, and the first attribute value is used to indicate that the desktop animation effect is being executed; After receiving the second status value, the virtual machine sets the status identifier to a second attribute value, and the second attribute value is used to indicate the end of the display of the desktop animation effect.

10. The method according to claim 9, wherein, When the electronic device detects the first user operation and the GC thread is in an execution state, raising the priority of the GC thread from a first priority to a second priority includes: Before the GC thread of the electronic device executes the target function, obtaining the status identifier of the desktop animation effect; When the GC thread of the electronic device determines that the status flag is the first attribute value, raising the priority of the GC thread from the first priority to the second priority; After the GC thread of the electronic device executes the target function, restoring the priority of the GC thread from the second priority to the first priority.

11. An electronic device, wherein, comprising one or more processors and one or more memories; wherein, the one or more memories are coupled to the one or more processors, and the one or more memories are used to store computer program code, and the computer program code includes computer instructions, and when the one or more processors execute the computer instructions, the method according to any one of claims 1-10 is executed.

12. A computer-readable storage medium, comprising instructions, wherein, when the instructions run on an electronic device, the method according to any one of claims 1-10 is executed.