Application management method and electronic device
By breaking down application function management into functional units and a management platform, the problem of gradually deteriorating application startup speed in mobile terminal operating systems has been solved, resulting in faster application startup speed and a better user experience, while also optimizing memory utilization and system stability.
Patent Information
- Authority / Receiving Office
- WO · WO
- Patent Type
- Applications
- Current Assignee / Owner
- HUAWEI TECH CO LTD
- Filing Date
- 2025-08-27
- Publication Date
- 2026-06-18
AI Technical Summary
The startup speed of applications in mobile terminal operating systems is gradually deteriorating, especially when hardware performance is limited, and a method is needed to speed up application startup.
Application function management is split into function units and a function management platform. The function management platform is created and holds the function units when the application is cold-started. When the application is exited, some or all of the function management platform is retained and some or all of the function units are destroyed. When the application is started, the function management platform creates function units as needed to reduce storage space usage.
By reducing storage space usage, application startup speed and user experience are improved, memory utilization efficiency is optimized, unnecessary resource waste is avoided, and system stability and security are enhanced.
Smart Images

Figure CN2025117170_18062026_PF_FP_ABST
Abstract
Description
An application management method and electronic device
[0001] This application claims priority to Chinese Patent Application No. 202411852145.4, filed on December 13, 2024, entitled "An Application Management Method and Electronic Device", the entire contents of which are incorporated herein by reference. Technical Field
[0002] This application relates to the field of computer technology, and in particular to an application management method and an electronic device. Background Technology
[0003] In mobile terminal operating systems, as application functions become more complex and application sizes increase, the application startup time often shows a gradual deterioration trend. This phenomenon is more pronounced when hardware performance is limited.
[0004] Therefore, an application management method is needed to speed up application startup. Summary of the Invention
[0005] To address the issue of how to speed up application startup, this application provides an application management method and an electronic device, and also provides a computer-readable storage medium.
[0006] The embodiments of this application adopt the following technical solutions:
[0007] Firstly, this application provides an application management method.
[0008] In the first aspect of the approach, regarding the application's management mechanism for application functions, the management and implementation of application functions during application runtime are broken down into functional units for implementing application functions, and a functional management platform for managing application functions. During the application cold start process, the functional management platform is first created and started. The functional management platform creates and holds the functional units, thereby enabling the functional management platform to manage the functional units during application runtime.
[0009] In one embodiment, the functional unit may be an Activity in the Android system application architecture.
[0010] In another embodiment, the functional unit can be a capability in Huawei's system application architecture, and the function management platform is the capability platform (AbilityStage).
[0011] In the first approach, upon exiting the application, some or all of the functional management platform is retained, all or some functional units are destroyed, and the application process holding at least the functional management platform is cached. This significantly reduces storage space usage through the destruction of functional units.
[0012] When the application starts, the functional units are created by the reserved functional management platform. Since the functional management platform itself is responsible for creating functional units, the creation speed is significantly reduced compared to the application process completely recreating functional units. Furthermore, the functional management platform can create and launch functional units on demand according to the actual startup scenario, thereby avoiding unnecessary waste of storage space.
[0013] According to the method in the first aspect, the storage space occupied by the application process cache can be effectively controlled while improving the application startup speed, thereby achieving a balance between improving the application startup speed and the storage space occupied by the application process cache, and improving the user experience of application startup.
[0014] Furthermore, considering the application startup scenario, after the application starts, the application process at least holds the main function management platform, and the main function management platform at least holds the main function unit, which is used to implement the application's basic functions. For example, the main function unit is used to create and hold the main window management platform, and the main window management platform is used to create and hold the main window. The main window is the initial application window that provides the basic user interface after the application starts.
[0015] That is, during the application startup process, the main function management platform holding the main function unit, the main function unit used to implement the basic functions of the application, and the main window that provides the basic function interaction interface must be started.
[0016] Therefore, in the first aspect of the method, when exiting the application, the main functional unit and the main window are retained, while other functional units and windows besides the main functional unit and the main window are destroyed. This destruction of other functional units and windows significantly reduces storage space usage.
[0017] Specifically, the first aspect of the method includes:
[0018] When the application is triggered to exit, an application exit operation is initiated for the application.
[0019] Interrupting the application exit operation to preserve the application process includes at least preventing the destruction of the main window and main functional unit, so that the application process at least holds the main window and main functional unit;
[0020] Cache application processes;
[0021] Trigger application startup;
[0022] Intervene in the application startup process before creating the application's application process, and activate the cached application process;
[0023] Based on the application process skipping part of the application startup process, the remaining application startup process is completed by the application process itself, including:
[0024] Launch the main functional unit and the main window.
[0025] According to the method in the first aspect, destroying the main functional unit and other functional units and windows other than the main window can effectively reduce the memory storage space occupied by the cached application process and improve memory utilization efficiency.
[0026] According to the method in the first aspect, the main functional unit and the main window are retained in the cached application process. When the application is started, it is not necessary to recreate the main functional unit and the main window, which can speed up the application startup speed and improve the user experience of the application startup.
[0027] In one implementation of the first aspect, the complete application process before application exits holds at least: one or more windows, one or more window management platforms, one or more functional units, one or more functional management platforms, and a logic code execution environment, wherein:
[0028] One or more windows, including the main window;
[0029] One or more window management platforms hold one or more windows;
[0030] One or more functional units include a main functional unit, and one or more functional units hold one or more window management platforms;
[0031] One or more function management platforms hold one or more function units;
[0032] The logic code runtime environment loads the application logic code.
[0033] In one implementation of the first aspect, the application exit operation includes at least: destroying one or more windows, destroying one or more window management platforms, destroying one or more functional units, destroying one or more functional management platforms, destroying the logic code runtime environment, and destroying the application process.
[0034] In one implementation of the first aspect, the complete application startup process includes at least: creating an application process, starting the logic code execution environment, loading the application logic code, creating one or more window management platforms, creating one or more functional units from one or more window management platforms, creating one or more window management platforms from one or more functional units, and creating one or more windows from one or more window management platforms.
[0035] In one implementation of the first aspect, the application process also holds at least a main function management platform and a logic code execution environment, wherein one or more function management platforms include a main function management platform, which is used to hold main function units.
[0036] The remaining application startup process is completed by the application process, which also includes:
[0037] Other functional units besides the main functional unit can be created by the main functional management platform;
[0038] Other functional units can create other window management platforms;
[0039] Other windows besides the main window can be created by other window management platforms, as well as the main window management platform.
[0040] In another implementation of the first aspect, the application process also holds at least a main function management platform and a logic code execution environment, wherein one or more function management platforms include a main function management platform, which is used to hold main function units.
[0041] The remaining application startup process is completed by the application process, which also includes:
[0042] The application process creates other function management platforms besides the main function management platform;
[0043] Other functional units besides the main functional unit are created by the main functional management platform and other functional management platforms;
[0044] Other functional units can create other window management platforms;
[0045] Other windows besides the main window can be created by other window management platforms, as well as the main window management platform.
[0046] According to the above implementation method, destroying the main functional unit and other functional units and windows other than the main window, and destroying other functional management platforms other than the main functional management platform, can effectively reduce the memory storage space occupied by cached application processes and improve memory utilization efficiency.
[0047] Based on the above implementation method, the main functional unit and main window are retained in the cached application process. When the application starts, it is not necessary to recreate the main functional unit and main window, which can speed up the application startup speed and improve the user experience of the application startup.
[0048] In another implementation of the first aspect, the application process also holds at least the main function management platform, other function management platforms besides the main function management platform, and the logic code execution environment.
[0049] The remaining application startup process is completed by the application process, which also includes:
[0050] Other functional units besides the main functional unit can be created by the main functional management platform and / or other functional management platforms;
[0051] Other functional units can create other window management platforms;
[0052] Other windows besides the main window can be created by other window management platforms, as well as the main window management platform.
[0053] According to the above implementation method, destroying the main functional unit and other functional units and windows other than the main window can effectively reduce the memory storage space occupied by the cached application process and improve memory utilization efficiency.
[0054] Based on the above implementation method, the main functional unit, main window, and all function management platforms are retained in the cached application process. When starting the application, it is not necessary to recreate the main functional unit and main window. Furthermore, other functional units can be flexibly created as needed through the function management platform, which can accelerate the application startup speed and improve the user experience of application startup.
[0055] In one implementation of the first aspect, the function management platform includes, during application runtime, the runtime parameters of the functional units held by the function management platform;
[0056] Functional units are created by the function management platform, including: the function management platform creates functional units based on operating parameters.
[0057] Based on the above implementation method, the function management platform creates functional units based on the saved running parameters, so that the application inherits the state of the previous application run after it starts. This can improve the matching degree between the application state after it starts and the user, and enhance the user experience of the application startup.
[0058] In one implementation of the first aspect, before interrupting the application exit operation to preserve the application process, the method further includes:
[0059] Determine whether the application process needs to be cached;
[0060] This includes actions such as interrupting the application's exit to preserve the application process when the application process needs to be cached, and caching the application process.
[0061] In one implementation of the first aspect, determining whether the application process needs to be cached includes:
[0062] Determine whether the application process needs to be cached based on whether the application process caching conditions are met.
[0063] Based on the above implementation method, by determining whether the application process needs to be cached, it is possible to effectively avoid application process caching failure and prevent application process caching from affecting the smooth execution of other operations.
[0064] Specifically, in one implementation of the first aspect, the application process caching conditions include:
[0065] The application is one that supports caching application processes;
[0066] And / or,
[0067] The application has already enabled the application process caching function;
[0068] And / or,
[0069] The application is not marked as an application to keep running in the background;
[0070] And / or,
[0071] The currently triggered application exit is not a complete application exit.
[0072] In another implementation of the first aspect, determining whether the application process needs to be cached also includes:
[0073] Based on user habit data, it is determined whether the application process needs to be cached. Specifically, if the application's launch frequency is lower than a preset frequency threshold, it is determined that the application process does not need to be cached.
[0074] According to the method in the embodiments of this application, determining whether the application process needs to be cached based on user habit data can improve the utilization efficiency of application process caching and enhance system operating efficiency.
[0075] In one implementation of the first aspect, after caching the application process, the method also includes freezing the cached application process.
[0076] According to the above implementation method, freezing cached application processes can effectively prevent cached application processes from running in the background, avoid cached application processes from occupying additional system resources, improve system operating efficiency, and enhance system security and stability.
[0077] In one implementation of the first aspect, before intervening in the application startup process before creating the application process and before activating the cached application process, the method also includes unfreezing the frozen application process.
[0078] In one implementation of the first aspect, freezing the cached application process includes:
[0079] Freeze the application process when all application processes are cached and none of the application processes are communicating.
[0080] Based on the above implementation method, freezing the cached application processes when all application processes are cached and there is no communication behavior can effectively prevent the freezing of application processes from affecting the normal operation of other application processes and improve the stability of system operation.
[0081] In one implementation of the first aspect, after caching the application process, the method further includes migrating the cached application process from memory to another storage device.
[0082] Based on the above implementation method, when available memory is insufficient, the application processes that are cached in memory can be migrated to other storage devices, which can effectively prevent the cached application processes from affecting the normal operation of other application processes, improve memory utilization efficiency, and enhance system stability.
[0083] In one implementation of the first aspect, before the application startup process is created and the cached application process is activated, the method also includes migrating the application process from other storage back to memory.
[0084] In one implementation of the first aspect, migrating the cached application process from memory to other storage includes:
[0085] When the current available memory is lower than the preset available memory threshold, the cached application processes will be migrated from memory to other storage.
[0086] In one implementation of the first aspect, the method further includes:
[0087] When an application is detected and killed, a portion of the application's process is destroyed, while the remaining application process retains at least the logic code execution environment, as well as all or part of the function management platform in one or more function management platforms.
[0088] Based on the above implementation method, when detecting inactive applications, some application processes are destroyed and the remaining application processes are cached, so that when the application is restarted, the cached application processes can be called to speed up the application startup.
[0089] The above implementation method can solve the problem of insufficient system available memory, accelerate application restart speed, and improve the user experience of application startup.
[0090] In one implementation of the first aspect, the method further includes:
[0091] When an application is triggered to kill or hibernate, a portion of the application's process is destroyed, while the remaining application process retains at least the logic code execution environment, and all or part of the function management platform in one or more function management platforms.
[0092] According to the above implementation method, when the application is in hibernation, some application processes are destroyed and the remaining application processes are cached, so that when the application is restarted after exiting hibernation, the cached application processes can be called to speed up the application startup.
[0093] The above implementation method can avoid insufficient system memory, speed up application restart, and improve the user experience of application startup.
[0094] Secondly, this application provides an application management device applied to an electronic device, which includes a cache management module for:
[0095] When triggering the application exit, when the application exit operation is started for the application, interrupt the application exit operation to preserve the application process, including at least preventing the destruction of the main window and the main functional unit, so that the application process at least holds the main window and the main functional unit.
[0096] Cache application processes;
[0097] When the application is launched, the application launch process is intervened before the application process is created, and the cached application process is activated so that the electronic device can skip part of the application launch process based on the application process, and the application process can complete the remaining application launch process, including launching the main functional unit and the main window.
[0098] In one implementation of the first aspect, the cache management module is used for:
[0099] Prevent the destruction of the main function management platform and the logic code execution environment, so that the application process still retains at least the main function management platform and the logic code execution environment.
[0100] In one implementation of the first aspect, the cache management module is used for:
[0101] Prevent the destruction of other function management platforms besides the main function management platform, so that the application process still holds at least other function management platforms.
[0102] In one implementation of the first aspect, the cache management module is also used for:
[0103] Determine whether the application process needs to be cached;
[0104] This includes actions such as interrupting the application's exit to preserve the application process when the application process needs to be cached, and caching the application process.
[0105] In one implementation of the first aspect, the cache management module is configured to determine whether the application process needs to be cached based on whether the application process caching conditions are met.
[0106] In one implementation of the first aspect, the cache management module is configured to determine whether the application process of the application needs to be cached based on user habit data, wherein when the application's startup frequency is lower than a preset frequency threshold, it is determined that the application process of the application does not need to be cached.
[0107] In one implementation of the first aspect, the application management device further includes a memory swapping management module for migrating cached application processes from memory to other storage.
[0108] In one implementation of the first aspect, the memory swapping management module is also used to migrate application processes from other storage devices back to memory.
[0109] In one implementation of the first aspect, the application management device further includes a freeze management module for freezing cached application processes.
[0110] In one implementation of the first aspect, the freeze management module is also used to unfreeze frozen application processes.
[0111] Thirdly, this application provides an electronic device including a memory and a processor; the processor is configured to execute instructions stored in the memory to cause the electronic device to perform the method described in the first aspect.
[0112] Fourthly, this application provides a computer program product containing instructions that, when run by a computing device system, cause a cluster of computing devices to perform the method described in the first aspect.
[0113] Fifthly, this application provides a computer-readable storage medium including computer program instructions, which, when executed by a computer system, perform the method described in the first aspect. Attached Figure Description
[0114] Figure 1 is a schematic diagram of an application startup process according to an embodiment of this application;
[0115] Figure 2 is a schematic diagram of the application usage of processor resources and memory resources according to an embodiment of this application;
[0116] Figure 3 shows an application startup flowchart according to an embodiment of this application;
[0117] Figure 4 shows an application startup flowchart according to an embodiment of this application;
[0118] Figure 5 is a schematic diagram of the application process structure after application startup according to an embodiment of this application;
[0119] Figure 6 shows an application exit flowchart according to an embodiment of this application;
[0120] Figure 7 is a schematic diagram of the functional units and window management platform creation / destruction logic according to an embodiment of this application;
[0121] Figure 8 is a schematic diagram of the structure of an application management device according to an embodiment of this application;
[0122] Figure 9 shows an application management flowchart according to an embodiment of this application;
[0123] Figure 10 is a schematic diagram of a system configuration interface according to an embodiment of this application;
[0124] Figure 11 is a schematic diagram of a system configuration interface according to an embodiment of this application;
[0125] Figure 12 shows an application management flowchart according to an embodiment of this application;
[0126] Figure 13 is a schematic diagram of the application process structure according to an embodiment of this application;
[0127] Figure 14 is a schematic diagram of the application process structure according to an embodiment of this application;
[0128] Figure 15 is a schematic diagram of the application process structure according to an embodiment of this application;
[0129] Figure 16 is a schematic diagram of the application process structure according to an embodiment of this application;
[0130] Figure 17 is a schematic diagram of the application process structure according to an embodiment of this application;
[0131] Figure 18 is a flowchart of the application exit section according to an embodiment of this application;
[0132] Figure 19 shows a flowchart of the application startup section according to an embodiment of this application;
[0133] Figure 20 is a schematic diagram of a terminal operating system according to an embodiment of this application;
[0134] Figure 21 is a schematic diagram of the deployment structure of an application management device according to an embodiment of this application;
[0135] Figure 22 is a schematic diagram of the cache management module structure according to an embodiment of this application;
[0136] Figure 23 is a schematic diagram of the process of an application process being swapped from memory to hard disk according to an embodiment of this application;
[0137] Figure 24 is a schematic diagram of the process of an application process being swapped from the hard disk to memory according to an embodiment of this application;
[0138] Figure 25 is a schematic diagram of the application process freezing process according to an embodiment of this application;
[0139] Figure 26 is a schematic diagram of the unfreezing application process according to an embodiment of this application;
[0140] Figure 27 is a schematic diagram of an electronic device structure according to an embodiment of this application. Detailed Implementation
[0141] To make the objectives, technical solutions, and advantages of this application clearer, the technical solutions of this application will be clearly and completely described below in conjunction with specific embodiments and corresponding drawings. Obviously, the described embodiments are only a part of the embodiments of this application, and not all of them. Based on the embodiments in this application, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of this application.
[0142] The terminology used in the implementation section of this application is for the purpose of explaining specific embodiments of this application only, and is not intended to limit this application.
[0143] In applications launched from electronic devices, one approach is a cold start. Specifically, when the user closes the application, all application processes are destroyed, releasing the processor and memory resources they occupy, and the application completely exits. When the application is launched again, a completely new application process is created, and the application's runtime parameters are loaded from scratch.
[0144] As applications become more complex and larger, their cold start time tends to deteriorate, a phenomenon that becomes more pronounced when hardware performance is limited.
[0145] To shorten application startup time, a viable technical solution is to use warm boot. Specifically, when the user closes the application, the application process is not destroyed, and the processor and memory resources occupied by the application process are not released. This way, when the application is restarted, there is no need to recreate the application process or reload the application's runtime parameters; the application can be launched directly.
[0146] However, in the application scenario of warm start, when the user closes the application, the application process is not destroyed and the processor and memory resources occupied by the application process are not released. This will increase the pressure on the processor and memory of the electronic device. In application scenarios where the processor and memory hardware capabilities are limited, the implementation of warm start will affect the normal operation of the electronic device.
[0147] For example, Figure 1 is a schematic diagram of an application startup process according to an embodiment of this application.
[0148] As shown in Figure 1, in one embodiment, the cold start of the application includes:
[0149] S101, Process creation and initialization phase.
[0150] In S101, the application process is created, initialized, and the application's runtime parameters are loaded.
[0151] S102, Create the activity phase (Activity.onCreate).
[0152] In S102, the application process creates an Activity.
[0153] An Activity is a component of an Android application that provides a screen for interaction. Each Activity receives a window to draw its user interface.
[0154] S103, Activity onStart phase.
[0155] In S103, the created Activity is enabled to complete the application launch.
[0156] As shown in Figure 1, in one embodiment, the Activity-based deactivation / startup hot start includes: S103, the activity activation phase (Activity.onStart).
[0157] In other words, after the initial cold start (S101, S102, and S103), when the user exits the application, only the Activity is disabled; the application process and the Activities created by the application process are not destroyed.
[0158] When performing a warm start, you only need to reactivate the previously disabled Activity to start the application, thereby improving the application startup speed.
[0159] However, in the application scenario of warm start, when the user exits the application, only the Activity is stopped, and the application process and the Activities created by the application process are not destroyed. Therefore, the processor resources and memory resources (memory usage) occupied by the application process and the Activities created by the application process are not released, which will increase the processor and memory pressure of the electronic device. In application scenarios where the processor and memory hardware capabilities are limited, the implementation of warm start will affect the normal operation of the electronic device.
[0160] To improve application startup speed while reducing the processor and memory resource usage of electronic devices, a feasible solution is to employ warm boot. This involves reserving a portion of the application's processor and memory resources when the user exits, releasing the remaining resources. When the application starts again, it utilizes the previously reserved processor and memory resources, thus improving startup speed while reducing the pressure on processor and memory resources.
[0161] For example, as shown in Figure 1, in one embodiment, warm start based on Activity destruction / creation includes:
[0162] S102, Create the activity phase (Activity.onCreate);
[0163] S103, Activity onStart phase.
[0164] In other words, after the initial cold start (S101, S102, and S103), when the user exits the application, the Activity created in S102 is disabled and destroyed, thereby releasing the processor and memory resources occupied by the Activity.
[0165] When performing a warm start, there is no need to recreate the application process. You only need to create a new Activity from the existing application process and enable it to complete the application startup.
[0166] Compared to a warm boot, a warm boot requires significantly fewer processor and memory resources.
[0167] However, although warm boots significantly reduce processor and memory resources compared to warm boots, application processes are still fully preserved. In warm boot scenarios, application processes consume a lot of memory, increasing system memory pressure and potentially leading to insufficient available memory on the entire machine.
[0168] For example, Figure 2 shows a schematic diagram of the application usage of processor resources and memory resources according to an embodiment of this application.
[0169] In one embodiment, after the application starts, the processor resources and memory resources occupied by the application (application resource usage 200) can be simply classified as follows:
[0170] Processor and memory resources used for application window display and interaction (window resource usage 201);
[0171] Processor and memory resources used by background application processes (application process resource usage 202).
[0172] When the user exits the application, the application window is closed and destroyed, releasing the processor and memory resources occupied by the application window display and interaction (releasing window resource usage 201), while the background application process continues to run (preserving application process resource usage 202).
[0173] That is, after exiting the application, the processor and memory resources occupied by the application (application resource usage 210) can be simply categorized as follows:
[0174] Processor and memory resources used by background application processes (application process resource usage 212).
[0175] When launching the application, there is no need to recreate and load the application process; instead, the window is recreated and launched, thus enabling quick application launch.
[0176] However, because the complete application process is retained to run in the background, the application process running in the background will not only occupy processor resources and memory resources, but may also affect the operation of other processes, and may even be abused by applications, affecting the operation security of electronic devices.
[0177] Furthermore, with the continuous development of software technology, application functions are becoming increasingly richer, and the functionalities that a single application can achieve are also expanding. Users do not typically utilize all application functions at once. Therefore, activating all application functions at once during the application's cold start phase would result in unnecessary resource waste.
[0178] Therefore, in order to save application startup overhead, in one embodiment, during the application cold start phase, the application function corresponding to the current application scenario is launched according to the current application scenario.
[0179] Specifically, considering that there may be inter-calling, parameter inheritance, and other related relationships among multiple application functions contained in the same application, in one embodiment, the basic functions of the application are divided into multiple independent functional units, and the application functions of the application are managed on a unit-by-unit basis.
[0180] Specifically, in one embodiment, the functional unit is the most basic component container of the application. When invoking application functions, the functional unit is the smallest callable unit for invoking application functions.
[0181] The embodiments of this application do not impose specific limitations on the specific structural composition of the functional units. Those skilled in the art can design the functional unit structure of the application according to actual needs.
[0182] For example, in one embodiment, the functional unit may be an Activity in the Android system application architecture.
[0183] For example, in another embodiment, the functional unit may be a capability in Huawei's system application architecture.
[0184] During the application cold start phase, functional units corresponding to the current application scenario are created and started according to the application scenario requirements.
[0185] According to the embodiments of this application, managing the application functions of an application by functional units can effectively improve the efficiency of application function management.
[0186] Furthermore, according to the embodiments of this application, during the application cold start phase, functional units corresponding to the current application scenario are created and started on a functional unit basis. This can effectively avoid application function conflicts when starting the application and avoid resource waste caused by enabling unnecessary application functions.
[0187] Figure 3 shows an application startup flowchart according to an embodiment of this application.
[0188] In one embodiment, the electronic device performs the following process shown in FIG3 to achieve a cold start of the application.
[0189] S300, create application process.
[0190] Specifically, in one embodiment, application processes are created through an application incubator (AppSpawn).
[0191] S301, Runtime for application process startup logic code.
[0192] The logic code runtime environment is used to run the application's logic code. For example, the logic code runtime environment could be the Arkts Runtime.
[0193] S302, the logic code runtime environment loads the application logic code.
[0194] S303, Create a functional unit.
[0195] Specifically, based on the application scenario requirements for application startup, corresponding functional units are created and launched to achieve customized startup of application functions.
[0196] S304: The launched functional unit creates a window to display the application interface to the user, thus completing the application launch.
[0197] For applications that manage application functions based on functional units, in one application startup scheme that implements application hot start, when the application is exited, only the window display is closed (the window is not destroyed), and the complete application process is cached. That is, the application process of all started functional units and windows is cached, which leads to a large storage space consumption.
[0198] For applications that manage application functions using functional units as the basic unit, in an application startup scheme that implements warm start, when exiting the application, all started functional units and windows are destroyed, and only the basic application process is retained (refer to the application process after executing S302).
[0199] During the application warm start process, a functional unit is created and started based on the previously cached basic application process. The started functional unit then creates and starts a window (see S303 and S304).
[0200] While the warm start scheme described above can save storage space, the functional unit is the basic unit for application function management. Therefore, the operation of the functional unit is a critical link in the application operation, which makes the structure of the functional unit the most complex part of the application structure. The creation and startup of the functional unit account for the largest proportion in the application startup process.
[0201] If functional units are destroyed when exiting the application, they need to be recreated during a warm start. The creation of functional units consumes a lot of application startup time, so the warm start solution does not significantly speed up the application startup.
[0202] For applications that manage application functions using functional units as the basic unit, another application startup scheme for implementing warm start destroys only the windows when exiting the application. That is, when exiting the application, all created windows are destroyed, all created functional units are retained, and the application processes holding functional units are cached.
[0203] During the application warm start process, a window is created and started by the reserved functional unit based on the previously cached application process (see S304).
[0204] While the above solution speeds up application startup by retaining functional units, the structure of these functional units is the most complex part of the application structure, and their memory usage accounts for the largest proportion of the application process. Retaining functional units will increase storage space usage and may lead to insufficient memory.
[0205] Furthermore, when application functions are launched on demand, the functional units that need to be launched may differ depending on the application launch scenario. When the application exits, it's impossible to predict which functional units will be launched the next time it's launched, making it impossible to selectively destroy or retain functional units. When the application restarts, if the application launch scenario changes, previously cached functional units may no longer need to be launched, requiring the creation of new functional units. This not only lengthens application startup time but also leads to unnecessary waste of storage space.
[0206] To address the aforementioned problems, one embodiment of this application provides an application management method based on functional units and a function management platform. According to the application management method of this embodiment, the application exit and application startup processes can be managed, thereby accelerating the application startup process.
[0207] In the method of this application embodiment, regarding the application's management mechanism for application functions, the management and implementation of application functions during application runtime are separated into functional units for implementing application functions, and a functional management platform for managing application functions. During the application cold start process, the functional management platform is first created and started, and the functional management platform creates and holds the functional units, so that the functional management platform can manage the functional units during application runtime.
[0208] The following uses the functional unit as the capability in Huawei's system application architecture and the function management platform as the capability platform (AbilityStage) to illustrate the method flow of the embodiments of this application.
[0209] Figure 4 shows an application startup flowchart according to an embodiment of this application.
[0210] For applications that use a function management platform to manage function units, in one embodiment, the application's cold start is implemented based on the following process shown in Figure 4.
[0211] S400 triggers the launch of applications installed on electronic devices.
[0212] For example, double-clicking an application icon on a desktop computer screen with a mouse; or tapping an application icon on a mobile phone screen with a finger.
[0213] S401, Electronic device creates application process.
[0214] Specifically, in one embodiment, application processes are created through an application incubator (AppSpawn).
[0215] S402, Application in-process startup logic code runtime environment.
[0216] The logic code runtime environment is used to run the application's logic code. For example, the logic code runtime environment could be the Arkts Runtime.
[0217] S403, the logic code runtime environment loads application logic code.
[0218] S404, Application Process Creation Function Management Platform.
[0219] For example: (AbilityStage: onCreate).
[0220] Application processes can create and hold one or more functional management platforms.
[0221] A feature management platform is used to create and hold feature units. A feature management platform can create and hold multiple feature units.
[0222] The function management platform is used to manage the functional units it holds.
[0223] For example, a function management platform is used to manage the lifecycle of functional units. Another example is the function management platform used to manage the operating parameters of functional units.
[0224] S405, Function Management Platform creates functional units.
[0225] For example: (Ability: onCreate).
[0226] S406, Function Unit Creation Window Management Platform.
[0227] For example: (WindowsStage: onCreate).
[0228] A functional unit creates and holds a window management platform; a functional unit can create and hold one window management platform.
[0229] A window management platform is used to create and hold windows (Windows: onCreate). A window management platform can create and hold multiple windows.
[0230] The window management platform is used to manage windows.
[0231] For example, a window management platform is used to manage the lifecycle of windows. Another example is using a window management platform to manage the runtime parameters of windows.
[0232] S407, Window Management Platform creates windows.
[0233] Specifically, after an application completes its startup, the application's complete process holds at least one or more windows, one or more window management platforms, one or more functional units, one or more functional management platforms, and a logic code execution environment that loads the application's logic code.
[0234] As shown in Figure 4, the application adopts a hierarchical, progressive startup method. During the application startup process, users can select the functional units to be created and started according to the actual application scenario requirements, thereby achieving customized application function startup.
[0235] Figure 5 is a schematic diagram of the application process structure after the application is launched according to an embodiment of this application.
[0236] After the application starts, the hierarchical relationship in the application process can be simplified to the holding relationship shown in Figure 5.
[0237] As shown in Figure 5, application processes 1:N hold function management platforms, that is, application processes can create and hold multiple function management platforms.
[0238] Function management platform 1:N holds functional units, that is, a function management platform can create and hold multiple functional units.
[0239] Functional Unit 1:1 Holds a Window Management Platform, meaning that a functional unit can create and hold a window management platform.
[0240] Window management platform 1:N holds windows, that is, a window management platform can create and hold multiple windows.
[0241] That is, after S407, the application process holds one or more function management platforms, one or more function management platforms hold one or more function units, one or more function units hold one or more window management platforms, and one or more window management platforms hold one or more windows.
[0242] Figure 6 shows an application exit flowchart according to an embodiment of this application.
[0243] For applications that use a function management platform to manage function units, in one embodiment, the complete exit of the application is achieved based on the following process shown in Figure 6.
[0244] S600, triggering application exit.
[0245] For example, the user closes the application, or the system forces the application to quit.
[0246] Specifically, referring to the embodiment shown in FIG4, before the application exits, the complete application process of the application holds at least one or more windows, one or more window management platforms, one or more functional units, one or more functional management platforms, and a logic code execution environment loaded with application logic code.
[0247] S601, destroy window.
[0248] For example: (Windows: onDestroy).
[0249] Specifically, in one embodiment, for application scenarios where the application completely exits, all windows in the application process are destroyed.
[0250] S602, Destruction Window Management Platform.
[0251] For example: (WindowsStage:onDestory).
[0252] Specifically, as shown in Figure 5, a window management platform can create and hold multiple windows. For a given window management platform, it can only be destroyed after all the windows it holds have been destroyed.
[0253] In one embodiment, all windows in the application process are destroyed first, and then all window management platforms in the application process are destroyed.
[0254] Alternatively, in another embodiment, for each window management platform, after destroying the windows it holds, the window management platform itself is destroyed. For different window management platforms, the destruction of windows and the destruction of window management platforms can be performed in parallel or sequentially.
[0255] S603, Destroy Function Unit.
[0256] For example: (Ability:onDestory).
[0257] Specifically, referring to Figure 5, a functional unit can create and hold a window management platform. For a given functional unit, the functional unit can only be destroyed after the window management platform it holds has been destroyed.
[0258] In one embodiment, all window management platforms in the application process are destroyed first, and then all functional units in the application process are destroyed.
[0259] Alternatively, in another embodiment, for each functional unit, the window management platform it holds is destroyed before the functional unit is destroyed. The destruction of the window management platform and the destruction of the functional units can be performed in parallel or sequentially for different functional units.
[0260] S604, Destruction Function Management Platform.
[0261] For example: (AbilityStage:onDestory).
[0262] Specifically, referring to Figure 5, a function management platform can create and hold multiple function units. For a given function management platform, the platform can only be destroyed after all the function units it holds have been destroyed.
[0263] In one embodiment, all functional units in the application process are destroyed first, and then all functional management platforms in the application process are destroyed.
[0264] Alternatively, in another embodiment, for each functional management platform, after destroying the functional units it holds, the functional management platform is then destroyed. For different functional management platforms, the destruction of functional units and the destruction of the functional management platform can be performed in parallel or sequentially.
[0265] S605 is the runtime environment for application process destruction logic code.
[0266] For example, the process destroys ArktsRuntime.
[0267] Specifically, referring to Figure 5, an application process can create and hold multiple function management platforms. The application process can only destroy its logic code execution environment after all function management platforms held by it have been destroyed.
[0268] Furthermore, referring to S402 of Figure 4, during the application startup phase, the logic code runtime environment loads the application logic code. Therefore, in S605, the application process destroys the logic code runtime environment that was loaded with the application logic code.
[0269] S606, destroy the application process.
[0270] Figure 7 shows a schematic diagram of the functional units and window management platform creation / destruction logic according to an embodiment of this application.
[0271] In one embodiment, the function management platform in the application process and the creation-destruction logic between functional units are shown in Figure 7.
[0272] S710, Functional unit 701 is created (onCreate).
[0273] Specifically, functional unit 701 is created by the functional management platform.
[0274] S711, Window Management Platform 702 is created (on WindowsStageCreate).
[0275] Specifically, the window management platform 702 is created by functional unit 701.
[0276] S712, the window management platform 702 enters the foreground of the functional unit 701.
[0277] S713, the window display event of the window management platform 702 is triggered (shown).
[0278] S714, Window Management Platform 702 enters active state.
[0279] After the window management platform 702 is activated, the window management platform 702 creates and displays windows.
[0280] When you exit the application, all displayed windows are closed.
[0281] S715, Window Management Platform 702 deactivation (inActive).
[0282] S716, the window hiding event of the window management platform 702 is triggered (Hidden).
[0283] Specifically, during the application process, the windows held by the window management platform 702 are destroyed.
[0284] S717, the window management platform 702 enters the background (onBackground) of the functional unit 701.
[0285] S718, the window management platform 702 in the application process is destroyed (on WindowsStageDestroy).
[0286] S719, Functional unit 701 in the application process is destroyed (on Destory).
[0287] According to an embodiment of the application management method, an application warm start process is provided.
[0288] In warm start scenarios, when exiting the application, some or all of the functional management platform is retained, all or some functional units are destroyed, and the application process that holds at least the functional management platform is cached. In this way, the destruction of functional units can significantly reduce storage space usage.
[0289] During application warm startup, functional units are created by the reserved functional management platform. Since the functional management platform's function is to create functional units, the creation speed is significantly faster compared to the application process completely recreating functional units. Furthermore, the functional management platform can create and launch functional units on demand, based on the actual startup scenario and the application's startup needs, thus avoiding unnecessary waste of storage space.
[0290] The method according to the embodiments of this application can effectively control the storage space occupied by the application process cache while improving the application startup speed, thereby achieving a balance between application startup speed and application process cache storage space occupied, and improving the user experience of application startup.
[0291] Specifically, in order to implement the warm start process of the application management method proposed in the embodiments of this application, an embodiment of this application also proposes an application management device.
[0292] Figure 8 shows a schematic diagram of the structure of an application management device according to an embodiment of this application.
[0293] As shown in Figure 8, the application management device 800 includes a cache management module 801.
[0294] Figure 9 shows an application management flowchart according to an embodiment of this application.
[0295] In one embodiment, an electronic device equipped with an application management device 800 executes the following process, as shown in FIG9, to exit an application.
[0296] S900 triggers application exit.
[0297] For example, the trigger condition for S900 could be that the user closes the application.
[0298] Specifically, referring to the embodiments shown in Figures 4 and 5, before triggering the application exit, the application process of the application holds at least one or more windows, one or more window management platforms, one or more functional units, one or more functional management platforms, and a logic code execution environment loaded with application logic code.
[0299] Specifically, an application process holds one or more function management platforms, one or more function management platforms hold one or more function units, one or more function units hold one or more window management platforms, and one or more window management platforms hold one or more windows.
[0300] S901, Electronic device (operating system) startup and exit operation.
[0301] Specifically, in one embodiment, referring to the embodiment shown in FIG6, the application exit operation includes at least destroying the window, destroying the window management platform, destroying the functional unit, destroying the functional management platform, destroying the logic code execution environment, and destroying the application process.
[0302] S902, the cache management module 801 interrupts the application exit operation, which includes at least:
[0303] Prevent the destruction of the functional management platform so that the remaining application processes retain at least all or part of the functional management platform.
[0304] Furthermore, in S902, referring to Figures 5 and 6, an application process can create and hold multiple function management platforms. While retaining the function management platforms held by the application process, the runtime environment of the logic code loaded with the application logic code is also retained.
[0305] Specifically, applications run based on services provided by the operating system. Application operations (including application startup and exit), application process lifecycle (application process creation and destruction), and application window states (including application window creation and destruction) are all managed by the operating system.
[0306] In one embodiment, the application management device 800 registers a listener in the application management process of the operating system to obtain lifecycle change signals of applications, processes, and windows.
[0307] The cache management module 801 confirms the progress of the current application exit operation based on the acquired lifecycle change signals. The cache management module 801 sends an exit termination command to the operating system's application management process, instructing the operating system's application management process to intervene and adjust the lifecycle of the application and process, interrupting the specified destruction operation.
[0308] Furthermore, in one embodiment, in S900, when the cache management module 801 detects that the application exit is triggered, it first determines whether the application process needs to be cached for the currently triggered application exit.
[0309] If application process caching is required, the application exit process is monitored. When the application exit operation reaches a specified stage, the application exit operation is interrupted to prevent the destruction of specified modules in the application process, and the application process containing the specified modules is cached.
[0310] If application process caching is not required, the application exit process is not monitored. The electronic device then performs a complete application exit operation, destroying the application process and completely exiting the application.
[0311] Specifically, in this embodiment, the cache management module 801 can determine whether application process caching is required based on a variety of preset strategies.
[0312] For example, in one embodiment, the cache management module 801 determines whether the application process needs to be cached based on whether the application process caching conditions are met.
[0313] Specifically, in one embodiment, the application process caching conditions include any one or a combination of the following conditions.
[0314] The application must support caching application processes. Specifically, the cache management module 801 determines whether the current application supports application process caching. For example, whether the application architecture supports caching and restoring partial processes.
[0315] The application process caching function is enabled for the current application. That is, the cache management module 801 determines whether the application process caching function is enabled for the current application.
[0316] For example, in certain application scenarios, for applications that support caching application processes, the operating system provides a configuration page in the system configuration interface to enable / disable the application process caching function for that application. Users can choose to enable / disable the application process caching function for that application on the configuration page.
[0317] Figure 10 shows a schematic diagram of a system configuration interface according to an embodiment of this application.
[0318] As shown in Figure 10, users can configure whether to enable the application process caching function for the applications "Video Playback", "Photography", "Browser" and "Music".
[0319] For example, in some application scenarios, the operating system provides a configuration page in the system configuration interface to enable / disable the application process caching function. Users can choose to enable / disable the application process caching function for all applications in the current system on the configuration page.
[0320] Figure 11 shows a schematic diagram of a system configuration interface according to an embodiment of this application.
[0321] As shown in Figure 11, users can configure whether to enable the application process caching function on the current device.
[0322] The current application is not marked as an application to be kept alive in the background. That is, the cache management module 801 determines whether the current application is a specific application. For example, an application marked as an application to be kept alive in the background cannot be cached and then quickly launched because it needs to be kept alive in the background.
[0323] The current application exit is not a complete exit. That is, the cache management module 801 determines whether the current application exit scenario falls under a specific category. For example, a forced application exit scenario, in which the application needs to exit completely. Another example is an application restart scenario, in which the application needs to exit completely and then restart to initialize application runtime parameters.
[0324] In another embodiment, the application process caching conditions may also include other conditions besides those described above.
[0325] According to the method in the embodiments of this application, by determining whether the application process caching conditions are met, it is possible to determine whether the application process needs to be cached, which can effectively avoid application process caching failure and effectively prevent application process caching from affecting the smooth execution of other operations.
[0326] For example, in another embodiment, the cache management module 801 determines whether the application needs to be cached based on user habit data.
[0327] For example, if the current application launches at a frequency higher than or equal to a preset frequency threshold (e.g., once a day), it is determined that the application process needs to be cached; if the current application launches at a frequency lower than the preset frequency threshold, it is determined that the application process does not need to be cached.
[0328] According to the method in the embodiments of this application, determining whether the application process needs to be cached based on user habit data can improve the utilization efficiency of application process caching and enhance system operating efficiency.
[0329] Furthermore, in another embodiment, the cache management module 801 first determines whether the application process caching conditions are met. If the application process caching conditions are met, it then determines whether the application needs to be cached based on user habit data. Alternatively, the cache management module 801 first determines whether the application needs to be cached based on user habit data. If the application needs to be cached based on user habit data, it then determines whether the application process caching conditions are met.
[0330] S903, the cache management module 801 caches the remaining application processes.
[0331] To prevent cached application processes from occupying too much memory space and causing other application processes to malfunction, in one embodiment, after S903, the cached application processes in memory are deleted to free up available memory space.
[0332] Furthermore, in order not to affect the application startup acceleration effect, in another embodiment, after S903, the application process cached in memory is migrated to other storage (e.g., hard disk).
[0333] For example, when the available memory of the system is lower than a preset available memory threshold (e.g., 40% of the total memory), the application processes that are cached in memory are migrated to other storage.
[0334] For example, when the system requests more memory than a preset memory threshold (e.g., 60% of total memory), the application processes already cached in memory are migrated to other storage.
[0335] According to the method in the embodiments of this application, when available memory is insufficient, the application processes that have been cached in memory are migrated to other storage devices, which can effectively prevent the cached application processes from affecting the normal operation of other application processes, improve memory utilization efficiency, and enhance system stability.
[0336] Specifically, in one embodiment, the cache management module 801 maintains an application process cache queue, which stores the remaining application processes of multiple applications when the application exits. The application processes in the application process cache queue are sorted according to a preset rule. When memory space is insufficient, one or more application processes in the application process cache queue are deleted according to the sorting of the application processes, or one or more application processes in the application process cache queue are migrated to the hard disk.
[0337] For example, in one embodiment, application processes are sorted in chronological order. When memory space is insufficient, the application process with the earliest cache time is deleted, or the application process with the earliest cache time is migrated to the hard disk.
[0338] For example, in one embodiment, application processes are sorted according to their data size. When memory space is insufficient, the application process with the smallest data size is either deleted or migrated to disk. The consideration here is that the smaller the data size of an application process, the less the improvement in application startup speed is affected by whether the application process is cached at application startup. Deleting or migrating the application process with the smallest data size also has the least impact on user experience.
[0339] Furthermore, this application embodiment does not limit the specific method for implementing the management of cached application processes (deleting cached application processes, or migrating cached application processes). Those skilled in the art can design specific methods for managing cached application processes according to actual needs.
[0340] For example, in one embodiment, the migration of cached application processes is implemented based on the Linux cgroup mechanism.
[0341] Furthermore, in one embodiment, to prevent application processes from running in the background and thus consuming processor resources, the application management device 800 freezes the cached application processes after the cache management module 801 caches them.
[0342] According to the method in the embodiments of this application, freezing cached application processes can effectively prevent cached application processes from running in the background, avoid cached application processes from occupying additional system resources, improve system operating efficiency, and enhance the security and stability of system operation.
[0343] Furthermore, an application includes multiple application processes. In order to avoid the freezing of application processes from affecting the operation of the application itself and the operation of other applications, in one embodiment, when all application processes of the currently triggered exit application are cached, and when all cached application processes are not communicating, the cached application processes are frozen.
[0344] According to the method in this application embodiment, the cached application process is frozen only when all application processes of the application are cached and there is no communication behavior. This can effectively prevent the freezing of application processes from affecting the normal operation of other application processes and improve the stability of system operation.
[0345] Furthermore, this application does not limit the specific method for freezing cached application processes in its embodiments. Those skilled in the art can design specific methods for freezing cached application processes according to actual needs.
[0346] For example, in one embodiment, the Linux-based cgroup freezer subsystem freezes cached application processes.
[0347] Furthermore, in another embodiment, for cached application processes, other processing methods besides freezing and migration can be used to manage the resource consumption of the application processes.
[0348] For example, in one embodiment, the form of CPU control is adjusted for cached application processes. Instead of directly freezing and prohibiting them from running, the CPU cores, frequency, and duration of operation are restricted.
[0349] For example, in another embodiment, the use of the GPU by the application to which the cached application process belongs is controlled for the cached application process.
[0350] Figure 12 shows an application management flowchart according to an embodiment of this application.
[0351] In one embodiment, after exiting the application based on the process shown in FIG9, the electronic device equipped with the application management device 800 executes the following process as shown in FIG12 to launch the application.
[0352] S904 triggers the application launch.
[0353] For example, double-clicking an application icon on a desktop computer screen with a mouse; or tapping an application icon on a mobile phone screen with a finger.
[0354] S905, the cache management module 801 intervenes in the application startup process before creating the application process, activating the cached application processes (the remaining application processes cached in S903).
[0355] Specifically, in one embodiment, in S905, the application process activated by the cache management module 801 is the application process cached in S903. That is, in S905, the application process activated by the cache management module 801 at least holds a logic code runtime environment loaded with application logic code and a function management platform.
[0356] Furthermore, in one embodiment, the application management device 800 registers a listener in the application management process of the operating system to obtain application startup signals. When the cache management module 801 detects that application startup has been triggered, it first determines whether a cache-based warm start is required for the currently triggered application startup.
[0357] If a cache-based warm start is required, the cache management module 801 intervenes in the application startup process before creating the application process and activates the cached application process.
[0358] If a cache-based warm start is required, the cache management module 801 will not intervene in the application startup process, and the application will perform a cold start based on the process shown in Figure 4.
[0359] Specifically, in this embodiment, the cache management module 801 can determine whether a cache-based warm start is needed based on a variety of preset strategies.
[0360] Specifically, in certain application startup scenarios, it is necessary to force the application to perform a cold start in order to initialize the application's runtime parameters.
[0361] Therefore, in one embodiment, when the cache management module 801 detects that the application startup is triggered, it determines the startup type of the currently triggered application startup. If the startup type is application cold start, the cache management module 801 determines that a cache-based warm start is not required.
[0362] Furthermore, in some application scenarios, the corresponding application process may not be cached for the application that needs to be launched at the moment.
[0363] Therefore, in one embodiment, when the cache management module 801 detects that the application startup is triggered, it determines whether there is a cached application process for the currently triggered application. If there is no cached application process, the cache management module 801 determines that a cache-based warm start is not required.
[0364] Furthermore, in one embodiment, in S905, when the cached application process has been migrated to other storage outside of memory (e.g., hard disk), the application management device 800 first migrates the application process migrated to other storage back to memory, and then the cache management module 801 activates the application process.
[0365] Furthermore, in one embodiment, in S905, when the cached application process has been frozen, the application management device 800 first unfreezes the frozen application process, and then the cache management module 801 activates the application process.
[0366] S906, the application startup process is completed by the activated application process.
[0367] Specifically, the activated application process skips part of the application startup process, and the activated application process completes the remaining application startup process.
[0368] Specifically, in one embodiment, referring to the embodiment shown in FIG4, the application startup process includes at least:
[0369] Create an application process; start the logic code execution environment; load the application logic code; create a function management platform; the function management platform creates function units; the function units create a window management platform; the window management platform creates windows.
[0370] Since the activated application process has at least a logic code execution environment that loads the application logic code, in S906, the activated application process completes the application startup process, so that the application startup process can skip at least the following steps: creating the application process; starting the logic code execution environment; and loading the application logic code.
[0371] Furthermore, in one embodiment, the activated application process also holds at least a function management platform, and the activated application process executes the corresponding application startup process according to the function management platform it holds.
[0372] Specifically, based on the function management platform in the activated application process, the step of creating the function management platform is skipped, or partially skipped, during the application startup process completed by the activated application process.
[0373] The method according to the embodiments of this application can skip part of the application startup process, thereby accelerating application startup.
[0374] Furthermore, in this embodiment of the application, when the cache management module 801 interrupts the application exit operation, there are no specific restrictions on the interrupt node that is switched to.
[0375] That is, after S902, the application process can retain all the functional management platform or only a part of the functional management platform; the application process can not retain functional units or only a part of the functional units.
[0376] Correspondingly, in S906, based on the function management platform and function units in the activated application process, during the application startup process completed by the activated application process, the steps of creating the function management platform and / or creating the function units are skipped, or partially skipped.
[0377] According to the method of the embodiments of this application, the portion of the application process to be retained in the cache can be flexibly selected according to actual needs, thereby adaptively seeking a balance between the storage space occupied by the application process cache and the application startup acceleration.
[0378] For example, in one embodiment, in S902, the cache management module 801 interrupts the application exit operation after all the functional units held by each functional management platform held by the application process are destroyed, preventing the destruction of the functional management platform, thereby preserving all functional management platforms and the logic code execution environment loaded with application logic code in the application process.
[0379] Correspondingly, in S906, the activated application process holds all the functional management platforms required for application startup, and the activated application process does not hold any functional units. During the application startup process completed by the activated application process:
[0380] The function management platform held by the activated application process creates corresponding functional units according to the application startup scenario requirements;
[0381] The window management platform is created from the functional units that are created;
[0382] The window management platform creates windows, launches functional units and windows, and finally completes the application startup.
[0383] For example, in another embodiment, for one or more function management platforms held by the application process, the cache management module 801 interrupts the application exit operation after all window management platforms of all functional units (or some functional units) held by the function management platform and all windows held by the window management platform are destroyed, preventing the destruction of the function management platform and all functional units (or some functional units) held by the function management platform.
[0384] For other function management platforms held by the application process, the cache management module 801 does not prevent the destruction of the function management platform; thus, a portion of the function management platform and the logic code execution environment loaded with application logic code are retained in the application process.
[0385] Correspondingly, in S906, since the activated application process does not hold functional units, but does hold a portion of the functional management platform required for application startup, the application startup process is completed by the activated application process as follows:
[0386] Based on the application startup scenario requirements, create a function management platform that is not owned by the application process;
[0387] The function management platform held by the activated application process, as well as the newly created function management platform, create corresponding functional units according to the application startup scenario requirements;
[0388] The window management platform is created from the functional units that are created;
[0389] The window management platform creates windows, launches functional units and windows, and finally completes the application startup.
[0390] For example, before the application exits, the application process holds functional management platforms A, B, C, D, and E. During the application exit process, the cache management module 801 interrupts the application exit operation after all functional units held by functional management platforms A, B, and C are destroyed, preventing the destruction of functional management platforms A, B, and C.
[0391] The cache management module 801 does not prevent the destruction function of the management platform D and E.
[0392] The application process retains the functional management platform A, B, C, the logic code execution environment, and the application code loaded by the logic code execution environment.
[0393] During application startup, the cache management module 801 calls the cached application process (the application process holds function management platforms A, B, and C, the logic code execution environment, and the application code loaded by the logic code execution environment) and activates the application process. The activated application process creates function management platforms D and E; function management platforms A, B, C, D, and E create corresponding functional units according to the application startup scenario requirements; the created functional units create a window management platform; the window management platform creates windows, ultimately completing the application startup.
[0394] For example, in another embodiment, in S902, for one or more function management platforms held by the application process, the cache management module 801 interrupts the application exit operation after all window management platforms of all functional units (or some functional units) held by the function management platform and all windows held by the window management platform are destroyed, preventing the destruction of the function management platform and all functional units (or some functional units) held by the function management platform.
[0395] For other function management platforms held by the application process, the cache management module 801 interrupts the application exit operation and prevents the destruction of the function management platform after all the function units held by the function management platform are destroyed.
[0396] The application process retains all the functional management platform, logic code execution environment, application code loaded by the logic code execution environment, and all or part of the functional units held by some functional management platforms.
[0397] Correspondingly, in S906, since the activated application process holds all the functional management platform and some functional units, during the application startup process completed by the activated application process:
[0398] When the functional units held by the activated application process contain all the functional units required for application startup, the window management platform is created by the functional units held by the activated application process.
[0399] The window is created by the window management platform, which ultimately completes the application startup.
[0400] When the functional units held by the activated application process do not include all the functional units required for application startup, the functional units not held by the application process are created by the functional management platform held by the activated application process according to the application startup scenario requirements.
[0401] The window management platform is created by the functional units held by the activated application process, as well as by newly created functional units;
[0402] The window management platform creates windows, launches functional units and windows, and finally completes the application startup.
[0403] For example, before the application exits, the application process holds functional management platforms A, B, C, D, and E. During the application exit process, the cache management module 801 interrupts the application exit operation after all window management platforms of all functional units held by functional management platforms A, B, and C, as well as all windows held by the window management platforms, are destroyed, preventing the destruction of functional management platforms A, B, and C, and all functional units held by functional management platforms A, B, and C.
[0404] The cache management module 801 interrupts the application exit operation and prevents the destruction of the function management platforms D and E after all the functional units held by the function management platforms D and E are destroyed.
[0405] The application process retains all functional management platforms A, B, C, D, E, the logic code execution environment, the application code loaded by the logic code execution environment, and all functional units held by functional management platforms A, B, and C.
[0406] During application startup, the cache management module 801 calls the cached application process (the application process holds function management platforms A, B, C, D, and E, the logic code execution environment, the application code loaded by the logic code execution environment, and all functional units held by function management platforms A, B, and C) and activates the application process. Based on the application startup scenario requirements, the activated application process's function management platforms A, B, C, D, and E create functional units not held by the application process; the created functional units and the functional units originally held by the application process create a window management platform; the window management platform creates windows, ultimately completing the application startup.
[0407] Furthermore, considering the application startup scenario, after the application starts, the application process at least holds the main function management platform, and the main function management platform at least holds the main function unit, which is used to implement the application's basic functions. For example, the main function unit is used to create and hold the main window management platform, and the main window management platform is used to create and hold the main window. The main window is the initial application window that provides the basic user interface after the application starts.
[0408] That is, during the application startup process, the main function management platform holding the main function unit, the main function unit used to implement the basic functions of the application, and the main window that provides the basic function interaction interface must be started.
[0409] Therefore, in one embodiment, during the application exit phase, specifically during the destruction of windows, window management platforms, and functional units, the cache management module 801 does not interrupt the application exit operation, ensuring that all windows, window management platforms, and functional units in the application process are destroyed. Similarly, during the phase of destroying other functional management platforms besides the main functional management platform, the cache management module 801 does not interrupt the application exit operation, ensuring that all other functional management platforms in the application process besides the main functional management platform are destroyed.
[0410] After the functional units held by the main function management platform are destroyed, the cache management module 801 interrupts the application exit operation to prevent the main function management platform from being destroyed and retain the main function management platform in the application process.
[0411] Ultimately, the remaining application processes hold the main function management platform and the logic code execution environment loaded with application logic code.
[0412] Figure 13 is a schematic diagram of the application process structure according to an embodiment of this application.
[0413] After the application exits, the hierarchical relationship of the cached application process can be simplified to the holding relationship shown in Figure 13.
[0414] As shown in Figure 13, the application process holds the logic code runtime environment loaded with the application logic code and the main function management platform.
[0415] Correspondingly, in S906, during the application startup process completed by the activated application process:
[0416] The main functional unit is created by the main functional management platform held by the activated application process;
[0417] The main window management platform is created from the main functional unit that was created.
[0418] The main window is created by the main window management platform, which then starts the main functional units and the main window, ultimately completing the application startup.
[0419] Furthermore, in one embodiment, during S906, the process of the activated application process completing the application startup process further includes:
[0420] Other windows besides the main window can be created by the main window management platform.
[0421] Furthermore, in another embodiment, in S906, during the application startup process completed by the activated application process, the following is also included:
[0422] Other functional units besides the main functional unit are created by the main functional management platform held by the activated application process;
[0423] Other window management platforms besides the main window management platform can be created by other functional units that are also created.
[0424] Windows other than the main window can be created by the main window management platform and other window management platforms.
[0425] Furthermore, in another embodiment, in S906, during the application startup process completed by the activated application process, the following is also included:
[0426] The activated application process creates other function management platforms besides the main function management platform;
[0427] Other functional units besides the main functional unit can be created by the main functional management platform and other functional management platforms.
[0428] Other window management platforms besides the main window management platform can be created by other functional units that are also created.
[0429] Windows other than the main window can be created by the main window management platform and other window management platforms.
[0430] Furthermore, in another embodiment, during the application exit phase, specifically during the destruction of windows and the destruction of the window management platform, the cache management module 801 does not interrupt the application exit operation, ensuring that all windows and the window management platform in the application process are destroyed. During the phase of destroying functional units other than the main functional unit, the cache management module 801 does not interrupt the application exit operation, ensuring that all other functional units in the application process besides the main functional unit are destroyed.
[0431] After the main window management platform held by the main functional unit is destroyed (all windows held by the main window management platform have been destroyed), the cache management module 801 interrupts the application exit operation to prevent the main functional unit from being destroyed. Simultaneously, as the destruction of the main functional unit is prevented, the main functional management platform holding the main functional unit will also not be destroyed.
[0432] When other function management platforms besides the main function management platform are destroyed, the cache management module 801 does not interrupt the application exit operation, so that all other function management platforms besides the main function management platform in the application process are destroyed.
[0433] Ultimately, the remaining application process holds the main functional unit, the main functional management platform, and the logic code execution environment loaded with the application logic code.
[0434] Figure 14 is a schematic diagram of the application process structure according to an embodiment of this application.
[0435] After the application exits, the hierarchical relationship of the cached application process can be simplified to the holding relationship shown in Figure 14.
[0436] As shown in Figure 14, the application process holds the logic code runtime environment loaded with the application logic code and the main function management platform. The main function management platform holds the main function units.
[0437] Correspondingly, in S906, during the application startup process completed by the activated application process:
[0438] The main window management platform is created by the main functional unit held by the activated application process;
[0439] The main window is created by the main window management platform, which then starts the main functional units and the main window, ultimately completing the application startup.
[0440] Furthermore, in one embodiment, during S906, the process of the activated application process completing the application startup process further includes:
[0441] Other windows besides the main window can be created by the main window management platform.
[0442] Furthermore, in another embodiment, in S906, during the application startup process completed by the activated application process, the following is also included:
[0443] Other functional units besides the main functional unit are created by the main functional management platform held by the activated application process;
[0444] Other window management platforms besides the main window management platform can be created by other functional units that are also created.
[0445] Windows other than the main window can be created by the main window management platform and other window management platforms.
[0446] Furthermore, in another embodiment, in S906, during the application startup process completed by the activated application process, the following is also included:
[0447] The activated application process creates other function management platforms besides the main function management platform;
[0448] Other functional units besides the main functional unit can be created by the main functional management platform and other functional management platforms.
[0449] Other window management platforms besides the main window management platform can be created by other functional units that are also created.
[0450] Windows other than the main window can be created by the main window management platform and other window management platforms.
[0451] Furthermore, in another embodiment, during the application exit phase, specifically during the destruction of windows and the destruction of the window management platform, the cache management module 801 does not interrupt the application exit operation, ensuring that all windows and the window management platform in the application process are destroyed. During the phase of destroying functional units other than the main functional unit, the cache management module 801 does not interrupt the application exit operation, ensuring that all other functional units in the application process besides the main functional unit are destroyed.
[0452] After the main window management platform held by the main functional unit is destroyed (all windows held by the main window management platform have been destroyed), the cache management module 801 interrupts the application exit operation to prevent the main functional unit from being destroyed. Simultaneously, as the destruction of the main functional unit is prevented, the main functional management platform holding the main functional unit will also not be destroyed.
[0453] After the functional units held by other functional management platforms besides the main functional management platform are destroyed, the cache management module 801 interrupts the application exit operation to prevent other functional management platforms besides the main functional management platform from being destroyed, and retains all functional management platforms in the application process.
[0454] Ultimately, the remaining application process holds the main functional unit, all functional management platforms, and the logic code execution environment loaded with application logic code.
[0455] Figure 15 is a schematic diagram of the application process structure according to an embodiment of this application.
[0456] After the application exits, the hierarchical relationship of the cached application process can be simplified to the holding relationship shown in Figure 15.
[0457] As shown in Figure 15, the application process holds the logic code runtime environment that loads the application logic code, as well as all the function management platforms (the main function management platform and other function management platforms). The main function management platform holds the main function units.
[0458] Correspondingly, in S906, during the application startup process completed by the activated application process:
[0459] The main window management platform is created by the main functional unit held by the activated application process;
[0460] The main window is created by the main window management platform, which then starts the main functional units and the main window, ultimately completing the application startup.
[0461] Furthermore, in one embodiment, during S906, the process of the activated application process completing the application startup process further includes:
[0462] Other windows besides the main window can be created by the main window management platform.
[0463] Furthermore, in another embodiment, in S906, during the application startup process completed by the activated application process, the following is also included:
[0464] Other functional units besides the main functional unit are created by the main functional management platform and / or other functional management platforms held by the activated application process;
[0465] Other window management platforms besides the main window management platform can be created by other functional units that are also created.
[0466] Windows other than the main window can be created by the main window management platform and other window management platforms.
[0467] Furthermore, in another embodiment, during the application exit phase, when destroying the main window and all other windows and window management platforms besides the main window management platform, the cache management module 801 does not interrupt the application exit operation, so that the main window and all other windows and window management platforms in the application process are destroyed. During the phase of destroying other functional units besides the main functional unit, the cache management module 801 does not interrupt the application exit operation, so that all other functional units in the application process besides the main functional unit are destroyed.
[0468] After the main window management platform held by the main functional unit is destroyed (all windows held by the main window management platform have been destroyed), the cache management module 801 interrupts the application exit operation to prevent the main functional unit from being destroyed. Simultaneously, as the destruction of the main functional unit is prevented, the main functional management platform holding the main functional unit will also not be destroyed.
[0469] After the functional units held by other functional management platforms besides the main functional management platform are destroyed, the cache management module 801 does not interrupt the application exit operation, nor does it prevent other functional management platforms besides the main functional management platform from being destroyed.
[0470] Ultimately, the remaining application process holds the main window, the main window management platform, the main functional unit, the main functional management platform, and the logic code execution environment that loads the application logic code.
[0471] Figure 16 is a schematic diagram of the application process structure according to an embodiment of this application.
[0472] After the application exits, the hierarchical relationship of the cached application process can be simplified to the holding relationship shown in Figure 16.
[0473] As shown in Figure 16, the application process holds the logic code execution environment containing the application logic code and the main function management platform. The main function management platform holds the main function unit. The main function unit holds the main window management platform. The main window management platform holds the main window.
[0474] Correspondingly, in S906, during the application startup process completed by the activated application process:
[0475] The main functional unit and main window are launched, and the application is finally launched.
[0476] According to the method in the embodiments of this application, destroying the main functional unit and other functional units and windows other than the main window, and destroying other functional management platforms other than the main functional management platform, can effectively reduce the memory storage space occupied by cached application processes and improve memory utilization efficiency.
[0477] According to the method in the embodiments of this application, the main functional unit and the main window are retained in the cached application process. When the application is started, it is not necessary to recreate the main functional unit and the main window, which can speed up the application startup speed and improve the user experience of the application startup.
[0478] Furthermore, in one embodiment, during S906, the process of the activated application process completing the application startup process further includes:
[0479] Other windows besides the main window can be created by the main window management platform.
[0480] Furthermore, in another embodiment, in S906, during the application startup process completed by the activated application process, the following is also included:
[0481] The activated application process creates other function management platforms besides the main function management platform;
[0482] Other functional units besides the main functional unit can be created by the main functional management platform and other functional management platforms.
[0483] Other window management platforms besides the main window management platform can be created by other functional units that are also created.
[0484] Windows other than the main window can be created by the main window management platform and other window management platforms.
[0485] Furthermore, in another embodiment, during the application exit phase, when destroying the main window and all other windows and window management platforms besides the main window management platform, the cache management module 801 does not interrupt the application exit operation, so that the main window and all other windows and window management platforms in the application process are destroyed. During the phase of destroying other functional units besides the main functional unit, the cache management module 801 does not interrupt the application exit operation, so that all other functional units in the application process besides the main functional unit are destroyed.
[0486] After the main window management platform held by the main functional unit is destroyed (all windows held by the main window management platform have been destroyed), the cache management module 801 interrupts the application exit operation to prevent the main functional unit from being destroyed. Simultaneously, as the destruction of the main functional unit is prevented, the main functional management platform holding the main functional unit will also not be destroyed.
[0487] After the functional units held by other functional management platforms besides the main functional management platform are destroyed, the cache management module 801 interrupts the application exit operation to prevent other functional management platforms besides the main functional management platform from being destroyed, and retains all functional management platforms in the application process.
[0488] Ultimately, the remaining application process holds the main window, the main window management platform, the main functional unit, all functional management platforms, and the logic code execution environment that loads the application logic code.
[0489] Figure 17 is a schematic diagram of the application process structure according to an embodiment of this application.
[0490] After the application exits, the hierarchical relationship of the cached application process can be simplified to the holding relationship shown in Figure 17.
[0491] As shown in Figure 17, the application process holds the logic code execution environment that loads the application logic code, as well as all function management platforms (the main function management platform and other function management platforms). The main function management platform holds the main function unit. The main function unit holds the main window management platform. The main window management platform holds the main window.
[0492] Correspondingly, in S906, during the application startup process completed by the activated application process:
[0493] The main functional unit and main window are launched, and the application is finally launched.
[0494] According to the method in the embodiments of this application, destroying the main functional unit and other functional units and windows other than the main window can effectively reduce the memory storage space occupied by the cached application process and improve memory utilization efficiency.
[0495] According to the method of this application embodiment, the main functional unit, main window and all function management platforms are retained in the cached application process. When the application is started, it is not necessary to recreate the main functional unit and main window. In addition, other functional units can be flexibly created as needed through the function management platform, which can speed up the application startup speed and improve the user experience of the application startup.
[0496] Furthermore, in one embodiment, during S906, the process of the activated application process completing the application startup process further includes:
[0497] Other windows besides the main window can be created by the main window management platform.
[0498] Furthermore, in another embodiment, in S906, during the application startup process completed by the activated application process, the following is also included:
[0499] Other functional units besides the main functional unit are created by the main functional management platform and / or other functional management platforms held by the activated application process;
[0500] Other window management platforms besides the main window management platform can be created by other functional units that are also created.
[0501] Windows other than the main window can be created by the main window management platform and other window management platforms.
[0502] Figure 18 shows a flowchart of the application exit portion according to an embodiment of this application.
[0503] In one embodiment, the electronic device executes the following process as shown in the figure to retain the main functional unit, the main window management platform, and the main window in the remaining application process.
[0504] S1000, select functional units one by one.
[0505] S1001, determine whether the currently selected functional unit is the main functional unit.
[0506] If the currently selected functional unit is the master functional unit, execute S1002.
[0507] S1002, Select each window held by the window management platform held by the main functional unit.
[0508] S1003 determines whether the currently selected window is the main window.
[0509] If the currently selected window is the main window, execute S1004.
[0510] If the currently selected window is not the main window, execute S1005.
[0511] S1005, destroy the currently selected window.
[0512] S1004 is executed after S1005.
[0513] S1004, Determine whether there are any unselected windows in the windows held by the window management platform held by the main functional unit.
[0514] If there are unselected windows under the main functional unit, return to S1002.
[0515] If there are no unselected windows under the main functional unit, execute S1006.
[0516] If the currently selected functional unit is not the main functional unit, execute S1007.
[0517] S1007, destroy all windows held by the window management platform held by the currently selected functional unit, destroy the window management platform held by the currently selected functional unit, and destroy the currently selected functional unit.
[0518] S1006 is executed after S1007.
[0519] S1006, Determine if there are any unselected functional units.
[0520] If no unselected functional unit exists, the process ends.
[0521] If there is an unselected functional unit, return to S1000.
[0522] Figure 19 shows a flowchart of the application startup section according to an embodiment of this application.
[0523] In one embodiment, the application launch requires the startup of the main functional unit and the main window. The electronic device executes the following process, as shown in Figure 19, to launch the application based on the cached application process.
[0524] S1200, activate cached application processes (remaining application processes).
[0525] S1201, determine whether the application process holds the main functional unit.
[0526] If the application process holds the main functional unit, execute S1202.
[0527] S1202, determine whether the application process holds the main window.
[0528] If the application process holds the main window, execute S1203.
[0529] S1203: Start the main functional unit in the application process and the main window held by the main window management platform to complete the application startup.
[0530] If the application process does not hold the main window, execute S1204.
[0531] S1204: Start the main functional unit in the application process, which creates the main window management platform, which in turn creates the main window, starts the main window, and completes the application startup.
[0532] If the application process does not hold the main functional unit, execute S1205.
[0533] S1205: The main functional unit is created by the function management platform held by the application process, the main functional unit is started, the main window management platform is created by the main functional unit, the main window is created by the main window management platform, the main window is started, and the application startup is completed.
[0534] Furthermore, in one embodiment, during application runtime, the function management platform is used to manage functional units, which stores the operating parameters of the functional units, such as user login information.
[0535] In S906, during the creation of functional units in the functional management platform, the platform creates functional units based on saved runtime parameters, so that the application inherits the state of the previous application runtime after startup.
[0536] According to the method in the embodiments of this application, the function management platform creates functional units based on the saved running parameters, so that the application inherits the state of the previous application run after it starts, which can improve the matching degree between the application state after the application starts and the user, and improve the user experience of the application startup.
[0537] Furthermore, the method provided in this application embodiment can also be applied to other application scenarios besides application exit / start.
[0538] Specifically, to ensure system stability, in application scenarios where available memory is insufficient, such as when system speed decreases / lags or other problems occur (e.g., unable to open new applications, displaying insufficient memory), the system will proactively kill (or be triggered by the user to kill) inactive applications and forcibly destroy application processes to free up memory storage space.
[0539] For applications that have been detected and killed, their application processes are destroyed. Therefore, if the application is to be restarted, the entire application startup process (application cold start) must be executed, which will result in a long application startup time.
[0540] To address the aforementioned issues, in one embodiment of this application, when an application is triggered for elimination, not all application processes are destroyed, but only a portion of the application processes are destroyed, and the remaining application processes are cached. The cached application processes at least hold the logic code execution environment and all or part of the functional management platform (refer to the application exit process shown in Figure 9).
[0541] This frees up some of the memory space previously occupied by the complete application process, thus solving the problem of insufficient memory space.
[0542] Furthermore, when the application needs to be restarted, the cached application process is invoked (see the application startup process shown in Figure 12).
[0543] This will speed up application startup.
[0544] According to the method in this application embodiment, when detecting and killing inactive applications, some application processes are destroyed and the remaining application processes are cached, so that when the application is restarted, the cached application processes can be called to speed up the application startup.
[0545] The method according to the embodiments of this application can accelerate application restart speed and improve the user experience of application startup under the premise of insufficient system available memory.
[0546] Specifically, in certain application scenarios, applications need to enter a hibernation state. For example, when the entire system goes into hibernation, it will instruct all applications to enter hibernation. Another example is that, to conserve processing resources, the system will instruct inactive applications to enter hibernation.
[0547] When an application enters a hibernation state, its entire process is cached so that it can be quickly launched when it exits hibernation. However, fully caching the application process consumes a significant amount of memory, leading to insufficient available memory and impacting the operation of other applications. Even when available memory is insufficient, the launch of an application that has exited hibernation can be affected, causing the application to lag and slow down its startup speed.
[0548] To address the aforementioned issues, in one embodiment of this application, when application hibernation is triggered, the complete application process is not cached. Instead, a portion of the application process is destroyed, and the remaining application process is cached. The cached application process at least holds the logic code execution environment and all or part of the functional management platform (refer to the application exit process shown in Figure 9).
[0549] This frees up some of the memory space previously occupied by the complete application process, thus avoiding memory shortage issues.
[0550] Furthermore, when it is necessary to exit the hibernation state and restart the application, the cached application process is invoked (refer to the application startup process shown in Figure 12).
[0551] This will speed up application startup.
[0552] According to the method in the embodiments of this application, when the application is in hibernation, some application processes are destroyed and the remaining application processes are cached, so that when the application is restarted after exiting the hibernation state, the cached application processes can be called to accelerate the application startup speed.
[0553] The method according to the embodiments of this application can avoid insufficient system available memory, accelerate application restart speed, and improve the user experience of application startup.
[0554] The method in this application embodiment is applied to an electronic device, which can be any device that has an operating system installed and can install applications, such as a mobile phone, tablet computer, laptop computer, desktop computer, cloud server, etc.
[0555] Specifically, in one embodiment, the application startup method is applied to the terminal operating system of the terminal device.
[0556] Figure 20 shows a schematic diagram of a terminal operating system according to an embodiment of this application.
[0557] As shown in Figure 20, the terminal operating system can be divided from bottom to top as follows:
[0558] Hardware Abstraction Layer 1001, Kernel OS Layer 1002, System Service Layer 1003, Application Framework Layer 1004, and Application Layer 1005.
[0559] The system kernel layer 1002 is used to manage the most critical resources and provide some resource access capabilities, such as CPU scheduling, memory allocation, file storage, and hardware I / O.
[0560] In one embodiment, the system kernel layer 1002 provides basic kernel capabilities to the upper layers, including process / thread management, memory management, file system, network management, and peripheral device management. The system kernel layer 1002 includes a kernel subsystem and a driver subsystem. The kernel subsystem employs a multi-kernel design, supporting the selection of a suitable OS kernel for different resource-constrained devices. The driver subsystem provides unified peripheral access capabilities and a framework for driver development and management.
[0561] The system service layer 1003 provides services to the application through the program framework layer 1004.
[0562] In one embodiment, the system service layer 1003 includes: a set of basic system capabilities subsystems, a set of basic software service subsystems, a set of enhanced software service subsystems, and a set of hardware service subsystems.
[0563] The system's basic capabilities subsystem set provides fundamental capabilities for the operation, scheduling, and migration of distributed applications across multiple devices. This subsystem set comprises distributed soft bus, distributed data management, distributed task scheduling, Ark multi-language runtime, common basic libraries, multi-modal input, graphics, security, and AI subsystems. Among these, the Ark runtime provides C / C++ / JS multi-language runtimes and basic system class libraries, and also provides a runtime for Java programs statically generated using the Ark compiler (i.e., the parts of the application or framework layer developed using the Java language).
[0564] The basic software service subsystem set is used to provide common, general-purpose software services. It consists of subsystems such as event notification, telephony, multimedia, DFX, and MSDP&DV.
[0565] The Enhanced Software Services Subsystem Assembly is used to provide differentiated, capability-enhancing software services for different devices. It consists of subsystems such as Smart Screen Dedicated Services, Wearable Dedicated Services, and IoT Dedicated Services.
[0566] The hardware services subsystem set is used to provide hardware services. It consists of subsystems such as location services, biometric recognition, wearable proprietary hardware services, and IoT proprietary hardware services.
[0567] The program framework layer 1004 provides the necessary capabilities for the application in the upper layer (application layer 305).
[0568] In one embodiment, the program framework layer 1004 provides the application with user program frameworks and functional unit (Ability) frameworks in multiple languages such as Java / C / C++ / JS, as well as multi-language framework interfaces (APIs) for various software and hardware services; at the same time, it provides the device with framework APIs in multiple languages such as C / C++ / JS, and the APIs supported by different devices are related to the degree of componentization and customization of the system.
[0569] The program framework layer 1004 is closely related to the system's underlying layer. Therefore, in one embodiment, the program framework layer 1004 and the system service layer 1003 are collectively referred to as the framework service layer 1006.
[0570] The framework service layer 1006 includes modules such as application lifecycle management, graphics and image capabilities, multimodal interaction, and security control, as well as necessary API interfaces.
[0571] Application layer 1005 includes system applications and third-party non-system applications.
[0572] In one embodiment, the application layer 1005 consists of one or more Feature Ability (FA) or Particle Ability (PA). FA has a user interface (UI) and provides the ability to interact with the user; while PA has no UI and provides the ability to run background tasks and a unified data access abstraction. Applications developed based on FA / PA can implement specific business functions, support cross-device scheduling and distribution, and provide users with a consistent and efficient application experience.
[0573] In one embodiment, according to the method and apparatus of this application, when an application running on a terminal operating system exits, the application management device 800 controls the retention of the application process through the framework service layer 1006 to put it into a cache state. Subsequently, when the application is restarted on the terminal operating system, the application management device 800 improves the application startup speed by reusing the cached application process.
[0574] Figure 21 shows a schematic diagram of the deployment structure of an application management device according to an embodiment of this application.
[0575] As shown in Figure 21, the framework service layer 1100 includes the system basic management service 1101.
[0576] The system basic management service 1101 is a collection of various system management modules, including but not limited to the application management module 1102, window management module 1103, application package management module 1104, etc.
[0577] In one embodiment, the application management device 1110 registers a listener in the application management module 1102 and the window management module 1103 to obtain data such as application operations (application startup, exit, etc.), process lifecycle (process creation, destruction), and window status (window creation, destruction).
[0578] Furthermore, the application management device 1110 also sends instructions to the application management module 1102 to instruct the application management module 1102 to intervene and adjust the lifecycle of applications and processes, and interrupt the specified destruction operation.
[0579] The application management device 1110 includes a cache management module 1111, a memory swapping management module 1112, and a freeze management module 1113 deployed on the framework service layer 1100, and a swap-in / swap-out module 1114 and a freeze / unfreeze module 1115 deployed on the system kernel layer 1105.
[0580] The application management device 1110 obtains data such as application operations (application startup, exit, etc.), process lifecycle (process creation, destruction), and window state (window creation, destruction), which is then transmitted to the cache management module 1111. The cache management module 1111 sends an instruction to the application management module 1102 based on the received data to interrupt the application exit operation.
[0581] Specifically, in one embodiment, the cache management module 1111 regulates the lifecycle of the cached application. When an application supporting caching exits, the application process first completes the destruction (onDestroy) of all windows and functional units (Ability). Subsequently, the cache management module 1111 intervenes to prevent the application process from further destroying the AbilityStage (avoiding the onDestroy callback of AbilityStage), while preserving the application process, the ArkTs engine running Ability logic, and the AbilityStage instance, thus putting the application process into a cached state. The cached application process is recorded in the cache queue.
[0582] After an application process enters the cache queue, when the cache management module 1200 confirms that all remaining application processes of its application have been cached, the cache management module 1111 sends a resource control signal to the memory swapping management module 1112 and the freeze management module 1113, which then perform memory swapping and process freezing operations respectively.
[0583] When a cached application is restarted, the cache management module 1111 receives the Ability onCreate callback before the application and intervenes in advance. At this time, the cache management module 1111 sends a release signal to the memory swapping management module 1112 and the freeze management module 1113 to swap the cached application process into memory and unfreeze the application process. Subsequently, the application creates and starts the Ability in the cached AbilityStage, completing the normal startup.
[0584] When a cached application is actively or passively forced to exit, the cache management module 1111 de-controls it in advance and then exits normally.
[0585] The application can be cached repeatedly, launched after caching, and restarted in the same way as a normal launch.
[0586] Figure 22 shows a schematic diagram of the cache management module structure according to an embodiment of this application.
[0587] In one embodiment, as shown in FIG22, the cache management module 1200 includes a cache decision module 1210, a cache maintenance module 1220, a cache execution module 1230, and a cache communication module 1240.
[0588] The cache decision module 1210 is used to determine whether the application has entered the cache state.
[0589] The caching decision module 1210 includes an application adaptation determination unit 1211, a special application filtering unit 1212, and a special scenario filtering unit 1213.
[0590] The application adaptation determination unit 1211 is used to determine whether the application is adapted to the fast startup function after caching and whether it wants to enable this capability.
[0591] Specifically, in one embodiment, the application adaptation determination unit 1211 determines whether the application is adapted to the function of fast startup after caching and whether it wants to enable this capability by reading the information set by the application to the application management module.
[0592] The special application filtering unit 1212 is used to filter out specific applications from the application process cache list. For example, some specific applications have special requirements for their own lifecycle (such as keep-alive applications), and these applications cannot be compatible with fast startup after caching, so they need to be excluded from the cache list by the special application filtering unit 1212.
[0593] The special scenario filtering unit 1213 is used to identify specific scenarios where application process caching is not allowed. For example, scenarios such as forced application exit.
[0594] The cache maintenance module 1220 includes a cache list management unit 1221, a cache maintenance strategy unit 1222, and an external management service unit 1224.
[0595] The cache list management unit 1221 is used to maintain at least one cache queue.
[0596] Applications and their processes can enter and leave the cache queue either passively triggered by the application's lifecycle (such as when the application process is terminated externally) or actively operated by the cache management module 1200.
[0597] For example, applications that support application process caching enter the cache queue when they exit, and cached applications are removed from the cache queue when they are restarted, exited, or crash.
[0598] The cache maintenance strategy unit 1222 is used to customize management strategies according to the needs of the system and devices. For example, it can limit the number of caches or limit the memory size occupied by the cache.
[0599] External management service unit 1224 is used to provide management interfaces. The management interfaces are divided into categories, including but not limited to data query types (querying cache quantity, process ID, etc.), cache manipulation types (waking up the cache, exiting the cache, etc.), and capability switch types (temporarily disabling cache capabilities, etc.).
[0600] The cache execution module 1230 is used to connect to the application management module to regulate the application lifecycle.
[0601] After receiving instructions from the cache decision module 1210, the cache execution module 1230 controls the application to enter the cache state. After receiving instructions from the cache maintenance module 1220, the cache execution module 1230 controls the application to exit the cache queue or completely destroys the application process and exits.
[0602] The cached communication module 1240 includes a message receiving unit 1241 and a message sending unit 1242.
[0603] The message receiving unit 1241 is used to receive lifecycle change signals such as applications, processes, and windows.
[0604] When the application process cache is under resource management, the message sending unit 1242 notifies the memory swapping management module 1112 and the freeze / unfreeze module 1115.
[0605] The memory swapping management module 1112 is used to listen for cache status change notifications and adjust the memory swapping strategy.
[0606] When an application is already cached, the memory swapping management module 1112 makes a decision based on information such as the total system memory, available memory, and memory waterline configuration, and controls the application process that is swapped out of memory to external storage.
[0607] When the application starts and exits the cache state, the memory swapping management module 1112 controls the swapping of the application process from external storage into memory.
[0608] The swap-in / swap-out module 1114 is used to accept instructions from the memory swapping management module 1112 and swap application processes between memory and external storage through the interface provided by the system kernel layer 1105.
[0609] In one embodiment, after receiving the resource control signal from the cache management module 1111, the memory swapping management module 1112 first records the controlled application. When the memory swapping management module 1112 detects that the system's available memory level or the system's memory request reaches a certain condition, it controls the swap-in / swap-out module 1114 to process (e.g., compress) the anonymous pages and other memory data of the cached application processes and then transfer them to external storage to reduce the amount of running memory used.
[0610] The percentage of memory swapped out is negatively correlated with the system's available memory, and follows a stepped pattern. For example, 40% of available memory corresponds to 50% swapping out, and 30% of available memory corresponds to 70% swapping out. Conversely, when a cached application process is restarted, all application processes that were swapped out of memory are swapped back into memory.
[0611] In one embodiment, the swap-in / swap-out module 1114 uses the cgroup memory subsystem of the Linux kernel to create independent groups for the caching process, adjusts the memory.swappiness node of the group, and thus controls the swapping between memory and external storage swap partitions.
[0612] Specifically, Figure 23 is a schematic diagram of the process of an application process being swapped from memory to hard disk according to an embodiment of this application.
[0613] In one embodiment, the application process cached in memory is swapped out to the hard disk based on the following process shown in Figure 23.
[0614] S1600, the memory swapping management module 1112 records information about the application process Proc1.
[0615] S1601, the memory swapping management module 1112 determines whether the application process Proc1 meets the conditions for swapping out of memory to the hard disk based on the information of the application process Proc1.
[0616] For example, determine whether the application process Proc1 has been frozen; or determine whether the application process Proc1 is an application process that is allowed to be swapped out.
[0617] If the application process Proc1 does not meet the conditions, execute S1602.
[0618] S1602, the memory swapping management module 1112 is waiting for the memory swapping trigger condition.
[0619] After S1602, return to S1601.
[0620] If the application process Proc1 meets the conditions, execute S1603.
[0621] S1603, the memory swapping management module 1112 calculates the swapping ratio of application process Proc1 based on the system memory status.
[0622] S1604, the memory swapping management module 1112 sends a memory swap-out instruction for the application process Proc1 to the swap-in / swap-out module 1114.
[0623] S1605, swap-in / swap-out module 1114 mounts memory swap cgroup groups.
[0624] For example, / cgroup / exc_mem.
[0625] S1606, the swap-in / swap-out module 1114 writes the PID of the application process Proc1 into the memory swap cgroup group.
[0626] For example, `echo pid> / cgroup / exc_mem / cgroup.procs`.
[0627] S1607, the swap-in / swap-out module 1114 adjusts the memory swap-out ratio to the ratio (exc_rate) indicated by the memory swap-out instruction.
[0628] For example, `echo exc_rate> / cgroup / exc_mem / memory.swappiness`.
[0629] Specifically, Figure 24 is a schematic diagram of the process of an application process being swapped from the hard disk to memory according to an embodiment of this application.
[0630] In one embodiment, the application process cached on the hard disk is swapped into memory based on the following process shown in Figure 24.
[0631] S1700, the memory swapping management module 1112 records information about the application process Proc1.
[0632] S1701, the memory swapping management module 1112 sends a memory swap-in instruction for the application process Proc1 to the swap-in / swap-out module 1114 based on the information of the application process Proc1.
[0633] S1702, swap-in / swap-out module 1114 is mounted with no memory swap cgroup group.
[0634] For example, / cgroup / no_exc_mem.
[0635] S1703, the swap-in / swap-out module 1114 writes the PID of the application process Proc1 into a memory-free swap cgroup group.
[0636] For example, `echo pid> / cgroup / no_exc_mem / cgroup.procs`.
[0637] The freeze management module 1113 is used to listen for cache status change notifications and adjust application freeze strategies.
[0638] When an application enters the cache, the freeze management module 1113 makes a decision based on information such as the application's cached time and whether it is communicating with other processes, and chooses the appropriate time to freeze the application process. When the application exits the cached state, the freeze management module 1113 controls the unfreezing of the application process.
[0639] The freeze / unfreeze module 1115 is used to receive instructions from the freeze management module 1113 and unfreeze or freeze application processes through the interface provided by the system kernel layer 1105 (such as the Linux kernel freezer mechanism).
[0640] In one embodiment, after receiving the resource control signal from the cache management module 1111, the freeze management module 1113 records the controlled application and freezes the application when the freeze conditions are met.
[0641] Freezing conditions include, but are not limited to: the process is not in the process of IPC communication; the process does not hold an exclusive hardware resource lock.
[0642] The freeze management module 1113 controls the freeze-unfreeze module 1115 to freeze all processes of the cached application. Conversely, when the cached application exits or is restarted, the freeze management module 1113 controls the freeze-unfreeze module 1115 to unfreeze all processes of the corresponding application.
[0643] In one embodiment, the freeze / unfreeze module 1115 uses the cgroup freezer subsystem of the Linux system to create independent groups for cached processes and adjusts the freezer.state node of the group. Writing "FROZEN" to freeze the process and writing "THAWED" to unfreeze the process.
[0644] Specifically, Figure 25 shows a schematic diagram of the application process freezing process according to an embodiment of this application.
[0645] In one embodiment, cached application processes are frozen based on the following process shown in Figure 25.
[0646] S1800, Freeze Management Module 1113 records information about application process Proc1.
[0647] S1801, the freeze management module 1113 determines whether the application process Proc1 meets the freeze conditions based on the information of the application process Proc1.
[0648] For example, determine whether all application processes of the application to which application process Proc1 belongs have been cached; or determine whether application process Proc1 has any communication behavior.
[0649] If the application process Proc1 does not meet the conditions, execute S1802.
[0650] S1802, Freeze management module 1113 is waiting for the freeze trigger condition.
[0651] After S1802, return to S1801.
[0652] If the application process Proc1 meets the conditions, execute S1803.
[0653] S1803, the freeze management module 1113 sends a freeze command for the application process Proc1 to the freeze-unfreeze module 1115.
[0654] S1804, Freeze / Unfreeze module 1115 mounts frozen cgroup groups.
[0655] For example, / cgroup / frzGroup.
[0656] S1805, the freeze / unfreeze module 1115 writes the PID of the application process Proc1 into the freeze cgroup group.
[0657] For example, `echo pid> / cgroup / frzGroup / cgroup.procs`.
[0658] S1806, Freeze / Unfreeze module 1115 triggers cgroup freeze.
[0659] For example, echo 'FROZEN' > / cgroup / frzGroup / freezer.state.
[0660] Specifically, Figure 26 shows a schematic diagram of the unfreezing application process according to an embodiment of this application.
[0661] In one embodiment, the frozen application process is unfrozen based on the following process shown in Figure 26.
[0662] S1900, Freeze management module 1113 records information about application process Proc1.
[0663] S1901, the freeze management module 1113 sends a freeze command for the application process Proc1 to the freeze-unfreeze module 1115 based on the information of the application process Proc1.
[0664] S1902, freeze / thaw module 1115 mounts and thaws cgroup groups.
[0665] For example, / cgroup / noFrzGroup.
[0666] S1903, Freeze / Unfreeze module 1115 triggers cgroup unfreeze.
[0667] For example, echo 'THAWED'> / cgroup / frzGroup / freezer.state.
[0668] S1904, the freeze / unfreeze module 1115 writes the PID of the application process Proc1 into the unfreeze cgroup group.
[0669] For example, `echo pid> / cgroup / noFrzGroup / cgroup.procs`.
[0670] In the description of the embodiments of this application, for the sake of convenience, the device is described by dividing it into various modules according to its functions. The division of each module is only a logical functional division. When implementing the embodiments of this application, the functions of each module can be implemented in one or more software and / or hardware.
[0671] Specifically, the apparatus proposed in this application can be fully or partially integrated onto a single physical entity (e.g., a GPU or other type of processor), or it can be physically separated. These modules can be implemented entirely in software via processing element calls; entirely in hardware; or some modules can be implemented in software via processing element calls, while others are implemented in hardware. For example, the detection module can be a separate processing element or integrated into a chip in an electronic device. The implementation of other modules is similar. Furthermore, these modules can be fully or partially integrated together or implemented independently. During implementation, each step of the above method or each of the above modules can be completed through integrated logic circuits in the hardware of the processor element or through software instructions.
[0672] For example, these modules can be one or more integrated circuits configured to implement the above methods, such as one or more application-specific integrated circuits (ASICs), one or more digital signal processors (DSPs), or one or more field-programmable gate arrays (FPGAs). Alternatively, these modules can be integrated together as a system-on-a-chip (SOC).
[0673] An embodiment of this application also proposes an electronic device. This electronic device is used to execute the method flow or part of the method flow described in the embodiments of this application. This electronic device is a terminal device, base station device, or server device as described in the embodiments of this specification.
[0674] Figure 27 is a schematic diagram of an electronic device structure according to an embodiment of this application.
[0675] As shown in FIG27, the electronic device 2500 includes a memory 2502 for storing computer program instructions and a processor 2501 for executing the program instructions. When the computer program instructions are executed by the processor 2501, the electronic device 2500 is triggered to execute the method steps performed by the terminal device, base station device, or server device as described in the embodiments of this application.
[0676] Specifically, in one embodiment of this application, the aforementioned one or more computer programs are stored in the aforementioned memory 2502. The aforementioned one or more computer programs include instructions that, when executed by the aforementioned electronic device 2500, cause the aforementioned electronic device 2500 to perform the method steps described in the embodiments of this application.
[0677] It is understood that the structural description of the electronic device 2500 in this application does not constitute a specific limitation on the electronic device 2500. In other embodiments of this application, the electronic device 2500 may include other components besides the processor 2501 and the memory 2502.
[0678] The processor 2501 may be an on-chip device (SOC) that may include a central processing unit (CPU) and may further include other types of processors.
[0679] The processor 2501 may include, for example, a CPU, DSP, microcontroller, or digital signal processor, and may also include a GPU, embedded neural network processing units (NPUs), and image signal processors (ISPs). The processor may also include necessary hardware accelerators or logic processing hardware circuitry, such as an ASIC, or one or more integrated circuits for controlling the execution of the program in this application. Furthermore, the processor may have the function of operating one or more software programs, which may be stored in a storage medium.
[0680] Processor 2501 may include one or more processing units. For example, a processor may include 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 components or integrated into one or more processors. In some embodiments, electronic device 2500 may also include one or more processors 2501. The controller can generate operation control signals based on instruction opcodes and timing signals to control instruction fetching and execution.
[0681] In some embodiments, the processor 2501 may include one or more interfaces. These interfaces may include an inter-integrated circuit (I2C) interface, an integrated circuit sound (I2S) interface, a pulse code modulation (PCM) interface, a universal asynchronous receiver / transmitter (UART) interface, a mobile industry processor interface (MIPI), a general-purpose input / output (GPIO) interface, a SIM card interface, and / or a USB interface, etc. The USB interface is a USB standard-compliant interface, specifically a Mini USB interface, a Micro USB interface, a USB Type-C interface, etc. The USB interface can be used to connect a charger to charge the electronic device, and can also be used for data transfer between the electronic device and peripheral devices.
[0682] Electronic device 2500 may also include an external memory interface for connecting an external memory card, such as a Micro SD card, to expand the storage capacity of the electronic device. The external memory card communicates with processor 2501 through the external memory interface to perform data storage functions. For example, music, video, and other files can be saved on the external memory card.
[0683] The memory 2502 may include a code storage area and a data storage area. The code storage area may store the operating system. The data storage area may store data created during the use of the electronic device 2500. Furthermore, the memory 2502 may include high-speed random access memory, and may also include non-volatile memory, such as one or more disk storage components, flash memory components, universal flash storage (UFS), etc.
[0684] The memory 2502 may be a read-only memory (ROM), other types of static storage devices that can store static information and instructions, random access memory (RAM), or other types of dynamic storage devices that can store information and instructions. It may also be an electrically erasable programmable read-only memory (EEPROM), a compact disc read-only memory (CD-ROM) or other optical disc storage, optical disc storage (including compressed optical discs, laser discs, optical discs, digital universal optical discs, Blu-ray discs, etc.), magnetic disk storage media, or other magnetic storage devices. Alternatively, it may be any computer-readable medium capable of carrying or storing desired program code in the form of instructions or data structures that can be accessed by a computer.
[0685] Processor 2501 and memory 2502 can be combined into a single processing device, but more commonly they are separate components.
[0686] An embodiment of this application also provides an electronic chip. This electronic chip is used to execute the method flow or part of the method flow described in the embodiments of this application.
[0687] Specifically, the electronic chip includes a processor for executing program instructions. When the computer program instructions are executed by the processor, the electronic chip is triggered to perform the steps described in the embodiments of this application. The processor of the electronic chip can refer to the processor of the above-described electronic device.
[0688] Optionally, the devices, apparatuses, and modules described in the embodiments of this application may be implemented by computer chips or physical entities, or by products with certain functions.
[0689] Those skilled in the art will understand that embodiments of this application can be provided as methods, apparatus, or computer program products. Therefore, the present invention can take the form of a completely hardware embodiment, a completely software embodiment, or an embodiment combining software and hardware aspects. Furthermore, the present invention can take the form of a computer program product embodied on one or more computer-usable storage media containing computer-usable program code.
[0690] In the several embodiments provided in this application, any function, if implemented as a software functional unit and sold or used as an independent product, can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of this application, in essence, or the part that contributes to the prior art, or part of the technical solution, can be embodied in the form of a software product. This computer software product is stored in a storage medium and includes several instructions to cause a computer device (which may be a personal computer, a server, or a network device, etc.) to execute all or part of the steps of the methods described in the various embodiments of this application.
[0691] Specifically, one embodiment of this application also provides a computer-readable storage medium storing a computer program that, when run on a computer, causes the computer to execute the method provided in the embodiment of this application.
[0692] An embodiment of this application also provides a computer program product, which includes a computer program that, when run on a computer, causes the computer to perform the method provided in the embodiment of this application.
[0693] The embodiments described in this application are described with reference to flowchart illustrations and / or block diagrams of methods, apparatus (devices), and computer program products according to embodiments of this application. It will be understood that each block of the flowchart illustrations and / or block diagrams, and combinations of blocks in the flowchart illustrations and / or block diagrams, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, special-purpose computer, embedded processor, or other programmable data processing apparatus to produce a machine, such that the instructions, which execute via the processor of the computer or other programmable data processing apparatus, create means for implementing the functions specified in one or more flowchart illustrations and / or one or more block diagrams.
[0694] These computer program instructions may also be stored in a computer-readable storage medium that can direct a computer or other programmable data processing device to function in a particular manner, such that the instructions stored in the computer-readable storage medium produce an article of manufacture including instruction means that implement the functions specified in one or more flowcharts and / or one or more block diagrams.
[0695] These computer program instructions may also be loaded onto a computer or other programmable data processing apparatus to cause a series of operational steps to be performed on the computer or other programmable apparatus to produce a computer-implemented process, such that the instructions, which execute on the computer or other programmable apparatus, provide steps for implementing the functions specified in one or more flowcharts and / or one or more block diagrams.
[0696] It should also be noted that in the embodiments of this application, "at least one" refers to one or more, and "more than one" refers to two or more. "And / or" describes the relationship between related objects, indicating that three relationships can exist. For example, A and / or B can represent the existence of A alone, the simultaneous existence of A and B, or the existence of B alone. A and B can be singular or plural. The character " / " generally indicates that the preceding and following related objects are in an "or" relationship. "At least one of the following" and similar expressions refer to any combination of these items, including any combination of singular or plural items. For example, at least one of a, b, and c can represent: a, b, c, a and b, a and c, b and c, or a and b and c, where a, b, and c can be single or multiple.
[0697] In this application, 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 limitation, 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.
[0698] This application can be described in the general context of computer-executable instructions, such as program modules, that are executed by a computer. Generally, program modules include routines, programs, objects, components, data structures, etc., that perform a specific task or implement a specific abstract data type. This application can also be practiced in distributed computing environments where tasks are performed by remote processing devices connected via a communication network. In distributed computing environments, program modules can reside in local and remote computer storage media, including storage devices.
[0699] The various embodiments in this application are described in a progressive manner. Similar or identical parts between embodiments can be referred to mutually. Each embodiment focuses on describing the differences from other embodiments. In particular, the device embodiments are basically similar to the method embodiments, so the description is relatively simple; relevant parts can be referred to the descriptions of the method embodiments.
[0700] Those skilled in the art will recognize that the units and algorithm steps described in the embodiments of this application can be implemented using electronic hardware, computer software, or a combination of electronic hardware. Whether these functions are implemented in hardware or software depends on the specific application and design constraints of the technical solution. Those skilled in the art can use different methods to implement the described functions for each specific application, but such implementation should not be considered beyond the scope of this application.
[0701] Those skilled in the art will clearly understand that, for the sake of convenience and brevity, the specific working processes of the devices, apparatuses, and units described above can be referred to the corresponding processes in the foregoing method embodiments, and will not be repeated here.
[0702] The above description is merely a specific embodiment of this application. Any variations or substitutions that can be easily conceived by those skilled in the art within the scope of the technology disclosed in this application should be included within the protection scope of this application. The protection scope of this application should be determined by the protection scope of the claims.
Claims
An application management method, characterized in that, The method includes: When the application is triggered to exit, an application exit operation is initiated for the application. Interrupting the application exit operation to preserve the application process includes at least preventing the destruction of the main window and the main functional unit, so that the application process at least holds the main window and the main functional unit; Cache the application process; Trigger application startup; Intervene in the application startup process before creating the application process of the application, and activate the cached application process; Based on the application process skipping a portion of the application startup process, the remaining application startup process is completed by the application process itself, including: Start the main functional unit and the main window. The method according to claim 1, characterized in that, The complete application process before the application exits must hold at least: one or more windows, one or more window management platforms, one or more functional units, one or more functional management platforms, and a logic code execution environment, wherein: The one or more windows include the main window; The one or more window management platforms hold the one or more windows; The one or more functional units include the main functional unit, and the one or more functional units hold the one or more window management platforms; The one or more functional management platforms hold the one or more functional units; The logic code runtime environment is loaded with application logic code. The method according to claim 2, characterized in that, The application process also holds at least the main function management platform and the logic code execution environment, wherein the one or more function management platforms include the main function management platform, which is used to hold the main function unit. The method according to claim 3, characterized in that, The remaining application startup process, which is completed by the application process, also includes: Other functional units besides the main functional unit are created by the main functional management platform; Other window management platforms can be created by the other functional units; Other windows besides the main window are created by the other window management platform and the main window management platform. The method according to claim 4, characterized in that, The main function management platform includes the operating parameters of the functional units held by the main function management platform when the application is running; The creation of other functional units besides the main functional unit by the main functional management platform includes: The main function management platform creates the other functional units based on the operating parameters. The method according to claim 3, characterized in that, The remaining application startup process, which is completed by the application process, also includes: The application process creates other function management platforms besides the main function management platform; Other functional units besides the main functional unit are created by the main functional management platform and the other functional management platforms; Other window management platforms can be created by the other functional units; Other windows besides the main window are created by the other window management platform and the main window management platform. The method according to claim 3, characterized in that, The application process also holds at least other function management platforms besides the main function management platform. The method according to claim 7, characterized in that, The remaining application startup process, which is completed by the application process, also includes: Other functional units besides the main functional unit may be created by the main functional management platform and / or the other functional management platforms. Other window management platforms can be created by the other functional units; Other windows besides the main window are created by the other window management platform and the main window management platform. The method according to claim 2, characterized in that, The application exit operation includes at least: destroying the one or more windows, destroying the one or more window management platforms, destroying the one or more functional units, destroying the one or more functional management platforms, destroying the logic code runtime environment, and destroying the application process. The method according to claim 9, characterized in that, The complete application startup process includes at least the following: creating the application process, starting the logic code execution environment, loading the application logic code, creating the one or more window management platforms, creating the one or more functional units from the one or more window management platforms, creating the one or more window management platforms from the one or more functional units, and creating the one or more windows from the one or more window management platforms. The method according to claim 2, characterized in that, The functional unit is an Activity in the Android system application architecture, or a Capability in the Huawei system application architecture. The method according to any one of claims 1-11, characterized in that, Before interrupting the application exit operation to preserve the application process, the method further includes: Determine whether the application process of the application needs to be cached; The operation of interrupting the application exit to preserve the application process is performed when the application process of the application needs to be cached, and the operation of caching the application process is also performed. The method according to claim 12, characterized in that, The determination of whether the application process needs to be cached includes: Determine whether the application process needs to be cached based on whether the application process caching conditions are met. The method according to claim 13, characterized in that, The application process caching conditions include: The application in question is one that supports caching application processes. And / or, The application process caching function has been enabled for the aforementioned application; And / or, The application is not marked as an application that is kept alive in the background; And / or, The currently triggered exit from the application is not a complete exit from the application. The method according to claim 13, characterized in that, The step of determining whether the application process needs to be cached also includes: Based on user habit data, it is determined whether the application process of the application needs to be cached. Specifically, if the launch frequency of the application is lower than a preset frequency threshold, it is determined that the application process of the application does not need to be cached. The method according to any one of claims 1-11, characterized in that, After caching the application process, the method further includes freezing the cached application process. The method according to claim 16, characterized in that, Before intervening in the application startup process before creating the application process and activating the cached application process, the method further includes unfreezing the frozen application process. The method according to claim 16, characterized in that, Freezing the cached application process includes: When all application processes of the application are cached and none of the application processes of the application are communicating, the application process is frozen. The method according to any one of claims 1-11, characterized in that, After caching the application process, the method further includes migrating the cached application process from memory to another storage device. The method according to claim 19, characterized in that, The method further includes, before intervening in the application startup process before creating the application process and before activating the cached application process, migrating the application process from the other storage back to the memory. The method according to claim 19, characterized in that, The step of migrating the cached application process from memory to other storage includes: When the current available memory is lower than a preset available memory threshold, the cached application process is migrated from memory to other storage. The method according to any one of claims 2-11, characterized in that, The method further includes: When the application is triggered to kill or hibernate, a portion of the application process is destroyed, and the remaining application process holds at least the logic code execution environment, as well as all or part of the function management platforms in the one or more function management platforms. An electronic device, characterized in that, The electronic device includes a memory and a processor; The processor is configured to execute instructions stored in the memory to cause the electronic device to perform the method as described in any one of claims 1-22. A computer program product containing instructions, characterized in that, When the instruction is executed by the computing device system, it causes the computing device cluster to perform the method as described in any one of claims 1-22. A computer-readable storage medium, characterized in that, It includes computer program instructions, which, when executed by a computer system, cause the computer system to perform the method as described in any one of claims 1-22.