Application control method, electronic equipment and readable storage medium
By filtering and terminating application subprocesses that occupy more resources in electronic devices, the problems of high device load and extended application startup time are solved, and faster application startup and device response are achieved.
Patent Information
- Application Number
- CN202310959929.6
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2023-07-31
- Publication Date
- 2025-02-14
AI Technical Summary
In electronic devices, multiple open applications can cause high device load and even cause stuttering of front-end applications. Existing methods such as killing background applications to reduce load, but will cause the application to be delayed when cold startup is applied.
By detecting the load and temperature of the electronic device, the target application that occupies a lot of resources is selected and its child process is terminated without terminating the main process, thereby avoiding cold start when the application switches to the foreground.
It reduces the application startup delay, improves the device's response speed, and effectively manages the device's resource occupation, avoiding the problems of excessive equipment load and temperature increase.
Smart Images

Figure CN119440788A_ABST
Abstract
Description
Technical Field
[0001] The embodiments of the present application relate to the field of electronic technology, and in particular, to an application control method, an electronic device, and a readable storage medium. Background Art
[0002] In order to meet the diverse needs of users, various types of applications emerge in an endless stream, and users can install multiple types of applications in electronic devices. When users open multiple applications, multiple applications will occupy a large amount of resources of the electronic device, resulting in a high load on the electronic device, and even causing the application running in the foreground to freeze.
[0003] Currently, in order to reduce the load of electronic devices, applications running in the background can be killed. However, when a user needs to use the killed application, the application needs to be cold-started, which takes a long time. Summary of the invention
[0004] The embodiments of the present application provide an application control method, an electronic device, and a readable storage medium, which can terminate the subprocess of a first target application. When the first target application is switched to the foreground, there is no need to perform a cold start, which can reduce the application startup delay.
[0005] In the first aspect, the embodiment of the present application provides an application control method, and the execution subject of the application control method can be an electronic device or a chip in the electronic device. The following is an explanation using an electronic device as an example. In the method, when the electronic device detects that the electronic device meets the first condition, it can filter out a first target application from the currently running application based on the information of the currently running application, and terminate the subprocess of the first target application without terminating the main process of the first target application.
[0006] In an embodiment of the present application, the terminal device can terminate the sub-process of the first target application, because the death of the sub-process will not affect the normal operation of the main process of the first target application. Therefore, when the first target application switches to the foreground, the electronic device does not need to create the main process of the first target application, and the startup speed of the first target application is fast and the delay is small.
[0007] In a possible implementation, the first condition includes at least one of the following:
[0008] The resources occupied by the currently running application are greater than or equal to a first threshold.
[0009] The resources occupied by the electronic device are greater than or equal to a second threshold.
[0010] The temperature of the electronic device is greater than or equal to a preset temperature.
[0011] The time interval between the start of any two adjacent applications among the M started applications is less than or equal to the first duration, where M is an integer greater than or equal to 2.
[0012] N applications are started within a second time period, where N is an integer greater than or equal to 2.
[0013] When the resources occupied by the currently running application are greater than or equal to the first threshold, it indicates that the electronic device has occupied a large number of resources and the load of the electronic device is high. In order to ensure the normal operation of the electronic device, the electronic device can filter out the first target application and terminate the subprocess of the first target application. The electronic device terminating the subprocess of the first target application may include: the electronic device terminates the resources occupied by the subprocess of the first target application, so that the occupation of the resources of the electronic device by the first target application can be reduced.
[0014] Among them, the resources occupied by the electronic device can represent the load of the electronic device. When the resources occupied by the electronic device are greater than or equal to the second threshold, it represents that the load of the electronic device is high. In order to ensure the normal operation of the electronic device, the electronic device can filter out the first target application and terminate the sub-process of the first target application.
[0015] When the temperature of the electronic device is greater than or equal to the preset temperature, it can indirectly indicate that the load of the electronic device is high. To ensure the normal operation of the electronic device, the electronic device can filter out the first target application and terminate the subprocess of the first target application.
[0016] Among them, the resources occupied by the currently running application are greater than or equal to a first threshold, and the temperature of the electronic device is greater than or equal to a preset temperature, indicating that more resources are occupied in the electronic device, the load of the electronic device is high, and the temperature of the electronic device is high. In order to reduce the load and temperature of the electronic device, the electronic device terminates the sub-process of the first target application, which may include: the electronic device terminates the resources occupied by the sub-process of the first target application to reduce the temperature of the electronic device.
[0017] Among them, when the time interval between the startup of any two adjacent applications among the M applications launched is less than or equal to the first time length, and when N applications are launched within the second time length, the electronic device is in a scenario where applications are started continuously. In this scenario, the electronic device needs to allocate more resources to multiple applications, and the load occupied by the electronic device will increase instantly. In order to reduce the load of the electronic device, the electronic device terminating the sub-process of the first target application may include: the electronic device terminates the resources occupied by the sub-process of the first target application.
[0018] It should be understood that the electronic device may detect that the electronic device meets at least one of the above conditions and execute an operation of terminating the sub-process of the first target application to reduce the occupation of the electronic device's resources by the first target application.
[0019] In a possible implementation, the startup methods of the application include: hot startup and cold startup. In the embodiment of the present application, the reason why both "hot startup and cold startup" are regarded as one startup of the application is that in the scenario where the application is started continuously, no matter whether the application is hot started or cold started, the application is switched to the foreground, and the electronic device needs to allocate resources for the application running in the foreground, which easily causes the problem of high load on the electronic device.
[0020] In one possible implementation, the M applications are different, and the N applications are different. That is to say, the electronic device can record the continuous launch of the same application as one launch of the application, and does not count the subsequent multiple launches of the same application in the number of application launches. In the embodiment of the present application, the reason why "subsequent multiple launches of the same application are not counted" is because in the scenario where the same application is launched multiple times in succession, the electronic device has allocated more resources to the application when the application is started for the first time. Subsequently, in the scenario where the application is launched multiple times in succession, the electronic device may not have adjusted the resources allocated to the application before the application is started again. Therefore, the electronic device does not need to reallocate resources to the application, and the subsequent continuous launch of the application will not cause the problem of high load on the electronic device.
[0021] In some embodiments, the above “the time interval between the launch of any two adjacent applications among the M launched applications is less than or equal to the first duration, where M is an integer greater than or equal to 2” can be replaced by “the time interval between the launch of any two adjacent applications among the M different launched applications is less than or equal to the first duration”. Among them, “N applications are launched within the second duration, where N is an integer greater than or equal to 2” can be replaced by “the electronic device launches N different applications within the second duration”.
[0022] The following is an explanation of the process of the electronic device selecting the first target application from the currently running applications:
[0023] In one possible implementation, the information of the currently running application includes at least one of the following: an identifier of the currently running application, a priority adj value of the process of the currently running application, and a state of the currently running application, wherein the state includes a perceptible state and an imperceptible state; wherein the adj value includes an adj value of the main process of the currently running application.
[0024] In a possible implementation, a second condition may be preconfigured to filter out the first target application from currently running applications that meet the second condition.
[0025] In a possible implementation, the second condition includes: the adj value is greater than a fourth threshold value. The electronic device may determine whether the adj value is less than or equal to the fourth threshold value, and filter out the first target application from the currently running applications whose adj values are greater than the fourth threshold value. Exemplarily, the electronic device may select the currently running application whose adj value is greater than the fourth threshold value as the first target application.
[0026] In a possible implementation, the second condition may further include at least one of the following: not in a whitelist and not in a perception state, the whitelist including: a whitelist preset in the electronic device and / or a whitelist set by a user.
[0027] Exemplarily, when the second condition includes not being in the whitelist, the electronic device may filter out the first target application from the currently running applications whose adj value is greater than the fourth threshold and are not in the whitelist. For example, the electronic device may use the currently running application whose adj value is greater than the fourth threshold and is not in the whitelist as the first target application.
[0028] Exemplarily, when the second condition includes not being in a perception state, the electronic device may filter out the first target application from the currently running applications whose adj value is greater than the fourth threshold and not being in a perception state. For example, the electronic device may select the currently running application whose adj value is greater than the fourth threshold and not being in a perception state as the first target application.
[0029] In some embodiments, when the second condition includes not being in the whitelist and not being in a sensed state, the electronic device may determine the first target application from currently running applications that are not included in the whitelist, have an adj value greater than the fourth threshold, and are not in a sensed state. Exemplarily, the electronic device may use an application that is not included in the whitelist, has an adj value greater than the fourth threshold, and is not in a sensed state as the first target application.
[0030] In a possible implementation, other conditions for filtering the first target application may also be set. The electronic device may also combine the conditions to determine the first target application from currently running applications that are not included in the whitelist, have an adj value greater than the fourth threshold, and are not in a perception state.
[0031] In this implementation method, the electronic device can filter out applications that do not affect the normal operation of the electronic device and the user experience from the currently running applications, and use them as the first target application. Because the first target application is an application that does not affect the normal operation of the electronic device and does not affect the user experience, the process of the first target application is managed and controlled without the user's awareness and without affecting the user experience.
[0032] In a possible implementation, after the electronic device terminates the subprocess of the first target application, it can also obtain the resources currently occupied by the electronic device. In response to the resources currently occupied by the electronic device being greater than or equal to a third threshold, wherein the third threshold is greater than the second threshold. The electronic device can determine that the resources occupied by the electronic device are further increased, and the load of the electronic device is further increased. The electronic device can filter out the second target application from the currently running application based on the information of the currently running application, and terminate all processes of the second target application.
[0033] It should be understood that after the electronic device terminates the sub-process of the first target application, the currently running application can be called the second application, and before the electronic device terminates the sub-process of the first target application, the currently running application can be called the first application. The first application and the second application can be the same or different.
[0034] In this implementation, after the electronic device terminates the sub-process of the first target application, if the resources occupied by the electronic device further increase to greater than or equal to the third threshold, the electronic device can filter out the second target application from the currently running applications and terminate all processes of the second target application, thereby reducing the load of the electronic device to a greater extent without affecting the normal operation of the electronic device and user experience.
[0035] In a possible implementation, in response to the application switching to the background, the electronic device can release the resources occupied by the target process of the application according to the state of the application without terminating the target process, which can also reduce the resources occupied by the application. The state of the application is different, and the target process of the application is different.
[0036] When the application is switched to the background, when the electronic device is in a perceptual state, the electronic device may switch the group of the application to the first group, and release the resources occupied by the first target process of the application in the first group. Exemplarily, the first target process may include some sub-processes of the application, and the sub-processes are sub-processes that are not related to the perceptual state of the application. For example, when the application is switched to the background, the application plays audio, and the sub-processes may be sub-processes that are not related to playing audio.
[0037] When the application is switched to the background, when the electronic device is in an imperceptible state, the electronic device can switch the group of the application to the second group, and release the resources occupied by the second target process of the application in the second group. The second target process is different from the first target process. Exemplarily, because the application is an imperceptible application, the second target sub-process can be a sub-process of the application.
[0038] It should be understood that both the first group and the second group belong to background groups. When the application group is switched to the background group (such as the first group or the second group), the electronic device can release the resources of the target process of the application in the background group.
[0039] In this implementation, when the application switches to the background, the electronic device can directly release the resources occupied by the target process of the application without waiting for the adj value of the application's process to reach the sixth threshold value in order to release the resources occupied by the target process of the application. Specifically, currently when the application switches to the background, because the electronic device will gradually adjust the adj value of the application's process, when the adj value of the application's process reaches the sixth threshold value, the electronic device can switch the application's group to the background group. In the present application, when the application switches to the background, the electronic device can immediately switch the application's group to the first group or the second group according to the state of the application, and release the resources occupied by the target process of the application in the first group or the second group, thereby effectively reducing the resource occupation of the electronic device.
[0040] In a second aspect, an embodiment of the present application provides an application control method, in which, in response to a user operation, an application is controlled to switch to the background; and according to the state of the application, resources occupied by the target process of the application are released.
[0041] In a possible implementation, releasing the resources occupied by the target process of the application according to the state of the application includes: when the state of the application is a perceptible state, switching the grouping of the application to a first group, and releasing the resources occupied by the first target process of the application in the first group; when the state of the application is an imperceptible state, switching the grouping of the application to a second group, and releasing the resources occupied by the second target process of the application in the second group, the first target process being different from the second target process.
[0042] In a third aspect, an embodiment of the present application provides an electronic device, which may include: a processor and a memory. The memory is used to store computer executable program code, and the program code includes instructions; when the processor executes the instructions, the instructions cause the electronic device to execute the methods in the first aspect and the second aspect.
[0043] In a fourth aspect, an embodiment of the present application provides an electronic device, which may include a unit, a module or a circuit for executing the method provided in the first aspect or the second aspect above.
[0044] In a fifth aspect, an embodiment of the present application provides a computer program product comprising instructions, which, when executed on a computer, enables the computer to execute the methods in the first and second aspects above.
[0045] In a sixth aspect, an embodiment of the present application provides a computer-readable storage medium, wherein instructions are stored in the computer-readable storage medium, and when the computer-readable storage medium is run on a computer, the computer executes the methods in the first and second aspects above.
[0046] The beneficial effects of the possible implementation methods of the second to sixth aspects mentioned above can be referred to the beneficial effects brought about by the first aspect mentioned above, and will not be elaborated here. BRIEF DESCRIPTION OF THE DRAWINGS
[0047] Figure 1 A flowchart of an application control method is shown;
[0048] Figure 2 A flowchart of an embodiment of an application control method provided in an embodiment of the present application;
[0049] Figure 3 A flowchart of another embodiment of the application control method provided in the embodiment of the present application;
[0050] Figure 4 A flowchart of another embodiment of the application control method provided in the embodiment of the present application;
[0051] Figure 5 A flowchart of another embodiment of the application control method provided in the embodiment of the present application;
[0052] Figure 6 A flowchart of another embodiment of the application control method provided in the embodiment of the present application;
[0053] Figure 7 A flowchart of another embodiment of the application control method provided in the embodiment of the present application;
[0054] Figure 8 A schematic diagram of the structure of an electronic device provided in an embodiment of the present application. DETAILED DESCRIPTION
[0055] For ease of understanding, the following first introduces the relevant terms and concepts involved in the embodiments of the present application:
[0056] Load of electronic device: In some embodiments, the load of electronic device can be understood as the load of the central processing unit (CPU) of the electronic device. The load of electronic device can also be understood as the amount of CPU resources occupied in the electronic device or the proportion of the CPU resources occupied in the electronic device to the total CPU resources.
[0057] Resources: may include but are not limited to at least one of the following: CPU resources, GPU resources, memory resources, and I / O resources, etc.
[0058] Resources occupied by applications: In some embodiments, the resources occupied by applications may be CPU resources occupied by applications. In some embodiments, the resources occupied by applications may include at least one of the following: CPU resources, GPU resources, memory resources, and I / O resources.
[0059] Resources occupied by the electronic device: resources occupied by the electronic device. In some embodiments, the resources occupied by the electronic device may be CPU resources occupied by the electronic device. In some embodiments, the resources occupied by the electronic device may include at least one of the following: CPU resources, GPU resources, memory resources, and I / O resources.
[0060] Resident application: an application that is always in operation. For example, some system applications may be resident applications, such as wallpaper applications, desktop applications, etc.
[0061] Terminate a process: clear the process from memory and release the resources occupied by the process. In some embodiments, terminating a process can also be understood as killing the process.
[0062] Main process and subprocess of an application: An application uses one process by default, and this process is the main process of the application. In some embodiments, the name (or name) of the main process is the package name of the application.
[0063] Process is the basic unit for resource allocation and scheduling in the system. Each process has its own independent resources and memory space. Other processes cannot arbitrarily access the memory and resources of the current process. The memory allocated by the system to each process is limited. If a process occupies more memory than this memory limit, an out of memory (OOM) error will be reported. In order to solve the problem of application memory, the concept of multi-process can be introduced. In the same application, in order to share the pressure of the main process, some independent components of the application can be placed in a new process, which can be called a sub-process. For example, the application's Flash, video playback page, frequently drawn pages, etc. can be run in the sub-process.
[0064] In order to distinguish the main process from the subprocess, in some embodiments, the name of the subprocess is different from the package name of the application, that is, the name of the subprocess is not the package name of the application. In some embodiments, the name of the subprocess includes the package name of the application and a string suffix.
[0065] Hot start: After the application switches to the background, the electronic device does not kill the application process. When the application switches to the foreground, the electronic device can display the interface of the application when it last switched to the background. This kind of startup is called hot start. In this scenario, when the application switches to the background, the electronic device does not kill the application process, and the process is still running in the memory. Therefore, when the application switches to the foreground, the electronic device does not need to create the application process. It only needs to pull the interface information of the application when it last switched to the background and display the interface.
[0066] Cold start: After the application switches to the background, the electronic device kills the application process. When the application switches to the foreground, the electronic device needs to create the application process and load executable files, dynamic libraries, etc. In addition, the electronic device can load the application icon and display the application startup interface. Subsequently, the electronic device can load the application home page information and display the application home page.
[0067] Compared with cold start, hot start does not require creating application processes or loading resources, so hot start is fast and consumes fewer resources. Cold start is slow and takes longer.
[0068] The electronic device in the embodiments of the present application may be referred to as user equipment (UE), terminal, etc. For example, the electronic device may be a mobile phone, a portable android device (PAD), a personal digital assistant (PDA), a handheld device with a wireless communication function, a computing device, a vehicle-mounted device or a wearable device, a virtual reality (VR) terminal device, an augmented reality (AR) terminal device, a wireless terminal in industrial control, a wireless terminal in a smart home, etc. The embodiments of the present application do not specifically limit the form of the electronic device.
[0069] Figure 1 A flowchart of an application control method is shown in FIG. Figure 1 In some embodiments, the application control method may include:
[0070] S101, detecting whether the load of the electronic device is greater than load 1, and detecting whether the temperature of the electronic device is greater than temperature 1. If yes, executing S102, if not, executing S105.
[0071] The temperature of the electronic device may be the temperature of the entire device or the temperature at a preset position of the electronic device. For example, the preset position may be the position where the CPU is located.
[0072] In some embodiments, for example, a temperature sensor can be set at at least one position in the electronic device, and the temperature sensor can detect the temperature at the corresponding position, wherein the average value of the temperature at the at least one position can be used as the temperature of the electronic device, or the maximum value of the temperature at the at least one position can be used as the temperature of the electronic device, and the embodiments of the present application are not limited to this.
[0073] In some embodiments, a load threshold and a temperature threshold may be preset. The load threshold is, for example, load 1, and the temperature threshold is, for example, temperature 1. The electronic device may detect the load of the electronic device and the temperature of the electronic device, and compare the load of the electronic device with load 1, and compare the temperature of the electronic device with temperature 1. For example, the electronic device may detect whether the load of the electronic device is greater than load 1, and detect whether the temperature of the electronic device is greater than temperature 1.
[0074] S102, performing frequency limiting operation on the CPU.
[0075] When the load of the electronic device is greater than load 1, and the temperature of the electronic device is greater than temperature 1, it indicates that the load of the electronic device is high and the temperature is also high. In this case, in order to reduce the temperature and power consumption of the electronic device, the electronic device can limit the frequency of the CPU. For example, the electronic device can reduce the operating frequency of the CPU. However, in this way, the lowering of the operating frequency of the CPU will affect the operating speed of the electronic device.
[0076] When the load of the electronic device is less than or equal to load 1, or the temperature of the electronic device is less than or equal to temperature 1, the electronic device may not perform any processing, for example, the electronic device may not perform frequency limiting operation on the CPU.
[0077] S103 , detecting whether the load of the electronic device is greater than load 2 , and detecting whether the temperature of the electronic device is greater than temperature 2 .
[0078] Load 2 is greater than load 1, and temperature 2 is greater than temperature 1.
[0079] S104, when the load of the electronic device is greater than load 2, and the temperature of the electronic device is greater than temperature 2, kill the application running in the background.
[0080] After the electronic device performs a frequency limiting operation on the CPU, if it is detected that the load of the electronic device is greater than load 2 and the temperature of the electronic device is greater than temperature 2, it indicates that the load and temperature of the electronic device are too high, and the frequency limiting operation on the CPU does not solve the problem of high load and high temperature of the electronic device. The electronic device can directly kill the application running in the background. Among them, the electronic device killing the application running in the background can be understood as: killing all processes of the application running in the background and releasing the resources occupied by all processes.
[0081] S105, the electronic device is not processed.
[0082] Currently, electronic devices use a method of killing applications running in the background to reduce the load of the electronic device. However, after the application running in the background is killed, when the user reopens the application, the application needs to be cold-started, which takes a long time.
[0083] The embodiment of the present application provides an application control method. When the application occupies more resources and the load of the electronic device is high, the CPU frequency limiting operation can be omitted to ensure the running speed of the electronic device. In addition, all processes of the application running in the background can be eliminated. Instead, the application that does not affect the normal operation of the electronic device and the user experience is screened out in the application, and the sub-processes of these applications are killed. In this way, on the one hand, because the application that kills the sub-process is an application that the electronic device runs normally and does not affect the user experience, the user does not perceive it and the user experience is not affected. On the other hand, because the sub-process is born to share the pressure of the main process, and the death of the sub-process will not affect the normal operation of the main process, when these applications are switched to the foreground, the electronic device does not need to create the main process of the application, and the speed is fast and the delay is small. In addition, after these applications are switched to the foreground, the electronic device can also create sub-processes of these applications to relieve the pressure of the main process and realize the complete functions of the application.
[0084] The application control method provided by the embodiment of the present application is described below in conjunction with specific embodiments. The following embodiments can be combined with each other, and the same or similar concepts or processes may not be described in detail in some embodiments.
[0085] Figure 2 A flowchart of an embodiment of the application control method provided in the present application embodiment. Figure 2 , the application control method provided in the embodiment of the present application may include:
[0086] S201, when it is detected that the electronic device meets a first condition, a first target application is screened out from the currently running applications according to information of the currently running applications.
[0087] In some embodiments, the first condition may include at least one of the following:
[0088] 1. The resources occupied by the currently running application are greater than or equal to the first threshold.
[0089] 2. The resources currently occupied by the electronic device are greater than or equal to the second threshold. The resources occupied by the electronic device can be understood as the resources already occupied in the electronic device, and the amount or proportion of the resources occupied by the electronic device can represent the load of the electronic device. When the resources occupied by the electronic device are greater than or equal to the second threshold, the electronic device can filter out the first target application from the currently running applications based on the information of the currently running applications.
[0090] 3. The temperature of the electronic device is greater than or equal to the preset temperature. When the load of the electronic device is high, the temperature of the electronic device increases. In the embodiment of the present application, the temperature of the electronic device can be used to indirectly characterize the load of the electronic device and the resources occupied by the electronic device. When the temperature of the electronic device is greater than or equal to the preset temperature, it can be characterized as a high load of the electronic device. The electronic device can filter out the first target application from the currently running applications based on the information of the currently running applications.
[0091] 4. The electronic device is in a scenario of continuous application startup. The method of detecting that the electronic device is in a scenario of continuous application startup can refer to the description in S301.
[0092] The first condition is described below by way of example. Here, the scenario in which the first condition includes "the resources occupied by the currently running application are greater than or equal to the first threshold value" is described first:
[0093] In some embodiments, the electronic device may periodically obtain the resources occupied by the currently running application, or obtain the resources occupied by the currently running application at certain times. The currently running application may include: a currently running foreground application and a currently running background application. In some embodiments, in the process of the electronic device continuously obtaining the resources occupied by the currently running application, the currently running application obtained each time may be used as the first application, and the resources occupied by the currently running application may be used as the first resource.
[0094] In some embodiments, the electronic device may obtain the specific value of the resources occupied by the currently running application, or the electronic device may obtain the proportion of the resources occupied by the currently running application. The proportion may be understood as the proportion of the resources occupied by the currently running application to the total resources.
[0095] In the embodiment of the present application, a first threshold may be preset. For example, taking the electronic device being able to obtain the ratio of resources occupied by currently running applications as an example, the first threshold may be a first preset ratio.
[0096] In response to the resources occupied by the currently running application being greater than or equal to a first threshold, the electronic device can determine that the resources occupied by the currently running application are high and the current load of the electronic device is high. The electronic device can filter out a first target application from the currently running applications based on information of the currently running application so as to manage and control the process of the first target application.
[0097] In some embodiments, the information of the currently running application may include at least one of the following: an identifier of the currently running application, a priority adj value of the process of the currently running application, and a state of the currently running application.
[0098] The identification of an application may include, but is not limited to, information such as the name, icon, package name, etc. of the application that allows users to distinguish between different applications.
[0099] For applications running in the background, the status of the applications running in the background can include a perceptible state and an imperceptible state. Perceptible can be understood as user perception, and imperceptible can be understood as user imperceptible. Exemplarily, when the application running in the background is navigating, such as the user can hear the navigation voice, or the user can see the information that the electronic device updates the navigation route, the status of the application running in the background is a perceptible state. Exemplarily, when the application running in the background is recording or playing sound, the user can see the information that the electronic device is recording, and the user can hear the audio played by the electronic device, and the status of the application running in the background is a perceptible state.
[0100] In addition, when the application running in the background is performing tasks such as uploading, downloading, displaying a floating window, and counting steps, the state of the application running in the background is a perceptible state. In some embodiments, when the application running in the background is performing a task that can be perceived by the user, the state of the application running in the background can be a perceptible state. In some embodiments, the task that can be perceived by the user can be pre-configured, and the electronic device can determine that the state of the application running in the background is a perceptible state in response to the application running in the background performing the task that can be perceived by the user.
[0101] In some embodiments, the adj value of the application process may include the adj value of the main process of the application, and the name of the main process is the same as the package name of the application. In some embodiments, the adj value of the application process may be the maximum value of the adj value of the main process of the application and the adj value of the child process of the application. In some embodiments, the adj value of the application process may be the sum of the adj value of the main process of the application and the adj value of the child process of the application.
[0102] In some embodiments, a blacklist may be preconfigured in the electronic device. The first target application may be an application in the blacklist among the currently running applications. Exemplarily, for example, the blacklist may include an identifier of at least one application, and in this example, the information of the currently running application may include the identifier of the currently running application. The electronic device may query whether the blacklist contains the identifier of the currently running application based on the identifier of the currently running application, and use the currently running application contained in the blacklist as the first target application.
[0103] Exemplarily, the applications in the blacklist do not include system applications and system-associated applications. In other words, system applications and system-associated applications can be used as uncontrolled applications, that is, system applications and system-associated applications are not used as the first target applications. In the embodiment of the present application, the purpose of not controlling system applications is that the death of the process of the system application may cause electronic equipment failure. For example, the wallpaper application is a system application. If the wallpaper application is included in the blacklist, once the process of the wallpaper application dies, the electronic device will not display the wallpaper, affecting the user experience.
[0104] In some embodiments, system-associated applications may include, but are not limited to: input method applications, voice assistants, accessibility assistance applications, dynamic wallpapers, etc. In the embodiments of the present application, the purpose of not controlling system-associated applications is that the death of the process of the system-associated application will affect the user experience. For example, when the process of the input method application dies, the user cannot wake up the interface of the input method application when inputting text, or the input method application needs to be cold-started continuously, resulting in a longer time for the user to wake up the interface of the input method application, and a poor user experience.
[0105] In some embodiments, the adj value of the process of the currently running application can characterize the type of the currently running application. Exemplarily, the process of the system application of the electronic device and the adj value of the resident application can be configured to be less than or equal to the fifth threshold. For example, the fifth threshold can be 0. Exemplarily, the adj value of the process of the application running in the foreground can be configured to be less than or equal to the fourth threshold, and the fourth threshold is greater than the fifth threshold. For example, the fourth threshold can be 100. Exemplarily, the adj value of the process of the application running in the background can be configured to be greater than the fourth threshold.
[0106] When the information of the currently running application includes the adj value of the process of the currently running application, the electronic device can determine that the currently running application can be a system application or a resident application based on the adj value of the process of the currently running application, and the electronic device may not use the currently running application as the first target application. When the adj value of the process of the currently running application is less than or equal to the fourth threshold, the electronic device can determine that the currently running application is an application running in the foreground, and the electronic device may not use the currently running application as the first target application. When the adj value of the process of the currently running application is greater than the fourth threshold, the electronic device can determine that the currently running application is an application running in the background, and the electronic device can use the currently running application as the first target application.
[0107] In some embodiments, the adj value of the process of the currently running application can represent the priority of the process of the currently running application. Exemplarily, an adj threshold can be pre-set, and when the information of the currently running application includes the adj value of the process of the currently running application, the electronic device can use the currently running application greater than the adj threshold as the first target application. In some embodiments, for example, the adj threshold can be a fourth threshold.
[0108] In some embodiments, when the information of the currently running application includes the state of the currently running application, the electronic device may use the currently running application in an imperceptible state as the first target application, and not use the currently running application in a perceptible state as the first target application. The purpose of doing so is that when the process of the currently running application in an imperceptible state dies, the user will not be aware of it, and the user experience will not be affected.
[0109] S202: Terminate the subprocess of the first target application.
[0110] The name of the subprocess of the first target application is different from the package name of the first target application. Exemplarily, the name of the subprocess of the first target application may include the package name of the first target application and a string suffix, and the main process of the first target application may be the package name of the first target application.
[0111] In the embodiment of the present application, after the electronic device determines the first target application, it can kill the sub-process of the first target application without killing the main process of the first target application. The electronic device killing the sub-process of the first target application can be understood as: the electronic device deletes the sub-process of the first target application from the memory and releases the resources occupied by the sub-process of the first target application.
[0112] In the application control method provided in the embodiment of the present application, when the currently running application occupies more resources and the electronic device is under high load, the first target application that does not affect the normal operation of the electronic device and does not affect the user experience can be screened out from the currently running applications, and the sub-process of the first target application can be killed. In this way, on the one hand, because the first target application is an application that does not affect the normal operation of the electronic device and does not affect the user experience, the process of the first target application is managed and controlled, and the user is not aware of it, and the user experience is not affected. On the other hand, because the death of the sub-process will not affect the normal operation of the main process of the first target application, when the first target application is switched to the foreground, the electronic device does not need to create the main process of the first target application, and the startup speed of the first target application is fast and the delay is small.
[0113] In some embodiments, in a scenario where an electronic device continuously starts multiple applications, because the electronic device needs to allocate resources for the multiple applications, the load of the electronic device will increase in a short period of time. In this scenario, in order to avoid the problem of applications occupying more resources of the electronic device, it is also possible to use Figure 2 The method for killing the subprocess of the first target application in the illustrated embodiment. It should be understood that the scenario in which the electronic device continuously starts multiple applications can be understood as: the electronic device is in a scenario in which applications are continuously started.
[0114] The following is an example of the first condition that the electronic device is in a scenario where applications are continuously started:
[0115] Reference Figure 3 , the application control method provided in the embodiment of the present application may include:
[0116] S301, detecting that the electronic device satisfies at least one of the following conditions: the time interval between the launch of any two adjacent applications among the M launched applications is less than or equal to the first duration, where M is an integer greater than or equal to 2; and N applications are launched within a second duration, where N is an integer greater than or equal to 2.
[0117] In the embodiment of the present application, when the electronic device is in a scenario where applications are continuously started, the electronic device may execute S302.
[0118] In some embodiments, when the electronic device meets at least one of the following conditions, it is determined that the electronic device is in a scenario where applications are continuously started:
[0119] First, the time interval between the start of any two adjacent applications among the M started applications is less than or equal to the first duration, where M is an integer greater than or equal to 2.
[0120] Exemplarily, M may be 5, and the first duration is 5 seconds. In response to detecting that the electronic device starts 5 applications continuously, and the time interval between the start of any two adjacent applications is less than or equal to 5 seconds, it can be determined that the electronic device starts multiple applications continuously, that is, the electronic device is in a scenario where applications are started continuously.
[0121] Second, the electronic device starts N applications within the second time period, where N is an integer greater than or equal to 2.
[0122] Exemplarily, the second time length may be 20 seconds, and N may be 5. In response to detecting that the electronic device starts five applications continuously within 20 seconds, it may be determined that the electronic device starts multiple applications continuously, that is, the electronic device is in a scenario where applications are started continuously.
[0123] In some embodiments, when the electronic device satisfies the conditions in "one" and "two" at the same time, it can also be determined that the electronic device is in a scenario where applications are continuously started. For example, in response to detecting that the electronic device continuously starts 5 applications within 20 seconds, and the time interval between the start of two adjacent applications is less than or equal to 5 seconds, it can be determined that the electronic device continuously starts multiple applications.
[0124] In some embodiments, the startup methods of the application include: hot start and cold start. Among them, the electronic device can increase the number of application startups by 1 each time it detects that the application is hot started, and the electronic device can increase the number of application startups by 1 each time it detects that the application is cold started, thereby counting the number of application startups. In the embodiments of the present application, the reason why "hot start and cold start" are both regarded as one startup of the application is that in the scenario of continuous startup of the application, regardless of whether the application is hot started or cold started, the application is switched to the foreground, and the electronic device needs to allocate resources for the application running in the foreground, which easily causes the problem of high load on the electronic device.
[0125] In some embodiments, in "one", the M applications are different, and in "two", the N applications are different. That is to say, the electronic device can record the continuous start of the same application as one start of the application, and does not count the subsequent multiple starts of the same application in the number of application starts. In the embodiment of the present application, the reason for "not counting the subsequent multiple starts of the same application" is that in the scenario where the same application is started multiple times in a row, the electronic device has allocated more resources to the application when the application is started for the first time. In the subsequent scenario where the application is started multiple times in a row, the electronic device may not have adjusted the resources allocated to the application, and the application is started again. Therefore, the electronic device does not need to reallocate resources to the application. At this time, the subsequent continuous start of the application will not cause the problem of high load on the electronic device.
[0126] In this embodiment, the above "one" can also be understood as: the time interval between the start of any two adjacent applications among the M different applications is less than or equal to the first duration. The above "two" can also be understood as: the electronic device starts N different applications within the second duration.
[0127] Exemplarily, when the electronic device continuously starts application 1, application 2, application 1, application 3, and application 1, the application startup method is not limited here. In response to starting application 1, the electronic device can record the number of application startups as 1, and in response to starting application 2, the electronic device can record the number of application startups as 2. In response to the electronic device restarting application 1, application 1 is repeatedly started, and the electronic device may not count the startup of application 1 this time as the startup number, and the electronic device can record the number of application startups as 2. Similarly, in response to the startup of application 3, the electronic device can record the number of application startups as 3, and in response to the electronic device restarting application 1, the electronic device can record the number of application startups as 3. When other conditions are met, when M is 5 or N is 5, the electronic device can determine that the electronic device is not in a scenario where applications are continuously started.
[0128] Exemplarily, when the electronic device continuously starts application 1, application 2, application 1, application 3, application 1, application 4, and application 5, the electronic device records the number of application startups as shown in the above example. In response to starting application 5, the electronic device can record the number of application startups as 5, and when other conditions are met, when M is 5 or N is 5, the electronic device can determine that the electronic device is in a scenario where applications are continuously started.
[0129] S302: Filter out a first target application from the currently running applications according to information of the currently running applications.
[0130] For S302 , reference may be made to the relevant description in S201 .
[0131] In some embodiments, the electronic device may filter out the first target application from the currently running applications that meet the second condition. Exemplarily, the second condition may include an adj value greater than a fourth threshold, and the electronic device may filter out the first target application from the currently running applications whose adj value is greater than the fourth threshold. It should be understood that when the adj value is greater than the fourth threshold, the application is a background running application, and the electronic device manages and controls the background running applications, which has little impact on the user experience.
[0132] In some embodiments, the electronic device may use a currently running application whose adj value is greater than a fourth threshold as the first target application.
[0133] In some embodiments, the second condition may also include any of the following: not included in the whitelist and not in a perception state.
[0134] In some embodiments, a whitelist may be pre-configured in the electronic device. Applications in the whitelist may be understood as uncontrolled applications, that is, applications whose processes cannot be killed by the electronic device.
[0135] In some embodiments, the whitelist may be a whitelist preset in the electronic device. In some embodiments, the whitelist may include: a whitelist preset in the electronic device and a whitelist set by the user. In some embodiments, the whitelist may include: a whitelist set by the user. Exemplarily, the user may set an uncontrolled application in the settings application of the electronic device, or the user may set the application as an uncontrolled application in the settings interface of each application. In some embodiments, the whitelist may include the identification of the application. In some embodiments, the whitelist may include system applications and system-associated applications.
[0136] Among them, when the currently running application is included in the whitelist, the electronic device can determine that the currently running application is an uncontrolled application. Among them, when the adj value of the process of the currently running application is less than or equal to the fourth threshold, the electronic device can determine that the currently running application is a system application, a resident application or a foreground application, all of which are uncontrolled applications. Among them, when the state of the currently running application is a perception state, the electronic device can determine that the currently running application is an uncontrolled application, because if the currently running application is killed, the user can perceive that the application has exited. In order to avoid affecting the user experience, the electronic device may not use the currently running application as the first target application.
[0137] In some embodiments, when the electronic device performs determination step 1, the electronic device may filter out the first target application from currently running applications that are not included in the whitelist and whose adj value is greater than the fourth threshold. Exemplarily, the electronic device may select a currently running application that is not included in the whitelist and whose adj value is greater than the fourth threshold as the first target application.
[0138] In some embodiments, when the second condition includes not being in the whitelist, the electronic device can filter out the first target application from the currently running applications whose adj value is greater than the fourth threshold and are not in the whitelist. For example, the electronic device can use the currently running application whose adj value is greater than the fourth threshold and is not in the whitelist as the first target application.
[0139] Exemplarily, when the second condition includes not being in a perception state, the electronic device may filter out the first target application from the currently running applications whose adj value is greater than the fourth threshold and not being in a perception state. For example, the electronic device may select the currently running application whose adj value is greater than the fourth threshold and not being in a perception state as the first target application.
[0140] In some embodiments, when the second condition includes not being in the whitelist and not being in a perceptual state, the electronic device may filter out the first target application from the currently running applications that are not included in the whitelist, have an adj value greater than a fourth threshold, and are in an imperceptible state. Exemplarily, the electronic device may use the currently running application that is not included in the whitelist, has an adj value greater than the fourth threshold, and is not in a perceptual state as the first target application.
[0141] In some embodiments, other conditions for screening the first target application may be set and may be combined with the step of screening the first target application in the present application.
[0142] In some embodiments, information of uncontrolled applications and information of controlled applications may be configured in the electronic device, as shown in Table 1.
[0143] Table 1
[0144]
[0145] S303: Terminate the subprocess of the first target application.
[0146] S303 may refer to the description in S202.
[0147] In the embodiment of the present application, when the electronic device is in a scenario where applications are continuously started, because the electronic device needs to allocate resources for the multiple applications, the load of the electronic device will increase in a short period of time. In this scenario, in order to avoid the problem of high load of the electronic device, the electronic device can also filter out the first target application from the currently running applications and kill the sub-process of the first target application. The embodiment of the present application has the same advantages as the above Figure 2 For the same technical effects as those of the illustrated embodiment, reference can be made to the description in the above embodiment.
[0148] In some embodiments, when the electronic device is in a scenario where applications are continuously started, the electronic device may also determine whether to enable the application based on the load of the electronic device. Figure 2 and Figure 3 In the case where the electronic device is in a scenario where applications are continuously started, for example, there may be a situation where the resources occupied by the currently running application are less than a first threshold value. If the sub-process of the first target application is forcibly killed in this case, after the first target application is switched to the foreground, the electronic device still needs to create the sub-process of the first target application.
[0149] The following is an example in which the first condition includes "the resources occupied by the currently running application are greater than or equal to the first threshold" (or the resources occupied by the currently running application are greater than or equal to the first threshold, and the temperature of the electronic device is greater than or equal to the preset temperature), and "the electronic device is in a scenario where applications are continuously started":
[0150] Reference Figure 4 , the application control method provided in the embodiment of the present application may include:
[0151] S401, detecting that the electronic device satisfies at least one of the following conditions: the time interval between the launch of any two adjacent applications among the M launched applications is less than or equal to the first time length, where M is an integer greater than or equal to 2; and N applications are launched within a second time length, where N is an integer greater than or equal to 2.
[0152] S401 may refer to the description in S301.
[0153] S402: Acquire resources occupied by the currently running application.
[0154] In some embodiments, the electronic device may also obtain the current first temperature of the electronic device. Accordingly, S402 may be replaced by: obtaining resources occupied by the currently running application and the current first temperature of the electronic device.
[0155] S403: In response to the resource occupied by the currently running application being greater than or equal to the first threshold, a first target application is screened out from the currently running applications according to information of the currently running application.
[0156] In the case where the electronic device can obtain the first temperature, S403 can be replaced by: in response to the resources occupied by the currently running application being greater than or equal to the first threshold and the first temperature being greater than or equal to the preset temperature, the electronic device filters out the first target application from the currently running applications based on information of the currently running application.
[0157] In the embodiment of the present application, the condition of "the first temperature is greater than or equal to the preset temperature" is added to make the conditions for the electronic device to screen the first target application more stringent. When the load and temperature of the electronic device are high, the electronic device will screen the first target application and kill the sub-process of the first target application, so that the application can be managed and controlled more accurately.
[0158] S404, killing the child process of the first target application.
[0159] S402 - S404 may refer to the description in S201 - S202 .
[0160] In one embodiment, referring to Figure 5 , the process of the electronic device executing the application control method may include:
[0161] Step 1: Detect whether the electronic device is in a scenario where applications are continuously started.
[0162] In some embodiments, the activity manager service (AMS) in the electronic device can monitor events at a station to detect whether the electronic device is in a scenario where applications are continuously started. The AMS monitors whether the electronic device is in a scenario where applications are continuously started, which can refer to the description in S301.
[0163] Step 2: Detect that the electronic device is in a scenario where applications are continuously started.
[0164] Step 3: Get the resources occupied by the currently running application.
[0165] In some embodiments, after the electronic device detects that the electronic device is in a scenario where applications are continuously started, the electronic device may obtain the resources occupied by the currently running applications every 3 seconds.
[0166] Step 4: When the resources occupied by the currently running application are greater than or equal to the first threshold, determine to filter the first target application from the currently running applications.
[0167] Step 5: Determine whether the currently running application is included in the whitelist according to the identifier of the currently running application.
[0168] Step 6: When the currently running application is not included in the whitelist, determine whether the adj value of the process of the currently running application is less than or equal to a fourth threshold.
[0169] Step 7: When the adj value of the process of the currently running application is greater than the fourth threshold, determine whether the state of the currently running application is a perception state.
[0170] Step 8: When the currently running application is in an imperceptible state, kill the child process of the currently running application.
[0171] It should be understood that there is no order restriction for the judgment steps in step 5 to step 7. Figure 5 For an example.
[0172] The embodiments of the present application have the same Figure 2 For the same technical effects as those of the illustrated embodiment, reference can be made to the description in the above embodiment.
[0173] In some embodiments, after the electronic device kills the sub-process of the first target application, if the resources occupied by the electronic device (for example, the proportion of resources occupied in the electronic device) continue to increase, in order to reduce the load of the electronic device, the electronic device can also filter out the second target application from the currently running applications and kill all processes of the second target application to avoid an increase in the load of the electronic device.
[0174] Reference Figure 6 In the application control method provided in the embodiment of the present application, after S202, or after S303, or after S404, S601-S603 may also be executed. It should be understood that Figure 6 Take the execution of S601-S603 after S404 as an example for explanation:
[0175] S601, obtaining resources occupied by the electronic device.
[0176] In an embodiment of the present application, after killing the sub-process of the first target application, the electronic device may periodically obtain the resources occupied by the electronic device, or obtain the resources occupied by the electronic device at certain specific times.
[0177] S602: In response to the resources occupied by the electronic device being greater than or equal to a third threshold, a second target application is screened out from the currently running applications according to information of the currently running applications.
[0178] The third threshold is greater than the second threshold. In some embodiments, the electronic device can obtain the specific value of the resources occupied by the electronic device, or the electronic device can obtain the proportion of the resources occupied by the electronic device. The proportion can be understood as: the proportion of the occupied resources in the electronic device to the total resources. The third threshold can be pre-set in the embodiment of the present application. Exemplarily, taking the example that the electronic device can obtain the proportion of the resources occupied by the electronic device, the third threshold can be the second preset proportion.
[0179] In an embodiment of the present application, in response to the resources occupied by the electronic device being greater than or equal to the third threshold, the electronic device may determine that the resources occupied by the electronic device have further increased. The electronic device may filter out the second target application from the currently running applications based on information of the currently running application. It should be understood that the "currently running application" in S602 is the currently running application after the electronic device kills the subprocess of the first target application. In some embodiments, the currently running application may be used as the second application, and the second application may be different from the first application.
[0180] It should be understood that in S602, the process in which the electronic device selects the second target application from the currently running application (the second application) can refer to the description in S201.
[0181] S603, kill all processes of the second target application.
[0182] In an embodiment of the present application, because the electronic device does not effectively reduce the load of the electronic device after killing the sub-process of the first target application, the resources occupied by the electronic device further increase to greater than or equal to the third threshold. At this time, killing the sub-process of the second target application cannot effectively reduce the load of the electronic device. The electronic device can kill all processes of the second target application to further reduce the load of the electronic device.
[0183] Among them, all processes of the second target application may include the main process and sub-processes of the second target application, that is, the electronic device kills the main process and sub-processes of the second target application. The electronic device killing all processes of the second target application can be understood as: the electronic device deletes all processes of the second target application from the memory and releases the resources occupied by all processes of the second target application. In some embodiments, the electronic device killing all processes of the second target application can also be understood as the electronic device killing the second target application as a whole package.
[0184] In an embodiment of the present application, after the electronic device kills the sub-process of the first target application, if the load of the electronic device further increases to greater than or equal to the third threshold, the electronic device can filter out the second target application from the currently running applications and kill all processes of the second target application. This can reduce the load of the electronic device to a greater extent without affecting the normal operation of the electronic device and user experience.
[0185] In a scenario where an electronic device is in the process of continuously starting applications, the application can be switched to the background, and the electronic device can adjust the adj value of the application's process to mark the application as a background-running application. At present, when the application is switched to the background, the electronic device can gradually increase the adj value of the application's process. Exemplarily, when the application is running in the foreground, the adj value of the application's process can be 80. When the application is switched to the background, the electronic device can first adjust the adj value of the application's process to 101. After the application is switched to the background and runs for a period of time, the electronic device can adjust the adj value of the application's process to 150. When the application is switched to the background and continues to run for a period of time, the electronic device can further adjust the adj value of the application's process to 200. Among them, the higher the adj value of the application's process, the lower the priority of the application's process, and the easier it is to be killed by the electronic device.
[0186] At present, although when the application is switched to the background, the electronic device can increase the adj value of the application's process to a value higher than the fourth threshold, the application's group is still in the foreground group, and the electronic device will not immediately release the resources occupied by all the processes of the application in the foreground group. At present, when the adj value of the application's process is greater than the sixth threshold, the electronic device can switch the application's group to the background group, and the sixth threshold is greater than the fourth threshold. Exemplarily, the sixth threshold can be 200. After the electronic device switches the application's group to the background group, the electronic device can release the resources occupied by the target process of the application in the background group, which can reduce the application's occupation of the electronic device's resources. However, since when the application is switched to the background, the electronic device gradually increases the adj value of the application's process, the adj value of the application's process will not reach the sixth threshold at once, and the electronic device will not immediately switch the application's group to the background group, so that the application will continue to occupy the electronic device's resources.
[0187] In some embodiments, in order to facilitate the electronic device to release the resources occupied by the process of the application in the background group in a timely manner, when the application is switched to the background, the electronic device can directly switch the group of the application to the background group, so that when the application is switched to the background, the electronic device can immediately release the resources occupied by the target process of the application, effectively reducing the resource occupation of the electronic device. Exemplarily, when the electronic device switches application 1 to the background, the electronic device can switch the group of application 1 from the foreground group to the background group, and release the resources occupied by the target process of application 1.
[0188] In one embodiment, when the electronic device is in a scenario where applications are continuously started, in response to the application being switched to the background, the electronic device may directly switch the group of the application to the background group.
[0189] In some embodiments, when an application is switched to the background, the electronic device can use the state of the application, and the electronic device can release the resources occupied by the target process of the application according to the state of the application, without killing the target process, which can also reduce the resources occupied by the application. Wherein, the state of the application is different, and the target process of the application is different.
[0190] In some embodiments, when the electronic device is in a perceptual state, the first target process may include some sub-processes of the application, and these some sub-processes are sub-processes that are not related to the perceptual state of the application. For example, when the application switches to the background, the application plays audio, and these some sub-processes may be sub-processes that are not related to playing audio.
[0191] In some embodiments, when the electronic device is in an imperceptible state, because the application is an imperceptible application, the second target sub-process may be a sub-process of the application.
[0192] In some embodiments, when the electronic device is switched to the background, when the electronic device is in a perceptual state, the electronic device may switch the group of applications to the first group, and release the resources occupied by the first target process of the application in the first group, without killing the first target process of the application. Exemplarily, the first target process may include some sub-processes of the application, and the sub-processes are sub-processes that are not related to the perceptual state of the application. For example, when the application is switched to the background, the application plays audio, and the sub-processes may be sub-processes that are not related to playing audio.
[0193] When the application is switched to the background, when the electronic device is in an imperceptible state, the electronic device can switch the group of the application to the second group, and release the resources occupied by the second target process of the application in the second group, without killing the second target process of the application. The second target process is different from the first target process. Exemplarily, because the application is an imperceptible application, the second target sub-process can be a sub-process of the application.
[0194] In some embodiments, the first target process and the second target process may further include a main process.
[0195] It should be understood that both the first group and the second group belong to background groups. When the application group is switched to the background group (such as the first group or the second group), the electronic device can release the resources of the target process of the application in the background group.
[0196] In some embodiments, the first group may be referred to as a background-aware group, and the second group may be referred to as a background-imperceptible group.
[0197] In some embodiments, regardless of whether the application group is switched to the first group or the second group, because the first group and the second group both belong to background groups, the electronic device can release the resources occupied by the target process of the application so as to quickly reduce the occupation of the electronic device's resources by the background application.
[0198] Reference Figure 7 , the application control method provided in the embodiment of the present application may include:
[0199] S701, in response to a user operation, controlling the application to switch to the background.
[0200] S702, identifying the status of the application.
[0201] S703: When the state of the application is a perceptible state, the group of the application is switched to the first group, and the resources of the first target process of the application in the first group are released.
[0202] S704: When the state of the application is an imperceptible state, the group of the application is switched to the second group, and resources of the second target process of the application in the second group are released.
[0203] S701-S704 may refer to the above-mentioned related description.
[0204] In the embodiment of the present application, when the application is switched to the background, the electronic device can switch the group of the application to the background group. Specifically, for example, when the state of the application is a perceptible state, the electronic device can switch the application to the first group, and when the state of the application is an imperceptible state, the electronic device can switch the application to the second group. In this way, the electronic device can release the resources occupied by the target process of the application in a timely manner, reducing the resource occupation of the electronic device.
[0205] It should be noted that the application information (including but not limited to the application identification, application status, and adj value of the application process, etc.) and data (including but not limited to data used for analysis, stored data, displayed data, etc.) involved in this application are all information and data authorized by the user or fully authorized by all parties, and the collection, use and processing of relevant data must comply with the relevant laws, regulations and standards of the relevant countries and regions, and provide corresponding operation entrances for users to choose to authorize or refuse.
[0206] In one embodiment, the present application also provides an electronic device, referring to Figure 8 , the electronic device may include: a processor 801 (such as a CPU), and a memory 802. The memory 802 may include a high-speed random access memory (RAM), and may also include a non-volatile memory (NVM), such as at least one disk memory. The memory 802 may store various instructions for completing various processing functions and implementing the method steps of the present application.
[0207] Optionally, the electronic device involved in the present application may further include: a power supply 803, a communication bus 804 and a communication port 805. The above-mentioned communication port 805 is used to realize the connection and communication between the electronic device and other peripherals. In the embodiment of the present application, the memory 802 is used to store computer executable program code, and the program code includes instructions; when the processor 801 executes the instruction, the instruction causes the processor 801 of the electronic device to perform the action in the above-mentioned method embodiment, and its implementation principle and technical effect are similar, which will not be repeated here.
[0208] It should be noted that the modules or components described in the above embodiments may be one or more integrated circuits configured to implement the above methods, such as one or more application specific integrated circuits (ASICs), or one or more digital signal processors (DSPs), or one or more field programmable gate arrays (FPGAs). For another example, when a module above is implemented in the form of a processing element scheduling program code, the processing element may be a general-purpose processor, such as a central processing unit (CPU) or other processors that can call program codes, such as a controller. For another example, these modules may be integrated together and implemented in the form of a system-on-a-chip (SOC).
[0209] In the above embodiments, it can be implemented in whole or in part by software, hardware, firmware or any combination thereof. When implemented using software, it can be implemented in whole or in part in the form of a computer program product. The computer program product includes one or more computer instructions. When loading and executing computer program instructions on a computer, the process or function according to the embodiment of the present application is generated in whole or in part. The computer can be a general-purpose computer, a special-purpose computer, a computer network, or other programmable devices. The computer instructions can be stored in a computer-readable storage medium, or transmitted from one computer-readable storage medium to another computer-readable storage medium. For example, the computer instructions can be transmitted from a website site, a computer, a server or a data center by wired (e.g., coaxial cable, optical fiber, digital subscriber line (DSL)) or wireless (e.g., infrared, wireless, microwave, etc.) mode to another website site, computer, server or data center. The computer-readable storage medium can be any available medium that a computer can access or a data storage device such as a server, a data center, etc. that contains one or more available media integrated. The available medium can be a magnetic medium, (e.g., a floppy disk, a hard disk, a tape), an optical medium (e.g., a DVD), or a semiconductor medium (e.g., a solid-state hard disk Solid State Disk (SSD)), etc.
[0210] The term "plurality" in this article refers to two or more than two. The term "and / or" in this article is only a description of the association relationship of associated objects, indicating that three relationships may exist. For example, A and / or B can represent: A exists alone, A and B exist at the same time, and B exists alone. In addition, the character " / " in this article generally indicates that the previous and next associated objects are in an "or" relationship; in the formula, the character " / " indicates that the previous and next associated objects are in a "division" relationship. In addition, it should be understood that in the description of this application, words such as "first" and "second" are only used for the purpose of distinguishing descriptions, and cannot be understood as indicating or implying relative importance, nor can they be understood as indicating or implying order.
[0211] It should be understood that the various numerical numbers involved in the embodiments of the present application are only used for the convenience of description and are not used to limit the scope of the embodiments of the present application.
[0212] It can be understood that in the embodiments of the present application, the size of the serial numbers of the above-mentioned processes does not mean the order of execution. The execution order of each process should be determined by its function and internal logic, and should not constitute any limitation on the implementation process of the embodiments of the present application.
Claims
1. An application control method, characterized in that: Applied to electronic equipment, the method comprises: When it is detected that the electronic device meets the first condition, a first target application is screened out from the currently running applications according to information of the currently running applications; The subprocess of the first target application is terminated.
2. The method according to claim 1, characterized in that The first condition includes at least one of the following: The resources occupied by the currently running application are greater than or equal to a first threshold; The resources occupied by the electronic device are greater than or equal to a second threshold; The temperature of the electronic device is greater than or equal to a preset temperature; The time interval between the start of any two adjacent applications among the M started applications is less than or equal to the first duration, where M is an integer greater than or equal to 2; N applications are started within a second time period, where N is an integer greater than or equal to 2.
3. The method according to claim 2, characterized in that The application startup methods include: hot start and cold start.
4. The method according to claim 2 or 3, characterized in that: The M applications are different from each other, and the N applications are different from each other.
5. The method according to any one of claims 1 to 4, characterized in that The information of the currently running application includes at least one of the following: an identifier of the currently running application, a priority adj value of a process of the currently running application, and a state of the currently running application, wherein the state includes a perceptible state and an imperceptible state; The adj value includes the adj value of the main process of the currently running application.
6. The method according to claim 5, characterized in that The step of selecting a first target application from the currently running applications according to information of the currently running applications includes: The first target application is screened out from currently running applications that meet a second condition, where the second condition includes: an adj value is greater than a fourth threshold.
7. The method according to claim 6, characterized in that The second condition also includes at least one of the following: not in the whitelist, the state is not a sensing state, and the whitelist includes: a whitelist preset in the electronic device, and / or a whitelist set by the user.
8. The method according to any one of claims 2 to 4, characterized in that: After terminating the subprocess of the first target application, the method further includes: Acquire the resources currently occupied by the electronic device; In response to the resource currently occupied by the electronic device being greater than or equal to a third threshold, screening out a second target application from the currently running applications according to information of the currently running applications, the third threshold being greater than the second threshold; All processes of the second target application are terminated.
9. The method according to any one of claims 1 to 8, characterized in that The method further comprises: In response to the application being switched to the background, resources occupied by the target process of the application are released according to the state of the application.
10. The method according to claim 9, characterized in that The releasing the resources occupied by the target process of the application according to the state of the application includes: When the state of the application is a perceptible state, switching the group of the application to the first group, and releasing the resources occupied by the first target process of the application in the first group; When the state of the application is an imperceptible state, the group of the application is switched to a second group, and resources occupied by a second target process of the application in the second group are released, and the first target process is different from the second target process.
11. An application control method, characterized in that: Applied to electronic equipment, the method comprises: In response to user operations, control the application to switch to the background; According to the state of the application, the resources occupied by the target process of the application are released.
12. The method according to claim 11, characterized in that The releasing the resources occupied by the target process of the application according to the state of the application includes: When the state of the application is a perceptible state, switching the group of the application to a first group, and releasing resources occupied by a first target process of the application in the first group; When the state of the application is an imperceptible state, the group of the application is switched to a second group, and resources occupied by a second target process of the application in the second group are released, and the first target process is different from the second target process.
13. An electronic device, characterized in that: include: Processor and memory; The memory stores computer-executable instructions; The processor executes the computer-executable instructions stored in the memory, so that the processor performs the method according to any one of claims 1 to 12.
14. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores a computer program or instruction, and when the computer program or instruction is executed, the method according to any one of claims 1 to 12 is implemented.