Application starting method, device, and storage medium

By optimizing the process lock-snatching order and rendering method when the application is started, triggering the startup effect in advance and using software rendering instead, it solves the problem of long startup time for terminal device applications and improves response speed and user experience.

WO2024169269A9PCT designated stage expired Publication Date: 2024-11-21HONOR DEVICE CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
PCT/CN2023/130513
Authority / Receiving Office
WO · WO
Patent Type
Applications
Current Assignee / Owner
Priority Date
2023-02-17
Filing Date
2023-11-08
Publication Date
2024-11-21

AI Technical Summary

Technical Problem

In terminal devices such as mobile phones, the application starts for a long time, resulting in slow response speed and affecting the user experience.

Method used

When the application starts, the system UI and systemserver process lock-up sequence is used to trigger the startup effect in advance, and the drawing task of the startup window is changed from hardware rendering to software rendering, optimize the process execution order and rendering method to shorten the The start time of the application.

Benefits of technology

It significantly shortens the startup time of the application, improves the user's response speed and user experience when opening the application, and avoids problems such as black screen caused by hardware rendering.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN2023130513_03102024_PF_FP_ABST
    Figure CN2023130513_03102024_PF_FP_ABST
Patent Text Reader

Abstract

Embodiments of the present application provide an application starting method, a device, and a storage medium, pertaining to the technical field of terminal application. In the solution of the present application, when a certain application undergoes a cold start, a systemUI process and a systemserver process will engage in a lock contention. If the systemUI gets the lock first, a startup window is created first, then desktop activities are suspended, and during the suspension of the desktop activities, a startup animation ready is triggered in advance; if the systemserver process gets the lock first, the desktop activities are suspended firstly, then a startup window is created, and during the creation of the startup window, a startup animation ready is triggered in advance. Because there is no need to wait for the completion of the rendering of the startup window to set the startup animation ready, the start time of the animation is advanced, which shortens the startup time of an application. From the user perspective, the operation of clicking on an application icon can be quickly responded to by a terminal device so that the effect of an application being opened immediately upon clicking can be experienced, and user experience is improved when an application is opened.
Need to check novelty before this filing date? Find Prior Art

Description

Application startup method, device and storage medium

[0001] This application claims priority to the Chinese patent application filed with the State Intellectual Property Office on February 17, 2023, with application number 202310156360.X and application name “Application startup method, device and storage medium”, the entire contents of which are incorporated by reference into this application. Technical Field

[0002] The present application relates to the field of terminal application technology, and in particular to an application startup method, device, and storage medium. Background Art

[0003] Various applications (APPs) installed on mobile devices and other terminal devices have become widely used in people's daily lives. Taking mobile phones as an example, the time from when a user clicks the application icon to when the first frame of the application is displayed is called the application's startup time. Application startup time is closely related to the application's response speed. The faster the response speed, the shorter the startup time, making response speed a key indicator of app performance.

[0004] However, after users click on an application icon, the application often responds slowly or freezes, resulting in a long startup time and a poor user experience. Improving the responsiveness of application launches has become a pressing technical challenge.

[0005] Summary of the Invention

[0006] The present application provides an application startup method, device, and storage medium, which can improve the response speed when starting an application, shorten the startup time of the application, and improve the user experience when opening the application.

[0007] To achieve the above objectives, this application adopts the following technical solutions:

[0008] In a first aspect, an embodiment of the present application provides an application startup method. The method includes:

[0009] Receive a user operation on the icon of the first application. In response to the operation, if the first process grabs the lock before the second process, the first process executes the first action first, and then the second process executes the second action, and triggers the startup animation in the process of executing the second action, wherein the first action is to create a startup window, and the second action is to suspend desktop activities, or the first action is to suspend desktop activities, and the second action is to create a startup window. After the startup window is created, the interface of the startup window is drawn. After the startup animation is triggered, the icon animation of the first application is displayed, and the start display time of the icon animation is earlier than the completion drawing time of the startup window. After the icon animation ends, the interface animation corresponding to the startup window is displayed.

[0010] In the above scheme, based on the lock grabbing results of the two processes, the execution order of creating the startup window and pausing the desktop activities can be determined, and the startup animation can be triggered in advance in the later executed action without waiting for the startup window to be drawn before starting the animation, thereby advancing the start time of the icon animation, that is, improving the response speed of the application and shortening the startup time of the application. In addition, the interface of the startup window can continue to be drawn during the display of the icon animation, so that the interface animation can continue to play after the icon animation ends. From the user's perspective, after clicking the application icon, the operation can be quickly responded to by the terminal device, and a point-and-click effect can be experienced, thereby improving the user experience when opening the application.

[0011] It should be noted that the embodiments of the present application do not limit the order of when the launch window interface starts to be drawn and when the first application's icon animation begins to be displayed. For example, the launch window interface can start to be drawn earlier than the first application's icon animation begins to be displayed, or the first application's icon animation begins to be displayed earlier than the launch window interface starts to be drawn, or the two moments can be the same moment.

[0012] In one possible implementation, the system UI process creates the launch window, while the system server process pauses desktop activities. The system UI and system server processes run in parallel. To prevent system issues caused by two processes modifying the same variable, the system UI and system server processes compete for a lock. The process that obtains the lock first takes precedence.

[0013] For example, when the first process is the systemUI process and the second process is the systemserver process (that is, the systemUI process grabs the lock before the systemserver process), the first process performs the first action, and then the second process performs the second action, and triggers the startup animation during the execution of the second action, including: the systemUI process calls the addStartingWindow() function to create a startup window with an empty interface content. After creating the startup window, the systemserver process calls the activityPause() function to notify the desktop launcher to pause desktop activities; at the same time, the activityPause() function sequentially calls the setReady() function to confirm that the creation of the startup window has been completed, calls the AppTranstitionReady() function to notify the launcher to start the animation, and calls the performSurfacePlacement() function to trigger the startup animation.

[0014] It should be understood that if the systemUI process successfully grabs the lock, the startup window can be created before activityPause(). Since the systemserver process and systemUI process are two parallel processes, after systemUI successfully creates the startup window, the systemserver process sets activityPause() and the systemUI process draws the startup window in parallel, and sets the startup animation ready during activityPause. That is, the startup animation ready is set in advance during the startup window drawing process, without having to wait until the startup window drawing is completed before setting the startup animation ready. This allows the remote animation to be triggered in advance, reducing response time.

[0015] It should be noted that after the launcher enters the pause state, the terminal device's display focus will switch from the entire desktop to the animation corresponding to the first application. In the scenario where the systemUI successfully grabs the lock, you can set the launch animation ready during the activityPause() process, but not before the activityPause() call. Otherwise, the animation will not be displayed due to the lack of focus.

[0016] For another example, when the first process is the systemserver process and the second process is the systemUI process (that is, the systemserver process grabs the lock before the systemUI process), the first process first executes the first action, and then the second process executes the second action, and triggers the startup animation during the execution of the second action, including: if the systemserver process grabs the lock before the systemUI process, the systemserver process calls the activityPause() function to notify the launcher to suspend desktop activities. After suspending desktop activities, the systemUI process calls the addStartingWindow() function to create a startup window with an empty interface content; at the same time, the addStartingWindow() function calls the setReady() function in sequence to confirm that the creation of the startup window has been completed, calls the AppTranstitionReady() function to notify the launcher of the desktop launcher startup animation, and calls the performSurfacePlacement() function to trigger the startup animation.

[0017] It should be understood that if the system server successfully grabs the lock, the startup window can be created after activityPause(), and the startup animation ready can be set during the creation of the startup window, without having to wait for the startup window to be drawn before setting the startup animation ready. This can trigger the display of remote animations in advance, thereby reducing response time. In addition, after the startup window is created, the system UI can continue to draw the startup window and continue to play the interface animation according to the drawn startup window after the icon animation ends.

[0018] It should be noted that in the scenario where the systemserver successfully grabs the lock, although the focus has been successfully switched during the activityPause process, the startup window has not yet been created. Therefore, the startup animation ready can be set during the execution of the addStartingWindow() function, but not before addStartingWindow(). Otherwise, the animation may not be displayed because the main window is not created.

[0019] In one possible implementation, after creating the splash window, drawing the splash window interface includes: after creating the splash window, having the ll.splashScreen thread of systemUI draw the splash window interface. For example, the ll.splashScreen thread calls the draw() function through the doframe() function to draw the splash window interface. The priority of the ll.splashScreen thread is greater than or equal to the priority of the render thread, which is used for hardware drawing.

[0020] Exemplarily, the priority of the 11.splashScreen thread is the highest priority (such as 97), and the priority of the render thread is 120. Alternatively, the priority of the 11.splashScreen thread and the priority of the render thread are both 120.

[0021] It should be understood that the priority of the ll.splashScreen thread, used for software rendering, is higher than that of the render thread, used for hardware rendering. Using the ll.splashScreen thread to draw the splash window eliminates the issues of texture loading, blocking commands being dequeued, and the render thread becoming runnable. Therefore, drawing the splash window using the ll.splashScreen thread takes less time than using the render thread to call hardware rendering.

[0022] Experimental verification shows that when the priority of the ll.splashScreen thread is equal to that of the render thread (for example, both are 120), the average time taken to draw the startup window using the ll.splashScreen thread is 12ms, while the time taken to draw the startup window using the render thread is 23.5ms. Therefore, using software rendering can effectively solve the long startup window drawing problem existing in hardware rendering. In particular, when the priority of the ll.splashScreen thread is the highest, the average time taken to draw the startup window using the ll.splashScreen thread can be reduced to 3ms to 9.5ms. Therefore, by increasing the priority of the ll.splashScreen thread, the average time taken to draw the startup window can be further shortened, allowing the startup window to be drawn before the icon animation ends.

[0023] In a possible implementation, the completion time of drawing the interface of the startup window is earlier than or equal to the end display time of the icon animation.

[0024] It should be understood that if the splash window interface drawing is not completed at the end of the icon animation, then after the icon animation ends, but before the splash window interface drawing is completed, abnormal issues such as a black screen may occur. If the ll.splashScreen thread is used to execute the splash window interface drawing task, it will not involve issues such as texture loading, all commands in the blocking instruction command being removed from the queue, and the render thread being able to run. Therefore, the splash window interface drawing can be completed before the icon animation ends, effectively avoiding abnormal issues such as a black screen.

[0025] In one possible implementation, after the startup animation is triggered, the icon animation of the first application is displayed, including: after calling the performSurfacePlacement() function to trigger the startup animation, the launcher calls the onAnimationStart() function to execute the remote animation. Among them, the remote animation includes icon animation and interface animation, the icon animation is a system-defined animation, and the interface animation is an application-defined animation. For example, after the launcher calls the onAnimationStart() function to start executing the remote animation, the icon animation can be drawn first, and then the icon animation can be displayed, and the interface animation can be drawn in the process of drawing the icon animation and displaying the icon animation, and then the interface animation can be displayed.

[0026] It should be understood that compared with the native application startup process which can only start the ready animation after the startup window is drawn, the optimized application startup method can start the ready animation in advance, so the time of executing the remote animation is correspondingly advanced, so that the user can see the icon animation faster.

[0027] In a possible implementation, after drawing the interface of the startup window and before displaying the interface animation corresponding to the interface, the method further includes: instructing the completion of drawing of the interface through a finishDrawing() function.

[0028] It should be understood that the finishDrawing() function is used to indicate the completion of the drawing of the interface, so that the launcher can further display the interface animation after the icon animation ends.

[0029] In one possible implementation, if the first process acquires the lock before the second process, the first process performs the first action first, and then the second process performs the second action. This includes: if the first process acquires the lock before the second process, the first process performs the first action. After the first process releases the lock, the second process performs the second action.

[0030] It should be understood that the first process that grabs the lock first can perform the first action before holding the lock, preventing other processes (such as the second process) from modifying the same variable, thereby preventing system problems.

[0031] In one possible implementation, before the first process and the second process grab the lock, the method also includes: apTouchDaemon reports an input event to the launcher, where the input event indicates the user's operation on the icon of the first application; the launcher distributes and processes the input event to the systemserver process, and notifies the systemserver process to start the activity corresponding to the input event; the systemserver process starts the activity corresponding to the input event.

[0032] In a possible implementation, the systemserver process starts an activity corresponding to the input event, including: if it is determined that the process of the first application does not exist, notifying the Zygote process to create a process for the first application.

[0033] It should be understood that if the process of the first application does not exist among all the processes currently created by the terminal device, it is necessary to create and start a process for the first application and notify the launcher to suspend desktop activities.

[0034] In one possible implementation, when using the native app launch process, the time from receiving the action to the start of icon animation is within the range of [120ms, 150ms]. When using the optimized app launch process, the time from receiving the action to the start of icon animation is within the range of [60ms, 90ms].

[0035] It should be understood that the optimized application startup method shortens the startup time compared to the native application startup process, allowing users to see icon animations more quickly.

[0036] In a second aspect, the present application provides a device comprising a unit for executing the method described in the first aspect. The device may correspond to executing the application startup method described in the first aspect. For the relevant description of the units in the device, please refer to the description of the first aspect above, and for the sake of brevity, it is not repeated here.

[0037] The application startup method described in the first aspect above can be implemented by hardware, or by hardware executing corresponding software implementation. The hardware or software includes one or more modules or units corresponding to the above functions. For example, a processing module or unit, a display module or unit, etc.

[0038] In a third aspect, the present application provides a terminal device comprising a memory and one or more processors. The memory is configured to store computer program code, which includes computer instructions. When the computer instructions are executed by the processor, the terminal device executes the application startup method provided in any one of the first aspects.

[0039] In a fourth aspect, the present application provides a computer-readable storage medium. The computer-readable storage medium includes computer instructions. When the computer instructions are executed on a terminal device, the terminal device executes the application startup method provided in the first aspect and any possible implementation thereof.

[0040] In a fifth aspect, the present application provides a computer program product. When the computer program product is run on a computer, the computer is caused to execute the application startup method provided in the first aspect and any possible implementation thereof.

[0041] In a sixth aspect, the present application provides a chip system. The chip system includes one or more interface circuits and one or more processors. The interface circuits and processors are interconnected via a circuit. The chip system can be applied to a terminal device including a communication module and a memory. The interface circuit is configured to receive a signal from the memory of the terminal device and send the received signal to the processor, the signal including computer instructions stored in the memory. When the processor executes the computer instructions, the terminal device can execute the application startup method provided in the first aspect and any possible implementation thereof.

[0042] It can be understood that the beneficial effects that can be achieved by the second aspect apparatus, the third aspect terminal device, the fourth aspect computer-readable storage medium, the fifth aspect computer program product and the sixth aspect chip system provided above can be referred to as the beneficial effects in the first aspect and any possible implementation thereof, and will not be repeated here. BRIEF DESCRIPTION OF THE DRAWINGS

[0043] FIG1 is a schematic diagram showing one of the interface changes when starting an application according to an embodiment of the present application;

[0044] FIG2 is a second schematic diagram of interface changes when starting an application according to an embodiment of the present application;

[0045] FIG3 is a schematic diagram of the architecture of a terminal device provided in an embodiment of the present application;

[0046] FIG4 is one of the timing diagrams for starting an application program provided in an embodiment of the present application;

[0047] FIG5 is a schematic diagram of a method flow chart corresponding to FIG4 provided in an embodiment of the present application;

[0048] FIG6 is a second timing diagram of starting an application program according to an embodiment of the present application;

[0049] FIG7 is a schematic diagram of a method flow chart corresponding to FIG6 provided in an embodiment of the present application;

[0050] FIG8 is a schematic diagram of the startup time corresponding to the method of FIG5 and FIG7 provided in an embodiment of the present application;

[0051] FIG9 is a third timing diagram of starting an application program according to an embodiment of the present application;

[0052] FIG10 is a schematic diagram of a method flow chart corresponding to FIG9 provided in an embodiment of the present application;

[0053] FIG11 is a schematic diagram of the startup time corresponding to the method of FIG5 and FIG10 provided in an embodiment of the present application;

[0054] FIG12 is a timing diagram of an embodiment of the present application when an exception occurs when starting an application;

[0055] FIG13 is a third schematic diagram of interface changes when starting an application according to an embodiment of the present application;

[0056] FIG14 is a fourth schematic diagram of interface changes when starting an application according to an embodiment of the present application;

[0057] FIG15 is a schematic diagram of the overall process of the application startup method provided in an embodiment of the present application;

[0058] FIG16 is a schematic diagram of the hardware structure of the terminal device provided in an embodiment of the present application. DETAILED DESCRIPTION

[0059] In order to make the purpose, technical solutions and advantages of the embodiments of the present application clearer, the technical solutions in the embodiments of the present application will be clearly and completely described below in combination with the drawings in the embodiments of the present application. Obviously, the described embodiments are only part of the embodiments of the present application, not all of the embodiments.

[0060] In the description of this application, unless otherwise specified, " / " means or. For example, A / B can mean A or B. In the description of this application, "and / or" is simply a way to describe the association relationship between related objects, indicating that three relationships can exist. For example, A and / or B can mean: A exists alone, A and B exist at the same time, and B exists alone.

[0061] In the specification and claims of this application, the terms "first" and "second" are used to distinguish different objects or to distinguish different processing of the same object, rather than to describe a specific order of objects. For example, "first time" and "second time" are used to distinguish different times, rather than to describe a specific order of times. In the embodiments of this application, "plurality" refers to two or more.

[0062] References to "one embodiment" or "some embodiments" in this specification mean that a particular feature, structure, or characteristic described in conjunction with that embodiment is included in one or more embodiments of the present application. Thus, phrases such as "in one embodiment," "in some embodiments," "in other embodiments," and "in other embodiments" appearing in various places in this specification do not necessarily refer to the same embodiment, but rather mean "one or more but not all embodiments," unless otherwise specifically emphasized. The terms "including," "comprising," "having," and variations thereof all mean "including but not limited to," unless otherwise specifically emphasized.

[0063] To facilitate understanding of the embodiments of the present application, some terms used in the embodiments of the present application are explained below.

[0064] Terminal devices can install and run applications. When a terminal device runs any application (such as application A) in the foreground, the terminal device's display shows the interface of application A, and the terminal device user can interact with application A's interface. When the terminal device runs application A in the background, the terminal device no longer displays the interface of application A, and the terminal device user cannot interact with application A's interface.

[0065] Each application's interface consists of activities, which in turn consist of views. A view is a window, which acts as a carrier for the view. When an activity is started, the application process is notified, and each activity belongs to that application process. For example, a reading app has one activity, and a memo app has another. Since the memo app and the reading app are different applications, they each have different activities.

[0066] When a user is using a terminal device, if application A is not running (including not running in the background or in the foreground), the user can start application A by clicking the icon of application A on the desktop of the terminal device. The terminal device first creates and starts a process for application A, and loads activity1 of application A through the process. Activity1 enters the task stack and is located at the top of the task stack. The terminal device displays an interface corresponding to activity1. The user can interact with interface 1 to make the terminal device display another new interface. Then the process of application A in the system loads another new activity2. Activity2 will enter the task stack and be located at the top of the task stack, and the old activity1 will be pushed below the task stack. Accordingly, the display screen of the terminal device displays interface 2 corresponding to activity2, and the interface of the old activity1 is destroyed.

[0067] From the above description, it can be understood that the various interfaces displayed by the application rely on the application process to load various activities. In addition, after the application goes from the foreground to the background, the application process can still exist in the system. If the user clicks the application icon to make the application return to the foreground, since the application process exists in the system background, the system no longer needs to create and start a process for the application. If the application's activity still exists in the system memory, the application does not need to repeat the activity initialization, rendering and drawing operations, but instead displays the interface corresponding to the activity at the top of the application's task stack in the foreground. This startup process can be called a hot start.

[0068] After the application goes from running in the foreground to running in the background, the application process may still exist in the system. If the application is killed in the background (for example, the application process is destroyed and the activity is recycled), in this case, the application process does not exist in the system background. After the application process is destroyed, the application may still have self-starting behavior, that is, the application can request the system to create and start a process for the application in the background. If the application process is successfully created and started in the system background, the user clicks on the application icon to make the application return to the foreground again. Since the application process exists in the system background, the system no longer needs to create and start a process for the application, and since the application activity has been recycled before, the system needs to load the application activity through the application process until the activity is successfully loaded and the application interface is displayed. This startup process can be called a warm startup.

[0069] When an application moves from the foreground to the background, its process may be destroyed and its activity may be recycled. This means that the application's process no longer exists in the system background. If the user clicks the application's icon to bring it back to the foreground, the system must create and start a process for the application. After the process is started, the system loads the application's activity through the process until the activity is successfully loaded and the application's interface is displayed. This startup process is called a cold boot.

[0070] The embodiments of the present application mainly relate to the cold start of an application. During the cold start process, the terminal device needs to go through a series of processing operations before the interface of the application can be displayed. It takes a period of time from the user clicking the icon of the application to the display of the first frame of the application (i.e., the startup window). In actual applications, during this period of time, the terminal device can display the system-defined startup page (also called transition page), such as icon animation page, advertising page, blank page, logo page, and snapshot page. After the startup page is displayed, if the drawing of the first frame of the application has been completed, the first frame of the application and other interfaces after the first frame are displayed, wherein the first frame can be the window background interface of the application theme, the boot page custom developed by the application, the main interface, the last interface displayed before returning to the background last time, etc.

[0071] The above-mentioned terminal device is also referred to as a terminal or user equipment (UE). For example, the terminal device may be a PC, a mobile phone, a smart screen, a smart TV, a tablet computer (Pad), a wearable device, a computer with wireless transceiver function, a virtual reality (VR) device, an augmented reality (AR) device, a wireless terminal in industrial control, a wireless terminal in self-driving, a wireless terminal in remote medical surgery, a wireless terminal in a smart grid, a wireless terminal in transportation safety, a wireless terminal in a smart city or a wireless terminal in a smart home, etc., or may be other devices or apparatuses capable of installing and starting applications. The embodiments of the present application do not impose any restrictions on the specific type of the terminal device.

[0072] As a scenario example, FIG1 is a schematic diagram of interface changes during a cold start provided in an embodiment of the present application.

[0073] The terminal device provides multiple system desktops, each of which includes icons for multiple applications. Users can trigger the terminal device to display the application's operation interface by clicking on any application icon. For example, Figure 1 (a) shows a system desktop that includes system applications such as Honor Video, Sports Health, Weather, and Browser. It should be understood that the system desktop may also include third-party applications.

[0074] Take, for example, the case where the Honor Video task stack does not exist in the system background when launching Honor Video. As shown in Figure 1 (b), the user can click the Honor Video icon. After the terminal device detects the user's click on the Honor Video icon, it first starts the activity, then creates a new process for Honor Video and adds the Honor Video launch window. After the launch window is drawn, the remote animation is started. Remote animation can include two parts: the first part is the icon animation (displaying the system-defined launch page), and the second part is the interface animation (displaying the application-customized interface). As shown in Figure 1 (c), the terminal device first starts the icon animation, gradually enlarging the Honor Video icon, and transitioning to the icon animation shown in Figure 1 (d). After the icon animation is played according to the system default settings, the terminal device starts the interface animation shown in Figure 1 (e) according to the already drawn launch window. This interface animation is the window background interface of the Honor Video theme. In actual applications, this interface animation can also be a custom-developed boot page, a custom-developed blank page, a custom-developed main interface, the last interface displayed before returning to the background, etc. Then, the terminal device gradually enlarges the interface dynamic effect shown in (e) of Figure 1 to transition to the interface dynamic effect shown in (f) of Figure 1. After the interface dynamic effect is enlarged to full screen display, the terminal device can display the main interface of Honor Video.

[0075] As another example scenario, Figure 2 is a schematic diagram of another interface change during a cold start provided by an embodiment of the present application. Different from the previous example scenario, this example scenario uses the icon animation of an advertisement page and the interface animation of a user agreement and privacy policy prompt interface customized by the browser application as an example.

[0076] Take, for example, a user's first use of a browser during a football match. Figure 2 (a) shows a terminal device's system desktop, which includes an icon for a browser the user has never used before. As shown in Figure 2 (b), the user can click the browser icon. After the terminal device detects the user's click on the browser icon, it first launches the activity, then creates a new process for the browser and adds the browser's startup window. After the startup window is drawn, the remote animation is launched. Remote animation can include two parts: the first is the advertising animation (displaying the system-defined startup page), and the second is the interface animation (displaying the application's customized interface). As shown in Figure 2 (c), the terminal device first launches the advertising animation, displaying the full-screen advertising page with a football at the center. As shown in Figure 2 (d), the terminal device displays the animation of the football spinning by updating the advertisement. After the advertising animation is played according to the system default settings, the terminal device launches the interface animation shown in Figure 2 (e) based on the already drawn startup window. Since this is the user's first use of the browser, the interface animation is a user agreement and privacy policy prompt interface custom-developed by the browser application. The terminal device then gradually enlarges the interface animation shown in Figure 2 (e), transitioning to the interface animation shown in Figure 2 (f). After the interface animation is enlarged to full screen, if the user clicks "Agree and Continue," the terminal device displays the browser's main interface, and the interface animation is updated to another guide page the next time the browser is launched. If the user clicks "Disagree and Exit," the terminal device cancels the browser launch, and the interface animation remains the user agreement and privacy policy prompt interface the next time the browser is launched.

[0077] In both of the above scenarios, after a user clicks an application icon, the device performs the following operations to launch the application: first, the activity is started, then a new process is created for the application, and the browser launch window is added. After the launch window is drawn, remote animation is initiated. Remote animation involves two steps: first, displaying the system-defined launch page, and then displaying the application's customized interface.

[0078] The architecture of the terminal device is introduced below with reference to FIG3 .

[0079] Figure 3 is a schematic diagram of the architecture of a terminal device provided in an embodiment of the present application. As shown in Figure 3, the terminal device can adopt a layered architecture to divide the software into several layers, each layer having a clear role and division of labor. The layers communicate with each other through software interfaces. In some embodiments, the software layers of the software structure are divided from top to bottom into: application (APP) layer, application framework (FWK) layer, system library and kernel layer. The above software architecture runs on top of the hardware layer, which may include a graphics processing unit (GPU), a display and a speaker, etc.

[0080] The application layer, also known as the app layer, includes a range of applications, such as cameras, photo galleries, browsers, video players, and games. When these applications are running, they access the various service modules provided by the application framework layer through the application programming interface (API) and execute corresponding intelligent services. The app layer also includes core Android applications such as the application monitoring process (apTouchDaemon), the desktop launcher (launcher), and the system user interface (systemUI).

[0081] Usually, after the Android system is started, the launcher can run as a core application resident in the Android system. The startup icon of the application is generally set in the launcher. Specifically, the launcher can monitor the user's operation on the application icon through apTouchDaemon. When apTouchDaemon detects that the user clicks on the startup icon of a certain application, apTouchDaemon generates an input event and reports the input event to the launcher. The launcher distributes and processes the input event, generates an application startup message and sends it to the relevant services in the application framework layer, starts the application process of the application through these services, and draws the startup window, and then the systemUI displays the drawn interface. It should be understood that when the user clicks on the icons of different applications, the launcher will generate startup messages for different applications, thereby starting the application processes corresponding to different applications.

[0082] The application framework layer, also known as the framework layer, provides APIs and a programming framework for applications in the application layer. The programming framework includes predefined functions, such as the system server process and the Zygote process.

[0083] The systemserver process provides almost all system services for apps in the application layer, such as activity manager service (AMS), power manager service (PMS), window manager service (WMS), and input method manager service (IMS). These system services can reside in the systemserver process as threads.

[0084] The Zygote process is a crucial daemon service in the Android system. Almost all application processes are forked from the Zygote process. Because applications are written in Java, each needs to run as a process in its own independent virtual machine. When an application starts, the Zygote process hatches its own virtual machine, sharing the virtual machine's memory and the services provided by the system server process.

[0085] Typically, after the launcher detects that a user has clicked on an application's launch icon, it sends a launch message for the application to the systemserver process. If an application process for the application doesn't exist in the current application process, then a new application process needs to be created for the application. The systemserver process then calls AMS to communicate with the Zygote process, requesting that the Zygote process create a corresponding application process for the application. After receiving the request, the Zygote process creates application process 1 in response. Application process 1 includes the application's main thread (activityThread). To begin running the application's code normally, application process 1 must first initialize the application's main thread and load the application's class files into memory. The main thread can initialize the main thread by executing the activityThread's main function. Initializing the application's main thread allows you to build a virtual machine environment in which the application can run. You can then register application process 1 in AMS, create various directories during the application's runtime, and establish a message distribution mechanism between the application and various services in the systemserver process.

[0086] In the embodiment of the present application, processes such as apTouchDaemon, launcher, systemserver, systemUI and Zygote can communicate with each other through binder.

[0087] The system library can include multiple functional modules. For example, the surface manager, media libraries, 3D graphics processing library (such as OpenGL ES), 2D graphics engine (such as SGL), etc. Among them, the surface manager is used to manage the display subsystem and provide 2D and 3D layer fusion for multiple applications. The media library supports a variety of commonly used audio and video format playback and recording, as well as static image files, etc. The media library can support multiple audio and video encoding formats. The 3D graphics processing library is used to implement 3D graphics drawing, image rendering, synthesis, and layer processing, etc. The 2D graphics engine is a drawing engine for 2D drawing.

[0088] The Android runtime consists of core libraries and a virtual machine (VM). The Android runtime is responsible for scheduling and management of the Android system. The core libraries consist of two parts: one for Java-based functions and the other for the Android core library. The application layer and application framework layer run in the VM. The VM executes Java files from the application and framework layers as binary files. The VM performs functions such as object lifecycle management, stack management, thread management, security and exception management, and garbage collection.

[0089] The kernel layer is the layer between hardware and software. The kernel layer includes at least display drivers, audio drivers, sensor drivers, etc., and the present application embodiment does not impose any restrictions on this.

[0090] It should be noted that the layers in the software structure shown in FIG3 and the components contained in each layer do not constitute a specific limitation on the terminal device. In other embodiments, the terminal device may include more layers than shown. Each layer may include more or fewer components than shown. In addition, the above-mentioned functional modules may be combined into one functional module, and a functional module may be composed of multiple functional modules.

[0091] It is understandable that, in order to implement the application startup method in the embodiment of the present application, the terminal device includes hardware and / or software modules that perform the corresponding functions. In combination with the algorithm steps of each example described in the embodiments disclosed herein, the present application can be implemented in the form of hardware or a combination of hardware and computer software. Whether a function is executed in the form of hardware or computer software driving hardware depends on the specific application and design constraints of the technical solution. Those skilled in the art can use different methods to implement the described functions for each specific application in combination with the embodiments.

[0092] The following will introduce the native process of application cold start based on the software architecture provided in Figure 3 in combination with Figures 4 and 5. This native process can be applied to the scenario examples shown in Figures 1 and 2.

[0093] As shown in Figure 4, the sequence of the application cold start response process includes the following: ① apTouchDaemon monitors user actions on the application icon, generates input events, and calls the InputEvent() function to report the input events to the launcher. ② The launcher calls the DeliverInput() function to notify the system server to dispatch the application event. The system server calls the InputDispatch() function to dispatch the input events. ③ The launcher calls the startActivity() function to start an activity corresponding to the application. ④ SystemUI calls the addStartingWindow() function to create the startup window, uses the doFrame() function to draw the startup window interface / view, and then uses the finishDrawing() function to indicate that the startup window drawing is complete. Furthermore, the system server notifies the launcher to enter the pause state through the activityPause() function. ⑤ After completing the startup window drawing, the system server calls the setReady() function to set the animation ready. ⑥ The system server starts the animation ready through the AppTranstitionReady() function and triggers the startup animation by calling the performSurfacePlacement() function on the layout window through the traverser method. ⑦The launcher starts the remote animation through the onAnimationStart() function to execute the remote animation.

[0094] Fig. 5 is a schematic flow chart of a specific method corresponding to the timing diagram of Fig. 4. As shown in Fig. 5, the method includes steps A1 to A13.

[0095] A1, in response to a user operation on the application 1 icon, apTouchDaemon monitors the user operation on the application icon to generate an input event, that is, apTouchDaemon monitors the occurrence of an input event.

[0096] Among them, application 1 is any system application or third-party application installed in the terminal device.

[0097] For example, the above operation can be a click operation on the application 1 icon on the desktop, or a click operation on the application 1 icon in the APP resource library. For example, the above operation can be a click operation on the Honor Video icon as shown in (b) of Figure 1, or a click operation on the browser icon as shown in (b) of Figure 2.

[0098] apTouchDaemon can be used to monitor user operations on icons of various application programs. When a user clicks the icon of application 1, apTouchDaemon generates an input event corresponding to application 1.

[0099] A2, apTouchDaemon calls the InputEvent() function to report the input event to the launcher.

[0100] A3: The launcher starts calling the DeliverInput() function to notify the system server to deliver the input event. In other words, the launcher requests the system server to deliver the input event.

[0101] A4, systemserver dispatches input events through the InputDispatch() function.

[0102] It should be understood that when a user clicks on icons of different applications, the system server will dispatch corresponding input events to the different applications so that they can execute corresponding startup processes.

[0103] A5: The launcher calls the startActivity() function of the system server, instructing the system server to start an activity corresponding to the input event. In other words, the launcher requests the system server to start an activity.

[0104] The launcher itself is an activity. When the user clicks the app icon, the launcher first calls the startActivitySafely function and then calls the Activity.startActivity() function, which begins communication with the system server. The launcher and system server are different processes and communicate through Binder.

[0105] Combined with the description of the above embodiment, the systemserver process can include multiple services, such as AMS, PMS, WMS and IMS. Since AMS is the core service in Android, it is mainly responsible for starting, switching, scheduling components in the system and managing and scheduling application processes. Therefore, the launcher can specifically call the startActivity() function of AMS to request AMS to start an activity.

[0106] A6, systemserver calls the startActivity() function to start an activity corresponding to the input event.

[0107] During the activity startup process, AMS can determine whether a new process needs to be created for application 1 by detecting whether there is a process of application 1 in the current process, that is, whether the input event is a cold start.

[0108] The process of starting an activity can be as follows: (1) AMS tells the launcher to enter the pause state, and the launcher enters the paused state and tells AMS. (2) When it is determined that there is no process for application 1, AMS tells Zygote to create a process for application 1 and start ActivityThread.main(). Bind the application process to AMS. AMS sends a request to start the activity. The Handler of ActivityThread processes the request to start the activity. In process (2), AMS also calls systemUI to create a startup window through the startActivityInner() function in the startActivity() function. It should be understood that since Zygote creates a new process for application 1 in this process, this startup process is a cold start, and you can continue to execute A7-A13 below.

[0109] According to the introduction in the previous paragraph, the startup process of an activity includes at least two parts: one part is that the systemserver tells the launcher to execute activityPause(), which is A7 below; the other part is that the systemUI creates a startup window, which is A8 below. The present application is an embodiment that provides a lock-grabbing mechanism, in which two processes running in parallel, systemserver and systemUI, grab the lock. The process that grabs the lock first will hold the lock, thereby preventing other processes that have not grabbed the lock from modifying the same variable, thereby preventing system problems. In one case, the systemserver grabs the lock first. At this time, the systemserver first tells the launcher to execute activityPause(), the launcher enters the paused state, and then the systemUI creates the startup window, that is, A7 is executed first and then A8 is executed. In another case, the systemUI grabs the lock first. At this time, the systemUI first creates the startup window, and then the systemserver tells the launcher to execute activityPause(). The creation of the startup window has been completed before activityPause(), that is, A8 is executed first and then A7 is executed.

[0110] A7, systemserver notifies the launcher to enter the pause state through the activityPause() function.

[0111] After the launcher receives the activity pause instruction sent by the system server, the desktop activity enters the paused state (ie, the desktop activity is paused), and the display screen focus of the terminal device is switched from the entire desktop to the startup page corresponding to application 1.

[0112] A8, systemUI calls the addStartingWindow() function to create the startup window.

[0113] It should be noted that the creation of the startup window in A8 only means that it will be registered in the WMS, but the created window is empty. This window can be called the main window.

[0114] A9, systemUI calls the doFrame() function to draw the startup window interface.

[0115] After A8 creates an empty startup window, A9 can draw the interface for the startup window. That is, the empty startup window is rendered and filled, and the final result is the startup window.

[0116] The startup window can render an interface customized by application 1, such as the window background interface of the application theme, the boot page customized by application 1, the main interface customized by application 1, or any other interface customized by application 1, etc., which is not limited in the embodiments of this application.

[0117] For example, in the native process of cold start of the application, the doFrame() function can call the HardwareRender() function, and the render thread uses the GPU for hardware rendering, thereby sharing the pressure of the main thread.

[0118] A10, systemUI indicates the completion of startup window drawing through the finishDrawing() function.

[0119] A11, after completing the drawing of the startup window, systemserver calls the setReady() function to set the animation effect to ready.

[0120] It should be noted that "ready" in the embodiment of the present application means preparation, or preparation for a certain action or object. For example, "set animation ready" means that preparation for animation setting is ready, and "AppTranstitionReady()" means that preparation for starting the animation of the application is ready.

[0121] A12, the system server's animation thread triggers the start animation ready.

[0122] Specifically, systemserver can first call the AppTranstitionReady() function to set the startup animation ready, and then call the performSurfacePlacement() function to trigger the startup animation.

[0123] The animation effects during cold start of the application in the embodiment of the present application include two parts: one is the animation effects corresponding to the startup page defined by the system, such as icon animation, advertising animation, logo animation, blank page and snapshot page, etc.; the other is the animation effects corresponding to the first frame defined by the application, such as the window background interface animation of the application theme, the guide page animation custom developed by the application, the main interface animation, etc.

[0124] A13: The launcher calls the onAnimationStart() function to execute the remote animation, that is, to start the animation.

[0125] As an example, after drawing the startup window and icon animation, the launcher begins executing remote animations, first displaying the icon animation shown in Figure 1 (c), and then displaying the icon animation shown in Figure 1 (d). After the icon animation is played according to the system settings, the launcher starts the interface animation shown in Figure 1 (e) based on the first frame that has been drawn, and then displays the interface animation shown in Figure 1 (f).

[0126] As another example, after completing the drawing of the startup window and the ad animation, the launcher begins executing remote animations, first displaying the ad animation shown in Figure 2 (c), and then displaying the ad animation shown in Figure 2 (d). After completing the ad animation according to the system settings, the launcher starts the interface animation shown in Figure 2 (e) based on the first frame that has been drawn, and then displays the interface animation shown in Figure 2 (f).

[0127] In the native process of the above-mentioned application cold start, whether the systemserver or systemUI successfully grabs the lock, it is necessary to wait for the startup window to be drawn before setting and starting the animation ready. Since the startup window drawing takes a certain amount of time, setting and starting the animation ready after waiting for the startup window to be drawn may cause the remote animation to start later, that is, the native process of the application cold start has the problem of long startup time and slow response speed. From the user's perspective, it may take a long time to view the remote animation after clicking the application icon, and during this time there are no other changes in the terminal device interface. In this way, the user feels that the click effect is delayed and the operation waiting time is long, which makes the user's operating experience when starting the application poor.

[0128] In view of the above problems, the embodiment of the present application improves the native process of application cold start and provides an optimized application cold start method: when the launcher executes activityPause() or the systemUI creates a startup window, the AppTranstitionReady() function is called to trigger the startup animation in advance, without waiting for the startup window to be drawn before starting the animation, thereby advancing the start time of the animation and shortening the startup time of the application. In addition, the drawing task of the startup window is changed from hardware execution to software execution, and the priority of the main thread used to perform software rendering (such as ll.splashScreen) is higher than the priority of the thread used to perform hardware rendering (such as render), which effectively solves the problem of the startup window drawing taking a long time due to the render thread being runnable (runnable) and uploading textures, so that the startup window drawing can be completed before the icon animation is finished. Then, after the icon animation is finished, the interface animation can continue to be played according to the drawn startup window, avoiding the black screen and other screen freeze problems between the two animations.

[0129] The optimized application cold start method provided in the embodiments of the present application is described below through the following embodiments.

[0130] Example 1

[0131] In the above examples, the lock grabbing mechanism is described, where both the system server and the system UI compete for the lock. Experimental data shows that the system UI is more likely to grab the lock before the system server. Therefore, Example 1 will explain in detail how to trigger the startup animation in advance in the scenario where the system UI grabs the lock before the system server.

[0132] For example, FIG6 and FIG7 are an optimized application cold start process provided in an embodiment of the present application.

[0133] As shown in Figure 6, the optimized application cold start response process sequence includes the following: ① apTouchDaemon monitors user actions on the application icon, generates input events, and calls the InputEvent() function to report the input events to the launcher. ② The launcher calls the DeliverInput() function to notify the system server to dispatch the application event. The system server calls the InputDispatch() function to dispatch the input events. ③ The launcher calls the startActivity() function to start an activity corresponding to the application. ④ If the systemUI acquires the lock before the systemserver, the systemUI calls the addStartingWindow() function to create the startup window, completing the creation of the main window. After the main window is created, the systemUI also calls the doFrame() function to draw the startup window interface, and then the finishDrawing() function indicates that the startup window drawing is complete. ⑤ After the main window is created, the lock is released by the systemUI, and the systemserver notifies the launcher to enter the pause state through the activityPause() function. ⑥ In the process of notifying the launcher to enter the pause state, the activityPause() function calls the setReady() function, the AppTranstitionReady() function, and the performSurfacePlacement() function in sequence. That is, when activityPause is used, the animation is set to be ready, the animation is ready to start, and the animation is triggered. ⑦ After the animation is drawn, the launcher executes the remote animation through the onAnimationStart() function.

[0134] Referring to Figure 6, the native process for cold starting an app must wait for the startup window to be drawn before calling the setReady() function, AppTranstitionReady() function, and performSurfacePlacement() function in sequence. The optimized cold start process first has systemUI create the startup window, then systemserver tells the launcher to execute activityPause(). During activityPause, the setReady() function, AppTranstitionReady() function, and performSurfacePlacement() function are called. This means that the startup animation is already set to ready during the startup window drawing process, which also brings forward the time when the launcher starts the remote animation.

[0135] Fig. 7 is a schematic flow chart of a specific method corresponding to the timing diagram of Fig. 6. As shown in Fig. 7, the method includes B1 to B13.

[0136] B1 : In response to a user operation on the application 1 icon, apTouchDaemon monitors the user operation on the application icon to generate an input event, that is, apTouchDaemon monitors the occurrence of an input event.

[0137] B2, apTouchDaemon calls the InputEvent() function to report the input event to the launcher.

[0138] B3: The launcher starts calling the DeliverInput() function to notify the system server to deliver the input event. In other words, the launcher requests the system server to deliver the input event.

[0139] B4, systemserver dispatches input events through the InputDispatch() function.

[0140] B5: The launcher calls the startActivity() function of the system server, instructing the system server to start an activity corresponding to the input event. In other words, the launcher requests the system server to start an activity.

[0141] Exemplarily, the systemserver process may include an AMS service, and the launcher may specifically call the startActivity() function of the AMS to request the AMS to start an activity.

[0142] B6, systemserver calls the startActivity() function to start an activity corresponding to the input event.

[0143] For the implementation of B1 to B6, reference may be made to the detailed description of the above embodiments A1 to A6, which will not be repeated here.

[0144] During the activity startup process, AMS can determine whether to create a new process for Application 1 by detecting whether the current process already exists. This determines whether the input event is a cold start. If so, continue with steps B7 to B13.

[0145] B7, systemserver and systemUI grab the lock.

[0146] Combined with the description of A6 in the above embodiment, the activity startup process consists of at least two parts: one is the creation of the startup window by systemUI, which is described below as B8; the other is the notification of the launcher by systemserver to execute activityPause(), which is described below as B9. The two parallel processes, systemserver and systemUI, will compete for the lock. When systemUI first obtains the lock (i.e., systemUI successfully acquires the lock), systemUI first creates the startup window, and then systemserver notifies the launcher to execute activityPause(), meaning that the startup window is created before activityPause() is executed.

[0147] B8: If systemUI grabs the lock first, it calls the addStartingWindow() function to create an empty startup window, thus completing the creation of the main window.

[0148] After systemUI completes the creation of the main window, systemUI and systemserver execute B9 and B11 in parallel.

[0149] It should be noted that the above B8 only adds a startup window. At this time, the startup window has no content and is equivalent to an empty window. Therefore, it is necessary to continue to use B9 to draw the startup window interface.

[0150] B9, after systemUI completes the creation of the main window, systemUI calls the doFrame() function to draw the interface of the startup window.

[0151] The interface of the above-mentioned startup window is an interface customized by application 1, such as the window background interface of the application theme, the guide page customized by application 1, the main interface customized by application 1, or any other interface customized by application 1, etc., which is not limited in the embodiment of this application.

[0152] For example, in B9, the doFrame() function can first call the get() function to obtain the pre-set startup window data packet of application 1, which indicates the relevant parameters of the custom interface of application 1, and then the doFrame() function calls the draw() function to draw the startup window interface according to the relevant parameters indicated by the startup window data packet.

[0153] B10, systemUI instructs the completion of the startup window drawing through the finishDrawing() function.

[0154] B11, after systemUI completes the creation of the main window, systemserver notifies the launcher to enter the pause state through the activityPause() function.

[0155] B12, when the system server notifies the launcher to enter the pause state, the system server calls the AppTranstitionReady() function through the activityPause() function to set the startup animation ready.

[0156] For example, the activityPause() function can sequentially call the setReady() function to set the animation ready, call the AppTranstitionReady() function to start the animation ready, and call the performSurfacePlacement() function to trigger the startup animation. Among them, in the process of calling the setReady() function, it is first determined whether the creation of the startup window has been completed. If it is determined that the creation of the startup window has been completed, it is set to ready, that is, setting the animation ready specifically refers to determining that the creation of the startup window has been completed. The AppTranstitionReady() function specifically refers to notifying the launcher to start the animation. The performSurfacePlacement() function is used to calculate the layout result attributes (such as layout size) based on the layout control attributes to trigger the startup animation.

[0157] It should be noted that, in combination with the description of the above embodiment, after the launcher enters the paused state, the display focus of the terminal device will switch from the entire desktop to the startup page corresponding to application 1. For the scenario where the systemUI successfully grabs the lock, the startup animation ready can be set during the activityPause, but not before the activityPause. Otherwise, the animation will not be displayed due to the lack of focus switching.

[0158] B13, the launcher calls the onAnimationStart() function to execute the remote animation.

[0159] When the launcher executes remote animation, it can first play the animation of the startup page (such as the icon animation). When the icon animation finishes playing, if the above B9 and B10 have been executed (that is, the interface drawing of the startup window has been completed), then continue to play the interface animation according to the drawn interface. Among them, the process of playing the animation of the startup page may include: obtaining the application icon data corresponding to the application icon, and sending the application icon data to WMS to generate the layer corresponding to the application icon. SurfaceFlinger calls the synthesis thread to perform layer synthesis on the received layer data corresponding to the application icon to obtain an image frame, and plays the icon animation according to the image frame.

[0160] Compared with the native process of cold starting an application, which must wait for the startup window to be drawn before setting the startup animation ready, the optimized application cold start process has the following advantages: If the systemUI successfully grabs the lock, the startup window can be created before activityPause(). Since systemserver and systemUI are two processes running in parallel, after systemUI successfully creates the startup window, systemserver sets activityPause() and systemUI draws the startup window interface in parallel, and sets the startup animation ready during activityPause, that is, the startup animation ready is set in advance during the drawing of the startup window, without having to wait for the startup window to be drawn before setting the startup animation ready, thereby triggering the launcher to start the remote animation in advance and reducing the response time. From the user's perspective, the operation can be responded to quickly after clicking the application icon, and a point-and-click effect can be experienced, which improves the user experience when opening the application.

[0161] For the application scenario where systemUI obtains the lock before systemserver, to more clearly compare the native and optimized application cold start processes, the following uses Figure 8 to illustrate the execution times of multiple key actions in these two processes.

[0162] FIG8 (a) shows the execution timing of multiple key actions in the native process of cold starting an application.

[0163] Assume that the starting time of apTouchDaemon monitoring the user's operation on the application icon is 5.1 milliseconds (ms), the starting time of application event distribution processing is 7ms, the starting time of starting activity is 24.1ms, the starting time of systemUI calling addStartingWindow() function to create the startup window is 49ms, the starting time of systemserver notifying launcher to enter the pause state through activityPause() function is 66ms, the end time of activityPause is 82ms, the starting time of systemUI calling doFrame() function to draw the startup window interface is 77ms, the time when systemUI indicates the completion of startup window drawing through finishDrawing() function (that is, the end time of startup window drawing completion) is 116.5ms, the starting time of systemserver calling setReady() function to set the animation ready is 117ms, the starting time of systemserver's animation thread triggering the startup animation ready is 130.8ms, and the starting time of launcher calling onAnimationStart() function to execute remote animation is 136ms.

[0164] Based on (a) in Figure 8, we can conclude the following: 1. Before setting the ready animation, the launcher has already entered the paused state, and the system UI has completed drawing the startup window. 2. In the native app cold start process, the time from when apTouchDaemon detects the user's action on the app icon to when the launcher begins executing the remote animation takes approximately 120-150ms.

[0165] FIG8( b ) shows the execution timings of multiple key actions in the optimized application cold start process.

[0166] Assume that the starting time for apTouchDaemon to monitor user operations on the application icon is 5.1ms, the starting time for application event distribution processing is 7ms, the starting time for starting the activity is 24.1ms, the starting time for systemUI to call the addStartingWindow() function to create the startup window is 49ms, the starting time for systemserver to notify the launcher to enter the pause state through the activityPause() function is 66ms, the starting time for the activityPause() function to call the setReady() function to set the animation ready is 67ms, the ending time of activityPause is 82ms, and the starting time for the launcher to call the onAnimationStart() function to execute the remote animation is 85ms. The starting time for systemUI to call the doFrame() function to draw the startup window interface is 76ms, and the time when systemUI indicates the completion of the startup window drawing through the finishDrawing() function (i.e., the ending time of the startup window drawing) is 117ms.

[0167] Based on (b) in Figure 8, we can draw the following conclusions: 1. The animation ready is set during the activityPause process, and the launch window has already been created (but not yet drawn) before the activityPause process. 2. The optimized application cold start process sets the animation ready starting time (67ms) 50ms earlier than the native process (117ms). 3. The optimized application cold start process calls the onAnimationStart() function to execute remote animations starting time (85ms) 51ms earlier than the native process calls onAnimationStart() to execute remote animations starting time (136ms). 4. In the optimized application cold start process, the time from apTouchDaemon detecting the user's action on the application icon to the launcher starting to execute remote animations is approximately 60-90ms, which is approximately 50-60ms shorter than the native process's 120-150ms. 5. While the launcher executes remote animations (such as displaying icon animations), systemUI can continue to draw the launch window interface.

[0168] It should be noted that during the cold start process of the application, each of the multiple key actions may be executed for a period of time. According to actual needs, Figure 8 shows the start time of the execution time for some key actions and the start time and end time of the execution time for some key actions. It should be understood that the start time and end time of the execution time of each key action can be adjusted according to actual needs, which does not limit the embodiments of the present application.

[0169] Example 2

[0170] Example 2 will explain in detail how to trigger the startup animation in advance when the system server grabs the lock before the system UI.

[0171] For example, FIG9 and FIG10 are another optimized application cold start process provided in an embodiment of the present application.

[0172] As shown in Figure 9, the optimized application cold start response process sequence includes the following: ① apTouchDaemon monitors user actions on the application icon, generates input events, and calls the InputEvent() function to report the input events to the launcher. ② The launcher calls the DeliverInput() function to notify the system server to dispatch the application event. The system server calls the InputDispatch() function to dispatch the input events. ③ The launcher calls the startActivity() function to start an activity corresponding to the application. ④ If the system server acquires the lock before the system UI, the system server notifies the launcher to enter the pause state through the activityPause() function. ⑤ After the launcher enters the paused state, the lock is released by the system server, and the system UI calls the addStartingWindow() function to create the startup window, which in turn creates the main window. ⑥ The addStartingWindow() function sequentially calls the setReady() function, the AppTransitionReady() function, and the performSurfacePlacement() function. During the creation of the main window, the animation ready is set, the animation ready is started, and the startup animation is triggered. After completing the creation of the main window, systemUI also calls the doFrame() function to draw the interface of the startup window, and then the finishDrawing() function instructs the startup window drawing to be completed. ⑦ After systemUI calls the performSurfacePlacement() function to complete the animation drawing, the launcher executes the remote animation through the onAnimationStart() function.

[0173] Referring to Figure 9, the native process for cold starting an app must wait for the startup window to be drawn before calling the setReady(), AppTranstitionReady(), and performSurfacePlacement() functions in sequence. In the optimized cold start process, the systemserver first tells the launcher to execute activityPause(), then the systemUI creates the startup window and calls the setReady(), AppTranstitionReady(), and performSurfacePlacement() functions when creating the startup window. This means that the startup animation is already set to ready during the startup window drawing process, which also brings forward the time when the launcher starts the remote animation.

[0174] Fig. 10 is a schematic flow chart of a specific method corresponding to the timing diagram of Fig. 9. As shown in Fig. 10, the method includes steps C1 to C13.

[0175] C1, in response to a user operation on the application 1 icon, apTouchDaemon monitors the user operation on the application icon to generate an input event, that is, apTouchDaemon monitors the occurrence of an input event.

[0176] C2, apTouchDaemon calls the InputEvent() function to report the input event to the launcher.

[0177] C3: The launcher starts calling the DeliverInput() function to notify the system server to distribute input events. In other words, the launcher requests the system server to distribute input events.

[0178] C4, systemserver dispatches input events through the InputDispatch() function.

[0179] C5: The launcher calls the startActivity() function of the system server, instructing the system server to start an activity corresponding to the input event. In other words, the launcher requests the system server to start an activity.

[0180] Exemplarily, the systemserver process may include an AMS service, and the launcher may specifically call the startActivity() function of the AMS to request the AMS to start an activity.

[0181] C6, systemserver calls the startActivity() function to start an activity corresponding to the input event.

[0182] For the implementation of C1 to C6, reference may be made to the detailed description of the above embodiments A1 to A6, which will not be repeated here.

[0183] During the activity startup process, AMS can determine whether to create a new process for Application 1 by detecting whether a process for Application 1 exists in the current process. This determines whether the input event is a cold start. If this input event is a cold start, then continue executing C7 to C13 below.

[0184] C7, systemserver and systemUI grab the lock.

[0185] Combined with the description of A6 in the above embodiment, the activity startup process includes at least two parts: one part is that the system server tells the launcher to execute activityPause(), which is C8 below; the other part is that the system UI creates a startup window, which is C9 below.

[0186] The systemserver and systemUI processes, running in parallel, will compete for the lock. When the systemserver obtains the lock first (i.e., the systemserver succeeds in acquiring the lock), it first tells the launcher to execute activityPause(), and then systemUI creates the startup window, that is, the startup window is created after activityPause().

[0187] C8, if the system server grabs the lock first, the system server notifies the launcher to enter the pause state through the activityPause() function.

[0188] C9, after the launcher enters the paused state, systemUI calls the addStartingWindow() function to create an empty startup window, that is, systemUI creates the main window of application 1.

[0189] It should be noted that the above C9 only adds a startup window. At this time, the startup window has no content and is equivalent to a blank page. Therefore, it is necessary to continue to use C10 to draw the interface of the startup window.

[0190] C10, after completing the creation of the main window, systemUI calls the doFrame() function to draw the interface of the startup window.

[0191] The interface of the above-mentioned startup window is an interface customized by application 1, such as the window background interface of the application theme, the guide page customized by application 1, the main interface customized by application 1, or any other interface customized by application 1, etc., which is not limited in the embodiment of this application.

[0192] C11, systemUI indicates the completion of startup window drawing through the finishDrawing() function.

[0193] C12: When systemUI executes the addStartingWindow() function to create the startup window, systemUI calls the AppTranstitionReady() function through the addStartingWindow() function to set the startup animation ready.

[0194] For example, the addStartingWindow() function can first call the setReady() function to set the animation ready, then call the AppTranstitionReady() function to start the animation ready, and then call the performSurfacePlacement() function to trigger the startup animation. Among them, in the process of calling the setReady() function, it is first determined whether the creation of the startup window has been completed. If it is determined that the creation of the startup window has been completed, it is set to ready, that is, setting the animation ready specifically refers to determining that the creation of the startup window has been completed. The AppTranstitionReady() function specifically refers to notifying the launcher to start the animation. The performSurfacePlacement() function is used to calculate the layout result properties (such as layout size) based on the layout control properties to trigger the startup animation.

[0195] It should be noted that, in combination with the description of the above embodiment, after the launcher enters the paused state, the display focus of the terminal device will switch from the entire desktop to the startup page corresponding to application 1. In the scenario where the systemserver successfully grabs the lock, although the focus has been successfully switched during the activityPause process, the main window has not yet been created. Therefore, the startup animation ready can be set during the execution of the addStartingWindow() function. Otherwise, the animation may not be displayed because the main window has not been created.

[0196] C13, launcher calls the onAnimationStart() function to execute the remote animation.

[0197] Since the above C12 has completed the drawing of the startup page, the launcher can first play the startup page animation (such as icon animation) when executing remote animation. When the icon animation ends, if the above C10 and C11 have been executed (that is, the interface drawing of the startup window has been completed), then the interface animation can continue to be played according to the drawn interface.

[0198] Compared with the native process of cold starting an application, which must wait for the startup window to be drawn before setting the startup animation ready, the optimized application cold start process has the following advantages: If the systemserver successfully grabs the lock, the startup window can be created after activityPause(), and the startup animation ready can be set during the creation of the startup window, without having to wait for the startup window to be drawn before setting the startup animation ready. This can trigger the display of the startup page animation in advance, thereby reducing the response time. In addition, after the startup window is created, the systemUI can continue to draw the interface of the startup window, and continue to play the interface animation according to the drawn interface after the icon animation finishes playing. From the user's perspective, the operation of clicking the application icon can be responded to quickly, and the user can experience an effect of opening the application as soon as it is clicked, thereby improving the user experience when opening the application.

[0199] For the application scenario where systemserver obtains the lock before systemUI, to more clearly compare the native and optimized application cold start processes, the following uses Figure 11 to illustrate the execution times of multiple key actions in these two processes.

[0200] FIG11( a ) shows the execution timing of multiple key actions in the native process of cold starting an application.

[0201] Assume that the starting time of apTouchDaemon monitoring the user's operation on the application icon is 5.1ms, the starting time of application event distribution processing is 7ms, the starting time of starting activity is 24.1ms, the starting time of systemserver notifying launcher to enter the pause state through activityPause() function is 40ms, the starting time of systemUI calling addStartingWindow() function to create the startup window is 49ms, the starting time of systemUI calling doFrame() function to draw the startup window interface is 52ms, the time when systemUI indicates the completion of startup window drawing through finishDrawing() function (that is, the end time of startup window drawing is completed) is 116.5ms, the starting time of systemserver calling setReady() function to set the animation ready is 117ms, the starting time of systemserver's animation thread triggering the startup animation ready is 130.8ms, and the starting time of launcher calling onAnimationStart() function to execute remote animation is 141ms.

[0202] Based on (a) in Figure 11, we can conclude the following: 1. Before setting the ready animation, the launcher has already entered the paused state, and the system UI has completed drawing the startup window. 2. In the native app cold start process, the time from when apTouchDaemon detects the user's action on the app icon to when the launcher begins executing the remote animation takes approximately 120-150ms.

[0203] FIG11( b ) shows the execution timings of multiple key actions in the optimized application cold start process.

[0204] Assume that the starting time of apTouchDaemon monitoring the user's operation on the application icon is 5.1ms, the starting time of application event distribution processing is 7ms, the starting time of starting activity is 24.1ms, the starting time of systemserver notifying launcher to enter the pause state through activityPause() function is 40ms, the starting time of systemUI calling addStartingWindow() function to create the startup window is 49ms, the starting time of addStartingWindow() function calling setReady() function to set the animation ready is 61ms, the starting time of launcher calling onAnimationStart() function to execute remote animation is 89ms, the starting time of systemUI calling doFrame() function to draw the startup window interface is 83ms, and the time when systemUI indicates the completion of startup window drawing through finishDrawing() function (that is, the end time of startup window drawing completion) is 127ms.

[0205] Based on Figure 11 (b), we can draw the following conclusions: 1. The animation ready is set during the creation of the main window, and activityPause is completed before the launch window is created. 2. The optimized application cold start process sets the animation ready starting time (61ms) 56ms earlier than the native process (117ms). 3. The optimized application cold start process calls the onAnimationStart() function to execute remote animations starting time (89ms) 52ms earlier than the native process calls onAnimationStart() to execute remote animations starting time (141ms). 4. In the optimized application cold start process, the time from apTouchDaemon detecting the user's action on the application icon to the launcher starting to execute remote animations is approximately 60-90ms, which is approximately 50-60ms shorter than the native process's 120-150ms. 5. While the launcher executes remote animations (such as displaying icon animations), systemUI can continue to draw the launch window interface.

[0206] It should be noted that during the cold start of an application, each of multiple key actions may execute for a period of time. Based on actual needs, Figure 11 shows the start time of the execution duration for some key actions and the start and end times of the execution duration for some key actions. It should be understood that the start and end times of the execution duration of each key action can be adjusted based on actual needs and do not limit the embodiments of the present application.

[0207] Example 3

[0208] In conjunction with the description of the above embodiment, the AppTransitionReady() function can be called when the launcher executes activityPause() or when the systemUI creates the launch window, thereby triggering the launch animation in advance. While the launcher executes remote animations (such as displaying icon animations), the systemUI can continue to draw the launch window interface.

[0209] Taking the startup page animation as an example, as shown in Figure 12, when systemUI draws the startup window interface, the following two situations may occur:

[0210] As a possible scenario, if the launch window interface drawing is completed when the icon animation ends, the launcher can continue to play the interface animation according to the drawn interface.

[0211] For example, Figure 13 shows a schematic diagram of the interface changes when the application is started when the systemUI is normal. (a) in Figure 13 shows a system desktop of the terminal device. As shown in (b) in Figure 13, the user can click on the Honor Video icon. After the terminal device detects the user's click operation on the Honor Video icon, the terminal device first starts the activity, then creates a startup window for the Honor Video, and executes activityPause(). When the Honor Video creates the startup window and executes activityPause(), the animation ready is set to trigger the start of the remote animation in advance. The remote animation can include two parts: the first part is the icon animation, and the second part is the interface animation. As shown in (c) in Figure 13, the terminal device first starts the icon animation, gradually enlarges the Honor Video icon, first transitions to the icon animation shown in (d) in Figure 13, and then transitions to the icon animation shown in (f) in Figure 13. During the transition of the icon animation, the systemUI can complete the drawing of the first frame as shown in (e) in Figure 13. If the icon animation shown in (f) of Figure 13 is the last frame of the icon animation, then after that, the terminal device can start the interface animation shown in (g) of Figure 13 according to the first frame that has been drawn. Then, the terminal device gradually enlarges the interface animation shown in (g) of Figure 13 and transitions to the interface animation shown in (h) of Figure 13. After the interface animation is enlarged to full screen display, the terminal device can display the main interface of Honor Video.

[0212] As another possible situation, if an exception occurs in the systemUI and the animation drawing is blocked, and the startup window interface (such as the first frame interface) is not completed when the icon animation ends, then a black screen or other abnormal problems may occur before the startup window interface is completed.

[0213] For example, Figure 14 shows a schematic diagram of the interface changes when an application is started when the systemUI is abnormal. Figure 14 (a) shows a system desktop of a terminal device, which includes icons of applications such as Honor Video, Sports Health, Weather, and Browser. As shown in Figure 14 (b), the user can click on the Honor Video icon. After the terminal device detects the user's click operation on the Honor Video icon, the terminal device first starts the activity, then creates a startup window for Honor Video, and executes activityPause(). When Honor Video creates the startup window and executes activityPause(), the animation ready is set to trigger the start of the remote animation in advance. The remote animation can include two parts: the first part is the icon animation, and the second part is the interface animation. As shown in Figure 14 (c), the terminal device first starts the icon animation, gradually enlarges the Honor Video icon, first transitions to the icon animation shown in Figure 14 (d), and then transitions to the icon animation shown in Figure 14 (e). Assuming that the icon animation shown in (e) in Figure 14 is the last frame of the icon animation, if an exception occurs in the systemUI and the animation drawing is blocked, the first frame of the interface drawing may not be completed when the icon animation ends. In this case, the terminal device may have a black screen as shown in (f) in Figure 14. Until the systemUI completes the first frame of the interface drawing as shown in (g) in Figure 14, the terminal device can start the interface animation as shown in (h) in Figure 14, and gradually enlarge the interface animation to full screen display, and then switch to the main interface of Honor Video.

[0214] Experimental data shows that abnormal animation effects such as black screen are caused by hardware rendering.

[0215] The hardware rendering process is as follows: When an application updates part of the user interface (UI), the terminal device's central processing unit (CPU) calculates the dirty area corresponding to the updated portion and records the draw() function for this dirty area as a drawing instruction (DrawOp) in a list (DisplayList). This list is then passed to a render thread, separate from the main thread, which calls OpenGL to perform hardware rendering on the GPU. OpenGL is a cross-platform graphics API that provides a standard software interface for 2D / 3D graphics processing hardware. The GPU is a powerful graphics processing unit. Hardware rendering is typically used for complex graphics rendering tasks such as creating 3D models, image transformations, texture mapping, lighting and material settings, image enhancement, and extended bitmap display. Because hardware rendering is performed in a separate render thread, it not only offloads workloads from the main thread but also achieves hardware acceleration.

[0216] However, hardware rendering has issues with compatibility (some drawing functions do not support acceleration), memory consumption, and power consumption (GPU power consumption). For the application cold start scenario, compared with complex graphics drawing tasks such as building 3D models, the difficulty and complexity of drawing the startup window interface are both lower. If the drawing task of the startup window interface is assigned to the render thread, then due to issues such as texture upload, all commands in the blocking instruction command are removed from the queue (flush command), and the runnability of the render thread, the startup window may not be able to complete drawing within a period of time (such as when the icon animation ends), resulting in a black screen as shown in (f) in Figure 14, which delays the startup response and reduces the user experience when opening the application.

[0217] In order to solve the problem of abnormal animation caused by hardware rendering, the embodiment of the present application proposes replacing hardware rendering with software rendering to shorten the execution time of the drawing task of the interface of the startup window.

[0218] In some embodiments, the thread used to perform software rendering may be the main thread of systemUI, such as the ll.splashScreen thread of systemUI.

[0219] As a possible implementation, the priority of the ll.splashScreen thread is equal to the priority of the render thread.

[0220] For example, the priority of the ll.splashScreen thread and the priority of the render thread are both 120. It should be noted that in the native startup process, the priority of the ll.splashScreen thread and the priority of the render thread are both 120, but the task of drawing the interface of the startup window can only be completed by calling the CPU through the render thread. In the optimized application startup process, the ll.splashScreen thread completes the task of drawing the interface of the startup window through software rendering. It should be understood that since the ll.splashScreen thread will not involve issues such as texture loading, all commands in the blocking guidance command being removed from the queue, and the runnability of the render thread, it can effectively solve the problem of long startup window time in hardware rendering.

[0221] As another possible implementation, the priority of the ll.splashScreen thread is higher than that of the render thread. The priority of the ll.splashScreen thread may be BT priority (highest priority), that is, the priority of the ll.splashScreen thread is the highest among all threads of the systemUI.

[0222] For example, the ll.splashScreen thread has a priority of 97, which is higher than the render thread's priority of 120. In the native application cold start process, the ll.splashScreen thread can call the addStartingWindow() function to create the startup window, or it can call HardwareRender() (the render thread) to perform hardware rendering on the GPU. In the optimized application cold start process, the ll.splashScreen thread can still call the addStartingWindow() function to create the startup window, but instead of calling HardwareRender() for hardware rendering on the GPU, the ll.splashScreen thread calls the draw() function for software rendering.

[0223] The software rendering process is as follows: When the application updates part of the UI, the CPU calculates the dirty region corresponding to the updated portion and then draws all areas in the view hierarchy that intersect with the dirty region. During the drawing process, the ll.splashScreen thread calls the draw() function to write the content to be drawn into a bitmap. Later, during the rendering process, the pixel contents of this bitmap are filled into the Surface buffer. Since the ll.splashScreen thread belongs to the main thread, the software drawing process is performed in the main thread.

[0224] In some embodiments, when the software is drawing, the ll.splashScreen thread uses the Skia library to draw the splash window interface. The Skia library is a 2D vector graphics processing library that offers high-performance and concise performance in fonts, coordinate conversion, and bitmap graphics, making it highly effective at drawing interfaces with relatively low difficulty and complexity.

[0225] Experimental verification shows that when the priority of the ll.splashScreen thread and the render thread are both 120, the average time it takes to draw the splash window using the ll.splashScreen thread is 12ms, while the average time it takes to draw the splash window using the render thread is 23.5ms. Therefore, software rendering can effectively address the long startup window drawing time issue with hardware rendering. In particular, when the priority of the ll.splashScreen thread is the highest, the average time it takes to draw the splash window using the ll.splashScreen thread is reduced to 3ms to 9.5ms. Therefore, by increasing the priority of the ll.splashScreen thread, the average time it takes to draw the splash window can be further improved, allowing the splash window to be drawn before the icon animation ends.

[0226] The following describes the overall process of the application startup method provided by the embodiment of the present application in conjunction with Figure 15. The application startup method provided by the embodiment of the present application can be effective in a variety of scenarios, such as when the application 1 is installed and started for the first time on the terminal device, when the display screen of the terminal device is in dark mode, or when the terminal device is restarted.

[0227] S1 : In response to a user operation on an application 1 icon, apTouchDaemon monitors the user operation on the application icon to generate an input event, that is, apTouchDaemon monitors the occurrence of an input event.

[0228] S2, apTouchDaemon calls the InputEvent() function to report the input event to the launcher.

[0229] In step S3, the launcher starts calling the DeliverInput() function to notify the system server to deliver the input event. In other words, the launcher requests the system server to deliver the input event.

[0230] S4, systemserver dispatches input events through the InputDispatch() function.

[0231] S5: The launcher calls the startActivity() function of the system server, instructing the system server to start an activity corresponding to the input event. In other words, the launcher requests the system server to start an activity.

[0232] S6, systemserver calls the startActivity() function to start an activity corresponding to the input event.

[0233] The implementation of S1 to S6 can refer to the detailed description of the above embodiments A1 to A6, which will not be repeated here.

[0234] During the activity startup process, AMS can determine whether a new process needs to be created for Application 1 by detecting whether the current process already has a process for Application 1. In other words, it can determine whether this input event is a cold start. If this input event is a cold start, the following steps S7 to S18 can be continued.

[0235] S7, systemserver and systemUI grab the lock.

[0236] If systemUI grabs the lock first, execute S8 to S12 below. If systemserver grabs the lock first, execute S13 to S17 below. That is, either S8 to S12 or S13 to S17 will be executed.

[0237] S8, if systemUI grabs the lock first, systemUI calls the addStartingWindow() function to create an empty startup window, thus completing the creation of the main window.

[0238] After systemUI completes the creation of the main window, systemUI and systemserver execute the following S9 and S11 in parallel.

[0239] S9, after systemUI completes the creation of the main window, systemUI calls doFrame() to draw the frame using the ll.splashScreen thread.

[0240] S10, systemUI instructs the completion of the startup window drawing through the finishDrawing() function.

[0241] S11, after systemUI completes the creation of the main window, systemserver calls the activityPause() function to notify the launcher to enter the pause state.

[0242] S12, when the system server notifies the launcher to enter the pause state, the system server calls the AppTranstitionReady() function through the activityPause() function to set the startup animation ready.

[0243] For the implementation of S8 to S12, reference may be made to the detailed description of S8 to S12 in the above embodiments, which will not be repeated here.

[0244] S13, if the system server grabs the lock first, the system server notifies the launcher to enter the pause state through the activityPause() function.

[0245] S14, after the launcher enters the paused state, systemUI calls the addStartingWindow() function to create a startup window, that is, systemUI creates the main window of application 1.

[0246] S15, after completing the creation of the main window, systemUI calls doFrame() to draw the frame using the ll.splashScreen thread.

[0247] S16, systemUI instructs the completion of the startup window drawing through the finishDrawing() function.

[0248] S17, when systemUI executes the addStartingWindow() function to create the startup window, systemUI calls the AppTranstitionReady() function through the addStartingWindow() function to set the startup animation ready.

[0249] The implementation of S13 to S17 may refer to the detailed description of the above embodiments C8 to C12, which will not be repeated here.

[0250] S18, launcher calls the onAnimationStart() function to execute the remote animation.

[0251] Compared to the native app cold start process, which requires waiting for the splash window to be drawn before setting the ready state, the optimized app cold start process offers the following advantages: Calling the AppTransitionReady() function preemptively triggers the splash animation when the launcher executes activityPause() or when the systemUI creates the splash window, thereby accelerating the start of the animation and shortening the app launch time. Furthermore, by shifting the splash window drawing task from hardware to software, the main thread performing software rendering (such as ll.splashScreen) takes priority over threads performing hardware rendering (such as render). This effectively addresses the issue of long splash window drawing times caused by waiting for the render thread to be ready or uploading textures. This allows the splash window to be drawn before the icon animation ends, allowing the UI animation to continue playing according to the drawn splash window after the icon animation ends, avoiding screen freezes and other issues between animations. From the user's perspective, tapping the app icon is instantly responded to, creating a "click-to-open" experience, which improves the user experience when opening the app.

[0252] It is understandable that, in order to implement the above functions, the terminal device includes a hardware structure or software module corresponding to each function, or a combination of the two. Those skilled in the art should easily realize that, in combination with the units and algorithm steps of each example described in the embodiments disclosed herein, the present application can be implemented in the form of hardware or a combination of hardware and computer software. Whether a function is executed in the form of hardware or computer software driving hardware depends on the specific application and design constraints of the technical solution. Professional and technical personnel can use different methods to implement the described functions for each specific application, but such implementation should not be considered to be beyond the scope of this application.

[0253] The embodiment of the present application can divide the terminal device into functional modules according to the above method example. For example, each functional module can be divided corresponding to each function, or two or more functions can be integrated into one processing module. The above integrated modules can be implemented in the form of hardware or in the form of software functional modules. It should be noted that the division of modules in the embodiment of the present application is schematic and is only a logical functional division. In actual implementation, there may be other division methods.

[0254] FIG16 shows a schematic diagram of the hardware structure of the terminal device provided in an embodiment of the present application.

[0255] As shown in Figure 16, the terminal device 100 may include a processor 110, an external memory interface 120, an internal memory 121, a universal serial bus (USB) interface 130, a charging management module 140, a power management module 141, a battery 142, an antenna 1, an antenna 2, a mobile communication module 150, a wireless communication module 160, an audio module 170, a speaker 170A, a receiver 170B, a microphone 170C, an earphone interface 170D, a sensor module 180, a button 190, a motor 191, an indicator 192, a camera 193, a display screen 194, and a subscriber identification module (SIM) card interface 195, etc. Among them, the sensor module 180 may include a pressure sensor 180A, a gyroscope sensor 180B, an air pressure sensor 180C, a magnetic sensor 180D, an acceleration sensor 180E, a distance sensor 180F, a proximity light sensor 180G, a fingerprint sensor 180H, a temperature sensor 180J, a touch sensor 180K, an ambient light sensor 180L, and a bone conduction sensor 180M, etc.

[0256] The processor 110 may include one or more processing units, for example: the processor 110 may include a controller, an application processor (AP), a modem processor, a GPU, an image signal processor (ISP), a memory, a video codec, a digital signal processor (DSP), a baseband processor, and / or a neural-network processing unit (NPU), etc. Among them, the controller may be the nerve center and command center of the terminal device 100, including a CPU. The controller may generate an operation control signal based on the instruction opcode and timing signal to complete the control of instruction fetching and execution. A memory may also be provided in the processor 110 for storing instructions and data.

[0257] In an embodiment of the present application, the processor 110 can be used to: when the launcher executes activityPause() or when the systemUI creates a startup window, call the AppTransitionReady() function to trigger the startup animation in advance. In addition, the processor 110 can be used to perform software rendering using ll.splashScreen.

[0258] The wireless communication function of the terminal device 100 can be implemented through the antenna 1, the antenna 2, the mobile communication module 150, the wireless communication module 160, the modem processor and the baseband processor.

[0259] The terminal device 100 implements a display function through a GPU, a display screen 194, and an application processor. The GPU is a microprocessor for image processing, connecting the display screen 194 and the application processor.

[0260] The display screen 194 is used to display the operation interface of the projection APP, the projection image and the projection video, etc. The display screen 194 includes a display panel. The display panel can be a liquid crystal display (LCD), an organic light-emitting diode (OLED), an active matrix organic light-emitting diode or an active matrix organic light-emitting diode (AMOLED), a flexible light-emitting diode (FLED), and a quantum dot light-emitting diode (QLED). In some embodiments, the terminal device 100 may include 1 or N display screens 194, where N is a positive integer greater than 1.

[0261] The terminal device 100 can realize the shooting function through the ISP, camera 193, video codec, GPU, display screen 194 and application processor.

[0262] The external memory interface 120 can be used to connect an external memory card to expand the storage capacity of the terminal device 100. The external memory card communicates with the processor 110 through the external memory interface 120 to implement a data storage function.

[0263] The internal memory 121 can be used to store computer executable program codes, and the executable program codes include instructions. The processor 110 executes various functional applications and data processing of the terminal device 100 by running the instructions stored in the internal memory 121. The internal memory 121 may include a program storage area and a data storage area. Among them, the program storage area can store an operating system, an application (application, APP) required for at least one function (such as a camera APP, a gallery APP, and a third-party video editing software, etc.). The data storage area can store data created during the use of the terminal device 100, etc. In addition, the internal memory 121 may include a high-speed random access memory, and may also include a non-volatile memory, such as at least one disk storage device, a flash memory device, and a universal flash storage (UFS), etc.

[0264] The terminal device 100 can implement audio functions through the audio module 170, the speaker 170A, the receiver 170B, the microphone 170C, the headphone jack 170D, and the application processor.

[0265] It should be understood that the structures illustrated in the embodiments of the present application do not constitute a specific limitation on the terminal device 100. In other embodiments of the present application, the terminal device 100 may include more or fewer components than shown, or may combine or separate certain components, or arrange the components differently. The illustrated components may be implemented in hardware, software, or a combination of software and hardware.

[0266] The embodiment of the present application also provides a computer-readable storage medium, which stores computer instructions; when the computer-readable storage medium is run on a terminal device, the terminal device executes the method shown above. The computer instructions can be stored in a computer-readable storage medium, or transmitted from one computer-readable storage medium to another computer-readable storage medium. For example, the computer instructions can be transmitted from one website, computer, server or data center to another website, computer, server or data center via a wired (e.g., coaxial cable, optical fiber, digital subscriber line (DSL)) or wireless (e.g., infrared, wireless, microwave, etc.) method. The computer-readable storage medium can be any available medium that can be accessed by a computer or a data storage device such as a server or data center that includes one or more media integrated therein. The available medium can be a magnetic medium (e.g., a floppy disk, hard disk or tape), an optical medium or a semiconductor medium (e.g., a solid state drive (SSD)), etc.

[0267] An embodiment of the present application further provides a computer program product, which includes computer program code. When the computer program code runs on a computer, the computer executes the methods in the above embodiments.

[0268] The present application also provides a chip that is coupled to a memory and is used to read and execute computer programs or instructions stored in the memory to perform the methods in the above embodiments. The chip can be a general-purpose processor or a dedicated processor. It should be noted that the chip can be implemented using the following circuits or devices: one or more field programmable gate arrays (FPGAs), programmable logic devices (PLDs), controllers, state machines, gate logic, discrete hardware components, any other suitable circuits, or any combination of circuits capable of performing the various functions described throughout this application.

[0269] The terminal device, computer-readable storage medium, computer program product and chip provided in the above-mentioned embodiments of the present application are all used to execute the method provided above. Therefore, the beneficial effects that can be achieved can refer to the beneficial effects corresponding to the method provided above, and will not be repeated here.

[0270] Through the description of the above implementation methods, technical personnel in the relevant field can clearly understand that for the convenience and simplicity of description, only the division of the above-mentioned functional modules is used as an example. In actual applications, the above-mentioned functions can be assigned to different functional modules as needed, that is, the internal structure of the device can be divided into different functional modules to complete all or part of the functions described above.

[0271] In the several embodiments provided in this application, it should be understood that the disclosed devices and methods can be implemented in other ways. For example, the device embodiments described above are merely schematic. For example, the division of modules or units is only a logical function division. In actual implementation, there may be other division methods, such as multiple units or components can be combined or integrated into another device, or some features can be ignored or not executed. Another point is that the mutual coupling or direct coupling or communication connection shown or discussed can be through some interfaces, indirect coupling or communication connection of devices or units, which can be electrical, mechanical or other forms.

[0272] Units described as separate components may or may not be physically separate, and components shown as units may be one physical unit or multiple physical units, that is, they may be located in one place or distributed in multiple places. Some or all of the units may be selected according to actual needs to achieve the purpose of the present embodiment.

[0273] In addition, the functional units in the various embodiments of the present application may be integrated into a single processing unit, or each unit may exist physically separately, or two or more units may be integrated into a single unit. The aforementioned integrated units may be implemented in the form of hardware or software functional units.

[0274] If the integrated unit is implemented in the form of a software functional unit and sold or used as an independent product, it can be stored in a readable storage medium. Based on this understanding, the technical solution of the embodiment of the present application is essentially or the part that contributes to the prior art or all or part of the technical solution can be embodied in the form of a software product, which is stored in a storage medium and includes several instructions for enabling a device (which can be a single-chip microcomputer, chip, etc.) or a processor (processor) to execute all or part of the steps of the various embodiments of the present application. The aforementioned storage medium includes: various media that can store program codes, such as a USB flash drive, a mobile hard disk, a read-only memory (ROM), a random access memory (RAM), a magnetic disk or an optical disk.

[0275] The above content is only a specific embodiment of this application, but the scope of protection of this application is not limited to this. Any changes or replacements within the technical scope disclosed in this application should be included in the scope of protection of this application. Therefore, the scope of protection of this application should be based on the scope of protection of the claims.

Claims

1. A method for starting an application, characterized in that: The method comprises: receiving a user operation on an icon of a first application; In response to the operation, if the first process grabs the lock before the second process, the first process first performs a first action, and then the second process performs a second action, and a startup animation is triggered during the execution of the second action; wherein the first action is to create a startup window, and the second action is to suspend desktop activities, or the first action is to suspend desktop activities, and the second action is to create a startup window; After creating the startup window, drawing the interface of the startup window; After the startup animation is triggered, the icon animation of the first application is displayed, and the start display time of the icon animation is earlier than the completion drawing time of the startup window; After the icon animation ends and the start window is finished drawing, the interface animation corresponding to the start window is displayed.

2. The method according to claim 1, characterized in that The interface for drawing the startup window includes: The interface of the startup window is drawn by the 11.splashScreen thread of the system user interface process, and the system user interface process is the first process or the second process.

3. The method according to claim 2, characterized in that The duration of drawing the startup window through the ll.splashScreen thread is shorter than the duration of drawing the startup window through the render thread calling the hardware.

4. The method according to claim 3, characterized in that The priority of the ll.splashScreen thread is greater than or equal to the priority of the render thread.

5. The method according to claim 4, characterized in that The priority of the ll.splashScreen thread is the highest priority.

6. The method according to claim 2, characterized in that The ll.splashScreen thread of the system user interface process draws the interface of the startup window, including: The ll.splashScreen thread calls the draw() function through the doframe() function to draw the interface of the startup window.

7. The method according to claim 1, characterized in that The completion drawing time of the startup window is earlier than or equal to the end display time of the icon animation.

8. The method according to any one of claims 1 to 7, characterized in that The first process is a system user interface process, the second process is a system service process, the first action is to create a startup window, and the second action is to suspend desktop activities; If the first process grabs the lock before the second process, the first process first performs the first action, and then the second process performs the second action, and triggers the start animation during the execution of the second action, including: If the system user interface process grabs the lock before the system service process, the system user interface process calls the addStartingWindow() function to create the starting window with an empty interface content; After creating the startup window, the system service process calls the activityPause() function to notify the desktop launcher to pause desktop activities; and the activityPause() function sequentially calls the setReady() function to determine that the creation of the startup window has been completed, calls the AppTranstitionReady() function to notify the desktop launcher to start the animation, and calls the performSurfacePlacement() function to trigger the startup animation.

9. The method according to any one of claims 1 to 7, characterized in that The first process is a system service process, the second process is a system user interface process, the first action is to suspend desktop activities, and the second action is to create a startup window; If the first process grabs the lock before the second process, the first process first performs the first action, and then the second process performs the second action, and triggers the start animation during the execution of the second action, including: If the system service process grabs the lock before the system user interface process, the system service process calls the activityPause() function to notify the desktop launcher to pause the desktop activity; After pausing desktop activities, the system user interface process calls the addStartingWindow() function to create the startup window with empty interface content; and, the addStartingWindow() function sequentially calls the setReady() function to confirm that the creation of the startup window has been completed, calls the AppTranstitionReady() function to notify the desktop launcher to start the animation, and calls the performSurfacePlacement() function to trigger the startup animation.

10. The method according to claim 8 or 9, characterized in that: After the start-up animation is triggered, displaying the icon animation of the first application includes: After calling the performSurfacePlacement() function to trigger the startup animation, the desktop launcher calls the onAnimationStart() function to execute the remote animation; Among them, the remote animation effect includes the icon animation effect and the interface animation effect.

11. The method according to any one of claims 1 to 7, characterized in that After drawing the interface of the startup window and before displaying the interface animation corresponding to the startup window, the method further includes: The finishDrawing() function indicates that the drawing of the interface is completed.

12. The method according to any one of claims 1 to 7, characterized in that If the first process grabs the lock before the second process, the first process first performs the first action, and then the second process performs the second action, including: If the first process grabs the lock before the second process, the first process performs the first action; After the first action is executed, the first process releases the lock first, and then the second process executes the second action.

13. The method according to any one of claims 1 to 7, characterized in that Before the first process and the second process grab the lock, the method further includes: The application monitoring process reports an input event to the desktop launcher, where the input event indicates the operation on the icon of the first application; The desktop launcher distributes and processes the input event to the system service process, and notifies the system service process to start the activity corresponding to the input event; The system service process starts an activity corresponding to the input event.

14. The method according to claim 13, characterized in that The system service process starts an activity corresponding to the input event, including: If it is determined that the process of the first application does not exist, the Zygote process is notified to create a process for the first application.

15. The method according to any one of claims 1 to 7, characterized in that The time taken from receiving the operation to starting to display the icon animation is within the range of [60ms, 90ms].

16. A terminal device, characterized in that: It comprises a processor and a memory coupled to the processor; wherein the memory stores instructions, and when the processor executes the instructions, the terminal device executes the application startup method as described in any one of claims 1 to 15.

17. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores a computer program, and when the computer program is executed on a terminal device, the terminal device executes the application startup method according to any one of claims 1 to 15.