Application control method, electronic device and readable storage medium
By terminating the subprocess of the application in the electronic device to reduce the device load, the problems of high device load and application lag caused by multiple applications running are solved, and rapid application startup and device performance improvement are achieved.
Patent Information
- Application Number
- PCT/CN2024/104828
- Authority / Receiving Office
- WO · WO
- Patent Type
- Applications
- Current Assignee / Owner
- Priority Date
- 2023-07-31
- Filing Date
- 2024-07-10
- Publication Date
- 2025-02-06
AI Technical Summary
In electronic devices, multiple open applications will cause high device load and even cause applications running in the foreground to stutter. Existing methods such as killing background applications will cause applications to start coldly and prolong.
By detecting the load and temperature of the electronic device, when a specific condition is met, the child process of the first target application is terminated without the main process, thereby avoiding cold start when the application switches to the foreground.
It effectively reduces the application startup delay, improves the performance and user experience of electronic devices, and avoids the problem of excessive device load.
Smart Images

Figure CN2024104828_06022025_PF_FP_ABST
Abstract
Description
Application control method, electronic device, and readable storage medium
[0001] This application claims priority to the Chinese patent application filed with the China Patent Office on July 31, 2023, with application number 202310959929.6 and application name “Application Control Method, Electronic Device and Readable Storage Medium”, the entire contents of which are incorporated by reference into this application. Technical Field
[0002] 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
[0003] To meet the diverse needs of users, various types of applications are emerging one after another, and users can install multiple types of applications on electronic devices. When users open multiple applications, multiple applications will occupy a large amount of electronic device resources, resulting in high load on the electronic device and even causing the foreground application to freeze.
[0004] 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.
[0005] Summary of the Invention
[0006] The embodiments of the present application provide an application control method, an electronic device, and a readable storage medium, which can terminate the sub-process of a first target application. When the first target application switches to the foreground, there is no need to cold start, which can reduce the application startup delay.
[0007] In a first aspect, embodiments of the present application provide an application control method, wherein the execution subject of the application control method may be an electronic device or a chip in the electronic device. The following description uses an electronic device as an example. In this method, when the electronic device detects that the electronic device satisfies a first condition, it may filter out a first target application from the currently running applications based on information about the currently running applications, terminate the subprocess of the first target application, and not terminate the main process of the first target application.
[0008] 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.
[0009] In a possible implementation, the first condition includes at least one of the following:
[0010] The resources occupied by the currently running application are greater than or equal to a first threshold.
[0011] The resources occupied by the electronic device are greater than or equal to a second threshold.
[0012] The temperature of the electronic device is greater than or equal to a preset temperature.
[0013] The time interval between the startup 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.
[0014] N applications are started within a second time period, where N is an integer greater than or equal to 2.
[0015] When the resources occupied by the currently running application are greater than or equal to a first threshold, it indicates that a large number of resources are occupied in the electronic device and 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 sub-process of the first target application. The electronic device terminating the sub-process of the first target application may include: the electronic device terminating the resources occupied by the sub-process of the first target application, thereby reducing the occupation of the resources of the electronic device by the first target application.
[0016] 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.
[0017] 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 sub-process of the first target application.
[0018] 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.
[0019] 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 continuously started. 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 terminating the resources occupied by the sub-process of the first target application.
[0020] It should be understood that the electronic device may terminate the sub-process of the first target application when detecting that the electronic device meets at least one of the above conditions, so as to reduce the occupation of the electronic device's resources by the first target application.
[0021] In one possible implementation, the application startup methods include: hot startup and cold startup. In the embodiments of the present application, the reason why "hot startup and cold startup" are both considered as a single startup of the application is that in the scenario where the application is started continuously, 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 to the application running in the foreground, which can easily cause a high load on the electronic device.
[0022] 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 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 for "not counting the subsequent multiple launches of the same application" is that 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 launched 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 launched again. Therefore, the electronic device does not need to reallocate resources to the application. At this time, the subsequent continuous launch of the application will not cause the problem of high load on the electronic device.
[0023] In some embodiments, the phrase "among the M launched applications, the time interval between the launch of any two adjacent applications is less than or equal to the first duration, where M is an integer greater than or equal to 2" can be replaced with "among the M different launched applications, the time interval between the launch of any two adjacent applications is less than or equal to the first duration." Furthermore, "N applications are launched within a second duration, where N is an integer greater than or equal to 2" can be replaced with "the electronic device launches N different applications within the second duration."
[0024] The following describes the process of the electronic device selecting the first target application from the currently running applications:
[0025] 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, where the state includes a perceptible state and an imperceptible state; wherein the adj value includes the adj value of the main process of the currently running application.
[0026] In a possible implementation, a second condition may be pre-configured to filter out the first target application from currently running applications that meet the second condition.
[0027] In one possible implementation, the second condition includes: an adj value greater than a fourth threshold. The electronic device may determine whether the adj value is less than or equal to the fourth threshold, and filter out the first target application from currently running applications whose adj values are greater than the fourth threshold. Exemplarily, the electronic device may select the currently running application whose adj value is greater than the fourth threshold as the first target application.
[0028] In a possible implementation, the second condition may further include at least one of the following: not being in a whitelist and not being in a perception state, the whitelist including: a whitelist preset in the electronic device and / or a whitelist set by the user.
[0029] 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 which are not in the whitelist. For example, the electronic device may select, as the first target application, a currently running application whose adj value is greater than the fourth threshold and which is not in the whitelist.
[0030] Exemplarily, when the second condition includes not being in a sensing state, the electronic device may filter out the first target application from currently running applications whose adj values are greater than the fourth threshold and are not in a sensing state. For example, the electronic device may select, as the first target application, an application whose adj value is greater than the fourth threshold and is not in a sensing state.
[0031] In some embodiments, when the second condition includes not being in the whitelist and not being in the awareness 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 the awareness state. Exemplarily, the electronic device may use, as the first target application, an application that is not included in the whitelist, has an adj value greater than the fourth threshold, and is not in the awareness state.
[0032] In one possible implementation, other conditions for filtering the first target application can also be set. The electronic device can also combine the conditions to determine the first target application from the 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.
[0033] In this implementation method, the electronic device can screen 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, and the user is not aware of it, and it has no impact on the user experience.
[0034] In one possible implementation, after the electronic device terminates the sub-process 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 have further increased and the load of the electronic device has further increased. The electronic device can filter out the second target application from the currently running applications based on information of the currently running application and terminate all processes of the second target application.
[0035] 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.
[0036] 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. 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.
[0037] In one possible implementation, in response to an application being switched to the background, the electronic device may release resources occupied by the target process of the application based on the application's state, without terminating the target process, thereby reducing the resources occupied by the application. The target process of the application may be different depending on the application's state.
[0038] When an application switches to the background, when the electronic device is in a perceptual state, the electronic device may switch the application group 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 these sub-processes are sub-processes unrelated to the perceptual state of the application. For example, when the application switches to the background, the application plays audio, and these sub-processes may be sub-processes unrelated to playing audio.
[0039] When an application is switched to the background, if the electronic device is in an imperceptible state, the electronic device may switch the application's group to a 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. For example, because the application is imperceptible, the second target sub-process may be a sub-process of the application.
[0040] 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.
[0041] 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 having to wait for the adj value of the application's process to reach the sixth threshold value before releasing 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 this 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 status 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.
[0042] 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 based on the status of the application, resources occupied by the target process of the application are released.
[0043] In one 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 and the second target process are different.
[0044] In a third aspect, embodiments of the present application provide an electronic device, which may include a processor and a memory. The memory is configured to store computer-executable program code, the program code including instructions; when the processor executes the instructions, the instructions cause the electronic device to perform the methods described in the first and second aspects.
[0045] In a fourth aspect, an embodiment of the present application provides an electronic device, which may include a unit, module or circuit for executing the method provided in the first and second aspects above.
[0046] 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.
[0047] In a sixth aspect, an embodiment of the present application provides a computer-readable storage medium, wherein the computer-readable storage medium stores instructions, which, when executed on a computer, enables the computer to execute the methods in the first and second aspects above.
[0048] 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
[0049] FIG1 is a flow chart of an application control method;
[0050] FIG2 is a flow chart of an embodiment of an application control method provided in an embodiment of the present application;
[0051] FIG3 is a flow chart of another embodiment of the application control method provided in an embodiment of the present application;
[0052] FIG4 is a flow chart of another embodiment of the application control method provided in an embodiment of the present application;
[0053] FIG5 is a flow chart of another embodiment of the application control method provided in an embodiment of the present application;
[0054] FIG6 is a flow chart of another embodiment of the application control method provided in an embodiment of the present application;
[0055] FIG7 is a flow chart of another embodiment of the application control method provided in an embodiment of the present application;
[0056] FIG8 is a schematic structural diagram of an electronic device provided in an embodiment of the present application. DETAILED DESCRIPTION
[0057] For ease of understanding, the following first introduces the relevant terms and concepts involved in the embodiments of the present application:
[0058] Electronic device load: In some embodiments, the electronic device load can be understood as the load on the electronic device's central processing unit (CPU). The electronic device load can also be understood as the amount of CPU resources occupied by the electronic device or the proportion of the occupied CPU resources to the total CPU resources.
[0059] Resources: may include but are not limited to at least one of the following: CPU resources, GPU resources, memory resources, and I / O resources.
[0060] Resources occupied by an application: In some embodiments, the resources occupied by an application may be CPU resources occupied by the application. In some embodiments, the resources occupied by an application may include at least one of the following: CPU resources, GPU resources, memory resources, and I / O resources.
[0061] Resources occupied by the electronic device: The resources occupied by the electronic device. In some embodiments, the resources occupied by the electronic device may be the 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.
[0062] Resident applications: applications that are always running. For example, some system applications can be resident applications, such as wallpaper applications, desktop applications, etc.
[0063] 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.
[0064] Main process and sub-process of an application: An application uses one process by default, which 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.
[0065] A 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 to each process by the system is limited. If a process occupies more memory than this limit, an out of memory (OOM) error will be reported. To solve the problem of application memory, the concept of multi-process can be introduced. Within 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 this sub-process.
[0066] In order to distinguish the main process from the sub-process, in some embodiments, the name of the sub-process is different from the package name of the application, that is, the name of the sub-process is not the package name of the application. In some embodiments, the name of the sub-process includes the package name of the application and a string suffix.
[0067] 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 type of startup is called a hot start. In this scenario, the electronic device does not kill the application process when the application switches to the background. The process is still running in 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 when the application last switched to the background and display that interface.
[0068] Cold start: After an 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 the executable file, dynamic library, 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 homepage information and display the application homepage.
[0069] Compared with cold start, hot start does not require creating an application process or loading resources, so hot start is fast and consumes fewer resources. Cold start is slow and takes longer.
[0070] The electronic devices in the embodiments of the present application may be referred to as user equipment (UE), terminals, etc. For example, the electronic devices may be mobile phones, portable Android devices (PADs), personal digital assistants (PDAs), handheld devices with wireless communication capabilities, computing devices, vehicle-mounted devices, or wearable devices, virtual reality (VR) terminal devices, augmented reality (AR) terminal devices, wireless terminals in industrial control, wireless terminals in smart homes, etc. The embodiments of the present application do not specifically limit the form of the electronic devices.
[0071] FIG1 is a flow chart of an application control method. Referring to FIG1 , in some embodiments, the application control method may include:
[0072] 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 so, executing S102, if not, executing S105.
[0073] The temperature of the electronic device may be the temperature of the entire device or the temperature of a preset position of the electronic device. For example, the preset position may be the position where the CPU is located.
[0074] In some embodiments, for example, a temperature sensor can be set at at least one location in the electronic device, and the temperature sensor can detect the temperature at the corresponding location, wherein the average temperature at the at least one location can be used as the temperature of the electronic device, or the maximum temperature at the at least one location can be used as the temperature of the electronic device. The embodiments of the present application are not limited to this.
[0075] In some embodiments, a load threshold and a temperature threshold can be preset. The load threshold can be, for example, Load 1, and the temperature threshold can be, for example, Temperature 1. The electronic device can detect the load and temperature of the electronic device, and compare the load of the electronic device with Load 1, and the temperature of the electronic device with Temperature 1. For example, the electronic device can detect whether the load of the electronic device is greater than Load 1, and whether the temperature of the electronic device is greater than Temperature 1.
[0076] S102: performing frequency limiting operation on the CPU.
[0077] When the load of an electronic device is greater than Load 1 and the temperature of the electronic device is greater than Temperature 1, it indicates that the load and temperature of the electronic device are high. In this case, to reduce the temperature and power consumption of the electronic device, the electronic device can limit the CPU frequency. For example, the electronic device can reduce the CPU operating frequency. However, in this method, the reduced CPU operating frequency will affect the operating speed of the electronic device.
[0078] 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 on the CPU.
[0079] 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 .
[0080] Load 2 is greater than Load 1, and Temperature 2 is greater than Temperature 1.
[0081] 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.
[0082] After limiting the CPU frequency, if the electronic device detects that the electronic device's load is greater than Load 2 and the electronic device's temperature is greater than Temperature 2, indicating that the electronic device's load and temperature are too high and that limiting the CPU frequency does not address the high load and high temperature issues, the electronic device can directly kill applications running in the background. Killing background applications by the electronic device can be understood as killing all processes of the background applications and releasing the resources occupied by all processes.
[0083] S105: No processing is performed on the electronic device.
[0084] 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.
[0085] The embodiment of the present application provides an application control method. When the application occupies a large number of 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 does not affect the user experience can be screened out from the application, and the sub-processes of these applications are killed. In this way, on the one hand, because the application whose sub-process is killed is an application that runs normally on the electronic device 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 created 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, which is fast and has a small delay. 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 on the main process and realize the complete functions of the application.
[0086] The following describes the application control method provided by the embodiments of the present application 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.
[0087] FIG2 is a flow chart of an embodiment of an application control method provided by an embodiment of the present application. Referring to FIG2 , the application control method provided by an embodiment of the present application may include:
[0088] 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.
[0089] In some embodiments, the first condition may include at least one of the following:
[0090] 1. The resources occupied by the currently running application are greater than or equal to a first threshold.
[0091] 2. The resources currently occupied by the electronic device are greater than or equal to a second threshold. The resources occupied by the electronic device can be understood as the resources already occupied by the electronic device. The amount or proportion of 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 information about the currently running applications.
[0092] 3. The temperature of the electronic device is greater than or equal to a preset temperature. When the load of the electronic device is high, the temperature of the electronic device increases. In embodiments of the present application, the temperature of the electronic device can be used to indirectly represent 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 a preset temperature, it can be indicated that the load of the electronic device is high. The electronic device can filter out the first target application from the currently running applications based on information about the currently running applications.
[0093] 4. The electronic device is in a scenario of continuous application startup. The method of detecting whether the electronic device is in a scenario of continuous application startup can refer to the description in S301.
[0094] The first condition is described below with examples. Here, the scenario where the first condition includes "the resources occupied by the currently running application are greater than or equal to the first threshold" is described first:
[0095] In some embodiments, the electronic device may periodically obtain resources occupied by currently running applications, or obtain resources occupied by currently running applications at specific times. The currently running applications may include: currently running foreground applications and background applications. In some embodiments, as the electronic device continuously obtains resources occupied by currently running applications, 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.
[0096] 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.
[0097] In the embodiment of the present application, a first threshold value may be pre-set. For example, taking the example of the electronic device being able to obtain the ratio of resources occupied by currently running applications, the first threshold value may be a first preset ratio.
[0098] 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 the first target application from the currently running applications based on the information of the currently running application so as to manage and control the process of the first target application.
[0099] 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 a process of the currently running application, and a status of the currently running application.
[0100] The identification of an application may include, but is not limited to, information such as the application name, icon, package name, etc. that allows users to distinguish different applications.
[0101] 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. For example, 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. For example, 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.
[0102] In addition, when an application running in the background is performing tasks such as uploading, downloading, displaying a floating window, or counting steps, the status of the application running in the background is a perceptible state. In some embodiments, when an application running in the background is performing a task that is perceptible to the user, the status of the application running in the background can be a perceptible state. In some embodiments, the task that is perceptible to the user can be pre-configured, and the electronic device can determine that the status of the application running in the background is a perceptible state in response to the application running in the background performing the task that is perceptible to the user.
[0103] In some embodiments, the adj value of an application process may include the adj value of the application's main process, where the name of the main process is the same as the application's package name. In some embodiments, the adj value of an application process may be the maximum of the adj value of the application's main process and the adj value of the application's child processes. In some embodiments, the adj value of an application process may be the sum of the adj value of the application's main process and the adj value of the application's child processes.
[0104] In some embodiments, a blacklist may be pre-configured 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. 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.
[0105] For example, 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 system application process 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 wallpaper application process dies, the electronic device will not display the wallpaper, affecting the user experience.
[0106] In some embodiments, system-associated applications may include, but are not limited to, input method applications, voice assistants, accessibility assistance applications, dynamic wallpapers, and the like. 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, if 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 continuously cold-started, resulting in a prolonged time for the user to wake up the interface of the input method application, and a poor user experience.
[0107] In some embodiments, the adj value of the process of the currently running application can represent the type of the currently running application. Exemplarily, the adj value of the process of the system application of the electronic device and 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.
[0108] 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. When the adj value of the process of the currently running application is less than or equal to the fifth threshold, the electronic device can determine that the currently running application can be a system application or a resident application, and the electronic device can 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 a foreground application, and the electronic device can 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 a background application, and the electronic device can use the currently running application as the first target application.
[0109] In some embodiments, the adj value of the currently running application process can represent the priority of the currently running application process. For example, an adj threshold can be pre-set. When the information of the currently running application includes the adj value of the currently running application process, the electronic device can use the currently running application with a value greater than the adj threshold as the first target application. In some embodiments, for example, the adj threshold can be a fourth threshold.
[0110] In some embodiments, when the information of the currently running application includes the state of the currently running application, the electronic device may select the currently running application in an imperceptible state as the first target application, rather than the currently running application in a perceptible state. This is done so that if the process of the currently running application in an imperceptible state dies, the user will not be aware of it, thereby not affecting the user experience.
[0111] S202: Terminate the sub-process of the first target application.
[0112] The name of the sub-process of the first target application is different from the package name of the first target application. Exemplarily, the name of the sub-process 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.
[0113] In an 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. Killing the sub-process of the first target application by the electronic device can be understood as: the electronic device deletes the sub-process of the first target application from memory and releases the resources occupied by the sub-process of the first target application.
[0114] 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 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.
[0115] In some embodiments, when an electronic device continuously launches multiple applications, the load on the electronic device may increase in a short period of time because the electronic device needs to allocate resources to the multiple applications. In this scenario, to avoid the problem of applications occupying a large number of electronic device resources, the method of killing the subprocess of the first target application in the embodiment shown in FIG2 may also be used. It should be understood that the scenario of an electronic device continuously launching multiple applications can be understood as: the electronic device is in a scenario where applications are continuously launched.
[0116] The following describes the first condition as an example in which the electronic device is in a scenario where applications are continuously started:
[0117] 3 , the application control method provided in the embodiment of the present application may include:
[0118] S301, detecting that the electronic device meets 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 a 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.
[0119] In an embodiment of the present application, when the electronic device is in a scenario where applications are continuously started, the electronic device may execute S302.
[0120] In some embodiments, when the electronic device satisfies at least one of the following conditions, it is determined that the electronic device is in a scenario where applications are continuously launched:
[0121] 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.
[0122] For example, M may be 5, and the first duration may be 5 seconds. In response to detecting that the electronic device launches five applications continuously, and the time interval between the launches of any two adjacent applications is less than or equal to 5 seconds, it can be determined that the electronic device launches multiple applications continuously, that is, the electronic device is in a scenario of continuous application launch.
[0123] Second, the electronic device starts N applications within the second time period, where N is an integer greater than or equal to 2.
[0124] Exemplarily, the second time duration may be 20 seconds, and N may be 5. In response to detecting that the electronic device continuously launches 5 applications within 20 seconds, it can be determined that the electronic device continuously launches multiple applications, that is, the electronic device is in a scenario where applications are continuously launched.
[0125] In some embodiments, when the electronic device satisfies both the conditions in "one" and "two," it can also be determined that the electronic device is in a scenario where applications are launched continuously. For example, in response to detecting that the electronic device launches five applications continuously within 20 seconds, and the time interval between two adjacent application launches is less than or equal to 5 seconds, it can be determined that the electronic device has launched multiple applications continuously.
[0126] In some embodiments, the startup methods of an application include: hot startup and cold startup. Among them, the electronic device can increase the number of application startups by 1 each time it detects that an application is hot started, and the electronic device can increase the number of application startups by 1 each time it detects that an application is cold started, thereby counting the number of application startups. In the embodiments of the present application, the reason why "hot startup and cold startup" are both regarded as one startup of an application is that in the scenario where the application is continuously started, 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.
[0127] 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 launch of the same application as one launch of the application, and 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 for "not counting the subsequent multiple launches of the same application" is that 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 launched 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 launched again. Therefore, the electronic device does not need to reallocate resources to the application. At this time, the subsequent continuous launch of the application will not cause the problem of high load on the electronic device.
[0128] 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.
[0129] For example, when an electronic device continuously launches Application 1, Application 2, Application 1, Application 3, and Application 1, the application launch method is not limited here. In response to launching Application 1, the electronic device may record the number of application launches as 1. In response to launching Application 2, the electronic device may record the number of application launches as 2. In response to launching Application 1 again, the electronic device may not count the launch of Application 1 as the number of launches, and the electronic device may record the number of application launches as 2. Similarly, in response to launching Application 3, the electronic device may record the number of application launches as 3. In response to launching Application 1 again, the electronic device may record the number of application launches as 3. If other conditions are met, when M is 5 or N is 5, the electronic device may determine that the electronic device is not in a scenario where applications are launched continuously.
[0130] For example, when an electronic device continuously launches Application 1, Application 2, Application 1, Application 3, Application 1, Application 4, and Application 5, the electronic device records the number of application launches as shown in the above example. In response to launching Application 5, the electronic device may record the number of application launches as 5. If other conditions are met, when M is 5 or N is 5, the electronic device may determine that the electronic device is in a scenario of continuous application launches.
[0131] S302: Filter out a first target application from the currently running applications according to information of the currently running applications.
[0132] For S302 , reference may be made to the relevant description in S201 .
[0133] In some embodiments, the electronic device may filter out the first target application from 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 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.
[0134] 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.
[0135] In some embodiments, the second condition may further include any one of the following: not included in the whitelist, not in a perception state.
[0136] 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.
[0137] In some embodiments, the whitelist may be a whitelist pre-set in the electronic device. In some embodiments, the whitelist may include: a whitelist pre-set 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 identifier of the application. In some embodiments, the whitelist may include system applications and system-associated applications.
[0138] 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.
[0139] 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.
[0140] In some embodiments, 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 select the currently running application whose adj value is greater than the fourth threshold and is not in the whitelist as the first target application.
[0141] Exemplarily, when the second condition includes not being in a sensing state, the electronic device may filter out the first target application from currently running applications whose adj values are greater than the fourth threshold and are not in a sensing state. For example, the electronic device may select, as the first target application, an application whose adj value is greater than the fourth threshold and is not in a sensing state.
[0142] In some embodiments, when the second condition includes not being in the whitelist and not being in the perception state, the electronic device may filter out the first target application from 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 select, as the first target application, currently running applications that are not included in the whitelist, have an adj value greater than the fourth threshold, and are not in the perception state.
[0143] In some embodiments, other conditions for screening the first target application may be set and combined with the step of screening the first target application in the present application.
[0144] In some embodiments, the electronic device may be configured with information of unregulated applications and information of regulated applications, as shown in Table 1.
[0145] Table 1
[0146] S303: Terminate the sub-process of the first target application.
[0147] S303 may refer to the description in S202.
[0148] In an embodiment of the present application, when an 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 technical effect as the embodiment shown in Figure 2 above, and reference can be made to the description in the above embodiment.
[0149] In some embodiments, when the electronic device is in a scenario where applications are continuously launched, the electronic device may also determine whether to enable the method of killing the sub-process of the first target application in Figures 2 and 3 based on the load of the electronic device. When the electronic device is in a scenario where applications are continuously launched, for example, the resources occupied by the currently running application may be less than a first threshold. If the sub-process of the first target application is forcibly killed in this case, the electronic device will need to create the sub-process of the first target application after the first target application switches to the foreground.
[0150] The following describes the first condition as follows: "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 a preset temperature), and "the electronic device is in a scenario where applications are continuously started."
[0151] 4 , the application control method provided in the embodiment of the present application may include:
[0152] S401, detecting that the electronic device meets 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 a 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.
[0153] S401 may refer to the description in S301.
[0154] S402: Obtain resources occupied by the currently running application.
[0155] 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.
[0156] 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.
[0157] 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.
[0158] In the embodiment of the present application, the condition of "the first temperature is greater than or equal to the preset temperature" is added, so that the conditions for the electronic device to screen the first target application are more stringent. When the load of the electronic device is high and the temperature is 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.
[0159] S404: Kill the child process of the first target application.
[0160] S402-S404 may refer to the description in S201-S202.
[0161] In one embodiment, referring to FIG. 5 , the process of the electronic device executing the application control method may include:
[0162] Step 1: Detect whether the electronic device is in a scenario where applications are continuously started.
[0163] In some embodiments, an activity management service (AMS) in an electronic device may monitor events to detect whether the electronic device is in a scenario where applications are continuously launched. The AMS monitors whether the electronic device is in a scenario where applications are continuously launched, as described in S301.
[0164] Step 2: Detect that the electronic device is in a scenario where applications are continuously started.
[0165] Step 3: Get the resources occupied by the currently running application.
[0166] In some embodiments, after the electronic device detects that the electronic device is in a scenario where applications are continuously started, it can obtain the resources occupied by the currently running applications every 3 seconds.
[0167] 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.
[0168] Step 5: Determine whether the currently running application is included in the whitelist based on the identifier of the currently running application.
[0169] 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.
[0170] 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.
[0171] Step 8: When the currently running application is in an imperceptible state, kill the child process of the currently running application.
[0172] It should be understood that there is no restriction on the order of the determination steps in steps 5 to 7, and FIG5 is an example.
[0173] The embodiment of the present application has the same technical effect as the embodiment shown in FIG2 above, and reference may be made to the description in the above embodiment.
[0174] 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.
[0175] 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 FIG6 is illustrated by taking S601 - S603 executed after S404 as an example:
[0176] S601: Acquire resources occupied by the electronic device.
[0177] In an embodiment of the present application, after killing the sub-process of the first target application, the electronic device can periodically obtain the resources occupied by the electronic device, or obtain the resources occupied by the electronic device at certain specific times.
[0178] 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.
[0179] 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 resources occupied by the electronic device to the total resources. In the embodiment of the present application, the third threshold can be pre-set. For example, taking the example of the electronic device being able to obtain the proportion of the resources occupied by the electronic device, the third threshold can be the second preset proportion.
[0180] In an embodiment of the present application, in response to the resources occupied by the electronic device being greater than or equal to a third threshold, the electronic device may determine that the resources occupied by the electronic device have further increased. The electronic device may filter out a second target application from the currently running applications based on information about 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.
[0181] 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 .
[0182] S603: Kill all processes of the second target application.
[0183] 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.
[0184] 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.
[0185] 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.
[0186] In a scenario where an electronic device is in a state where applications are continuously started, 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. Currently, when an application is switched to the background, the electronic device can gradually increase the adj value of the application's process. For example, 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. After 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.
[0187] At present, although when an application is switched to the background, the electronic device can increase the adj value of the application's process to above 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 all 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.
[0188] In some embodiments, in order to facilitate the electronic device to promptly release the resources occupied by the process of the application in the background group, when the application is switched to the background, the electronic device can directly switch the group of the application to the background group. In this way, 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. For example, 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.
[0189] In one embodiment, when the electronic device is in a scenario where applications are continuously started, in response to an application being switched to the background, the electronic device may directly switch the group of the application to the background group.
[0190] In some embodiments, when an application is switched to the background, the electronic device can use the application's state and release the resources occupied by the application's target process based on the application's state without killing the target process, thereby reducing the resources occupied by the application. The application's state is different, and the application's target process is different.
[0191] In some embodiments, when the electronic device is in a perceptual state, the first target process may include some sub-processes of the application, which are sub-processes unrelated to the perceptual state of the application. For example, when the application switches to the background, the application plays audio, and these sub-processes may be sub-processes unrelated to playing audio.
[0192] 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.
[0193] 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 application group 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 these sub-processes are sub-processes that are unrelated to the perceptual state of the application. For example, when the application is switched to the background, the application plays audio, and these sub-processes may be sub-processes that are unrelated to playing audio.
[0194] When an application switches to the background, if the electronic device is in an imperceptible state, the electronic device may switch the application's group to a 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. For example, because the application is imperceptible, the second target child process may be a child process of the application.
[0195] In some embodiments, the first target process and the second target process may further include a main process.
[0196] 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.
[0197] 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.
[0198] 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 background application's occupation of the electronic device's resources.
[0199] 7 , the application control method provided in the embodiment of the present application may include:
[0200] S701 , in response to a user operation, controlling the application to switch to the background.
[0201] S702: Identify the status of the application.
[0202] 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.
[0203] S704: When the state of the application is in an imperceptible state, the group of the application is switched to a second group, and resources of the second target process of the application in the second group are released.
[0204] S701-S704 may refer to the above-mentioned related description.
[0205] In an embodiment of the present application, when an application is switched to the background, the electronic device may switch the application's group to the background group. Specifically, for example, when the application is in a perceptible state, the electronic device may switch the application to a first group, and when the application is in an imperceptible state, the electronic device may switch the application to a second group. In this way, the electronic device can promptly release the resources occupied by the target process of the application, thereby reducing the resource usage of the electronic device.
[0206] 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.
[0207] In one embodiment, the present application also provides an electronic device. Referring to FIG8 , the electronic device may include a processor 801 (e.g., 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 storage device. The memory 802 may store various instructions for performing various processing functions and implementing the method steps of the present application.
[0208] Optionally, the electronic device involved in this application may further include: a power supply 803, a communication bus 804, and a communication port 805. The communication port 805 is used to enable communication between the electronic device and other peripheral devices. In the embodiment of the present application, the memory 802 is used to store computer-executable program code, which includes instructions; when the processor 801 executes the instructions, the instructions cause the processor 801 of the electronic device to perform the actions in the above-mentioned method embodiment. The implementation principles and technical effects are similar and will not be repeated here.
[0209] 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), one or more digital signal processors (DSPs), or one or more field programmable gate arrays (FPGAs). For another example, when a module is implemented by scheduling program code through a processing element, the processing element may be a general-purpose processor, such as a central processing unit (CPU) or other processor that can call program code, 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).
[0210] In the above embodiments, it can be implemented in whole or in part by software, hardware, firmware or any combination thereof. When software is used for implementation, 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 the computer program instructions are loaded and executed 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 device. 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, computer, server or data center to another website, computer, server or data center via a wired (e.g., coaxial cable, optical fiber, digital subscriber line (DSL)) or wireless (e.g., infrared, wireless, microwave, etc.) method. The computer-readable storage medium can be any available medium that a computer can access or a data storage device such as a server or data center that includes one or more available media integrations. 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 drive (SSD)).
[0211] The term "plurality" in this article refers to two or more. The term "and / or" in this article is merely a description of the association relationship of associated objects, indicating that three relationships may exist. For example, A and / or B can represent three situations: 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 the description, and cannot be understood as indicating or implying relative importance, nor can they be understood as indicating or implying order.
[0212] It will be understood that the various numerical numbers involved in the embodiments of the present application are merely distinctions for the convenience of description and are not intended to limit the scope of the embodiments of the present application.
[0213] 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 the second group is released. The resources occupied by the second target process of the application, 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.
Citation Information
Patent Citations
Process management method and device, memory medium and electronic device
CN107402808A
Process processing method and device
CN111831449A
Process processing method and device and electronic equipment
CN112084058A
AAR-based process processing method and apparatus, and electronic device
CN115373869A
Memory management method and system of Android system, electronic equipment and storage medium
CN115686808A
Cited By
Application starting control method and device, electronic equipment and storage medium
CN120631460A