Application program starting method, electronic equipment, storage medium and program product

By detecting the foreground startup instruction during the application's process creation phase and modifying the startup type to a foreground startup type, the problem of long background startup time in existing technologies is solved, thereby improving the application's startup speed and user interaction experience.

CN121934962APending Publication Date: 2026-04-28HONOR DEVICE CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
HONOR DEVICE CO LTD
Filing Date
2024-10-17
Publication Date
2026-04-28

AI Technical Summary

Technical Problem

In existing technologies, background-launched applications cannot be changed to foreground-launched applications during the process creation phase, resulting in a longer startup time and affecting the user experience.

Method used

When a foreground startup instruction is detected during the application's process creation phase, its startup type is changed to foreground startup type, and startup is completed based on the system resources of the foreground startup type.

Benefits of technology

It shortens application startup time, reduces welcome page display time, and improves user interaction experience.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN121934962A_ABST
    Figure CN121934962A_ABST
Patent Text Reader

Abstract

The invention relates to the technical field of computers, and discloses an application program starting method, electronic equipment, a storage medium and a program product. The application program starting method is applied to the electronic equipment, and when the electronic equipment detects a background starting instruction of a first application program, a background starting process of the first application program is started. Setting a background starting type for the first application program in a process creation stage of the starting process, and modifying the starting type of the first application program into a foreground starting type when a foreground starting instruction of the first application program is detected in the process creation stage of the starting process; and starting the first application program based on the first system resource corresponding to the foreground starting type. Therefore, the starting time of the first application program can be shortened, the display duration of the welcome page of the first application program can be shortened, and the starting speed of the application program is ensured.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the field of computer technology, and in particular to an application launch method, electronic device, storage medium, and program product. Background Technology

[0002] When an application in an electronic device starts, the operating system (e.g., system, The system (such as the operating system) typically loads the application's code and resources and creates the corresponding process. During application startup, the operating system allocates system resources to the application's process based on the application's startup type to ensure that the process can be created and run normally, thereby ensuring that the application can start normally.

[0003] When an application is launched in the background (i.e., the application's launch type is background launch), the application process is a background process. Because background applications do not require user interaction, the operating system typically allocates fewer system resources to background processes, resulting in a longer startup time. Conversely, when an application is launched in the foreground (i.e., the application's launch type is foreground launch), the application process is a foreground process. Because foreground applications require user interaction, the operating system typically allocates more system resources to foreground processes, resulting in a shorter startup time.

[0004] In existing application startup methods, it's impossible to modify the application's startup type during the process creation phase. In high-load scenarios, for applications designed for background startup, if the user launches the application in the foreground during process creation, the application's startup type needs to be switched to foreground. However, existing application startup methods can only allocate system resources based on the background startup type. Since background processes receive fewer system resources during application startup, the startup process is more time-consuming, resulting in a longer welcome page display time after the user launches the application in the foreground, negatively impacting the user experience. Summary of the Invention

[0005] To address the aforementioned technical problems, embodiments of this application provide an interactive method, an electronic device, a storage medium, and a program product. The following describes this application from multiple perspectives, and the implementation methods and beneficial effects of these multiple aspects can be referenced together.

[0006] In a first aspect, embodiments of this application provide an application launch method applied to an electronic device. The method includes: detecting a first launch instruction for a first application, wherein the first launch instruction corresponds to background launch of the first application; then, initiating a launch process for the first application; setting the launch type of the first application to a background launch type during the process creation phase of the launch process, and corresponding to detecting a second launch instruction during the process creation phase of the launch process, modifying the launch type of the first application to a foreground launch type, wherein the second launch instruction corresponds to foreground launch of the first application; and completing the launch of the first application based on the first system resources corresponding to the foreground launch type.

[0007] Understandably, in existing application startup methods, the application startup type cannot be modified during the application process creation stage. If the first application needs to be switched from background startup to foreground startup, that is, if the electronic device detects the second startup instruction of the first application during the process creation stage of the background startup process of the first application, then during the entire startup process, the electronic device can only complete the startup of the first application according to the second system resources corresponding to the background startup type. Moreover, the second system resources are less than the first system resources, which will result in the startup process of the first application taking a relatively long time.

[0008] In the application startup method provided in this application embodiment, during the process creation stage of the startup process (i.e., background startup process) initiated after the electronic device (e.g., the operating system of the electronic device) detects the first startup instruction of the first application, if the electronic device detects the second startup instruction, the startup type of the first application can be modified to a foreground startup type, and the startup of the first application can be completed based on the first system resources. This shortens the startup time of the first application, thereby shortening the display duration of the welcome page of the first application and ensuring a better user experience.

[0009] In one possible implementation of the first aspect above, starting the first application based on the first system resources corresponding to the foreground startup type includes: during the main thread creation phase of the startup process, allocating first system resources to the first application according to the foreground startup type.

[0010] It is understood that in the embodiments of this application, after the electronic device changes the startup type of the first application to the foreground startup type, it can allocate the first system resources to the process of the first application. Alternatively, after the electronic device changes the startup type of the first application to the foreground type, it can continue to allocate the second system resources to the process of the first application. The first system resources are allocated to the first application according to the foreground startup type only during the main thread creation stage of the startup process.

[0011] In one possible implementation of the first aspect above, the method further includes: upon detecting a second startup instruction, obtaining runtime information of the first application, wherein the runtime information includes a process identifier; corresponding to obtaining the runtime information and the process identifier being unassigned or empty, determining that a second startup instruction was detected during the process creation phase of the startup process.

[0012] Understandably, once the startup process of the first application begins, the electronic device can obtain the running log information of the first application. During the process creation phase of the first application's startup process, the electronic device assigns a value to the process identifier of the first application. During the process creation phase, the value of the process identifier is less than or equal to 0, at which point it can be considered that the process identifier has not been assigned a value or is empty. At the end of the process creation phase (i.e., when process creation is complete), the value of the process identifier is greater than 0, at which point it can be considered that the process identifier has been assigned a value.

[0013] In one possible implementation of the first aspect above, it further includes: corresponding to detecting the second startup instruction before the startup process starts, adding a foreground flag to the process of the first application; corresponding to determining that the process of the first application includes the foreground flag at the end of the process creation phase of the startup process, or at the main thread initialization phase of the startup process, modifying the startup type of the first application to the foreground startup type.

[0014] Understandably, when a second startup instruction is detected before the startup process begins, it indicates that the startup type of the first application is a foreground startup type. The electronic device can determine whether the process of the first application includes a foreground flag at the end of the process creation phase of the startup process or during the main thread initialization phase of the startup process. If a foreground flag is included, the electronic device can determine that the startup type of the first application is a foreground startup type and can modify the startup type of the first application to a foreground startup type.

[0015] In one possible implementation of the first aspect above, the method further includes: if a second startup instruction is detected, obtaining the running record information of the first application; and if no running record information is obtained, determining that the second startup instruction was detected before the startup process begins.

[0016] It is understandable that when the electronic device does not obtain the running record information, it means that the startup process of the first application has not yet started. Therefore, it can be determined that when the electronic device detects the second startup command, the startup process of the first application has not yet started, that is, the second startup command is detected before the startup process starts.

[0017] In one possible implementation of the first aspect above, the foreground startup type corresponds to a first priority and a foreground group, and the background startup type corresponds to a second priority and a background group, with the first priority being higher than the second priority; the method further includes: after modifying the startup type of the first application to a foreground startup type, at the start of the main thread initialization phase, updating the priority of the process of the first application from the second priority to the first priority, and at the end of the main thread initialization phase, updating the resource group of the process of the first application from the background group to the foreground group.

[0018] It is understood that when an electronic device allocates system resources to the process of a first application based on the startup type of the first application, it can first determine the resource group and priority corresponding to the process according to the startup type, and then allocate system resources to the process of the first application according to the priority of the resource group. The resource group includes foreground group and background group, and the priority includes first priority (e.g., the high priority mentioned in this application) and second priority (e.g., the non-high priority mentioned in this application). The electronic device can update the priority of the process of the first application at the beginning of the main thread initialization phase, and the electronic device can update the resource group of the process of the first application at the end of the main thread initialization phase.

[0019] In one possible implementation of the first aspect above, the first application is bound to the second application, and the second application has related business functions of the first application; the method further includes: during the foreground operation of the second application, when the related business functions of the first application are triggered, a first startup instruction is detected.

[0020] It is understandable that the first application is the SMS application, and the second application is... For example, if the first application is bound to the second application and the second application has related services of the first application (such as SMS service), then when the electronic device receives SMS information, the SMS service is triggered and the electronic device can detect the first start command.

[0021] Secondly, embodiments of this application provide an electronic device, which includes: one or more processors and a memory, wherein the memory is used to store instructions executed by the one or more processors of the electronic device; when the processor executes the instructions in the memory, the electronic device executes the application startup method mentioned in embodiments of this application.

[0022] Thirdly, embodiments of this application provide a readable storage medium storing instructions that, when executed on an electronic device, cause the electronic device to perform the application startup method mentioned in embodiments of this application.

[0023] Fourthly, embodiments of this application provide a program product, which includes a computer program or instructions, which, when executed, cause a computer to perform the application startup method mentioned in embodiments of this application. Attached Figure Description

[0024] Figures 1A to 1B According to some embodiments of this application, an application scenario is illustrated;

[0025] Figure 2 According to some embodiments of this application, a schematic diagram of an application startup process is shown;

[0026] Figure 3 According to some embodiments of this application, a flowchart of an application startup method is shown;

[0027] Figure 4 According to some embodiments of this application, a flowchart of another application startup method is shown;

[0028] Figure 5 According to some embodiments of this application, a schematic diagram of another application startup process is shown;

[0029] Figure 6 According to some embodiments of this application, a schematic diagram of the startup process of another application is shown;

[0030] Figure 7 According to some embodiments of this application, a schematic diagram of the system architecture of an electronic device is shown;

[0031] Figure 8 According to some embodiments of this application, a module interaction diagram in the startup process of an application is shown;

[0032] Figure 9 According to some embodiments of this application, a flowchart is shown to determine the resource allocation strategy of a first application based on the running record information of the first application.

[0033] Figure 10 According to some embodiments of this application, a schematic diagram of a process for allocating system resources to the process of a first application based on a resource allocation strategy of the first application is shown.

[0034] Figure 11 According to some embodiments of this application, a timing diagram of an application startup method is shown;

[0035] Figure 12 According to some embodiments of this application, a schematic diagram of the hardware structure of an electronic device is shown. Detailed Implementation

[0036] The illustrative embodiments of this application include, but are not limited to, an application launch method, an electronic device, a storage medium, and a program product. The application launch method of this application is described below with reference to specific embodiments.

[0037] To better understand the solution of this application, the relevant terms in the field will be explained first.

[0038] High-load scenarios: High-load scenarios refer to situations where the operating system is processing a large number of requests or data. Examples include scenarios such as the startup of electronic devices, scenarios where a user operates other applications while a video application plays a video in a small window, and scenarios of continuous cold starts (i.e., the first startup of multiple applications after the electronic device is powered on).

[0039] This application does not limit the specific form of the electronic device. For example, the electronic device can be a mobile phone, tablet, smart screen, wearable device (e.g., watch, smart glasses, helmet), desktop computer, augmented reality (AR) / virtual reality (VR) device, personal digital assistant (PDA), in-vehicle mobile device (e.g., car infotainment system), etc. The following uses mobile phone 100 as an example of an electronic device.

[0040] Figures 1A-1B An exemplary application scenario of this application is shown.

[0041] Reference Figure 1A The mobile phone 100 has multiple applications installed. In some embodiments, if application 11 (e.g. Application 11 is bound to application 12 (e.g., a messaging application), and application 11 has related services of application 12, such as messaging services. Figure 1A As shown, when the mobile phone 100 detects that the user clicks the icon of application 11 on the desktop 10, the mobile phone 100 launches application 11 in the foreground. During the launch process of application 11, the foreground launch type of application 11 is set, a foreground process of application 11 is created, and the interface 20 of application 11 is displayed after application 11 is launched. At this time, the user can interact with the mobile phone 100 by clicking the controls in the displayed interface 20.

[0042] It should be understood that during the foreground startup of application 11, the electronic device will display the welcome page of application 11 while waiting for application 11 to finish starting. Therefore, when the startup process of application 11 takes a short time, the display time of the welcome page of application 11 is short, thus ensuring the user's interactive experience.

[0043] When a user interacts with the mobile phone 100 on the display interface 20, if the background launch event of application 12 is triggered, such as when the mobile phone 100 receives an SMS message, the mobile phone 100 will launch application 12 in the background upon detecting the background launch event. During the launch process of application 12, the background launch type of application 12 is set, and a background process of application 12 is created. In high-load scenarios, if the user returns to the desktop 10 and clicks the icon of application 12 during the process creation phase of application 12's background launch, the mobile phone 100 will launch application 12 in the foreground, that is, the launch type of application 12 will be switched to the foreground launch type.

[0044] However, existing application launch methods do not allow modification of the application's launch type during the application's process creation phase. Since the phone 100 has already specified the application's launch type as background launch when the application 12's process is created, the phone 100's operating system allocates system resources to the process based on the background launch type during the application 12's launch process. Because background processes receive fewer system resources, the launch process of application 12 may take a long time. For example, ... Figure 1B As shown, the welcome page 30 of application 12 in the display interface of mobile phone 100 takes a relatively long time to display, which affects the user's interactive experience.

[0045] To facilitate understanding, let's first combine... Figure 2 Describe the application startup process.

[0046] like Figure 2 As shown, the application startup process can include a process creation phase and an initialization phase. The initialization phase can include the main thread initialization phase, the application creation phase, the activity startup phase, the user interface (UI) construction and rendering phase, and the message loop phase.

[0047] It's understandable that the system allocates system resources to an application throughout its startup process to ensure it starts normally. At the beginning of the application's startup process, the system sets the corresponding startup type for the application; that is, the startup type is set during the process creation phase.

[0048] During the process creation phase, the system creates a new process for the application and allocates the necessary system resources and memory space to the process based on the default startup type (i.e., background startup type).

[0049] It's understandable that the process creation phase is a common stage in the startup process of different applications. The system first creates a process, and then assigns meaning to the created process during the process creation and initialization phases. For example, it determines the application that the process corresponds to, loads the corresponding application code, and sets the initial data of the corresponding application. Therefore, during the process creation phase, the system usually allocates system resources to the process based on its background startup type to ensure that the process can be created normally and to provide the necessary environment for the subsequent initialization phase.

[0050] During the main thread initialization phase, the system calls the ActivityThread.main() method to initialize the application process's main thread message loop mechanism (Looper) and message queue, and establishes a connection between the process and system services, preparing to receive and process system messages and user input in subsequent processes.

[0051] It's understandable that during the main thread initialization phase, the system updates the application's startup type to the type set when the process was created. In subsequent processes, it allocates system resources to the process based on the updated startup type to ensure a good user experience and system performance. Since subsequent phases are related to the initialization of the application's user interface, when the startup type is foreground, the system allocates more system resources to the process as a foreground process, ensuring a shorter initialization time for the application's user interface, thus minimizing startup time and maintaining a good user experience. When the startup type is background, since the application doesn't require user interaction, the system allocates fewer system resources to the process as a background process. In this case, subsequent phases may run slowly or pause, thus ensuring overall system performance.

[0052] During application creation, the system creates an Application object and executes the onCreate method, allowing developers to perform global initialization operations, including registering components that receive broadcast messages (BroadcastReciver), binding services, or initializing third-party libraries. Broadcasting is a mechanism for exchanging information between applications or between an application and the system. Registering a BroadcastReciver allows the application to respond to specific system or application events. Binding a service refers to associating the application with a service to ensure that the service is available while the application is running and can communicate with it whenever needed.

[0053] During the activity launch phase, the system creates and starts the specified Activity based on the application's launch intent, executing the Activity's lifecycle methods, including creation (onCreate()), start (onStart()), and resume (onResume()), making the Activity visible and interactive to the user. An Activity typically refers to a part of the application's user interface, responsible for displaying information to the user and receiving user interactions; it is the window through which the user interacts with the application. An Activity usually contains a layout, which can include various views and view groups, such as buttons, text boxes, and images.

[0054] During the user interface construction and rendering phase, the system builds a view hierarchy, measures, lays out, and draws the views, and finally presents the UI elements on the screen for users to view and interact with.

[0055] During the message loop phase, the application process's main thread starts the message loop, continuously listening for and processing user input events, system messages, and other asynchronous events to ensure the application's real-time responsiveness and dynamic update capabilities.

[0056] The following is based on Figure 1A Briefly describe the foreground startup process of application 11.

[0057] When mobile phone 100 detects that the user clicks the icon of application 11 on the desktop 10, mobile phone 100 launches application 11 in the foreground. During the launch process of application 11, the operating system of mobile phone 100 sets the foreground launch type for application 11 and creates a foreground process for application 11, initially allocating system resources to this process as a background process. After the process of application 11 is created, during the main thread initialization phase, the operating system of mobile phone 100 updates the launch type of application 11 to the foreground launch type and continues to allocate system resources to this process as a foreground process.

[0058] The following is based on Figure 1A Briefly describe the background startup process of application 12.

[0059] During user interaction with application 11, if mobile phone 100 detects that a background startup event for application 12 has been triggered (e.g., mobile phone 100 receives an SMS message), mobile phone 100 will launch application 12 in the background. During the startup process of application 12, the operating system of mobile phone 100 sets the background startup type for application 12 and creates a background process for application 12, allocating system resources to this process as a background process. After the process of application 12 is created, during the main thread initialization phase, the operating system of mobile phone 100 determines that the startup type of application 12 is a background startup type, without needing to update the startup type, and continues to allocate system resources to this process as a background process.

[0060] The following is based on Figure 1B and Figure 3 Taking the first application as application 12 as an example, this article briefly introduces the startup process of application 12 when it is switched from background startup to foreground startup.

[0061] S301: Start the background startup process of the first application.

[0062] According to some embodiments, if the mobile phone 100 detects that the background startup event of the application 12 is triggered, the mobile phone 100 will start the background startup process of the application 12.

[0063] S302: During the process creation phase of the startup process, a foreground startup instruction for the first application is detected.

[0064] According to some embodiments, during the process creation phase of the background startup process of application 12, when the mobile phone 100 detects that the user clicks the icon of application 12, the mobile phone 100 detects the foreground startup instruction of application 12.

[0065] S303: During the main thread initialization phase, determine that the startup type of the first application is a background startup type.

[0066] According to some embodiments, since the existing application startup method cannot modify the startup type during the process creation stage, after the process of application 12 is created, during the main thread initialization stage, the operating system of mobile phone 100 will determine the startup type of application 12 as a background startup type and continue to allocate system resources to the process as a background process.

[0067] S304: During the main thread initialization phase, determine the resource group of the first application process as the background group.

[0068] According to some embodiments, the launch type of application 12 is a background launch type, and the resource group of application 12 is a background group. For example, the operating system of mobile phone 100 can allocate system resources to the processes of application 12 according to the background group. It is understood that application processes in the background group have lower priority; for example, if system resources are scarce, the process may be allocated fewer system resources, or the system may terminate the process to release resources.

[0069] In the above embodiment, during the foreground startup of application 12, the process of application 12 is only allocated resources corresponding to the background startup type; however, only after the startup process of application 12 is completed does the system update the startup type of application 12 to the foreground startup type and continue to allocate system resources to application 12 as a foreground process. This may result in a relatively long startup process for application 12, leading to a longer display time for the welcome page interface 30 of application 12, thus affecting the user's interactive experience.

[0070] In view of this, embodiments of this application provide an application startup method. In this method, if the startup type of the first application is background startup, and during the process creation phase of the first application's startup process, the electronic device (e.g., the operating system of the electronic device) detects a user instruction, such as a user instruction to switch the first application from background startup to foreground startup, the startup type can be modified during the process creation phase. Then, during the main thread initialization phase, the operating system of the electronic device (hereinafter referred to as the system) allocates system resources to the process based on the modified startup type to complete the startup of the first application.

[0071] It is understood that when the system detects a foreground launch instruction of the first application (i.e., the second launch instruction mentioned in this application) during the background startup process of the first application, it is equivalent to the system detecting a user instruction, which corresponds to switching the first application from background startup to foreground startup.

[0072] Thus, during the background startup of the first application, if the system detects the foreground startup instruction of the application during the process creation stage of the first application, the system can complete the startup of the first application based on the first system resources corresponding to the foreground startup type, thereby shortening the startup time of the first application and thus shortening the display time of the welcome page of the first application, ensuring the user's interactive experience.

[0073] For example, regarding the above Figure 1BIn the scenario shown, during the process creation phase of application 12's background startup, if mobile phone 100 detects a foreground startup instruction for application 12 (e.g., the user clicks the icon of application 12), the operating system of mobile phone 100 can change the startup type of application 12 from background startup type to foreground startup type. During the main thread initialization phase of application 12's startup process, the operating system of mobile phone 100 can update the startup type to foreground startup type and allocate first-level system resources to the foreground process to complete the startup of application 12.

[0074] The following is combined with Figure 4 The flowchart shown describes the application startup method mentioned in this application. (Refer to...) Figure 4 The method includes:

[0075] S401, the system detected the first startup command of the first application.

[0076] In some embodiments, the system may detect a first launch instruction for a first application, wherein the first launch instruction corresponds to launching the first application in the background, that is, the first launch instruction includes a background launch instruction.

[0077] In some embodiments, a first application is bound to a second application, and the second application has related business functions of the first application. When the second application is running in the foreground, if the related business functions of the first application are triggered, the background startup process of the first application will be triggered, so that the system can detect the background startup instruction of the first application.

[0078] For example, the first application could be a text messaging application, and the second application could be... when When the app is running in the foreground, if the phone receives an SMS message, it will trigger the background startup process of the SMS application, and the system can detect the background startup command of the SMS application.

[0079] S402, initiates the startup process of the first application.

[0080] In some embodiments, when the system detects a first launch instruction from the first application, it may initiate the launch process of the first application.

[0081] S403 sets the background startup type for the first application during the process creation phase of the startup process.

[0082] In some embodiments, when the system initiates the startup process of the first application, it can determine that the startup type of the first application is a background startup type. During the process creation phase of the startup process of the first application, the system sets the background startup type for the first application and then allocates system resources to the process of the first application according to the background process. The system resources may include first system resources and second system resources. The first system resources correspond to the foreground startup type, and the second system resources correspond to the background startup type, with the first system resources exceeding the second system resources.

[0083] In some embodiments, the first system resources and the second system resources may include central processing unit (CPU) scheduling resources, network resources, storage resources, memory resources, etc.

[0084] It is understandable that although the system sets the startup type when starting the startup process of the first application, during the process creation phase, the system will first allocate the second system resources to the process of the first application according to the default startup type (such as background startup type). During the main thread initialization phase, the startup type of the first application will be updated to the startup type set when starting the startup process, and then system resources will be allocated to the process of the first application based on the updated startup type.

[0085] S404 corresponds to the system detecting a second startup instruction during the process creation phase of the startup process, and then changing the startup type of the first application to the foreground startup type.

[0086] In some embodiments, corresponding to the detection of a second startup instruction during the process creation phase of the startup process, the system modifies the startup type of the first application to a foreground startup type. Here, the second startup instruction corresponds to foreground startup of the first application; that is, the second startup instruction includes a foreground startup instruction.

[0087] It is understandable that after the system changes the startup type of the first application to the foreground startup type, during the process creation phase, the system still allocates the second system resources to the process of the first application according to the background startup type. During the main thread initialization phase, the system will update the startup type of the first application to the modified foreground startup type, and then allocate the first system resources to the first application based on the foreground startup type.

[0088] In some embodiments, the second startup instruction detected during the process creation phase of the startup process may correspond to a user operation, such as... Figure 1AAs shown, taking application 12 (e.g., a text messaging application) as an example, if the user interacts with the mobile phone 100 on the display interface 20, the background startup event of application 12 is triggered. For example, when the mobile phone 100 receives a text message, it will start application 12 in the background, i.e., begin the background startup process of application 12. At this time, a text message notification will be displayed in the status bar of the mobile phone 100 or a text message notification banner will be displayed at the top of the display interface 20. During the process creation phase of the background startup process of application 12, if the mobile phone 100 detects that the user returns to the desktop 10 and clicks the icon of application 12, or detects that the user clicks the text message notification in the status bar, or detects that the user clicks the text message notification banner in the display interface 20, the mobile phone 100 can detect the second startup command.

[0089] S405, the first application is launched based on the first system resources corresponding to the foreground startup type.

[0090] In some embodiments, the system launches the first application based on the first system resources corresponding to the foreground launch type. Specifically, during the main thread initialization phase of the startup process, after updating the launch type of the first application to the foreground launch type, the system allocates the first system resources to the process of the first application according to the foreground process in subsequent processes to complete the launch of the first application.

[0091] In some embodiments, after the system changes the startup type of the first application to the foreground startup type, the first application can be started based on the first system resources corresponding to the foreground startup type. That is, the first system resources are allocated to the process of the first application according to the foreground process, without having to wait until the main thread initialization stage to allocate the first system resources to the process of the first application according to the foreground process.

[0092] Thus, by using the above method, when the system detects a foreground startup instruction during the process creation phase of the first application's background startup process, it can change the startup type of the first application to a foreground startup type, and then complete the startup of the first application based on the first system resources corresponding to the foreground startup type. This can shorten the startup time of the first application, thereby shortening the display time of the first application's welcome page and ensuring the speed of application startup.

[0093] The following describes an exemplary process for allocating system resources based on startup type, using some embodiments.

[0094] In some embodiments, when the system allocates system resources to an application process based on the application's launch type, it first determines the resource group and priority corresponding to the process based on the launch type, and then determines the system resource allocation strategy based on the resource group and priority corresponding to the process. The resource group may include a foreground group and a background group, and the priority may include high priority (i.e., first priority) and low priority (i.e., second priority). When the launch type is foreground, the resource group corresponding to the process is the foreground group; when the launch type is background, the resource group corresponding to the process is the background group. When the process corresponds to the foreground group and high priority, the first system resource is allocated to the process; when the process corresponds to the background group and low priority, the second system resource is allocated to the process.

[0095] It is understood that the resource grouping of a process is not limited to foreground and background groups, and may include other groups in some embodiments. Furthermore, the priority of a process may also include other priorities, which are not limited in this application.

[0096] According to some embodiments, system resource types may include central processing unit (CPU) scheduling resources, network resources, storage resources, memory resources, etc. Resource grouping is used to determine the allocation strategy of system resources of types such as network resources, storage resources, and memory resources, and priority is used to determine the allocation strategy of CPU scheduling resources.

[0097] Specifically, when the startup type is foreground startup, the resource group corresponding to the process is the foreground group, and the process has a high priority. For network resources, more network bandwidth can be allocated to the process based on the foreground group; for storage resources, more input / output (IO) bandwidth can be allocated to the process based on the foreground group; for memory resources, a longer memory reclamation time can be allocated to the process based on the foreground group, that is, the memory release of the application corresponding to the process is delayed; for CPU scheduling resources, more CPU scheduling resources can be allocated to the process based on high priority, thereby making the process run faster.

[0098] When the startup type is background startup, the resource group corresponding to the process is the background group, and the process has a low priority. For network resources, less network bandwidth can be allocated to the process based on the background group; for storage resources, less I / O bandwidth can be allocated to the process based on the background group; for memory resources, a shorter memory reclamation time can be allocated to the process based on the background group, that is, the memory of the application corresponding to the process can be released in a timely manner to avoid background processes occupying memory resources; for CPU scheduling resources, less CPU scheduling resources can be allocated to the process based on low priority, thus making the process run slower.

[0099] It is understandable that the first system resources allocated to a process that starts as an application in the foreground are more than the second system resources allocated to a process that starts as an application in the background. Therefore, the time taken to start an application using the first system resources is shorter than the time taken to start an application using the second system resources.

[0100] As introduced above Figure 3 In the illustrated embodiment, when the system detects a foreground startup instruction for the first application during the process creation phase of the first application's background startup process, it cannot modify the startup type. Instead, it sets a background startup type for the first application. Then, during the main thread initialization phase, it does not update the startup type and determines that the resource grouping of the first application's process is a background group with a non-high priority. In subsequent processes, the system allocates second system resources to this process based on the background grouping.

[0101] Specifically, such as Figure 5 As shown, when the first application is triggered to start in the background, the background startup process of the first application is initiated. During the process creation phase, the priority of the first application's process is the default priority (which can be considered as low priority), and the resource group is the default group (THREAD_GROUP_DEFAULT, which can be considered as the background group). If the first application is triggered to start in the foreground during the process creation phase, since the system cannot modify the startup type during the process creation phase, the startup type of the first application is determined to be the background startup type during the main thread initialization phase. That is, it is determined that there is no need to update the startup type, and the second system resources are still allocated to the first application's process as a background process. In other words, the process resource group remains the default group, and the process priority is low priority.

[0102] Therefore, in Figure 3 In the embodiment shown, after the system determines that the resource group of the first application's process is a background group, it completes the startup of the first application based on the second system resources. This may result in a longer startup process for the first application, which in turn may lead to a longer display time for the first application's welcome page.

[0103] In this embodiment, the system can modify the startup type when it detects the foreground startup instruction of the first application during the process creation stage of the background startup process of the first application, and then complete the startup of the first application based on the first system resources corresponding to the foreground startup type.

[0104] Specifically, such as Figure 6 As shown, when the first application is triggered to start in the background, the background startup process of the first application is initiated. During the process creation phase, the process priority of the first application is the default priority, and the resource grouping is the default grouping. If the first application is triggered to start in the foreground during the process creation phase, the system can change the startup type of the first application to the foreground startup type. At the beginning of the main thread initialization phase, the system can update the process priority of the first application to high priority (THREAD_PRIORITY_TOP_APP_BOOST), and at the end of the main thread initialization phase, update the resource grouping of the first application process to the foreground group (THREAD_GROUP_TOP_APP). In this way, the first application can be started based on the first system resources corresponding to the foreground startup type.

[0105] In some embodiments, such as Figure 6 During the startup process shown, the system can update the priority of the first application's process to high priority and update the resource group to foreground group after changing the startup type of the first application to foreground startup type, without waiting for the main thread initialization phase to update the priority and resource group of the first application's process.

[0106] Thus, in the application startup method provided in this application embodiment, when the system detects a foreground startup instruction during the process creation stage of the background startup process of the first application, it can modify the startup type of the first application to a foreground startup type, and then complete the startup of the first application based on the first system resources corresponding to the foreground startup type. This can shorten the startup time of the first application, thereby shortening the display time of the welcome page of the first application and ensuring the speed of application startup.

[0107] The following is combined with Figure 7 This application provides a schematic diagram of the system architecture of the electronic device provided in the embodiments.

[0108] like Figure 7 As shown, the system architecture of the electronic device provided in this application embodiment is a layered architecture, which may include an application layer, an application framework layer, etc.

[0109] The application layer can include desktop launchers and other applications, such as phone apps and SMS apps. The desktop launcher is responsible for managing and displaying the user interface, providing the entry point for users to launch applications; for example, the launcher can display application icons, widgets, etc.

[0110] The application framework layer can include system services. These services are responsible for starting and coordinating the services necessary for the normal operation of the system, including the Activity Manager Service (AMS), the Windows Manager Service (WMS), and the Power Management Service (not shown in the diagram). The Activity Manager Service is responsible for maintaining application processes and activities, including starting, pausing, stopping, and destroying application components, creating and destroying application processes, and scheduling system resources for application processes. The Windows Manager Service manages services related to window display and interaction, including controlling the creation, destruction, position, size, hierarchy, and animation of application windows.

[0111] The system services also include a real-time processing subsystem, which includes an application status acquisition module and a resource management module.

[0112] The application status acquisition module can collect the application's runtime status by instrumenting code within the activity management service, thereby detecting whether the system is launching the application in the foreground. Instrumentation refers to inserting code segments that collect application information into the relevant code within the activity management service.

[0113] The resource management module can obtain information about applications starting in the foreground through the application status acquisition module, and determine the system resource allocation strategy corresponding to that application. When the application's startup type is foreground startup, the system resource allocation strategy can be determined to be to complete the application's startup based on the first system resource corresponding to the foreground startup type; when the application's startup type is background startup, the system resource allocation strategy can be determined to be to complete the application's startup based on the second system resource corresponding to the background startup type.

[0114] The activity management service also includes a policy execution module. When the system updates system resource allocation, the policy execution module is responsible for obtaining the system resource allocation policy of the application from the resource management module and allocating system resources to the corresponding application according to the resource allocation policy.

[0115] The following is based on Figure 7 The system architecture of the electronic device shown is combined with Figure 8This application describes an application startup method mentioned in its embodiments. For example... Figure 8 As shown, the method is as follows:

[0116] S801, the application status acquisition module determines that the foreground startup process of the first application has started.

[0117] In some embodiments, when the system detects a second startup command, it initiates the startup process of the first application. The application status acquisition module can determine that the foreground startup process of the first application has begun. Then, the application status acquisition module can record the application information of the first application, which may include the package name and activity information of the first application, wherein the package name is a unique identifier for the application used to distinguish different applications. For example, the first application is... At that time, the recorded package name can be com.taobao.taobao. Activity information can include process name, activity class name, etc.

[0118] S802, the resource management module obtains the application information of the first application and obtains the running record information of the first application based on the application information.

[0119] In some embodiments, the resource management module can obtain application information of the first application from the application status acquisition module. Using this application information, the module can obtain the process record information of the first application, which may include a process identifier (PID). The process identifier is a unique numerical identifier assigned to each process by the operating system. During process creation, the value of the process identifier is less than or equal to 0; at this stage, it can be considered that the process identifier has not been assigned a value or is empty. Upon completion of process creation, the process identifier is assigned a value, i.e., its value is greater than 0; at this stage, it can be considered that the process identifier has been assigned a value.

[0120] It should be understood that runtime log information only exists when the process of the first application begins to be created. When the resource management module can obtain the runtime log information of the first application, it means that the process of the first application has begun to be created, that is, it is in the process creation stage. At this time, it means that when the foreground startup process of the first application begins, the background startup process of the first application has already begun.

[0121] S803, the resource management module determines the resource allocation strategy for the first application based on the running record information of the first application.

[0122] In some embodiments, the resource management module updates the startup type of the first application based on its runtime information and then determines the resource allocation strategy for the first application. When the resource management module can obtain the runtime information of the first application, and the value of the process identifier in the runtime information is less than or equal to 0, it can determine that the startup type of the first application needs to be changed to a foreground startup type. Therefore, the resource management module can determine that the resource allocation strategy for the first application is to launch the application based on the first system resources corresponding to the foreground startup type. Details will be described below and will not be elaborated here.

[0123] It is understandable that when the resource management module can obtain the running record information of the first application, and the value of the process identifier in the running record information is less than or equal to 0, it means that the first application is in the process creation stage, that is, the background startup process of the first application has started. At this time, the startup type of the first application can be changed from background startup type to foreground startup type.

[0124] S804, the policy execution module in the activity management service allocates system resources to the process of the first application based on the resource allocation policy of the first application.

[0125] In some embodiments, the policy enforcement module in the activity management service can obtain the resource allocation policy of the first application from the resource management module, that is, obtain the startup type of the first application, then determine the resource grouping and priority of the first application's processes based on the startup type of the first application, and then allocate system resources to the processes of the first application according to the resource grouping and priority of the first application's processes. Details will be described below and will not be repeated here.

[0126] It is understandable that the startup type of the first application here is the foreground startup type. The policy execution module can determine that the resource group of the first application process is the foreground group and the priority is high priority. Then, according to the foreground group and high priority, the first system resources are allocated to the first application. This can ensure that the startup process of the first application takes a relatively short time, thereby making the display time of the welcome page of the first application in the user interface relatively short, thus ensuring the user's interactive experience.

[0127] The following is combined with Figure 9 This section introduces the method mentioned in S803 above for determining the resource allocation strategy of the first application based on the runtime log information of the first application.

[0128] like Figure 9 As shown, the method is as follows:

[0129] S8031, based on the running record information of the first application, determine whether the first application is in the process creation stage.

[0130] In some embodiments, the resource management module can determine whether the first application is in the process creation stage based on the running record information of the first application. If the first application is in the process creation stage, then S8032 is executed; if the first application is not in the process creation stage, then S8033 is executed.

[0131] S8032, if the first application is determined to be in the process creation stage, change the startup type of the first application to the foreground startup type and update the resource allocation strategy of the first application.

[0132] In some embodiments, when the resource management module can obtain the running record information of the first application, and the value of the process identifier in the running record information is less than or equal to 0 (i.e., the process identifier is not assigned a value or is empty), it can determine that the first application is in the process creation stage, modify the startup type of the first application to the foreground startup type, and update the resource allocation strategy of the first application. At this time, the resource allocation strategy of the first application is to complete the startup of the first application based on the first system resources corresponding to the foreground startup type.

[0133] It is understandable that when the process of the first application begins to be created, the resource management module will first determine the resource allocation strategy for the first application, which is to complete the startup of the first application based on the second system resources corresponding to the default startup type (i.e., background startup type). After the resource management module determines the resource allocation strategy, the strategy execution module can execute S804 to determine the resource group of the first application process as the default group (i.e., background group) and the priority as the default priority (i.e., non-high priority) based on the background group and non-high priority. Then, the second system resources are allocated to the first application according to the background group and non-high priority.

[0134] In some embodiments, after S8032 is executed, i.e. after the resource allocation strategy of the first application is determined, S804 can be executed. The strategy execution module can determine the resource group of the process of the first application as a foreground group and the priority as high priority based on the foreground startup type, and then allocate the first system resources to the process of the first application according to the foreground group and the high priority.

[0135] S8033, determine that the first application is not in the process creation stage, add a foreground marker to the process of the first application, and do not update the resource allocation strategy of the first application.

[0136] In some embodiments, when the resource management module cannot obtain the runtime information of the first application, it can be determined that the first application is not in the process creation stage. In this case, it can be determined that the system detected the second startup instruction before the startup process of the first application began. Then, based on the process name in the obtained application information of the first application, a foreground marker is added to the process of the first application. At this time, the startup type of the first application is not updated, and the resource allocation strategy of the first application remains the resource allocation strategy determined at the beginning of the process creation of the first application.

[0137] The following is combined Figure 10 This section introduces the resource allocation strategy based on the first application mentioned in S804 above, and describes the method for allocating system resources to the process of the first application.

[0138] like Figure 10 As shown, the method is as follows:

[0139] S8041, determine that the process of the first application does not include a foreground flag, and allocate system resources to the process of the first application based on the startup type of the first application.

[0140] In some embodiments, during the process creation phase, after the policy execution module obtains the resource allocation policy of the first application from the resource management module, it can first determine whether the process of the first application includes a foreground flag. If it is determined that the process of the first application does not include a foreground flag, system resources can be allocated to the process of the first application based on the startup type of the first application. If S804 is executed after S801, then at this time, based on the foreground startup type, the resource group of the process of the first application can be determined to be a foreground group with a high priority. Then, based on the foreground group and the high priority, the first system resources are allocated to the first application.

[0141] In some embodiments, at the end of the process creation phase, the policy enforcement module can again determine whether the process of the first application includes a foreground flag. When it is determined that the process of the first application does not include a foreground flag, the policy enforcement module can continue to allocate system resources to the process of the first application according to the previously obtained resource allocation policy. At this time, the resource allocation policy for the first application is to allocate second system resources to the first application based on the background startup type.

[0142] It is understood that at the end of the process creation phase, the process identifier has already been assigned a value in the runtime log information of the first application. In some embodiments, the system can only manually modify the resource group of the first application's process to the foreground group during the active startup phase after the process identifier of the first application has been assigned a value, thereby enabling the first application to start based on the first system resources. However, in this application, the system can modify the resource group of the first application's process to the foreground group before assigning a value to the process identifier of the first application, that is, it can allocate the first system resources to the first application's process earlier, thereby shortening the startup time of the first application.

[0143] In some embodiments, during the main thread initialization phase, when updating the resource grouping of the first application's process, the policy execution module can again determine whether the first application's process includes a foreground flag. If it is determined that the first application's process does not include a foreground flag, system resources can be allocated to the first application according to the updated resource grouping and priority.

[0144] Understandable, refer to Figure 6 The startup process illustrated involves updating the priority of the first application's process at the start of the main thread initialization phase and updating its resource grouping at the end of the main thread initialization phase. Therefore, after updating the resource grouping of the first application's process during the main thread initialization phase, the policy execution module can allocate system resources to the first application according to the updated resource grouping and priority. If, during the main thread initialization phase, the resource grouping of the first application's process is updated to the foreground group and the priority is updated to high priority, the policy execution module can allocate the first system resources to the first application's process.

[0145] S8042, determine that the process of the first application includes a foreground flag, update the startup type of the first application to a foreground startup type, and allocate first system resources to the process of the first application.

[0146] In some embodiments, during the process creation phase, after the policy execution module obtains the resource allocation policy of the first application from the resource management module, it can first determine whether the process of the first application includes a foreground flag. If it is determined that the process of the first application includes a foreground flag, the startup type of the first application can be updated to a foreground startup type, and then the resource allocation policy can be updated. That is, based on the foreground startup type, the resource group of the process of the first application is determined to be a foreground group with a high priority. Then, according to the foreground group and the high priority, the first system resources are allocated to the process of the first application.

[0147] It is understandable that during the process creation phase, the policy execution module obtains the resource allocation policy of the first application from the resource management module, and allocates the second system resources to the process of the first application based on the background startup type.

[0148] In some embodiments, at the end of the process creation phase, the policy enforcement module can again determine whether the process of the first application includes a foreground flag. When it is determined that the process of the first application includes a foreground flag, the policy enforcement module can update the startup type of the first application to a foreground startup type, and then update the resource allocation policy. That is, based on the foreground startup type, the resource group of the process of the first application is determined to be a foreground group with a high priority. Then, according to the foreground group and the high priority, the first system resources are allocated to the process of the first application.

[0149] In some embodiments, during the main thread initialization phase, when updating the resource grouping of the first application's process, the policy execution module can again determine whether the first application's process includes a foreground flag. When it is determined that the first application's process includes a foreground flag, the policy execution module can update the first application's startup type to a foreground startup type, and then update the resource allocation policy. That is, based on the foreground startup type, the resource grouping of the first application's process is determined to be a foreground group with a high priority. Then, based on the foreground grouping and the high priority, the first system resources are allocated to the first application's process.

[0150] Thus, in the application startup method provided in this application embodiment, when the system determines that the first application has started a background startup process when the first application starts in the foreground, the startup type of the first application can be changed to the foreground startup type. Then, the startup of the first application can be completed based on the first system resources corresponding to the foreground startup type, thereby shortening the startup time of the first application and thus shortening the display time of the welcome page of the first application, ensuring the speed of application startup.

[0151] The following is combined with Figure 11 This application describes an application launch method provided by an embodiment of the present application. (Refer to...) Figure 11 , Figure 11 A timing diagram of an application startup method is shown, such as... Figure 11 As shown, the method includes:

[0152] S1101, the ActivityStarter class detected an activity launch request.

[0153] In some embodiments, when the system detects a second startup instruction, it initiates the startup process of the first application. First, the active startup controller class can detect an active startup request that indicates the activity that starts the first application, i.e., the process that creates the first application.

[0154] S1102, the Resource Management Service (RMSFeature) calls the Activity Start Flag (noteActivityStart) method.

[0155] In some embodiments, after the Activity Launch Controller class detects an activity launch request, the Resource Management Service may call the Activity Launch Marking method to mark the start time of the activity launch process of the first application.

[0156] S1103, the ActivityAdvanceStart method calls the ActivityStateCheck method.

[0157] In some embodiments, after the resource management service calls the activity launch flag method, the activity flag method may call the activity status check method to check the activity status of the first application. At this time, the activity status of the first application may be starting up.

[0158] S1104, Activity Management Service Class 1 (HwActivityManagerService.Java) calls the Run Record Retrieval (getProcessRecordLockedEX) method.

[0159] In some embodiments, after the activity marking method calls the activity status check method, the activity management service class 1 can call the runtime record acquisition method to obtain the runtime record information of the process of the first application.

[0160] S1105, ActivityManagerService.Java calls the process record lookup (getProcessRecordLocked) method.

[0161] In some embodiments, after Activity Management Service Class 1 calls the Run Record Acquisition Method, Activity Management Service Class 2 can call the Run Record Search Method to find the run record information of the process of the first application.

[0162] S1106, the ActivityAdvanceStart method, based on runtime log information, determines that when the first application is in the process creation phase, it updates the startup type of the first application to the foreground startup type.

[0163] In some embodiments, after the Activity Management Service Class 2 finds the running record information of the process of the first application, the Activity Marking Method can obtain the running record information and then determine whether the first application is in the process creation stage based on the running record information.

[0164] Specifically, if the activity marking method can obtain the process log information of the first application, and the process identifier value in the log information is less than or equal to 0 (i.e., the process identifier is not assigned a value or is empty), then it can be determined that the first application is in the process creation stage. At this point, it can be determined that the system detected the second startup instruction during the process creation stage of the first application's startup process. Then, the startup type of the first application can be updated to a foreground startup type. Afterwards, it can be determined that the resource grouping of the first application's process is a foreground group with a high priority. Then, based on the foreground grouping and high priority, the first system resources are allocated to the first application's process.

[0165] S1107, the ActivityAdvanceStart method, based on runtime log information, determines that the first application is not in the process creation stage, and adds a foreground marker to the process of the first application.

[0166] In some embodiments, if the activity marking method cannot obtain the running record information of the process of the first application, it can be determined that the first application is not in the process creation stage. In this case, it can be determined that the system detected the second startup instruction before the startup process of the first application started, and then a foreground mark is added to the process of the first application.

[0167] S1108, When the ProcessList determines that the process of the first application includes a foreground flag, the startup type of the first application is updated to the foreground startup type.

[0168] In some embodiments, at the end of the process creation phase, the process class list can obtain the flag of the first application's process from the activity flag method. If a foreground flag is available, the process class list can determine that the first application's process includes a foreground flag and update the first application's startup type to a foreground startup type. Then, the resource grouping of the first application's process can be determined to be a foreground group with a high priority, and then first system resources can be allocated to the first application's process based on the foreground grouping and the high priority.

[0169] S1109, When the ActivityManagerService determines that the process of the first application includes a foreground flag, it updates the launch type of the first application to a foreground launch type.

[0170] In some embodiments, during the main thread initialization phase, when updating the resource grouping of the first application's process, the activity management service can obtain the process tag of the first application from the activity tagging method. If a foreground tag is available, the activity management service can determine that the first application's process includes a foreground tag and update the first application's startup type to a foreground startup type. Afterward, it can determine that the resource grouping of the first application's process is a foreground group with a high priority, and then allocate first system resources to the first application's process based on the foreground grouping and the high priority.

[0171] In some embodiments, during the main thread initialization phase, the activity management service can update the process priority by updating the out-of-memory adjustment (OOMAdj) value and can update the process resource grouping based on the process startup type. When updating the process priority value, the activity management service can call the `setAttachingProcessStatesLSP` method to obtain the process flag of the first application. If a foreground flag is available, the activity management service can update the startup type of the first application to a foreground startup type and update the process priority value to the priority value corresponding to the foreground process (e.g., 1000). Afterward, the activity management service can update the resource grouping of the first application's process to a foreground group with a high priority, and then allocate first system resources to the first application's process.

[0172] Thus, in the application startup method provided in this application embodiment, when the system determines that the first application has started a background startup process when the first application starts in the foreground, the startup type of the first application can be changed to the foreground startup type. Then, the startup of the first application can be completed based on the first system resources corresponding to the foreground startup type, thereby shortening the startup time of the first application and thus shortening the display time of the welcome page of the first application, ensuring the speed of application startup.

[0173] In some embodiments, this application also provides a readable storage medium storing instructions that, when executed on an electronic device, cause the electronic device to perform the application startup method described in the above embodiments.

[0174] In some embodiments, this application also provides a program product, including a computer program or instructions, which, when executed, cause a computer to perform the application startup method described in the above embodiments.

[0175] In some embodiments, this application provides an electronic device including one or more processors and a memory, the memory being used to store instructions executed by one or more processors of the electronic device; when the processor executes the instructions in the memory, it causes the electronic device to execute the application startup method described in the above embodiments.

[0176] The following is combined with Figure 12 This application describes the hardware structure of an electronic device provided in an embodiment.

[0177] Figure 12 A schematic diagram of the hardware structure of electronic device 00 is shown. (For example...) Figure 12 As shown, the electronic device 00 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, antenna 1, 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, a headphone jack 170D, a sensor module 180, buttons 190, a motor 191, an indicator 192, a camera 193, a display screen 194, and a subscriber identification module (SIM) card interface 195, etc. The sensor module 180 may include a touch sensor 180K, etc.

[0178] It is understood that the structures illustrated in the embodiments of the present invention do not constitute a specific limitation on the electronic device 00. In other embodiments of this application, the electronic device 00 may include more or fewer components than illustrated, or combine some components, or split some components, or have different component arrangements. The illustrated components may be implemented in hardware, software, or a combination of software and hardware.

[0179] Processor 110 may include one or more processing units, such as an application processor (AP), a modem processor, a graphics processing unit (GPU), an image signal processor (ISP), a controller, a video codec, a digital signal processor (DSP), a baseband processor, and / or a neural network processing unit (NPU). Different processing units may be independent devices or integrated into one or more processors. In this embodiment, processor 110 can execute the application launch method provided in this embodiment.

[0180] The charging management module 140 is used to receive charging input from the charger. The charger can be a wireless charger or a wired charger.

[0181] The power management module 141 is used to connect the battery 142, the charging management module 140, and the processor 110. The power management module 141 receives input from the battery 142 and / or the charging management module 140 to power the processor 110, internal memory 121, display 194, camera 193, and wireless communication module 160, etc.

[0182] The wireless communication function of electronic device 00 can be realized through antenna 1, antenna 2, mobile communication module 150, wireless communication module 160, modem processor and baseband processor, etc.

[0183] Antenna 1 and antenna 2 are used to transmit and receive electromagnetic wave signals.

[0184] The mobile communication module 150 can provide wireless communication solutions, including 2G / 3G / 4G / 5G, for use on the electronic device 00. In some embodiments, at least some functional modules of the mobile communication module 150 may be housed in the processor 110. In some embodiments, at least some functional modules of the mobile communication module 150 and at least some modules of the processor 110 may be housed in the same device.

[0185] A modem processor may include a modulator and a demodulator. The modulator modulates the low-frequency baseband signal to be transmitted into a mid-to-high frequency signal. The demodulator demodulates the received electromagnetic wave signal into a low-frequency baseband signal. The demodulator then transmits the demodulated low-frequency baseband signal to the baseband processor for processing.

[0186] The wireless communication module 160 can provide solutions for wireless communication applications on electronic devices 00, including wireless local area networks (WLAN) (such as wireless fidelity (Wi-Fi) networks), Bluetooth (BT), global navigation satellite system (GNSS), frequency modulation (FM), near field communication (NFC), infrared (IR) technology, etc.

[0187] Electronic device 00 implements display functions 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. The GPU is used to perform mathematical and geometric calculations and for graphics rendering. Processor 110 may include one or more GPUs, which execute program instructions to generate or modify display information.

[0188] Display screen 194 is used to display images, videos, etc. Display screen 194 includes a display panel. In some embodiments, electronic device 00 may include one or N displays screens 194, where N is a positive integer greater than 1. In this embodiment, electronic device 00 can display the welcome page of the application launched in the foreground (e.g., the welcome page of application 11 and the welcome page of application 12) and other user interfaces through the display screen 194.

[0189] Electronic device 00 can achieve shooting function through ISP, camera 193, video codec, GPU, display 194 and application processor.

[0190] The ISP is used to process data fed back by the camera 193. For example, when taking a picture, the shutter is opened, and light is transmitted through the lens to the camera's photosensitive element. The light signal is converted into an electrical signal, and the camera's photosensitive element transmits the electrical signal to the ISP for processing. In some embodiments, the ISP may be located in the camera 193.

[0191] Camera 193 is used to capture still images or videos. In some embodiments, electronic device 00 may include one or N cameras 193, where N is a positive integer greater than 1.

[0192] A digital signal processor (DSP) is used to process digital signals; in addition to digital image signals, it can also process other digital signals. A video codec is used to compress or decompress digital video.

[0193] An NPU (Neural Processing Unit) is a computational processor for neural networks (NNs). By borrowing the structure of biological neural networks, such as the transmission patterns between neurons in the human brain, it can rapidly process input information and continuously learn on its own. NPUs enable intelligent cognitive applications in electronic devices, such as image recognition, facial recognition, speech recognition, and text understanding.

[0194] The external storage interface 120 can be used to connect an external memory card, such as a Micro SD card, to expand the storage capacity of the electronic device 00. The external memory card communicates with the processor 110 through the external storage interface 120 to perform data storage functions. For example, music, video, and other files can be saved on the external memory card.

[0195] Internal memory 121 can be used to store computer executable program code, which includes instructions.

[0196] Electronic device 00 can implement audio functions through audio module 170 and application processor, such as music playback and recording. Audio module 170 is used to convert digital audio information into analog audio signals for output, and also to convert analog audio input into digital audio signals. Audio module 170 can also be used for encoding and decoding audio signals.

[0197] Touch sensor 180K, also known as a "touch device," can be located on display screen 194. The touch sensor 180K and display screen 194 together form a touchscreen, also known as a "touchscreen." Touch sensor 180K detects touch operations applied to or near it. The touch sensor can transmit the detected touch operation to the application processor to determine the type of touch event. Visual output related to the touch operation can be provided through display screen 194. In other embodiments, touch sensor 180K may also be located on the surface of electronic device 00, in a different position than display screen 194.

[0198] Buttons 190 include a power button, volume buttons, etc. A motor 191 can generate vibration alerts. Motor 191 can be used for incoming call vibration alerts or for touch vibration feedback. An indicator 192 can be an indicator light used to indicate charging status. A SIM card interface 195 is used to connect a SIM card.

[0199] The embodiments disclosed in this application can be implemented in hardware, software, firmware, or a combination of these implementation methods. Embodiments of this application can be implemented as computer programs or program code executable on a programmable system, the programmable system including at least one processor, a storage system (including volatile and non-volatile memory and / or storage elements), at least one input device, and at least one output device.

[0200] Program code can be applied to input instructions to execute the functions described in this application and generate output information. The output information can be applied to one or more output devices in a known manner. For the purposes of this application, the processing system includes any system having a processor such as, for example, a digital signal processor (DSP), a microcontroller, an application-specific integrated circuit (ASIC), or a microprocessor.

[0201] The program code can be implemented using a high-level procedural language or an object-oriented programming language to communicate with the processing system. Assembly language or machine language can also be used when needed. In fact, the mechanisms described in this application are not limited to any particular programming language. In either case, the language can be a compiled language or an interpreted language.

[0202] In some cases, the disclosed embodiments may be implemented in hardware, firmware, software, or any combination thereof. The disclosed embodiments may also be implemented as instructions carried or stored thereon on one or more temporary or non-temporary machine-readable (e.g., computer-readable) storage media, which may be read and executed by one or more processors. For example, the instructions may be distributed via a network or through other computer-readable media. Therefore, machine-readable media may include any mechanism for storing or transmitting information in a machine-readable (e.g., computer-readable) form, including but not limited to floppy disks, optical disks, optical discs, magneto-optical disks, read-only memory (ROM), random access memory (RAM), electrically programmable read-only memory (EPROM), electrically erasable programmable read-only memory (EEPROM), magnetic cards or optical cards, flash memory, or tangible machine-readable storage for transmitting information (e.g., carrier waves, infrared signals, digital signals, etc.) using the Internet in the form of electrical, optical, acoustic, or other forms of propagated signals. Therefore, machine-readable media includes any type of machine-readable medium suitable for storing or transmitting electronic instructions or information in a machine-readable (e.g., computer-readable) form.

[0203] In the accompanying drawings, some structural or methodological features may be shown in a specific arrangement and / or order. However, it should be understood that such a specific arrangement and / or order may not be necessary. Rather, in some embodiments, these features may be arranged in a manner and / or order different from that shown in the illustrative drawings. Furthermore, the inclusion of structural or methodological features in a particular figure does not imply that such features are required in all embodiments, and in some embodiments, these features may be omitted or may be combined with other features.

[0204] It should be noted that all units / modules mentioned in the device embodiments of this application are logical units / modules. Physically, a logical unit / module can be a physical unit / module, a part of a physical unit / module, or a combination of multiple physical units / modules. The physical implementation of these logical units / modules themselves is not the most important factor; the combination of functions implemented by these logical units / modules is the key to solving the technical problems proposed in this application. Furthermore, to highlight the innovative aspects of this application, the above-described device embodiments of this application have not introduced units / modules that are not closely related to solving the technical problems proposed in this application. This does not mean that the above-described device embodiments do not contain other units / modules.

[0205] It should be noted that in the examples and description of this application, relational terms such as "first" and "second" are used only to distinguish one entity or operation from another, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Furthermore, the terms "comprising," "including," or any other variations thereof are intended to cover non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements includes not only those elements but also other elements not expressly listed, or elements inherent to such a process, method, article, or apparatus. Without further limitations, an element defined by the phrase "comprising one" does not exclude the presence of other identical elements in the process, method, article, or apparatus that includes said element.

[0206] Although this application has been illustrated and described with reference to certain embodiments thereof, those skilled in the art will understand that various changes in form and detail may be made thereto without departing from the scope of this application.

Claims

1. An application launch method, applied to an electronic device, characterized in that, include: A first launch instruction for a first application is detected, wherein the first launch instruction corresponds to launching the first application in the background; Initiate the startup process of the first application; During the process creation phase of the startup process, the startup type of the first application is set to background startup type, and When a second startup instruction is detected during the process creation phase of the startup process, the startup type of the first application is changed to a foreground startup type, wherein the second startup instruction corresponds to foreground startup of the first application; The first application is launched based on the first system resources corresponding to the foreground launch type.

2. The method according to claim 1, characterized in that, The step of launching the first application based on the first system resources corresponding to the foreground launch type includes: During the main thread creation phase of the startup process, the first system resources are allocated to the first application according to the foreground startup type.

3. The method according to claim 1, characterized in that, Also includes: Upon detecting the second startup command, the running record information of the first application is obtained, wherein the running record information includes a process identifier; If the running record information is obtained and the process identifier is not assigned a value or is empty, it is determined that the second startup instruction was detected in the process creation phase of the startup process.

4. The method according to any one of claims 1 to 3, characterized in that, Also includes: If a second startup command is detected before the startup process begins, a foreground marker is added to the process of the first application. When the process creation phase of the startup process ends, or when the main thread initialization phase of the startup process determines that the process of the first application includes the foreground flag, the startup type of the first application is modified to the foreground startup type.

5. The method according to claim 4, characterized in that, Also includes: Upon detecting the second startup command, obtain the running record information of the first application; If the running record information is not obtained, it is determined that the second startup command was detected before the startup process started.

6. The method according to claim 5, characterized in that, The foreground startup type corresponds to a first priority and a foreground group, and the background startup type corresponds to a second priority and a background group, wherein the first priority is higher than the second priority; The method further includes: After changing the startup type of the first application to foreground startup, at the start of the main thread initialization phase, the process priority of the first application is updated from the second priority to the first priority, and... At the end of the main thread initialization phase, the resource group of the first application's process is updated from the background group to the foreground group.

7. The method according to claim 1, characterized in that, The first application is bound to the second application, and the second application has related business functions of the first application; The method further includes: During the foreground operation of the second application, the relevant business corresponding to the first application is triggered, and the first startup command is detected.

8. An electronic device, characterized in that, include: One or more processors and a memory, the memory being used to store instructions executed by one or more processors of the electronic device; When the processor executes the instructions in the memory, the electronic device performs the method of any one of claims 1 to 7.

9. A readable storage medium, characterized in that, The readable storage medium stores instructions that, when executed on an electronic device, cause the electronic device to perform the method of any one of claims 1 to 7.

10. A program product, characterized in that, The program product includes a computer program or instructions that, when executed, cause a computer to perform the method as described in any one of claims 1 to 7.