CN109375995B - Application freezing method and device, storage medium and electronic equipment - Google Patents

Application freezing method and device, storage medium and electronic equipment Download PDF

Info

Publication number
CN109375995B
CN109375995B CN201811122265.3A CN201811122265A CN109375995B CN 109375995 B CN109375995 B CN 109375995B CN 201811122265 A CN201811122265 A CN 201811122265A CN 109375995 B CN109375995 B CN 109375995B
Authority
CN
China
Prior art keywords
application
freezing
state
rate
freezing rate
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Active
Application number
CN201811122265.3A
Other languages
Chinese (zh)
Other versions
CN109375995A (en
Inventor
陈岩
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Guangdong Oppo Mobile Telecommunications Corp Ltd
Original Assignee
Guangdong Oppo Mobile Telecommunications Corp Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Guangdong Oppo Mobile Telecommunications Corp Ltd filed Critical Guangdong Oppo Mobile Telecommunications Corp Ltd
Priority to CN201811122265.3A priority Critical patent/CN109375995B/en
Publication of CN109375995A publication Critical patent/CN109375995A/en
Application granted granted Critical
Publication of CN109375995B publication Critical patent/CN109375995B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/46Multiprogramming arrangements
    • G06F9/48Program initiating; Program switching, e.g. by interrupt
    • G06F9/4806Task transfer initiation or dispatching
    • G06F9/4843Task transfer initiation or dispatching by program, e.g. task dispatcher, supervisor, operating system
    • G06F9/485Task life-cycle, e.g. stopping, restarting, resuming execution

Abstract

The application relates to an application freezing method and device, electronic equipment and a computer readable storage medium, wherein a preset freezing rate of an application and an actual freezing rate of the application are obtained, and when the actual freezing rate is smaller than the preset freezing rate, a corresponding freezing strategy is configured for the application. And freezing the application according to the freezing strategy so that the actual freezing rate is greater than or equal to the preset freezing rate. By comparing the actual freezing rate of the application with the preset freezing rate, whether the actual freezing rate of the application reaches the preset freezing rate can be accurately quantified according to the comparison result. And if the preset freezing rate is not reached, configuring a corresponding freezing strategy, and adjusting the actual freezing rate until the actual freezing rate is greater than or equal to the preset freezing rate. The obtained preset freezing rate and the actual freezing rate of the application can provide accurate data support for the establishment of the freezing strategy, so that the established freezing strategy can achieve a good freezing effect.

Description

Application freezing method and device, storage medium and electronic equipment
Technical Field
The present application relates to the field of computer technologies, and in particular, to an application freezing method and apparatus, a storage medium, and an electronic device.
Background
With the popularization of electronic devices and the rapid development of mobile internet, users of electronic devices are increasingly using more and more. At present, as more and more application programs and more functions are installed on electronic equipment, resources on the electronic equipment are less and less enough, and the problems of unsmooth and unsmooth use and the like often occur in the use process of a user. Therefore, it is necessary to freeze some applications in the background on the electronic device to reduce the consumption of resources, so that the resources on the electronic device can better meet the normal use of other applications. However, the current freezing strategy cannot well freeze the application on the electronic device, so how to optimize the freezing strategy is always an urgent problem to be solved.
Disclosure of Invention
The embodiment of the application freezing method and device, the storage medium and the electronic device can optimize the application freezing strategy to achieve a good freezing effect.
An application freezing method comprising:
acquiring a preset freezing rate of an application and an actual freezing rate of the application;
when the actual freezing rate is smaller than the preset freezing rate, configuring a corresponding freezing strategy for the application;
freezing the application according to the freezing strategy so that the actual freezing rate is greater than or equal to the preset freezing rate.
An application freezing apparatus, the apparatus comprising:
the freezing rate acquisition module is used for acquiring a preset freezing rate of the application and an actual freezing rate of the application;
the freezing strategy configuration module is used for configuring a corresponding freezing strategy for the application when the actual freezing rate is smaller than the preset freezing rate;
and the freezing module is used for freezing the application according to the freezing strategy so as to enable the actual freezing rate to be greater than or equal to the preset freezing rate.
A computer-readable storage medium, on which a computer program is stored which, when being executed by a processor, carries out the steps of the application freezing method as described above.
An electronic device comprising a memory, a processor and a computer program stored on the memory and executable on the processor, the processor executing the computer program to perform the steps of the application freezing method as described above.
The application freezing method and device, the storage medium and the electronic equipment acquire the preset freezing rate of the application and the actual freezing rate of the application, and configure the corresponding freezing strategy for the application when the actual freezing rate is smaller than the preset freezing rate. And freezing the application according to the freezing strategy so that the actual freezing rate is greater than or equal to the preset freezing rate. By comparing the actual freezing rate of the application with the preset freezing rate, whether the actual freezing rate of the application reaches the preset freezing rate can be accurately quantified according to the comparison result. And if the preset freezing rate is not reached, configuring a corresponding freezing strategy, and adjusting the actual freezing rate until the actual freezing rate is greater than or equal to the preset freezing rate. The obtained preset freezing rate and the actual freezing rate of the application can provide accurate data support for the establishment of the freezing strategy, so that the established freezing strategy can achieve a good freezing effect.
Drawings
In order to more clearly illustrate the embodiments of the present application or the technical solutions in the prior art, the drawings used in the description of the embodiments or the prior art will be briefly described below, it is obvious that the drawings in the following description are only some embodiments of the present application, and for those skilled in the art, other drawings can be obtained according to the drawings without creative efforts.
FIG. 1 is a diagram of the internal structure of an electronic device in one embodiment;
FIG. 2 is a partial block diagram of a system in an electronic device in one embodiment;
FIG. 3 is a flow diagram of an application freezing method in one embodiment;
FIG. 4 is a flow diagram of a method of obtaining an actual freeze rate of an application in one embodiment;
FIG. 5 is a time-axis diagram of the state change of an application and the time corresponding to the state change;
FIG. 6 is a flow diagram of a method for obtaining a preset freeze rate for an application in one embodiment;
FIG. 7 is a schematic diagram of an embodiment of a freezing apparatus;
FIG. 8 is a schematic diagram of the freeze rate acquisition module of FIG. 7;
fig. 9 is a block diagram of a partial structure of a cellular phone related to an electronic device provided in one embodiment.
Detailed Description
In order to make the objects, technical solutions and advantages of the present application more apparent, the present application is described in further detail below with reference to the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are merely illustrative of the present application and are not intended to limit the present application.
Fig. 1 is a schematic diagram of an internal structure of an electronic device in one embodiment. As shown in fig. 1, the electronic device includes a processor, a memory, and a network interface connected by a system bus. Wherein, the processor is used for providing calculation and control capability and supporting the operation of the whole electronic equipment. The memory is used for storing data, programs and the like, and the memory stores at least one computer program which can be executed by the processor to realize the scene recognition method suitable for the electronic device provided in the embodiment of the application. The Memory may include a non-volatile storage medium such as a magnetic disk, an optical disk, a Read-Only Memory (ROM), or a Random-Access-Memory (RAM). For example, in one embodiment, the memory includes a non-volatile storage medium and an internal memory. The non-volatile storage medium stores an operating system and a computer program. The computer program is executable by a processor for implementing an application freezing method as provided in the following embodiments. The internal memory provides a cached execution environment for the operating system computer programs in the non-volatile storage medium. The network interface may be an ethernet card or a wireless network card, etc. for communicating with an external electronic device. The electronic device may be a mobile phone, a tablet computer, or a personal digital assistant or a wearable device, etc.
In one embodiment, as shown in FIG. 2, a partial architecture diagram of an electronic device is provided. The architecture system of the electronic device includes a JAVA space layer 210, a local framework layer 220, and a Kernel space layer 230. The JAVA space layer may include a freezing management application 212, and the electronic device may implement a freezing policy for each application through the freezing management application 212, and perform a freezing operation on the related application consuming power in the background. A resource priority and restriction management module 222 and a platform freeze management module 224 are contained in the local framework layer 220. The electronic device can maintain different applications in organizations with different priorities and different resources in real time through the resource priority and restriction management module 222, and adjust the resource groups of the application programs according to the requirements of the upper layer, thereby achieving the effects of optimizing performance and saving power consumption. The electronic device may allocate, according to the length of the freezing time, the task that the background can be frozen to the freezing layers corresponding to the preset different levels through the platform freezing management module 224, and optionally, the freezing layers may include three, which are: CPU limited sleep mode, CPU frozen sleep mode, process deep frozen mode.
The CPU sleep-restricted mode is to restrict CPU resources occupied by related processes, so that the related processes occupy less CPU resources, and the vacant CPU resources are inclined to other processes which are not frozen, so that the occupation of the CPU resources is restricted, and the occupation of network resources and I/O interface resources by the processes is correspondingly restricted; the CPU freezing sleep mode means that related processes are forbidden to use the CPU, the occupation of a memory is reserved, and when CPU resources are forbidden to use, corresponding network resources and I/O interface resources are also forbidden to use; the process deep freezing mode is to further recycle the memory resources occupied by the relevant processes except for forbidding the use of CPU resources, and the recycled memory can be used by other processes.
The kernel space layer 230 includes a UID management module 231, a Cgroup module 232, a Binder management module 233, a process memory recycling module 234, and a freeze timeout exit module 235. The UID management module 231 is configured to manage or freeze resources of the third-party application based on a User Identifier (UID) of the application. Compared with the Process control based on the Process Identifier (PID), the unified management of the resources of the application of one user is facilitated through the UID. The Cgroup module 232 is used to provide a complete set of resource restriction mechanisms related to Central Processing Unit (CPU), CPU set, memory, input/output (I/O) and Net. The Binder management and control module 233 is used for controlling the priority of background Binder communication. The interface module of the local framework layer 220 includes a binder interface that is issued to the upper layer, and the framework or application of the upper layer sends a resource restriction or freezing instruction to the resource priority and restriction management module 222 and the platform freezing management module 224 through the provided binder interface. The process memory recycling module 234 is used to implement a deep process freezing mode, so that when a third-party application is in a frozen state for a long time, a file area of a process is mainly released, thereby achieving a memory-saving module and increasing the speed of the application when the application is started next time. The freeze timeout exit module 235 is used to resolve the exception generated by the freeze timeout scenario. Through the above-mentioned architecture, the application freezing method in the embodiments of the present application can be implemented.
In one embodiment, as shown in fig. 3, an application freezing method is provided, which is described by taking the application of the method to the electronic device in fig. 1 as an example, and includes:
and step 320, acquiring a preset freezing rate of the application and an actual freezing rate of the application.
Step 320 includes step 321 of obtaining an actual freeze rate of the application and step 322 of obtaining a preset freeze rate of the application. Many applications are generally installed on the electronic device, and when a user opens many applications for use, the resources are not enough. At this time, some applications on the electronic device can be frozen to reduce the consumption of resources, so that the resources on the electronic device can better meet the normal use of other application programs. Specifically, when a freezing policy is formulated for each application program, a preset freezing rate and an actual freezing rate of the application program (i.e., application) are first acquired. The preset freezing rate is the average freezing rate of the application obtained by performing big data analysis on historical data obtained by tracking and recording the running state of the application on the server. Specifically, the preset freezing rate is to obtain multiple state switching data tables generated by the application running on different electronic devices from a database on the server. And calculating the average freezing rate of the application according to the plurality of state switching data tables, and taking the average freezing rate as a preset freezing rate. The state change of the application and the time corresponding to the state change are recorded in the state switching data table, and the states of the application comprise a foreground state, a background state, a frozen state, an exit state and the like.
The actual freezing rate is a freezing rate that describes a certain application on a certain electronic device or on certain electronic devices and is within a certain time period. The actual freezing rate of the application can be obtained by obtaining the duration of the application in the background state and the duration of the application in the freezing state in a certain time period on a certain electronic device or on certain electronic devices. And calculating the actual freezing rate of the application according to the acquired duration of the application in the background state and the duration of the application in the freezing state in the time period.
And 340, configuring a corresponding freezing strategy for the application when the actual freezing rate is less than the preset freezing rate.
When the actual freezing rate of the application is smaller than the preset freezing rate, the actual freezing rate of the application is lower than the average freezing rate obtained through big data analysis, namely the preset freezing rate, and then a corresponding freezing strategy needs to be configured for the application. If the comparison result shows that the actual freezing rate of the application is greater than or equal to the preset freezing rate, the actual freezing rate of the application is in accordance with the requirement, and the purpose of saving resources is achieved.
And step 360, freezing the application according to the freezing strategy so that the actual freezing rate is greater than or equal to the preset freezing rate.
And when the comparison result shows that the actual freezing rate of the application is smaller than the preset freezing rate, the actual freezing rate of the application is lower than the average freezing rate obtained through big data analysis, namely the preset freezing rate, and a corresponding freezing strategy needs to be configured for the application. The configured freezing strategy can control the actual freezing rate of the application to be greater than or equal to the preset freezing rate, so that the requirements are met, and the purpose of saving resources is achieved.
In the embodiment of the application, the preset freezing rate is an average freezing rate of an application obtained by performing big data analysis on historical data obtained by tracking and recording the running state of the application on a server. The actual freeze rate is a freeze rate that describes a certain application on a certain electronic device or on certain electronic devices and over a certain period of time. By comparing the actual freezing rate of the application with the preset freezing rate, whether the actual freezing rate of the application reaches the preset freezing rate can be accurately quantified according to the comparison result. And if the preset freezing rate is not reached, configuring a corresponding freezing strategy, and adjusting the actual freezing rate until the actual freezing rate is greater than or equal to the preset freezing rate. The obtained preset freezing rate and the actual freezing rate of the application can provide accurate data support for the establishment of the freezing strategy, so that the established freezing strategy can achieve a good freezing effect.
In one embodiment, step 321, obtaining an actual freeze rate of the application includes:
in step 321b, the duration of the application in the background state and the duration of the application in the frozen state are obtained.
The state change of the application and the time corresponding to the state change are recorded in the state switching data table, and the states of the application comprise a foreground state, a background state, a frozen state, an exit state and the like. The state switching data table corresponding to the application on a certain electronic device or on certain electronic devices can be acquired from the server or directly from the electronic devices. The duration of the application in the background state can be obtained from the state switching data tables, and then the duration of the application in the frozen state is obtained.
Specifically, the recording process of the data in the state switching data table is as follows:
recording when the application enters the background state: when the application enters the background, the upper layer informs the Native layer of the application entering the background through the interface, and the Native layer records the time when the application enters the background through the code.
Recording the time when the application enters the foreground state: when the application enters the foreground, the upper layer informs the Native layer of the application entering the foreground at the moment through the interface, and the Native layer records the moment when the application enters the foreground through the code.
Recording the moment when the application enters the frozen state: when the application is frozen, the Native layer records the time when the application is frozen through the code.
Recording the moment when the application enters the exit state: when the application enters the exit state, namely the process of the application exits, the Native layer receives a message that the kernel notifies the process to exit, and when all processes in the application exit, the exit time of the application is recorded as the time when the application enters the exit state.
Thus, each state change of the application and the time corresponding to the state change are recorded and stored in a data table form. Therefore, each application is provided with a corresponding data table (list table), and when the actual freezing rate of a certain application needs to be calculated, the list table is traversed to count the duration of the application in the background state and the duration of the application in the freezing state. And when the application state is switched to the foreground state again after passing through other states from the foreground state, or the application is switched to an exit state from the foreground state after passing through other states, triggering one-time actual freezing rate calculation.
In step 321c, the actual freezing rate of the application is calculated according to the duration of the application in the background state and the duration of the application in the freezing state.
And calculating the actual freezing rate of the application according to the duration of the application in the background state and the duration of the application in the freezing state, which are acquired from the state switching data table. Specifically, the actual freezing rate of the application is obtained by dividing the duration of the application in the freezing state by the duration of the application in the background state.
In the embodiment of the application, when the running state of the application changes, the state change and the time information of the state change are recorded on the state switching data table, so that when the application state is switched to the foreground state again after passing through other states from the foreground state, or when the application is switched to the exit state from the foreground state through other states, one-time calculation of the actual freezing rate is triggered. For example, the actual freezing rate of an application of an electronic device can be calculated from a state switching data table of the application. The actual freezing rate of an application of the plurality of electronic devices may be calculated from a state switching data table of the application. And specifically quantizing the duration of a certain application in the background state and the duration of the application in the frozen state through the state switching data table, so as to specifically quantize the actual freezing rate. And finally, accurately evaluating the freezing effect of the application by combining the actual freezing rate with the preset freezing rate, so as to judge whether the existing freezing strategy of the application meets the preset requirement, and further optimizing the existing freezing strategy.
In one embodiment, as shown in fig. 4, before obtaining the duration that the application is in the background state and the duration that the application is in the frozen state in step 321b, the method includes:
in step 321a, the state change of the application and the time corresponding to the state change are obtained from the state switching data table corresponding to the application, where the state of the application includes a foreground state, a background state, a frozen state, and an exit state.
First, the state change of the application and the time corresponding to the state change are acquired from the state switching data table corresponding to the application, that is, a time axis is recorded in the state switching data table, and the time corresponding to the state change and the state change is recorded on the time axis. The state of the application includes a foreground state, a background state, a frozen state, and an exit state, and of course, other states may be included according to different definitions.
For example, as shown in fig. 5(a), the state change of the application and the time corresponding to the state change are acquired from the state switching data table corresponding to the application. And the application enters a foreground state at the time t1, is switched to a background state at the time t2, is switched to a frozen state at the time t3 and is switched to a foreground/exit state at the time t 4. The frozen state is a state in a background state, and thus, the duration of the application in the background state is obtained as t4-t2, and the duration of the application in the frozen state is obtained as t4-t 3. Thus, the actual freezing rate of the application is ((t4-t3)/t4-t2)) 100% by dividing the duration of the application in the freezing state by the duration of the application in the background state.
For example, as shown in fig. 5(b), the state change of the application and the time corresponding to the state change are acquired from the state switching data table corresponding to the application. And the application enters a foreground state at the time t1, is switched to a background state at the time t2, is switched to a frozen state at the time t3, is switched to the background state at the time t4, and is switched to the foreground/exit state at the time t 5. Thus, the duration of the application in the background state is obtained as t5-t2, and the duration of the application in the frozen state is obtained as t4-t 3. Thus, the actual freezing rate of the application is ((t4-t3)/t5-t2)) 100% by dividing the duration of the application in the freezing state by the duration of the application in the background state.
In one case, when the state of the application enters the foreground state at time t1 and then directly switches from the foreground state to the exit state at time t2, the duration of the application in the background state is 0, and the duration of the application in the frozen state is also 0, so that the freezing rate does not need to be calculated at this time. When the state of the application enters a foreground state at the time t1, the state is switched to a background state at the time t2, the state is directly switched to a foreground/exit state from the background state at the time t3, the time length of the application in the background state is t3-t2, the time length of the application in the frozen state is 0, and therefore the actual freezing rate is calculated to be 0 at this time.
In one case, when the state of the application enters the frozen state at time t1, and then directly switches from the frozen state to the background/foreground state at time t2, the time duration of the application in the background state is t2-t1, and the time duration of the application in the frozen state is also t2-t1, so that the actual freezing rate is calculated to be 100%. Of course, the above state changes are not exhaustive, and the actual freezing rate may be calculated accordingly based on the state changes that occur.
In the embodiment of the application, the state change of the application and the time corresponding to the state change are firstly obtained from the state switching data table corresponding to the application, and then the duration of the application in the background state and the duration of the application in the frozen state are correspondingly calculated according to the state change condition. And finally, further calculating the actual freezing rate of the application. A detailed calculation method is given for calculating the actual freezing rate so as to directly perform calculation according to the calculation method.
In one embodiment, step 340, when the actual freezing rate is less than the preset freezing rate, configuring a corresponding freezing policy for the application, including:
when the actual freezing rate is smaller than the preset freezing rate, analyzing the awakening condition of the application converted from the freezing state to the non-freezing state to obtain an analysis conclusion;
reconfiguring the partial wake conditions to non-wake conditions according to the analysis conclusion;
step 360, freezing the application according to the freezing strategy to make the actual freezing rate greater than or equal to the preset freezing rate, including:
and freezing the application according to the reconfigured non-awakening condition so that the actual freezing rate is greater than or equal to the preset freezing rate.
Specifically, when the preset freezing rate of the application and the actual freezing rate of the application are obtained and compared in size, and the actual freezing rate of the application is smaller than the preset freezing rate, analyzing the awakening condition of the application converted from the freezing state to the non-freezing state. And reconfiguring the awakening condition which is repeated or has no meaning to the user, and configuring the awakening condition as a non-awakening condition, so that the existing freezing strategy of the application is optimized, and the time of the application in the frozen state is prolonged. Freezing the application according to the reconfigured non-wakeup condition, and calculating the actual freezing rate of the application after the wakeup condition is reconfigured again until the actual freezing rate is greater than or equal to the preset freezing rate.
In the embodiment of the application, when the actual freezing rate is smaller than the preset freezing rate, the wake-up condition for switching the application from the freezing state to the non-freezing state is analyzed, and some repeated wake-up conditions or wake-up conditions which are not meaningful to a user are reconfigured to be configured as the non-wake-up conditions. The freezing strategy is continuously optimized until the actual freezing rate is greater than or equal to the preset freezing rate. The method reconfigures some repeated or meaningless awakening conditions for the user, and configures the awakening conditions into non-awakening conditions, so that the utilization rate of resources is improved, and the normal use of the user can be ensured.
In one embodiment, as shown in fig. 6, step 322, obtaining a preset freeze rate of an application includes:
in step 322a, a plurality of status switching data tables generated by the application running on different electronic devices are obtained from the database.
The running state of applications installed on each electronic device can be tracked on the server, and the applications can be installed on different electronic devices for users to use. And further forming a state switching data table by the tracked data, and storing the switching data table corresponding to each electronic device in a database. In this way, the database stores a plurality of state switching data tables. And acquiring a plurality of state switching data tables generated by running the application on different electronic equipment from the database.
And 322b, calculating the average freezing rate of the application according to the plurality of state switching data tables, and taking the average freezing rate as a preset freezing rate.
Specifically, the state change and the time data corresponding to the state change in the first process of switching the application from the foreground state to the foreground state again and the second process of switching the application from the foreground state to the exit state are acquired from the multiple state switching data tables. And respectively acquiring the duration of the background state and the duration of the frozen state in the first process and the second process from the state change in the first process and the second process and the time data corresponding to the state change. And dividing the duration of the application in the frozen state by the duration of the application in the background state to obtain the freezing rate of the application. And averaging all the calculated freezing rates to obtain an average freezing rate, and taking the average freezing rate as a preset freezing rate.
In the embodiment of the application, in the state switching data table of the application collected from each electronic device installed with the application on the server, when it is detected that the application is completely switched from the foreground state to the foreground state again once or it is detected that the application is completely switched from the foreground state to the exit state once, a calculation of the freezing rate is triggered once. The freezing rate thus calculated is the effective freezing rate. And averaging all the calculated effective freezing rates to obtain an average freezing rate, and taking the average freezing rate as a preset freezing rate of the application. The preset freezing rate obtained in the way is obtained through big data analysis, and the method is high in accuracy and wide in applicability.
In one embodiment, calculating an average freezing rate of the application according to the multiple state switching data tables, and taking the average freezing rate as a preset freezing rate includes:
acquiring state changes and time data corresponding to the state changes in a first process of switching the application from the foreground state to the foreground state again and a second process of switching the application from the foreground state to the quitting state from the multiple state switching data tables;
respectively acquiring the duration in the background state and the duration in the frozen state in the first process and the second process from the state change in the first process and the second process and the time data corresponding to the state change;
dividing the duration of the application in the frozen state by the duration of the application in the background state to obtain the freezing rate of the application;
averaging all the calculated freezing rates to obtain an average freezing rate, and taking the average freezing rate as a preset freezing rate.
Specifically, for example, as shown in fig. 5(a), the state change of the application and the time corresponding to the state change are acquired from the state switching data table corresponding to the application. And the application enters a foreground state at the time t1, is switched to a background state at the time t2, is switched to a frozen state at the time t3 and is switched to a foreground/exit state at the time t 4. The frozen state is a state in a background state, and thus, the duration of the application in the background state is obtained as t4-t2, and the duration of the application in the frozen state is obtained as t4-t 3. Thus, the actual freezing rate of the application is ((t4-t3)/t4-t2)) 100% by dividing the duration of the application in the freezing state by the duration of the application in the background state. The switching of the middle application from the foreground state to the foreground state again through the other state is a first process, and the switching of the middle application from the foreground state to the exit state through the other state is a second process.
For example, as shown in fig. 5(b), the state change of the application and the time corresponding to the state change are acquired from the state switching data table corresponding to the application. And the application enters a foreground state at the time t1, is switched to a background state at the time t2, is switched to a frozen state at the time t3, is switched to the background state at the time t4, and is switched to the foreground/exit state at the time t 5. Thus, the duration of the application in the background state is obtained as t5-t2, and the duration of the application in the frozen state is obtained as t4-t 3. Thus, the actual freezing rate of the application is ((t4-t3)/t5-t2)) 100% by dividing the duration of the application in the freezing state by the duration of the application in the background state. The switching of the middle application from the foreground state to the foreground state again through the other state is a first process, and the switching of the middle application from the foreground state to the exit state through the other state is a second process.
And finally, averaging all the freezing rates calculated by each first process and each second process in the applied state switching data table to obtain an average freezing rate, and taking the average freezing rate as a preset freezing rate.
In the embodiment of the present application, first, from the multiple state switching data tables corresponding to the application, when it is detected that the application is switched from the foreground state to the foreground state again for one time, the process is obtained as the first process, or when it is detected that the application is switched from the foreground state to the quit state for one time, the process is obtained as the second process. And calculating the freezing rate of all the first processes and all the second processes of the application, and then averaging all the freezing rates of the application to obtain the average freezing rate which is used as the preset freezing rate. The preset freezing rate obtained in the way is obtained through big data analysis, and the method is high in accuracy and wide in applicability. And then comparing the actual freezing rate of the application on certain electronic equipment with a preset freezing rate, and freezing the application by adopting a corresponding freezing optimization strategy according to a comparison result so that the actual freezing rate of the application on the electronic equipment is finally greater than or equal to the preset freezing rate. Therefore, certain application programs in the background are frozen on the electronic equipment to reduce the consumption and occupation of resources, so that the resources on the electronic equipment can better meet the normal use of other application programs, and the problems of unsmooth and unsmooth use and the like are reduced.
In one embodiment, as shown in fig. 7, there is provided an application freezing apparatus 700 comprising: a freezing rate acquisition module 720, a freezing strategy formulation module 740, and a freezing module 760. Wherein the content of the first and second substances,
a freezing rate obtaining module 720, configured to obtain a preset freezing rate of the application and an actual freezing rate of the application;
a freezing strategy configuration module 740, configured to configure a corresponding freezing strategy for the application when the actual freezing rate is less than a preset freezing rate;
a freezing module 760 for freezing the application according to the freezing policy so that the actual freezing rate is greater than or equal to the preset freezing rate.
In one embodiment, as shown in fig. 8, the freeze rate obtaining module 720 includes an actual freeze rate obtaining module 722 and a preset freeze rate obtaining module 724.
The actual freezing rate obtaining module 722 is configured to obtain a duration that the application is in the background state and a duration that the application is in the freezing state; and calculating the actual freezing rate of the application according to the time length of the application in the background state and the time length of the application in the freezing state.
In an embodiment, the actual freezing rate obtaining module 722 is further configured to obtain, from a state switching data table corresponding to the application, a state change of the application and a time corresponding to the state change, where the state of the application includes a foreground state, a background state, a freezing state, and an exit state.
In one embodiment, the actual freeze rate obtaining module 722 is further configured to obtain the actual freeze rate of the application by dividing the duration of the application in the freeze state by the duration of the application in the background state.
In one embodiment, the freezing policy configuration module 740 is further configured to analyze the wake-up condition for the application to transition from the frozen state to the non-frozen state when the actual freezing rate is less than the preset freezing rate, so as to obtain an analysis conclusion; reconfiguring the partial wake conditions to non-wake conditions according to the analysis conclusion;
the freezing module 760 is further configured to freeze the application according to the reconfigured non-wakeup condition, so that the actual freezing rate is greater than or equal to the preset freezing rate.
In one embodiment, the preset freezing rate obtaining module 724 is configured to obtain multiple state switching data tables generated by running applications on different electronic devices from a database; and calculating the average freezing rate of the application according to the plurality of state switching data tables, and taking the average freezing rate as a preset freezing rate.
In an embodiment, the preset freezing rate obtaining module 724 is further configured to obtain, from the multiple state switching data tables, state changes and time data corresponding to the state changes in a first process in which the application is switched from the foreground state to the foreground state again and in a second process in which the application is switched from the foreground state to the exited state;
respectively acquiring the duration in the background state and the duration in the frozen state in the first process and the second process from the state change in the first process and the second process and the time data corresponding to the state change;
dividing the duration of the application in the frozen state by the duration of the application in the background state to obtain the freezing rate of the application;
averaging all the calculated freezing rates to obtain an average freezing rate, and taking the average freezing rate as a preset freezing rate.
The division of the modules in the application freezing apparatus is only used for illustration, and in other embodiments, the application freezing apparatus may be divided into different modules as needed to complete all or part of the functions of the application freezing apparatus.
In one embodiment, a computer-readable storage medium is provided, on which a computer program is stored, which, when being executed by a processor, carries out the steps of the application freezing method provided by the above embodiments.
In one embodiment, an electronic device is provided, which includes a memory, a processor, and a computer program stored on the memory and executable on the processor, and when the processor executes the computer program, the steps of the application freezing method provided in the above embodiments are implemented.
Embodiments of the present application further provide a computer program product, which when run on a computer, causes the computer to execute the steps of the application freezing method provided in the foregoing embodiments.
The embodiment of the application also provides the electronic equipment. As shown in fig. 9, for convenience of explanation, only the parts related to the embodiments of the present application are shown, and details of the technology are not disclosed, please refer to the method part of the embodiments of the present application. The electronic device may be any terminal device including a mobile phone, a tablet computer, a PDA (Personal Digital Assistant), a POS (Point of Sales), a vehicle-mounted computer, a wearable device, and the like, taking the electronic device as the mobile phone as an example:
fig. 9 is a block diagram of a partial structure of a mobile phone related to an electronic device provided in an embodiment of the present application. Referring to fig. 9, the handset includes: radio Frequency (RF) circuit 910, memory 920, input unit 930, display unit 940, sensor 950, audio circuit 990, wireless fidelity (WiFi) module 970, processor 980, and power supply 990. Those skilled in the art will appreciate that the handset configuration shown in fig. 9 is not intended to be limiting and may include more or fewer components than those shown, or some components may be combined, or a different arrangement of components.
The RF circuit 910 may be used for receiving and transmitting signals during information transmission or communication, and may receive downlink information of a base station and then process the downlink information to the processor 980; the uplink data may also be transmitted to the base station. Typically, the RF circuitry includes, but is not limited to, an antenna, at least one Amplifier, a transceiver, a coupler, a Low Noise Amplifier (LNA), a duplexer, and the like. In addition, the RF circuit 910 may also communicate with networks and other devices via wireless communication. The wireless communication may use any communication standard or protocol, including but not limited to Global System for Mobile communication (GSM), General Packet Radio Service (GPRS), Code Division Multiple Access (CDMA), Wideband Code Division Multiple Access (WCDMA), Long Term Evolution (LTE)), e-mail, Short Messaging Service (SMS), and the like.
The memory 920 may be used to store software programs and modules, and the processor 980 may execute various functional applications and data processing of the mobile phone by operating the software programs and modules stored in the memory 920. The memory 920 may mainly include a program storage area and a data storage area, wherein the program storage area may store an operating system, an application program required for at least one function (such as an application program for a sound playing function, an application program for an image playing function, and the like), and the like; the data storage area may store data (such as audio data, an address book, etc.) created according to the use of the mobile phone, and the like. Further, the memory 920 may include high speed random access memory, and may also include non-volatile memory, such as at least one magnetic disk storage device, flash memory device, or other volatile solid state storage device.
The input unit 930 may be used to receive input numeric or character information and generate key signal inputs related to user settings and function control of the cellular phone 900. Specifically, the input unit 930 may include a touch panel 931 and other input devices 932. The touch panel 931, which may also be referred to as a touch screen, may collect a touch operation performed by a user on or near the touch panel 931 (e.g., a user operating the touch panel 931 or near the touch panel 931 by using a finger, a stylus, or any other suitable object or accessory), and drive the corresponding connection device according to a preset program. In one embodiment, the touch panel 931 may include two parts of a touch detection device and a touch controller. The touch detection device detects the touch direction of a user, detects a signal brought by touch operation and transmits the signal to the touch controller; the touch controller receives touch information from the touch sensing device, converts the touch information into touch point coordinates, sends the touch point coordinates to the processor 980, and can receive and execute commands sent by the processor 980. In addition, the touch panel 931 may be implemented by various types, such as a resistive type, a capacitive type, an infrared ray, and a surface acoustic wave. The input unit 930 may include other input devices 932 in addition to the touch panel 931. In particular, other input devices 932 may include, but are not limited to, one or more of a physical keyboard, function keys (e.g., volume control keys, switch keys, etc.), and the like.
The display unit 940 may be used to display information input by the user or information provided to the user and various menus of the mobile phone. The display unit 940 may include a display panel 941. In one embodiment, the Display panel 941 may be configured in the form of a Liquid Crystal Display (LCD), an Organic Light-Emitting Diode (OLED), or the like. In one embodiment, the touch panel 931 may overlay the display panel 941, and when the touch panel 931 detects a touch operation thereon or nearby, the touch operation is transmitted to the processor 980 to determine the type of touch event, and then the processor 980 provides a corresponding visual output on the display panel 941 according to the type of touch event. Although in fig. 9, the touch panel 931 and the display panel 941 are two independent components to implement the input and output functions of the mobile phone, in some embodiments, the touch panel 931 and the display panel 941 may be integrated to implement the input and output functions of the mobile phone.
Cell phone 900 may also include at least one sensor 950, such as a light sensor, motion sensor, and other sensors. Specifically, the light sensor may include an ambient light sensor that adjusts the brightness of the display panel 941 according to the brightness of ambient light, and a proximity sensor that turns off the display panel 941 and/or backlight when the mobile phone is moved to the ear. The motion sensor can comprise an acceleration sensor, the acceleration sensor can detect the magnitude of acceleration in each direction, the magnitude and the direction of gravity can be detected when the mobile phone is static, and the motion sensor can be used for identifying the application of the gesture of the mobile phone (such as horizontal and vertical screen switching), the vibration identification related functions (such as pedometer and knocking) and the like; the mobile phone may be provided with other sensors such as a gyroscope, a barometer, a hygrometer, a thermometer, and an infrared sensor.
The audio circuit 990, speaker 991, and microphone 992 may provide an audio interface between a user and a cell phone. The audio circuit 990 may convert the received audio data into an electrical signal, transmit the electrical signal to the speaker 991, and convert the electrical signal into an audio signal by the speaker 991 and output the audio signal; on the other hand, the microphone 992 converts the collected sound signal into an electrical signal, which is received by the audio circuit 990 and converted into audio data, and then the audio data is output to the processor 980, and then the audio data is transmitted to another mobile phone through the RF circuit 910, or the audio data is output to the memory 920 for subsequent processing.
WiFi belongs to short-distance wireless transmission technology, and the mobile phone can help a user to receive and send e-mails, browse webpages, access streaming media and the like through the WiFi module 970, and provides wireless broadband Internet access for the user. Although fig. 9 shows WiFi module 970, it is to be understood that it does not belong to the essential components of cell phone 900 and may be omitted as desired.
The processor 980 is a control center of the mobile phone, connects various parts of the entire mobile phone by using various interfaces and lines, and performs various functions of the mobile phone and processes data by operating or executing software programs and/or modules stored in the memory 920 and calling data stored in the memory 920, thereby integrally monitoring the mobile phone. In one embodiment, processor 980 may include one or more processing units. In one embodiment, the processor 980 may integrate an application processor and a modem processor, wherein the application processor primarily handles operating systems, user interfaces, applications, and the like; the modem processor handles primarily wireless communications. It will be appreciated that the modem processor described above may not be integrated into the processor 980.
The handset 900 also includes a power supply 990 (e.g., a battery) for supplying power to various components, which may preferably be logically connected to the processor 980 via a power management system, such that the power management system may be used to manage charging, discharging, and power consumption.
In one embodiment, the cell phone 900 may also include a camera, a bluetooth module, and the like.
Any reference to memory, storage, database, or other medium used herein may include non-volatile and/or volatile memory. Suitable non-volatile memory can include read-only memory (ROM), Programmable ROM (PROM), Electrically Programmable ROM (EPROM), Electrically Erasable Programmable ROM (EEPROM), or flash memory. Volatile memory can include Random Access Memory (RAM), which acts as external cache memory. By way of illustration and not limitation, RAM is available in a variety of forms, such as Static RAM (SRAM), Dynamic RAM (DRAM), Synchronous DRAM (SDRAM), double data rate SDRAM (DDR SDRAM), Enhanced SDRAM (ESDRAM), synchronous Link (Synchlink) DRAM (SLDRAM), Rambus Direct RAM (RDRAM), direct bus dynamic RAM (DRDRAM), and bus dynamic RAM (RDRAM).
The above-mentioned embodiments only express several embodiments of the present application, and the description thereof is more specific and detailed, but not construed as limiting the scope of the present application. It should be noted that, for a person skilled in the art, several variations and modifications can be made without departing from the concept of the present application, which falls within the scope of protection of the present application. Therefore, the protection scope of the present patent shall be subject to the appended claims.

Claims (10)

1. An application freezing method, comprising:
acquiring a preset freezing rate of an application and an actual freezing rate of the application; the freezing rate is calculated according to the duration of the application in the freezing state and the duration of the application in the background state;
when the actual freezing rate is smaller than the preset freezing rate, configuring a corresponding freezing strategy for the application; the freezing strategy comprises analyzing a wake-up condition of the application for switching from a freezing state to a non-freezing state to obtain an analysis conclusion, and reconfiguring a part of the wake-up condition into a non-wake-up condition according to the analysis conclusion;
freezing the application according to the freezing strategy so that the actual freezing rate is greater than or equal to the preset freezing rate.
2. The method of claim 1, wherein obtaining the actual freeze rate of the application comprises:
acquiring the duration of the application in a background state and the duration of the application in a frozen state;
and calculating the actual freezing rate of the application according to the duration of the application in the background state and the duration of the application in the freezing state.
3. The method of claim 2, wherein before the obtaining the duration of the application in the background state and the duration of the application in the frozen state, the method comprises:
and acquiring the state change of the application and the time corresponding to the state change from a state switching data table corresponding to the application, wherein the states of the application comprise a foreground state, a background state, a frozen state and an exit state.
4. The method of claim 2, wherein calculating the actual freeze rate of the application based on the duration of the application in the background state and the duration of the application in the freeze state comprises:
and dividing the duration of the application in the frozen state by the duration of the application in the background state to obtain the actual freezing rate of the application.
5. The method of claim 1, wherein freezing the application according to the freezing policy such that the actual freezing rate is greater than or equal to the preset freezing rate comprises:
freezing the application according to the reconfigured non-awakening condition so that the actual freezing rate is greater than or equal to the preset freezing rate.
6. The method of claim 1, wherein the obtaining the preset freeze rate of the application comprises:
acquiring a plurality of state switching data tables generated by the application running on different electronic equipment from a database;
and calculating the average freezing rate of the application according to the plurality of state switching data tables, and taking the average freezing rate as a preset freezing rate.
7. The method according to claim 6, wherein the calculating an average freezing rate of the application from the plurality of state switching data tables, and setting the average freezing rate as a preset freezing rate includes:
acquiring state changes and time data corresponding to the state changes in a first process that the application is switched from a foreground state to the foreground state again and a second process that the application is switched from the foreground state to an exit state from the plurality of state switching data tables;
respectively acquiring the duration of the application in the background state and the duration of the application in the frozen state in the first process and the second process from the state change in the first process and the second process and the time data corresponding to the state change;
dividing the duration of the application in the frozen state by the duration of the application in the background state to obtain the freezing rate of the application;
averaging all the calculated freezing rates to obtain an average freezing rate, and taking the average freezing rate as a preset freezing rate.
8. An application freezing apparatus, the apparatus comprising:
the freezing rate acquisition module is used for acquiring a preset freezing rate of the application and an actual freezing rate of the application; the freezing rate is calculated according to the duration of the application in the freezing state and the duration of the application in the background state;
the freezing strategy configuration module is used for configuring a corresponding freezing strategy for the application when the actual freezing rate is smaller than the preset freezing rate; the freezing strategy comprises analyzing a wake-up condition of the application for switching from a freezing state to a non-freezing state to obtain an analysis conclusion, and reconfiguring a part of the wake-up condition into a non-wake-up condition according to the analysis conclusion;
and the freezing module is used for freezing the application according to the freezing strategy so as to enable the actual freezing rate to be greater than or equal to the preset freezing rate.
9. A computer-readable storage medium, on which a computer program is stored which, when being executed by a processor, carries out the steps of the application freezing method according to any one of claims 1 to 7.
10. An electronic device comprising a memory, a processor and a computer program stored on the memory and executable on the processor, characterized in that the processor implements the steps of the application freezing method of any of claims 1 to 7 when executing the computer program.
CN201811122265.3A 2018-09-26 2018-09-26 Application freezing method and device, storage medium and electronic equipment Active CN109375995B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201811122265.3A CN109375995B (en) 2018-09-26 2018-09-26 Application freezing method and device, storage medium and electronic equipment

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201811122265.3A CN109375995B (en) 2018-09-26 2018-09-26 Application freezing method and device, storage medium and electronic equipment

Publications (2)

Publication Number Publication Date
CN109375995A CN109375995A (en) 2019-02-22
CN109375995B true CN109375995B (en) 2021-03-02

Family

ID=65402473

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201811122265.3A Active CN109375995B (en) 2018-09-26 2018-09-26 Application freezing method and device, storage medium and electronic equipment

Country Status (1)

Country Link
CN (1) CN109375995B (en)

Families Citing this family (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN111913553A (en) * 2019-05-07 2020-11-10 中兴通讯股份有限公司 Method and device for controlling power consumption of terminal, terminal and computer readable storage medium
CN112351476A (en) 2019-08-06 2021-02-09 中兴通讯股份有限公司 Network-based application power consumption regulation and control method, terminal and storage medium

Citations (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN106095515A (en) * 2016-06-21 2016-11-09 东莞酷派软件技术有限公司 The processing method of a kind of application program and system
CN106815065A (en) * 2015-11-27 2017-06-09 腾讯科技(深圳)有限公司 The awakening method and device of background application, electronic equipment

Family Cites Families (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN105975348A (en) * 2016-05-31 2016-09-28 宇龙计算机通信科技(深圳)有限公司 Memory optimization method, optimization device and terminal
CN107450969A (en) * 2016-05-31 2017-12-08 中兴通讯股份有限公司 The method and apparatus that a kind of Application Status is set
CN106066966B (en) * 2016-05-31 2020-01-10 宇龙计算机通信科技(深圳)有限公司 Frozen application display method, frozen application display device and terminal
CN106202472B (en) * 2016-07-15 2020-03-17 宇龙计算机通信科技(深圳)有限公司 Application icon processing method and device
CN107807849A (en) * 2017-10-20 2018-03-16 广东欧珀移动通信有限公司 Using freezing method and related product

Patent Citations (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN106815065A (en) * 2015-11-27 2017-06-09 腾讯科技(深圳)有限公司 The awakening method and device of background application, electronic equipment
CN106095515A (en) * 2016-06-21 2016-11-09 东莞酷派软件技术有限公司 The processing method of a kind of application program and system

Also Published As

Publication number Publication date
CN109375995A (en) 2019-02-22

Similar Documents

Publication Publication Date Title
US11099900B2 (en) Memory reclamation method and apparatus
CN109992398B (en) Resource management method, resource management device, mobile terminal and computer-readable storage medium
CN107272872B (en) Power saving control method and related product
CN109144232B (en) Process processing method and device, electronic equipment and computer readable storage medium
WO2019128546A1 (en) Application program processing method, electronic device, and computer readable storage medium
CN110032267B (en) Information processing method and device, mobile terminal and computer readable storage medium
CN110032266B (en) Information processing method, information processing device, computer equipment and computer readable storage medium
CN106775685B (en) Awakening lock release method and device and mobile terminal
CN109992364B (en) Application freezing method and device, computer equipment and computer readable storage medium
CN108334345B (en) Application processing method and device, readable storage medium and mobile terminal
CN112703714A (en) Application program processing method and device, computer equipment and computer readable storage medium
CN110032429B (en) Information processing method and device, mobile terminal and computer readable storage medium
CN109992425B (en) Information processing method, information processing device, computer equipment and computer readable storage medium
CN109992399B (en) Resource management method, resource management device, mobile terminal and computer-readable storage medium
CN109992380B (en) Application program processing method and device, electronic equipment and computer readable storage medium
CN110018886B (en) Application state switching method and device, electronic equipment and readable storage medium
CN109375995B (en) Application freezing method and device, storage medium and electronic equipment
CN110032430B (en) Application program processing method and device, electronic equipment and computer readable storage medium
CN110018885B (en) Application program freezing method and device, storage medium and terminal
CN109992309B (en) Application program processing method and device, electronic equipment and computer readable storage medium
CN110032397B (en) Application processing method and device, electronic equipment and computer readable storage medium
CN109511139B (en) WIFI control method and device, mobile device and computer-readable storage medium
CN109992360B (en) Process processing method and device, electronic equipment and computer readable storage medium
CN109992395B (en) Application freezing method and device, terminal and computer readable storage medium
CN109992322B (en) Application program unloading method and device, storage medium and terminal

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
GR01 Patent grant
GR01 Patent grant