Android system-based foreground and background application keep-alive and data storage method
By periodically acquiring Android system processes, calculating their importance scores, and implementing a tiered keep-alive mode, the problems of excessive system memory usage and critical process interruption were solved, achieving stable system operation and efficient data storage.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-12-08
- Publication Date
- 2026-03-10
AI Technical Summary
In existing Android systems, the use of a single OOM_ADJ value to either keep applications alive or kill them indiscriminately can lead to excessive system memory usage or interruption of critical processes. Furthermore, the inability to dynamically update the keep-alive and storage mechanisms based on changes in system memory can result in system instability.
By periodically acquiring system processes, calculating process importance scores and classifying them into three levels, the keep-alive mode is determined based on the level, including alternating keep-alive, data storage, and shutdown. Combined with historical average interaction time and OOM_ADJ value, the keep-alive and storage strategies are dynamically adjusted.
It implements a dynamic update mechanism for keep-alive and storage based on changes in system memory, ensuring stable system operation, reducing process restart time, and improving the usability of the Android system.
Smart Images

Figure CN121636112A_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of keeping front-end and back-end applications alive and data storage, and more specifically, to methods for keeping front-end and back-end applications alive and data storage based on the Android system. Background Technology
[0002] In the Android system, the lifecycle of processes is controlled by the system. For user experience and performance reasons, even if you exit an app using the Home or Back button, the system does not actually kill the app's process; it still exists in memory. As the system runs longer and more apps are opened, the number of processes in memory increases, leading to less available memory. The system then triggers application keep-alive and storage mechanisms to ensure stable system operation.
[0003] Existing keep-alive and storage mechanisms are mainly implemented through foreground process identification, dual-process protection of background processes, and system broadcast reactivation. However, in the process of application keep-alive, on the one hand, the application is kept alive or killed in a one-size-fits-all manner based on a single OOM_ADJ value, which often leads to excessive keep-alive of processes, resulting in excessive system memory usage, or improper killing, resulting in the interruption of critical processes. On the other hand, the keep-alive and storage mechanisms cannot be dynamically updated according to changes in system memory, which makes it impossible for the keep-alive and storage mechanisms to guarantee the stable operation of the system.
[0004] Therefore, the existing technology has defects and urgently needs improvement. Summary of the Invention
[0005] In view of the above problems, the purpose of this invention is to provide a method for keeping foreground and background applications alive and storing data based on the Android system, so as to solve the problems in the prior art. On the one hand, the application is kept alive or killed in a one-size-fits-all manner based on a single OOM_ADJ value, which often causes excessive keeping of the process, resulting in excessive system memory consumption, or improper killing, resulting in the interruption of critical processes. On the other hand, the keep-alive and storage mechanism cannot be dynamically updated according to changes in system memory, so the keep-alive and storage mechanism cannot guarantee the stable operation of the system.
[0006] The first aspect of this invention provides a method for keeping foreground and background applications alive and storing data based on the Android system, including: At preset intervals, periodically retrieve all processes in the system's running memory, exclude necessary running processes, and obtain a list of processes that can be killed. The process that is currently interacting with the operation interface is obtained and the list of foreground processes to be kept alive is determined. Based on the list of processes that can be killed and the list of foreground processes to be kept alive, the list of memory release processes is determined. The importance score is calculated based on the running status parameters of each process in the memory release process list, and the importance level of the process is divided into three levels according to the importance score; Based on the importance level and the memory that the system needs to release, determine the keep-alive mode corresponding to each level. The keep-alive modes include: keeping processes alive in turn, storing data and killing the first n processes, keeping the remaining processes alive in turn, and storing process data and completely shutting them down. The process is kept alive and data is stored according to the determined keep-alive mode; The operating status parameters include: historical average interaction time and OOM_ADJ value.
[0007] As a preferred technical solution for keeping foreground and background applications alive and storing data based on the Android system, the step of determining the memory release process list based on the killable process list and the foreground process keep-alive list includes: Remove the processes from the foreground process keep-alive list from the killable process list, and record the remaining processes as the memory release process list; Specifically, during the process of removing processes from the foreground process keep-alive list from the killable process list, if a process in the killable process list has inter-communication association with a process in the foreground process keep-alive list and the association degree is greater than the association degree threshold, then that process will not be included in the memory release process list.
[0008] As a preferred technical solution for keeping foreground and background applications alive and storing data based on the Android system, the calculation of importance scores based on the running status parameters of each process in the memory release process list includes: Obtain the historical average interaction time and OOM_ADJ value of each process on the memory release process list; The historical average interaction time and the OOM_ADJ value are assigned corresponding weight coefficients, with the weight coefficient for the OOM_ADJ value being greater than that for the historical average interaction time. The sum of the products of the historical average interaction time and the OOM_ADJ value with the corresponding weight coefficients is calculated and recorded as the importance score.
[0009] As a preferred technical solution for keeping foreground and background applications alive and storing data based on the Android system, the importance level of a process is divided into three levels according to its importance score, including: Obtain the importance score of each process on the list of all memory release processes when the foreground process keep-alive lists are the same during the historical keep-alive period, filter the importance scores and build a sample dataset; The importance scores in the sample dataset were divided into three data clusters using a clustering algorithm. The critical values of adjacent data clusters are selected as the first score threshold and the second score threshold, and the first score threshold is less than the second score threshold; If the importance score is less than the first score threshold, the importance level of the process is determined to be Level 1; if the importance score is greater than or equal to the first score threshold and less than the second score threshold, the importance level of the process is determined to be Level 2; if the importance score is greater than or equal to the second score threshold, the importance level of the process is determined to be Level 3.
[0010] As a preferred technical solution for keeping foreground and background applications alive and storing data based on the Android system, the step of determining the keep-alive mode corresponding to each importance level based on the total amount of memory that the system needs to release includes: In response to the three-level importance of a process, the process is stored and killed, and the memory that can be released after killing is recorded as the level three memory release amount. In response to the process importance level being level 1, processes of level 1 importance are rotated and kept alive. The package name of the process with level 1 importance and the process keep-alive time are stored using the SettingsProvider system property. The minimum amount of memory that can be released during the rotation and keep-alive process is calculated and recorded as the level 1 memory release amount. In response to a process having a priority level of two, the amount of secondary memory that a process with a priority level of two needs to release is calculated based on the total amount of memory that the system needs to release, the amount of memory released at the third level, and the amount of memory released at the first level. Based on the amount of memory released at level 2, kill the first n processes with a priority of level 2 and rotate the remaining processes to keep them alive.
[0011] As a preferred technical solution for keeping foreground and background applications alive and storing data based on the Android system, the step of storing and killing the first n processes, and keeping the remaining processes alive in turn, includes: Obtain the amount of secondary memory released; Processes with a importance level of 2 are sorted in ascending order of importance score; Store and kill the first n processes, and keep the remaining processes alive in turn. The value of n is: the amount of memory released when killing the first n applications is greater than or equal to the amount of secondary memory released.
[0012] As a preferred technical solution for keeping front-end and back-end applications alive and storing data based on the Android system, the process of rotating and keeping processes of level 1 importance alive is described. The correlation between each level 1 important process and the list of foreground processes to be kept alive is calculated, and the keep-alive time of each level 1 important process is allocated according to the correlation and the keep-alive cycle.
[0013] As a preferred technical solution for keeping foreground and background applications alive and storing data based on the Android system, the step of storing and killing the first n processes, and keeping the remaining processes alive in turn, includes: Obtain the correlation between the remaining processes, and determine multiple keep-alive mechanisms based on the correlation. Sort the keep-alive order of processes in each keep-alive mechanism; The process that needs to be kept alive within each keep-alive cycle is determined based on the keep-alive sequence of each keep-alive mechanism; The first n processes are stored and killed, and the remaining processes are kept alive in turn.
[0014] As a preferred technical solution for keeping foreground and background applications alive and storing data based on the Android system, the preset period is α times the keep-alive period, where α is an integer and is greater than or equal to the maximum number of processes included in each keep-alive mechanism.
[0015] As a preferred technical solution for keeping foreground and background applications alive and storing data based on the Android system, the necessary running processes of the system include: the Android system core service process, the desktop startup process, and processes bound to the bound system core service process.
[0016] Compared with the prior art, the beneficial effects of the present invention are that it determines the list of processes that can be killed by the necessary running list of the Android system, retains the processes that the user is interacting with according to the user's interaction, and divides the remaining processes into three levels according to their importance. Different keep-alive and data storage methods are implemented for different levels. The protection measures can be adaptively adjusted according to different actual situations to ensure that the released memory meets the needs of the processes that the user is interacting with, thereby increasing the practicality of the Android system in keeping foreground and background applications alive and storing data.
[0017] This invention introduces the concept of historical average interaction time and assigns corresponding weight values to both the OOM_ADJ value and the historical average interaction time. This allows the importance score to take user habits into account when evaluating the importance of a process, compared to the traditional OOM_ADJ value. This further enhances the practicality of the Android system in terms of keeping foreground and background applications alive and storing data, building upon the traditional process priority evaluation system (OOM_ADJ value). Attached Figure Description
[0018] Figure 1 The flowchart illustrates the foreground / background application keep-alive and data storage method based on the Android system provided by this invention. Detailed Implementation
[0019] To better understand the above-mentioned objectives, features, and advantages of the present invention, the present invention will be further described in detail below with reference to the accompanying drawings and specific embodiments. It should be noted that, unless otherwise specified, the embodiments and features described in these embodiments can be combined with each other.
[0020] Many specific details are set forth in the following description in order to provide a full understanding of the invention. However, the invention may also be practiced in other ways different from those described herein, and therefore the scope of protection of the invention is not limited to the specific embodiments disclosed below.
[0021] like Figure 1 As shown, this invention discloses a method for keeping foreground and background applications alive and storing data based on the Android system, including: Step S1: Periodically obtain all processes running in the system at preset intervals, exclude necessary running processes to obtain a list of processes that can be killed. Step S2: Obtain the processes that are currently interacting with the operation interface and determine the list of foreground processes to keep alive. Determine the list of memory release processes based on the list of processes that can be killed and the list of foreground processes to keep alive. Step S3: Calculate the importance score based on the running status parameters of each process in the memory release process list, and divide the importance level of the process into three levels based on the importance score; Step S4: Determine the keep-alive mode corresponding to each level based on the importance level and the memory that the system needs to release. The keep-alive modes include: keeping processes alive in turn, storing data and killing the first n processes, keeping the remaining processes alive in turn, and storing process data and completely shutting them down. Step S5: Perform process keep-alive and data storage according to the determined keep-alive mode; The runtime status parameters include: historical average interaction time and OOM_ADJ value.
[0022] It should be noted that the processes on the foreground process keep-alive list are those currently interacting with by the user. The number of processes on the foreground process keep-alive list can be set by the user according to the actual situation. In this embodiment of the invention, the number of processes on the foreground process keep-alive list is 1. The historical average interaction time is the average time taken for the user to respond when a process needs to interact with the user in a historical period. The calculation process of the process's OOM_ADJ value is existing technology and will not be described in detail here. The value of the preset period is selected according to the actual running status of the Android system's processes. The more processes running, the shorter the preset period. In this embodiment of the invention, the preset period is 5 minutes.
[0023] In detail, the present invention periodically acquires processes and calculates their importance scores, and determines the corresponding keep-alive mode based on the importance scores. This allows the keep-alive and storage mechanisms to be dynamically updated according to changes in system memory, thereby ensuring the stable operation of the system.
[0024] Furthermore, a list of processes for memory release is determined based on the list of processes that can be killed and the list of foreground processes that need to be kept alive, including: Remove the processes from the list of processes that can be killed from the list of processes that should be kept alive in the foreground, and add the remaining processes to the list of processes that should be released into memory. Specifically, during the process of removing processes from the foreground process keep-alive list from the killable process list, if there is a process in the killable process list that has communication association with a process in the foreground process keep-alive list and the association degree is greater than the association degree threshold, then that process will not be added to the memory release process list.
[0025] This invention provides a method for calculating correlation, including: obtaining the number of communications and data transmission volumes between processes in the killable process list and processes in the foreground process keep-alive list in the previous period; assigning corresponding weight coefficients to the number of communications and data transmission volumes respectively; and calculating the sum of the products of the number of communications and data transmission volumes with their respective weight coefficients, which is then recorded as the correlation. The values of the weight coefficients and the correlation threshold are determined by the computer system.
[0026] Furthermore, an importance score is calculated based on the running status parameters of each process in the memory release process list, including: Obtain the historical average interaction time and OOM_ADJ value of each process in the memory release process list; The historical average interaction time and OOM_ADJ value are normalized and assigned corresponding scores. The historical average interaction time and OOM_ADJ value are assigned corresponding weight coefficients, with the weight coefficient corresponding to the OOM_ADJ value being the largest. The sum of the products of the historical average interaction time and the OOM_ADJ value with the corresponding weight coefficients is calculated and recorded as the importance score.
[0027] It should be noted that the historical average interaction time and the weight coefficients corresponding to the OOM_ADJ value are determined by the system.
[0028] Furthermore, in actual use, there may be situations where users have the habit of interacting with other application information only after the current foreground process has finished its task, or where users immediately interact with other applications when there is information that requires interaction. Based on the traditional static OOM_ADJ value, this invention introduces the parameter of historical average interaction time, thereby taking user habits into account in the importance evaluation system. Thus, based on the traditional process priority evaluation system (OOM_ADJ value), the importance of background processes is evaluated in combination with user habits, increasing the practicality of Android system foreground and background application keep-alive and data storage technologies.
[0029] Furthermore, based on importance scores, the importance of processes is categorized into three levels, including: Obtain the importance score of each process on the list of all memory release processes when the foreground process keep-alive lists are the same during the historical keep-alive period, filter the importance scores and build a sample dataset; Clustering algorithms were used to divide the importance scores in the sample dataset into three data clusters; The critical values of adjacent data clusters are selected as the first score threshold and the second score threshold, and the first score threshold is less than the second score threshold; If the importance score is less than the first score threshold, the importance level of the process is determined to be Level 1; if the importance score is greater than or equal to the first score threshold and less than the second score threshold, the importance level of the process is determined to be Level 2; if the importance score is greater than or equal to the second score threshold, the importance level of the process is determined to be Level 3.
[0030] In this embodiment of the invention, the sample dataset needs to collect importance scores of all processes within at least three preset periods, with a sample size of at least 50, to ensure the representativeness of the data in the sample dataset. In this embodiment, the importance scores are screened according to the 3σ principle: the standard deviation σ and mean μ of the importance scores are calculated, and importance scores within the interval (μ+3σ, μ+3σ) are retained, while outliers are removed. A clustering algorithm is used to divide the importance scores in the sample dataset into three data clusters. Three cluster centers are randomly initialized, and the Euclidean distance between each score and the three cluster centers is calculated. Scores are assigned to the nearest cluster based on the Euclidean distance. The mean of each cluster is recalculated as the new cluster center. This iteration is repeated until the change in cluster centers reaches a stable level, resulting in three clusters. Two median values from the three clusters are selected as the first and second score thresholds. Using a clustering algorithm to divide scattered data into three data clusters is existing technology and will not be elaborated upon here.
[0031] Furthermore, since the distribution of OOM_ADJ values exhibits clustering and interval patterns in actual applications, and the historical average interaction time varies significantly due to different user engagement levels, the importance scores also exhibit interval and clustering patterns. Combining the clustering algorithm, three importance score intervals are obtained, each corresponding to an importance level, thus providing a stable foundation for the subsequent keep-alive mode.
[0032] Furthermore, based on the importance level and the total amount of memory that the system needs to release, the corresponding keep-alive mode for each level is determined, including: In response to the three-level importance of a process, the process is stored and killed, and the memory that can be released after killing is recorded as the level three memory release amount. In response to the process importance level being level 1, processes of level 1 importance are rotated and kept alive. The package name and process keep-alive time of level 1 important processes are stored using the SettingsProvider system property. Based on the memory occupied by each level 1 important process, the minimum amount of memory that can be released during the rotation and keep-alive process is determined and recorded as the level 1 memory release amount. In response to a process's importance level being level two, the amount of level two memory that a process with a importance level of two needs to release is calculated based on the total amount of memory that the system needs to release, the amount of level three memory release, and the amount of level one memory release; where: level two memory release = total amount of memory that the system needs to release - level one memory release - level three memory release; Based on the amount of memory released at level 2, kill the first n processes with a priority of level 2 and rotate the remaining processes to keep them alive.
[0033] In detail, this invention calculates an importance score and divides processes into three levels based on the importance score, thereby using different keep-alive modes for processes of different levels. This ensures that the amount of memory released meets the standard while reducing the startup time required for process restart, thus increasing practicality.
[0034] Furthermore, based on the amount of secondary memory released, the first n processes are stored and killed, and the remaining processes are kept alive in turn, including: Get the amount of memory released at level 2; Processes with a importance level of 2 are sorted in ascending order of importance score; Store and kill the first n processes, and keep the remaining processes alive in turn. The value of n is: the amount of memory released when killing the first n applications is greater than or equal to the amount of secondary memory released.
[0035] Furthermore, this invention first kills processes with a importance level of three and calculates the memory they can release. Then, it keeps processes with a importance level of one alive in turn according to their correlation and calculates the memory they can release. This determines the memory that processes with a importance level of two need to release. Based on the importance score and the memory that processes with a importance level of two need to release, it determines the processes that need to be killed. The remaining processes are kept alive in turn, thereby further reducing the memory required by processes with a importance level of two.
[0036] In detail, processes of level 1 importance are rotated for keep-alive. The correlation between each level 1 important process and the keep-alive list of foreground processes is calculated. The keep-alive time of each level 1 important process is allocated according to the correlation and keep-alive cycle.
[0037] Furthermore, embodiments of the present invention provide a method for allocating keep-alive time for processes of importance level one based on correlation and keep-alive cycle, including: Calculate the correlation between each level of importance (Level 1) process and the foreground process keep-alive list; Obtain the correlation ratio between each level 1 process and the list of foreground processes to keep alive, and record it as the correlation ratio value. Allocate the keep-alive time for each level 1 process according to the correlation ratio value.
[0038] Furthermore, based on the amount of secondary memory released, the first n processes are stored and killed, and the remaining processes are kept alive in turn, including: Obtain the correlation between the remaining processes, and determine multiple keep-alive mechanisms based on the correlation. Sort the keep-alive order of processes in each keep-alive mechanism; The process that needs to be kept alive within each keep-alive cycle is determined based on the keep-alive sequence of each keep-alive mechanism; Wherein: the preset period is α times the keep-alive period, where α is an integer and is greater than or equal to the maximum number of processes included in each keep-alive mechanism; The first n processes are stored and killed, and the remaining processes are kept alive in turn.
[0039] It should be noted that multiple keep-alive mechanisms are determined based on correlation. Processes with a correlation greater than a correlation threshold among the remaining processes are grouped under the same keep-alive mechanism. The keep-alive order of processes within the keep-alive mechanism is sorted according to process name or process size, etc. Those skilled in the art will understand that the lower the correlation, the longer the time required to restart the process. Therefore, the correlation threshold needs to be determined based on the keep-alive period. The correlation threshold should be such that it can restart the process and store data within a single keep-alive period. The preset period is α times the keep-alive period, ensuring that each application can be kept alive in turn within a single preset period. After the current preset period ends, if the memory required for the current foreground process to run is sufficient, the process continues to be cached according to the current keep-alive mechanisms at the start of the next preset period. If the memory required for the current foreground process to run is sufficient, the process returns to step S1 to re-obtain the list of processes that can be killed.
[0040] Understandably, after determining which processes need to be killed based on their importance scores and the memory required to be released for processes with a importance level of two, and killing these processes, the released memory can only meet the memory requirements of the current foreground processes. As foreground processes continue to use the system, the required memory will increase, leading to continuous refreshing of the keep-alive mechanism and increasing the computational load during the keep-alive process. Therefore, this invention, after determining which processes need to be killed and killing them, calculates the correlation between background processes with an importance level of two and establishes multiple keep-alive mechanisms based on the correlation between background programs. Each keep-alive mechanism contains several processes. For a single keep-alive mechanism, one process is kept alive in each keep-alive cycle. At the end of the current keep-alive cycle, the next process is started according to the order in the keep-alive mechanism, the data of the currently kept-alive process is stored, and the currently kept-alive process is killed. After the last process in the keep-alive mechanism is kept alive, the first process is kept alive again. Since the keep-alive mechanism is based on the correlation between processes, it can ensure that processes can be quickly started within a single keep-alive mechanism. Meanwhile, by using multiple keep-alive mechanisms to simultaneously keep processes of level two importance alive, and ensuring that the memory required by the foreground process keep-alive list is met, further memory is released by reviving processes under each keep-alive mechanism in a round-robin manner. This means that after the keep-alive mechanism is established, it not only satisfies the running needs of processes in the foreground process keep-alive list but also provides additional memory space for any increase in the memory required by these processes. This avoids frequent rebuilding of the keep-alive mechanism due to the continuous increase in memory usage by processes in the foreground process keep-alive list, thereby increasing the stability of the background keep-alive mechanism while reducing latency during use.
[0041] In detail, the necessary running processes of the system include: Android system core service processes, desktop startup processes, and processes bound to the system core service processes (such as telephone, SMS services, etc.).
[0042] Those skilled in the art will understand that all or part of the steps of the above method embodiments can be implemented by hardware related to program instructions. The aforementioned program can be stored in a computer-readable storage medium. When the program is executed, it performs the steps of the above method embodiments. The aforementioned storage medium includes various media capable of storing program code, such as mobile storage devices, read-only memory (ROM), random access memory (RAM), magnetic disks, or optical disks.
[0043] Alternatively, if the integrated units of this invention are implemented as software functional modules and sold or used as independent products, they can also be stored in a computer-readable storage medium. Based on this understanding, the technical solutions of the embodiments of this invention, or the parts that contribute to the prior art, 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, server, or network device, etc.) to execute all or part of the methods described in the various embodiments of this invention. The aforementioned storage medium includes various media capable of storing program code, such as mobile storage devices, ROM, RAM, magnetic disks, or optical disks.
Claims
1. A method for keeping alive and data storage of foreground and background applications based on an Android system, characterized in that, The method comprises the following steps: Periodically obtaining all processes in the system running memory at intervals of a preset period, excluding necessary system running processes to obtain a list of killable processes; Obtaining processes that are currently interacting with the operation interface and determining a foreground process keep-alive list, and determining a memory release process list according to the list of killable processes and the foreground process keep-alive list; Calculating an importance score according to running state parameters of each process in the memory release process list, and dividing the importance level of the process into three levels according to the importance score; Determining a keep-alive mode corresponding to each level according to the importance level and the memory to be released by the system, wherein the keep-alive mode comprises: keeping the processes alive in turn, storing data of the first n processes and killing the processes, keeping the remaining processes alive in turn, and storing data of the processes and completely shutting down; Keeping the processes alive and storing data according to the determined keep-alive mode; The running state parameters comprise: historical average interaction time and OOM_ADJ value.
2. The Android system-based foreground and background application keep-alive and data storage method of claim 1, characterized in that, The method of determining the memory release process list according to the list of killable processes and the foreground process keep-alive list comprises: Removing the processes in the foreground process keep-alive list from the list of killable processes, and recording the remaining processes as the memory release process list; In the process of removing the processes in the foreground process keep-alive list from the list of killable processes, if there is a process in the list of killable processes that is associated with a process in the foreground process keep-alive list through communication and the degree of association is greater than a degree of association threshold, the process does not enter the memory release process list.
3. The Android system-based foreground and background application keep-alive and data storage method of claim 2, characterized in that, The method of calculating the importance score according to the running state parameters of each process in the memory release process list comprises: Obtaining the historical average interaction time and OOM_ADJ value of each process in the memory release process list; Assigning corresponding weight coefficients to the historical average interaction time and OOM_ADJ value, wherein the weight coefficient corresponding to the OOM_ADJ value is greater than the weight coefficient of the historical average interaction time; Calculating the sum of the product of the historical average interaction time and the corresponding weight coefficient and the product of the OOM_ADJ value and the corresponding weight coefficient, and recording the sum as the importance score.
4. The Android system-based foreground and background application keep-alive and data storage method according to claim 3, characterized in that, The method of dividing the importance level of the process into three levels according to the importance score comprises: Obtaining the importance scores of each process in all memory release process lists with the same foreground process keep-alive list in a historical keep-alive period, screening the importance scores, and establishing a sample data set; Dividing the importance scores in the sample data set into three data clusters using a clustering algorithm; Selecting a critical value of adjacent data clusters as a first score threshold and a second score threshold, and the first score threshold is less than the second score threshold; In response to the importance score being less than the first score threshold, determining that the importance level of the process is level one; in response to the importance score being greater than or equal to the first score threshold and less than the second score threshold, determining that the importance level of the process is level two; and in response to the importance score being greater than or equal to the second score threshold, determining that the importance level of the process is level three.
5. The Android system-based foreground and background application keep-alive and data storage method according to claim 4, characterized in that, The method of determining the keep-alive mode corresponding to each level according to the importance level and the total amount of memory to be released by the system comprises: In response to the importance level of the process being three, the process is stored and killed, the memory released after the killing is obtained and recorded as the three-level memory release amount; In response to the importance level of the process being one, the process with the importance level one is rotated and kept alive, the process package name with the importance level one and the process alive time are stored by using the SettingsProvider system attribute, the minimum value of the memory released in the rotation and keeping alive process is calculated and recorded as the one-level memory release amount; In response to the importance level of the process being two, the two-level memory release amount released by the process with the importance level two is calculated according to the total amount of the memory required to be released by the system, the three-level memory release amount and the one-level memory release amount; The first n processes with the importance level two are killed according to the two-level memory release amount and the remaining processes are rotated and kept alive.
6. The Android system-based foreground and background application keep-alive and data storage method according to claim 5, characterized in that, The data storage and killing of the first n processes and the rotation and keeping alive of the remaining processes include: The two-level memory release amount is obtained; The processes with the importance level two are sorted according to the importance level score from low to high; The data storage and killing of the first n processes and the rotation and keeping alive of the remaining processes are performed; The value of n is that the memory released when the first n applications are killed is greater than or equal to the two-level memory release amount.
7. The Android system-based foreground and background application keep-alive and data storage method of claim 5, characterized in that, The rotation and keeping alive of the processes with the importance level one includes that the correlation degrees of each process with the importance level one and the foreground process alive list are calculated respectively, and the alive time of each process with the importance level one is allocated according to the correlation degrees and the alive period.
8. The Android system-based foreground and background application keep-alive and data storage method of claim 6, characterized in that, The data storage and killing of the first n processes and the rotation and keeping alive of the remaining processes include: The correlation degrees between the remaining processes are obtained, and a plurality of alive mechanisms are determined according to the correlation degrees; The alive order of the processes in each alive mechanism is sorted; The processes required to be kept alive in each alive period of each alive mechanism are determined according to the alive order of each alive mechanism; The remaining processes are rotated and kept alive.
9. The Android system-based foreground and background application keep-alive and data storage method of claim 8, characterized in that, The preset period is α times of the alive period, α is an integer and greater than or equal to the maximum value of the number of processes included in each alive mechanism.
10. The Android system-based foreground and background application keep-alive and data storage method of claim 4, characterized in that, The necessary running processes of the system include: the Android system core service process, the desktop starting process and the process bound to the system core service process.