CN107765834B - Application management method and device, storage medium and electronic equipment - Google Patents

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

Info

Publication number
CN107765834B
CN107765834B CN201711047042.0A CN201711047042A CN107765834B CN 107765834 B CN107765834 B CN 107765834B CN 201711047042 A CN201711047042 A CN 201711047042A CN 107765834 B CN107765834 B CN 107765834B
Authority
CN
China
Prior art keywords
application
timer
background
task
executed
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.)
Expired - Fee Related
Application number
CN201711047042.0A
Other languages
Chinese (zh)
Other versions
CN107765834A (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 CN201711047042.0A priority Critical patent/CN107765834B/en
Publication of CN107765834A publication Critical patent/CN107765834A/en
Application granted granted Critical
Publication of CN107765834B publication Critical patent/CN107765834B/en
Expired - Fee Related legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F1/00Details not covered by groups G06F3/00 - G06F13/00 and G06F21/00
    • G06F1/26Power supply means, e.g. regulation thereof
    • G06F1/32Means for saving power
    • G06F1/3203Power management, i.e. event-based initiation of a power-saving mode
    • G06F1/3206Monitoring of events, devices or parameters that trigger a change in power modality
    • G06F1/3228Monitoring task completion, e.g. by use of idle timers, stop commands or wait commands
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F1/00Details not covered by groups G06F3/00 - G06F13/00 and G06F21/00
    • G06F1/26Power supply means, e.g. regulation thereof
    • G06F1/32Means for saving power
    • G06F1/3203Power management, i.e. event-based initiation of a power-saving mode
    • G06F1/3234Power saving characterised by the action undertaken
    • G06F1/329Power saving characterised by the action undertaken by task scheduling
    • 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/44Arrangements for executing specific programs
    • G06F9/4401Bootstrapping
    • G06F9/442Shutdown

Abstract

The application discloses an application management method, an application management device, a storage medium and electronic equipment. The application management method comprises the following steps: when the application is detected to be started, setting a timer for the started application and setting the overtime time of the timer, if the started application is detected to be positioned in a foreground, resetting the timer and suspending timing, and if the started application is detected to be switched from the foreground to a background, detecting whether the application switched to the background has a task executed in the background; if yes, controlling the timer to continue to pause timing, restarting the timer when detecting that the task is finished, and if the timer is overtime, automatically closing the application corresponding to the timer. According to the embodiment of the application, the timer is arranged for the started application, the timer is restarted after the background task is finished when the background task which is being executed exists in the background application, and the background application is closed if the timer is overtime, so that the background application can be timely and effectively cleaned, the operating efficiency of the electronic equipment is improved, and the endurance time is prolonged.

Description

Application management method and device, storage medium and electronic equipment
Technical Field
The present application relates to the field of mobile communications technologies, and in particular, to a method and an apparatus for application management, a storage medium, and an electronic device.
Background
With the development of electronic technology, people usually install many applications on electronic devices. When a user opens multiple application programs in the electronic device, if the user returns to a desktop of the electronic device or stays at an application interface of a certain application program or controls a screen of the electronic device, the multiple application programs opened by the user still run in a background of the electronic device. However, the application running in the background can severely occupy the memory of the electronic device, and the power consumption of the electronic device is increased, and the running smoothness of the electronic device is reduced.
Disclosure of Invention
The embodiment of the application management method and device, the storage medium and the electronic equipment can timely and effectively clean background applications, improve the running efficiency of the electronic equipment and prolong the endurance time.
The embodiment of the application provides an application management method, which is applied to electronic equipment and comprises the following steps:
when detecting that the application is opened, setting a timer for the opened application and setting the overtime time of the timer;
if the started application is detected to be in the foreground, resetting the timer and suspending timing;
if the started application is detected to be switched from the foreground to the background, detecting whether the application switched to the background has a task executed by the background;
if the application switched to the background has a task executed by the background, controlling the timer to continue to pause timing;
restarting the timer when the task is detected to be completely executed;
and if the timer is overtime, automatically closing the application corresponding to the timer.
An embodiment of the present application further provides an application management apparatus, where the apparatus includes:
the setting module is used for setting a timer for the started application and setting the overtime time of the timer when the application is detected to be started;
the reset module is used for resetting the timer and suspending timing if the started application is detected to be positioned in a foreground;
the detection module is used for detecting whether the application switched to the background has a task executed by the background or not if the started application is detected to be switched from the foreground to the background;
the control module is used for controlling the timer to continue to pause timing if the application switched to the background has a task executed by the background;
the restarting module is used for restarting the timer when detecting that the task is executed completely;
and the closing module is used for automatically closing the application corresponding to the timer if the timer is overtime.
Embodiments of the present application also provide a storage medium having a computer program stored thereon, which, when running on a computer, causes the computer to execute the application management method as described above.
An embodiment of the present application further provides an electronic device, which includes a memory and a processor, where the processor is configured to execute the application management method described above by calling a computer program stored in the memory.
According to the method and the device, when the application is detected to be started, a timer is set for the started application, the overtime time of the timer is set, if the started application is detected to be located in a foreground, the timer is reset and timing is suspended, and if the started application is detected to be switched from the foreground to a background, whether a task executed in the background exists in the application switched to the background is detected; if yes, controlling the timer to continue to pause for timing, restarting the timer when the completion of the task execution is detected, and if the timer is overtime, automatically closing the application corresponding to the timer. According to the embodiment of the application, the timer is arranged for the started application, the timer is restarted after the background task is finished when the background task which is being executed exists in the background application, and the background application is closed if the timer is overtime, so that the background application can be timely and effectively cleaned, the operating efficiency of the electronic equipment is improved, and the endurance time is prolonged.
Drawings
The technical solution and other advantages of the present application will become apparent from the detailed description of the embodiments of the present application with reference to the accompanying drawings.
Fig. 1 is a schematic view of an application scenario of an application management apparatus according to an embodiment of the present application.
Fig. 2 is a schematic flowchart of an application management method according to an embodiment of the present application.
Fig. 3 is another schematic flow chart of an application management method according to an embodiment of the present application.
Fig. 4 is a schematic flowchart of another application management method according to an embodiment of the present application.
Fig. 5 is a schematic structural diagram of an application management apparatus according to an embodiment of the present application.
Fig. 6 is another schematic structural diagram of an application management apparatus according to an embodiment of the present application.
Fig. 7 is a schematic structural diagram of an application management apparatus according to an embodiment of the present application.
Fig. 8 is a schematic structural diagram of an electronic device according to an embodiment of the present application.
Fig. 9 is another schematic structural diagram of an electronic device according to an embodiment of the present application.
Detailed Description
The technical solutions in the embodiments of the present application will be clearly and completely described below with reference to the drawings in the embodiments of the present application. It is to be understood that the specific embodiments described herein are merely illustrative of the application and are not limiting of the application. In addition, for convenience of description, only a part of structures related to the present application, not all of the structures, is shown in the drawings. All other embodiments, which can be derived by a person skilled in the art from the embodiments given herein without making any creative effort, shall fall within the protection scope of the present application.
The terms "first" and "second", etc. in this application are used to distinguish between different objects and not to describe a particular order. Furthermore, the terms "include" and "have," as well as any variations thereof, are intended to cover non-exclusive inclusions. For example, a process, method, system, article, or apparatus that comprises a list of steps or modules is not limited to the listed steps or modules but may alternatively include other steps or modules not listed or inherent to such process, method, article, or apparatus.
Reference herein to "an embodiment" means that a particular feature, structure, or characteristic described in connection with the embodiment can be included in at least one embodiment of the application. The appearances of the phrase in various places in the specification are not necessarily all referring to the same embodiment, nor are separate or alternative embodiments mutually exclusive of other embodiments. It is explicitly and implicitly understood by one skilled in the art that the embodiments described herein can be combined with other embodiments.
In the prior art, when a background application is managed and controlled, part of the background application is generally cleaned directly according to the memory occupation condition of the electronic device and the priority of each application, so as to release the memory. However, some applications are important to the user, or some applications need to be used again by the user in a short time, and if the applications are cleaned up when cleaning up the applications later, the process of reloading the applications by the electronic device is required when the user uses the applications again, which consumes a lot of time and memory resources. The electronic device may be a smart phone, a tablet computer, a desktop computer, a notebook computer, or a palm computer.
Specifically, please refer to fig. 1, where fig. 1 is a schematic view of an application scenario of an application management device according to an embodiment of the present application. For example, when detecting that an application is opened, the application management apparatus sets a timer for the opened application, and sets the timeout time of the timer, for example, opening application a, and correspondingly sets timer 1, where the timeout time is T1; starting the application b, correspondingly setting a timer 2, wherein the overtime time is T2; and starting the application c, correspondingly setting the timer 3, and setting the timeout time to be T3. If the started application is detected to be in the foreground, the timer is reset and the timing is suspended, for example, when the application a, the application b or the application c is in the foreground, the timer 1, the timer 2 or the timer 3 is reset correspondingly, and the timing is temporarily performed. If the started application is detected to be switched from the foreground to the background, detecting whether the application switched to the background has a task executed in the background, for example, the background application comprises an application a, an application b and an application c, and respectively detecting whether the background application has the task executed in the background; for example, if the application a has a task executed in the background, the timer 1 is controlled to continue to pause the timing, and if the applications b and c do not have the task executed in the background, the timer 2 and the timer 3 are directly restarted and the timing is started. When the background task in the application a is detected to be completely executed, the timer 1 is restarted and starts to count time. The timer 2 is overtime first, the application b corresponding to the timer 2 is automatically closed first, the timer 1 and the timer 3 which are not overtime continue to count time, and the corresponding application a and the application c are automatically closed after the timer is overtime. According to the application management device, the timer is arranged for the started application, the timer is restarted after the background task is executed when the background task which is being executed exists in the background application, and the background application is closed if the timer is overtime, so that the background application can be timely and effectively cleaned, the operating efficiency of the electronic equipment is improved, and the endurance time is prolonged.
An execution main body of the application management method provided in the embodiment of the present application may be an application management apparatus provided in the embodiment of the present application, or an electronic device (such as a palm computer, a tablet computer, a smart phone, and the like) integrated with the application management apparatus, and the application management apparatus may be implemented in a hardware or software manner.
Referring to fig. 2, fig. 2 is a flowchart illustrating an application management method according to an embodiment of the present disclosure. The method is applied to the electronic equipment and comprises the following steps:
step 101, when detecting that an application is opened, setting a timer for the opened application, and setting the timeout time of the timer.
The method comprises the steps that a corresponding relation table is required to be preset in the electronic equipment, and the corresponding relation table is used for recording the overtime time of a timer corresponding to each application program. For example, the timeout time corresponding to the game application is 3 minutes, the timeout time corresponding to the entertainment application is 3 minutes, the timeout time corresponding to the instant messaging application is 2 minutes, the timeout time corresponding to the browser application is 30 seconds, and the timeout time corresponding to the photo application is 1 minute. For example, a corresponding timeout time may be set for each application, or the same timeout time may be set for applications belonging to the same type.
The electronic device may detect in real time or within a preset time interval whether an application is started, and if the application is detected to be started, assign a corresponding timer to the started application, acquire the timeout time corresponding to the started application, which is pre-stored in the correspondence table, and set the timeout time as the timeout time of the timer. The application may be any application installed in the electronic device, such as a communication application, a multimedia application, a game application, an information application, a shopping application, a navigation application, a tool application, a social application, or a photo application. The detected application may be all application programs installed in the electronic device, or may also be a part of application programs, and when the application programs are a part of application programs, the application programs may be a plurality of application programs that are frequently used in the near future, and the specific number may be determined according to actual needs.
For example, when detecting that a video application in the entertainment application program is started, a timer is set for the video application, and the timeout time corresponding to the timer is set to be 3 minutes according to the corresponding relation table.
And 102, if the started application is detected to be in the foreground, resetting the timer and suspending timing.
After setting a timer and timeout time corresponding to the timer for the started application program, when detecting that the started application software is in foreground operation, acquiring the timer corresponding to the started application program, resetting the timer and pausing timing.
For example, after a video application is started, a 3-minute timer is started, and when the video application is switched to the foreground for execution, the 3-minute timer is reset and temporarily stopped.
Step 103, if it is detected that the started application is switched from the foreground to the background, detecting whether the application switched to the background has a task executed by the background.
When some applications are switched from a foreground to a background, tasks executed by the background can exist, such as background file sending, background caching, background recording, background uploading, background information modification and the like. If it is detected that the started application is switched from the foreground to the background, in order to manage background applications more intelligently, it is required to detect whether the application switched to the background has background tasks being executed in the background, for example, whether processes such as background file sending, background caching, background recording, background uploading, or background modification information exist, if so, step 104 is executed, otherwise, the corresponding timer can be directly restarted.
For example, when a video application is switched from a foreground to a background, whether a task executed in the background exists in the video application switched to the background is detected. For example, if it is detected that the video application is caching the video file in the background, step 104 is executed.
And step 104, if the application switched to the background has a task executed by the background, controlling the timer to continue to pause for timing.
If the application switched to the background has the task executed by the background, the background task is continuously executed, and the timer is controlled to continuously suspend timing. At this time, the timer may be controlled to reset again and continue to pause the timing.
For example, if it is detected that the video application is caching the video file in the background, controlling a timer corresponding to the video application to continue to pause for timing.
In some embodiments, further comprising: if the application switched to the background has the task executed in the background, further detecting whether the task executed in the background exists in a task blacklist, if not, executing the step 105, and if so, immediately closing the task executed in the background and restarting a timer. When the application program carrying the malicious plug-in or the rogue software is run, the malicious plug-in or the rogue software is easily installed and executed in the electronic device without being perceived by a user, and thus, the security of the electronic device is greatly threatened. Therefore, a task blacklist can be set in the electronic device in advance for respectively issuing malicious plug-ins or rogue software, such as sending tasks actively initiated by a non-user in the background, background recording, uploading user information in the background, or background modifying a registry and the like. By detecting whether the task executed by the background exists in the task blacklist, the behavior of distinguishing and restraining malicious plug-ins or rogue software from monitoring the operation of the user or revealing user information in the background of the system can be achieved, and the information safety is improved.
And 105, restarting the timer when the task is detected to be completely executed.
And the execution condition of the task can be detected in real time, so that after the task is completely executed, the timer corresponding to the application of which the background task is completely executed is restarted.
And 106, if the timer is overtime, automatically closing the application corresponding to the timer.
If the timer is overtime, acquiring the application corresponding to the overtime timer, and controlling the application corresponding to the timer to close.
In some embodiments, before the controlling the timer to continue to pause timing, further comprises:
if the application switched to the background has a task executed by the background, generating prompt information for prompting whether to restart the timer immediately;
and if the response instruction for responding to the prompt message is not acquired, controlling the timer to continue to pause timing.
In some embodiments, after the generating the prompting information for prompting whether to restart the timer immediately, the method further includes:
and if the response instruction for responding to the prompt message is acquired as yes, restarting the timer.
In some embodiments, before the controlling the timer to continue to pause timing, further comprises:
estimating the pre-execution time of the task executed by the background according to the current equipment state of the electronic equipment;
judging whether the difference value between the timeout time and the preset execution time reaches a preset threshold value or not;
and if the difference value between the timeout time and the preset execution time does not reach a preset threshold value, controlling the timer to continue to pause for timing.
In some embodiments, after determining whether the difference between the timeout time and the predetermined execution time reaches a predetermined threshold, the method further includes:
and if the difference value between the timeout time and the pre-execution time reaches a preset threshold value, restarting the timer.
All the above technical solutions can be combined arbitrarily to form the optional embodiments of the present application, and are not described herein again.
When the application is detected to be started, setting a timer for the started application, and setting the timeout time of the timer, if the started application is detected to be located in a foreground, resetting the timer and pausing timing, and if the started application is detected to be switched from the foreground to a background, detecting whether the application switched to the background has a task executed in the background; if yes, controlling the timer to continue to pause for timing, restarting the timer when the completion of the task execution is detected, and if the timer is overtime, automatically closing the application corresponding to the timer. According to the embodiment of the application, the timer is arranged for the started application, the timer is restarted after the background task is finished when the background task which is being executed exists in the background application, and the background application is closed if the timer is overtime, so that the background application can be timely and effectively cleaned, the operating efficiency of the electronic equipment is improved, and the endurance time is prolonged.
Referring to fig. 3, fig. 3 is another schematic flow chart of an application management method according to an embodiment of the present application. The method comprises the following steps:
step 201, when detecting that an application is opened, setting a timer for the opened application, and setting the timeout time of the timer. Step 201 may refer to step 101, and is not described herein again.
And 202, if the started application is detected to be in the foreground, resetting the timer and suspending timing. Step 202 may refer to step 102, and will not be described herein.
Step 203, if it is detected that the started application is switched from the foreground to the background, detecting whether the application switched to the background has a task executed by the background. If yes, go to step 204; if not, go to step 208.
When some applications are switched from a foreground to a background, tasks executed by the background can exist, such as background file sending, background caching, background recording, background uploading, background information modification and the like. If it is detected that the started application is switched from the foreground to the background, in order to manage the background application more intelligently, it is required to detect whether the application switched to the background has a background task being executed in the background, for example, whether processes such as background file sending, background caching, background recording, background uploading, or background modification information exist, if so, step 204 is executed, and if not, step 208 is executed.
For example, when a video application is switched from a foreground to a background, whether a task executed in the background exists in the video application switched to the background is detected. For example, if it is detected that the video application is caching the video file in the background, step 204 is executed.
And step 204, generating prompt information for prompting whether to restart the timer immediately.
When the application program carrying the malicious plug-in or the rogue software is run, the malicious plug-in or the rogue software is easily installed and executed in the electronic device without being perceived by a user, and thus, the security of the electronic device is greatly threatened. Therefore, if the application switched to the background has a task executed in the background, prompt information can be generated on a prompt window of a display interface of the electronic device, where the prompt information may include process information for prompting the task being executed in the background and confirmation information for prompting whether to restart the timer immediately, so that a user can select whether to restart the timer according to the background task process information displayed in the prompt information, thereby effectively suppressing a behavior of malicious plug-ins or rogue software monitoring the operation of the user in the system background or revealing user information in time, and improving information security.
Step 205, obtaining a response instruction for responding to the prompt message. If the response instruction for responding to the prompt message is obtained as no, executing step 206; if the response instruction for responding to the prompt message is yes, step 208 is executed.
After generating the prompt information for prompting whether to restart the timer immediately, exchanging a response instruction for responding to the prompt information according to the selection of the user, for example, if the selection of the user on a prompt window of a display interface is no, the electronic device obtains that the response instruction for responding to the prompt information is no, and then executing step 206; for example, when the user selects yes on the prompt window of the display interface, the electronic device acquires a response instruction for responding to the prompt information, and then step 208 is executed.
And step 206, controlling the timer to continue to pause timing.
And if the response instruction for responding to the prompt message is not acquired, continuing to execute the background task and controlling the timer to continue to pause for timing. At this time, the timer may be controlled to reset again and continue to pause the timing.
And step 207, detecting whether the task is executed completely. If yes, go to step 208; if not, go to step 206.
The execution condition of the task can be detected in real time so as to detect whether the task is executed completely.
Step 208, restart the timer.
And restarting the timer when the task is executed completely.
In some embodiments, when it is detected that the application switched to the background has no task executed in the background, the timer may be restarted immediately, so that the background application to be cleaned may be locked in time.
In some embodiments, when the response instruction obtained by the electronic device in response to the prompt message is yes, the timer can be restarted immediately and the execution of the background task is stopped while the timer is restarted, so that a behavior that a malicious plug-in or rogue software monitors the operation of the user or reveals user information in a system background can be prevented timely and effectively, and the information security is improved. And when the response instruction for responding to the prompt information acquired by the electronic equipment is yes, the timer can be restarted immediately without intervening the execution of the background task, and if the timer is overtime, the corresponding application can be directly closed regardless of whether the execution of the task is finished.
And 209, if the timer is overtime, automatically closing the application corresponding to the timer.
If the timer is overtime, acquiring the application corresponding to the overtime timer, and controlling the application corresponding to the timer to close.
According to the method and the device, when the application is detected to be started, a timer is set for the started application, the overtime time of the timer is set, if the started application is detected to be located in a foreground, the timer is reset and timing is suspended, and if the started application is detected to be switched from the foreground to a background, whether a task executed in the background exists in the application switched to the background is detected; if yes, generating prompt information for prompting whether to restart the timer immediately, controlling the timer to continue to pause for timing when a response instruction for responding to the prompt information is acquired, restarting the timer when the completion of the task execution is detected, and automatically closing the application corresponding to the timer if the timer is overtime. According to the embodiment of the application, the timer is arranged for the started application, the prompt information is generated when the background application has the background task which is being executed, so that a user can freely select whether to restart the timer immediately, if the response instruction is negative, the background task can be continuously executed, the timer is restarted after the background task is completely executed, and if the timer is overtime, the background application is closed, so that the background application can be timely and effectively cleaned, the running efficiency of the electronic equipment is improved, and the endurance time is prolonged. In addition, if the response instruction is yes, the timer is restarted immediately, so that the execution of a malicious process in the background can be effectively restrained in time, and the information security is improved.
Referring to fig. 4, fig. 4 is a schematic flowchart illustrating an application management method according to an embodiment of the present disclosure. The method comprises the following steps:
step 301, when detecting that an application is opened, setting a timer for the opened application, and setting the timeout time of the timer. Step 301 may refer to step 101, and will not be described herein again.
And 302, if the started application is detected to be in the foreground, resetting the timer and suspending timing. Step 302 may refer to step 102, and is not described herein again.
Step 303, if it is detected that the started application is switched from the foreground to the background, detecting whether the application switched to the background has a task executed by the background. If yes, go to step 304; if not, go to step 308.
When some applications are switched from a foreground to a background, tasks executed by the background can exist, such as background file sending, background caching, background recording, background uploading, background information modification and the like. If it is detected that the started application is switched from the foreground to the background, in order to manage the background application more intelligently, it is required to detect whether the application switched to the background has a background task being executed in the background, for example, whether processes such as background file sending, background caching, background recording, background uploading, or background modification information exist, if so, step 304 is executed, and if not, step 308 is executed.
For example, when a video application is switched from a foreground to a background, whether a task executed in the background exists in the video application switched to the background is detected. For example, if it is detected that the video application is caching the video file in the background, step 304 is executed.
And step 304, estimating the pre-execution time of the task executed by the background according to the current equipment state of the electronic equipment.
For example, the pre-execution time of the task executed in the background can be estimated according to the current network connection state of the electronic device. For example, if it is detected that the video application is caching the video file in the background, the pre-execution time for caching the video file in the background is estimated to be 5 minutes according to the current download rate and the size of the cache file.
Step 305, determining whether the difference between the timeout time and the pre-execution time reaches a preset threshold. If not, go to step 306; if yes, go to step 308.
For example, if the preset threshold is 1 minute, the timeout time of the video application is 3 minutes, and the pre-execution time is 5 minutes, the difference between the timeout time and the preset time is-2, and the step 306 is executed if the preset threshold is not reached.
For example, if the preset threshold is 1 minute, the timeout time of the video application is 3 minutes, and the pre-execution time is 1 minute, the difference between the timeout time and the preset time is 2 minutes, and the preset threshold is reached, step 308 is executed.
And step 306, controlling the timer to continue to pause timing.
And if the response instruction for responding to the prompt message is not acquired, continuing to execute the background task and controlling the timer to continue to pause for timing. At this time, the timer may be controlled to reset again and continue to pause the timing.
Step 307, detecting whether the task is executed completely. If yes, go to step 308; if not, go to step 306.
The execution condition of the task can be detected in real time so as to detect whether the task is executed completely.
Step 308, restart the timer.
And restarting the timer when the task is executed completely.
In some embodiments, when it is detected that the application switched to the background has no task executed in the background, the timer may be restarted immediately, so that the background application to be cleaned may be locked in time.
In some embodiments, when the difference between the timeout time and the predetermined execution time reaches a predetermined threshold, which indicates that the timeout time is longer than the execution time of the background task, the timer may be restarted immediately without affecting the execution of the background task, so as to shorten the execution time of the background application.
Step 309, if the timer is overtime, automatically closing the application corresponding to the timer.
If the timer is overtime, acquiring the application corresponding to the overtime timer, and controlling the application corresponding to the timer to close.
According to the method and the device, when the application is detected to be started, a timer is set for the started application, the overtime time of the timer is set, if the started application is detected to be located in a foreground, the timer is reset and timing is suspended, and if the started application is detected to be switched from the foreground to a background, whether a task executed in the background exists in the application switched to the background is detected; if yes, estimating the pre-execution time of the task executed by the background according to the current equipment state of the electronic equipment, judging whether the difference value between the overtime time and the pre-execution time reaches a preset threshold value, if not, controlling the timer to continue to pause for timing, if the task execution is detected to be finished, restarting the timer, and if the timer is overtime, automatically closing the application corresponding to the timer. According to the embodiment of the application, the timer is set for the opened application, the pre-execution time of the background executed task is estimated when the background task is executed in the background application, the background task is continuously executed when the difference value between the timeout time and the pre-execution time does not reach the preset threshold value, the timer is restarted after the background task is completely executed, the background application is closed if the timer is overtime, the background application can be timely and effectively cleaned, the operation efficiency of the electronic equipment is improved, and the endurance time is prolonged. In addition, if the difference value between the timeout time and the preset execution time does not reach the preset threshold value, the timer is restarted immediately, the execution state of the background task is not monitored, the operation burden of the electronic equipment for monitoring the background task can be reduced, and the operation time of the background application can be shortened.
An application management device is further provided in the embodiments of the present application, as shown in fig. 5, fig. 5 is a schematic structural diagram of an application management device provided in the embodiments of the present application. The application management apparatus 40 includes a setting module 41, a resetting module 42, a detecting module 43, a control module 44, a restarting module 45, and a shutdown module 46.
The setting module 41 is configured to set a timer for the started application and set the timeout time of the timer when it is detected that the application is started.
The reset module 42 is configured to reset the timer and suspend timing if it is detected that the started application is located in the foreground.
The detecting module 43 is configured to detect whether the application switched to the background has a task executed by the background if it is detected that the started application is switched from the foreground to the background.
The control module 44 is configured to control the timer to continue to suspend timing if the application switched to the background has a task executed by the background.
The restart module 45 is configured to restart the timer when it is detected that the task is completely executed.
The closing module 46 is configured to automatically close the application corresponding to the timer if the timer is overtime.
In the embodiment of the present application, when detecting that an application is started, the application management apparatus 40 sets a timer for the started application through the setting module 41, and sets the timeout time of the timer, if it is detected that the started application is located in a foreground, the resetting module 42 resets the timer and suspends timing, and if it is detected that the started application is switched from the foreground to the background, the detecting module 43 detects whether a task executed in the background exists in the application switched to the background; if yes, the control module 44 controls the timer to continue to pause timing, when it is detected that the task is completed, the restarting module 45 restarts the timer, and if the timer is overtime, the closing module 46 automatically closes the application corresponding to the timer. According to the embodiment of the application, the timer is set for the started application through the application management device 40, the timer is restarted after the background task is executed when the background task which is being executed exists in the background application, and the background application is closed if the timer is overtime, so that the background application can be timely and effectively cleaned, the operating efficiency of the electronic equipment is improved, and the endurance time is prolonged.
Referring to fig. 6, fig. 6 is another schematic structural diagram of an application management device according to an embodiment of the present disclosure. The application management device 40 further comprises a prompt module 47.
The prompting module 47 is configured to generate a prompting message for prompting whether to restart the timer immediately if the application switched to the background has a task executed by the background;
the control module 44 is further configured to control the timer to continue to pause timing if the obtained response instruction for responding to the prompt information is negative.
In some embodiments, the restarting module 45 is further configured to restart the timer if the response instruction obtained in response to the prompt information is yes.
In the embodiment of the present application, when detecting that an application is started, the application management apparatus 40 sets a timer for the started application through the setting module 41, and sets the timeout time of the timer, if it is detected that the started application is located in a foreground, the resetting module 42 resets the timer and suspends timing, and if it is detected that the started application is switched from the foreground to the background, the detecting module 43 detects whether a task executed in the background exists in the application switched to the background; if yes, the prompting module 47 generates prompting information for prompting whether to restart the timer immediately, and when a response instruction for responding to the prompting information is obtained, the control module 44 controls the timer to continue to pause for timing, when the task execution is detected to be completed, the restarting module 45 restarts the timer, and if the timer is overtime, the closing module 46 automatically closes the application corresponding to the timer. According to the embodiment of the application, the timer is set for the started application through the application management device 40, the prompt information is generated when the background application has the background task which is being executed, so that a user can freely select whether to restart the timer immediately, if the response instruction is negative, the background task can be continuously executed, the timer is restarted after the background task is completely executed, and if the timer is overtime, the background application is closed, so that the background application can be timely and effectively cleaned, the operating efficiency of the electronic equipment is improved, and the endurance time is prolonged. In addition, if the response instruction is yes, the application management device 40 immediately restarts the timer, so that execution of a malicious process in the background can be effectively suppressed in time, and information security is improved.
Referring to fig. 7, fig. 7 is a schematic structural diagram of an application management device according to an embodiment of the present application. The application management device 40 further comprises an evaluation module 48 and a judgment module 49.
The estimation module 48 is configured to estimate a pre-execution time of the task executed in the background according to a current device state of the electronic device;
the judging module 49 is configured to judge whether a difference between the timeout time and the pre-execution time reaches a preset threshold;
the control module is further configured to control the timer to continue to pause timing if the difference between the timeout time and the predetermined execution time does not reach a predetermined threshold.
In some embodiments, the restarting module 45 is further configured to restart the timer if a difference between the timeout time and the predetermined execution time reaches a predetermined threshold.
In the embodiment of the present application, when detecting that an application is started, the application management apparatus 40 sets a timer for the started application through the setting module 41, and sets the timeout time of the timer, if it is detected that the started application is located in a foreground, the resetting module 42 resets the timer and suspends timing, and if it is detected that the started application is switched from the foreground to the background, the detecting module 43 detects whether a task executed in the background exists in the application switched to the background; if yes, the estimation module 48 estimates a pre-execution time of the task executed by the background according to the current device state of the electronic device, the determination module 49 determines whether a difference between the timeout time and the pre-execution time reaches a preset threshold, if the difference does not reach the preset threshold, the control module 44 controls the timer to continue to pause for timing, when the task is detected to be executed completely, the restart module 45 restarts the timer, and if the timer is overtime, the shutdown module 46 automatically shuts down the application corresponding to the timer. According to the embodiment of the application, the timer is set for the opened application through the application management device 40, the pre-execution time of the background executed task is estimated when the background task exists in the background application, the background task is continuously executed when the difference value between the timeout time and the pre-execution time does not reach the preset threshold value, the timer is restarted after the background task is completely executed, the background application is closed if the timer is overtime, the background application can be timely and effectively cleaned, the operation efficiency of the electronic equipment is improved, and the endurance time is prolonged. In addition, if the difference between the timeout time and the predetermined execution time does not reach the predetermined threshold, the application management device 40 restarts the timer immediately without additionally monitoring the execution state of the background task, so that the operation burden of the electronic device in monitoring the background task can be reduced, and the operation time of the background application can be shortened.
All the above technical solutions can be combined arbitrarily to form the optional embodiments of the present application, and are not described herein again.
An embodiment of the present application further provides an electronic device, which includes a memory, a processor, and a computer program that is stored in the memory and can be run on the processor, where the processor invokes the computer program stored in the memory to execute the application management method according to any embodiment of the present application.
The electronic equipment can be equipment such as a smart phone, a tablet computer and a palm computer. As shown in fig. 8, an electronic device 500 includes a processor 501 having one or more processing cores, a memory 502 having one or more computer-readable storage media, and a computer program stored on the memory and executable on the processor. The processor 501 is electrically connected to the memory 502. Those skilled in the art will appreciate that the electronic device configurations shown in the figures do not constitute limitations of the electronic device, and may include more or fewer components than shown, or some components in combination, or a different arrangement of components.
The processor 501 is a control center of the electronic device 500, connects various parts of the whole electronic device by using various interfaces and lines, executes various functions of the electronic device and processes data by running or loading an application program stored in the memory 502 and calling the data stored in the memory 502, thereby performing overall monitoring of the electronic device.
In this embodiment, the processor 501 in the electronic device 500 loads instructions corresponding to processes of one or more application programs into the memory 502, and the processor 501 runs the application programs stored in the memory 502 according to the following steps, so as to implement various functions:
when detecting that the application is opened, setting a timer for the opened application and setting the overtime time of the timer;
if the started application is detected to be in the foreground, resetting the timer and suspending timing;
if the started application is detected to be switched from the foreground to the background, detecting whether the application switched to the background has a task executed by the background;
if the application switched to the background has a task executed by the background, controlling the timer to continue to pause timing;
restarting the timer when the task is detected to be completely executed;
and if the timer is overtime, automatically closing the application corresponding to the timer.
In some embodiments, the processor 501 is configured to, before the controlling the timer to continue to pause timing, further include:
if the application switched to the background has a task executed by the background, generating prompt information for prompting whether to restart the timer immediately;
and if the response instruction for responding to the prompt message is not acquired, controlling the timer to continue to pause timing.
In some embodiments, the processor 501 is configured to, after the generating the prompting information for prompting whether to restart the timer immediately, further include:
and if the response instruction for responding to the prompt message is acquired as yes, restarting the timer.
In some embodiments, the processor 501 is configured to, before the controlling the timer to continue to pause timing, further include:
estimating the pre-execution time of the task executed by the background according to the current equipment state of the electronic equipment;
judging whether the difference value between the timeout time and the preset execution time reaches a preset threshold value or not;
and if the difference value between the timeout time and the preset execution time does not reach a preset threshold value, controlling the timer to continue to pause for timing.
In some embodiments, after the determining whether the difference between the timeout time and the predetermined execution time reaches the predetermined threshold, the processor 501 further includes:
and if the difference value between the timeout time and the pre-execution time reaches a preset threshold value, restarting the timer.
In some embodiments, as shown in fig. 9, the electronic device 500 further comprises: a display 503, a radio frequency circuit 504, an audio circuit 505, an input unit 506, and a power supply 507. The processor 501 is electrically connected to the display 503, the rf circuit 504, the audio circuit 505, the input unit 506, and the power supply 507. Those skilled in the art will appreciate that the electronic device configuration shown in fig. 7 does not constitute a limitation of the electronic device and may include more or fewer components than shown, or some components may be combined, or a different arrangement of components.
The display screen 503 may be used to display information entered by or provided to the user as well as various graphical user interfaces of the electronic device, which may be made up of graphics, text, icons, video, and any combination thereof. When the display screen 503 is a touch display screen, it can also be used as a part of the input unit to implement an input function.
The rf circuit 504 may be configured to transmit and receive rf signals to establish wireless communication with a network device or other electronic devices via wireless communication, and transmit and receive signals with the network device or other electronic devices.
The audio circuit 505 may be used to provide an audio interface between the user and the electronic device through a speaker, microphone.
The input unit 506 may be used to receive input numbers, character information, or user characteristic information (e.g., fingerprint), and generate keyboard, mouse, joystick, optical, or trackball signal inputs related to user settings and function control.
The power supply 507 is used to power the various components of the electronic device 500. In some embodiments, the power supply 107 may be logically connected to the processor 501 through a power management system, so that functions of managing charging, discharging, and power consumption are implemented through the power management system.
Although not shown in fig. 9, the electronic device 500 may further include a camera, a sensor, a wireless fidelity module, a bluetooth module, etc., which are not described in detail herein.
In the foregoing embodiments, the descriptions of the respective embodiments have respective emphasis, and for parts that are not described in detail in a certain embodiment, reference may be made to related descriptions of other embodiments.
In this embodiment of the application, the application management apparatus and the application management method in the above embodiments belong to the same concept, and any method provided in the embodiment of the application management method may be run on the application management apparatus, and a specific implementation process thereof is described in the embodiment of the application management method in detail, and is not described herein again.
An embodiment of the present application further provides a storage medium, where the storage medium stores a computer program, and when the computer program runs on a computer, the computer is caused to execute the application management method in any of the above embodiments.
It should be noted that, for the application management method described in the present application, it can be understood by a person skilled in the art that all or part of the process of implementing the application management method described in the embodiments of the present application can be implemented by controlling related hardware through a computer program, where the computer program can be stored in a computer readable storage medium, such as a memory of an electronic device, and executed by at least one processor in the electronic device, and during the execution process, the process of implementing the embodiment of the application management method can be included. The storage medium may be a magnetic disk, an optical disk, a Read Only Memory (ROM), a Random Access Memory (RAM), or the like.
In the application management device according to the embodiment of the present application, each functional module may be integrated into one processing chip, or each module may exist alone physically, or two or more modules are integrated into one module. The integrated module can be realized in a hardware mode, and can also be realized in a software functional module mode. The integrated module, if implemented in the form of a software functional module and sold or used as a stand-alone product, may also be stored in a computer readable storage medium, such as a read-only memory, a magnetic or optical disk, or the like.
The application management method, the application management device, the storage medium, and the electronic device provided in the embodiments of the present application are described in detail above, and a specific example is applied in the description to explain the principle and the implementation of the present application, and the description of the embodiments above is only used to help understand the technical solutions and the core ideas of the present application; those of ordinary skill in the art will understand that: the technical solutions described in the foregoing embodiments may still be modified, or some technical features may be equivalently replaced; such modifications or substitutions do not depart from the spirit and scope of the present disclosure as defined by the appended claims.

Claims (8)

1. An application management method applied to an electronic device, the method comprising:
when detecting that the application is opened, setting a timer for the opened application and setting the overtime time of the timer;
if the started application is detected to be in the foreground, resetting the timer and suspending timing;
if the started application is detected to be switched from the foreground to the background, detecting whether the application switched to the background has a task executed by the background;
if the application switched to the background has the task executed in the background, detecting whether the task executed in the background exists in a task blacklist;
if yes, closing the task executed by the background and restarting a timer;
if not, estimating the pre-execution time of the task executed by the background according to the current equipment state of the electronic equipment;
judging whether the difference value between the timeout time and the preset execution time reaches a preset threshold value or not;
if the difference value between the timeout time and the pre-execution time reaches a preset threshold value, restarting the timer;
if the difference value between the overtime time and the preset execution time does not reach a preset threshold value, controlling the timer to continue to pause for timing;
restarting the timer when the task is detected to be completely executed;
and if the timer is overtime, automatically closing the application corresponding to the timer.
2. The application management method according to claim 1, further comprising, before said controlling said timer to continue to pause timing:
if the application switched to the background has a task executed by the background, generating prompt information for prompting whether to restart the timer immediately;
and if the response instruction for responding to the prompt message is not acquired, controlling the timer to continue to pause timing.
3. The application management method according to claim 2, wherein after the generating of the prompt information for prompting whether to restart the timer immediately, further comprising:
and if the response instruction for responding to the prompt message is acquired as yes, restarting the timer.
4. An application management apparatus, applied to an electronic device, the apparatus comprising:
the setting module is used for setting a timer for the started application and setting the overtime time of the timer when the application is detected to be started;
the reset module is used for resetting the timer and suspending timing if the started application is detected to be positioned in a foreground;
the detection module is used for detecting whether the application switched to the background has a task executed by the background or not if the started application is detected to be switched from the foreground to the background;
if the application switched to the background has the task executed in the background, detecting whether the task executed in the background exists in a task blacklist;
the control module is used for closing the task executed by the background if the task executed by the background exists in a task blacklist;
the restarting module is used for restarting a timer if the task executed by the background exists in a task blacklist;
the estimation module is used for estimating the pre-execution time of the task executed by the background according to the current equipment state of the electronic equipment;
the judging module is used for judging whether the difference value between the overtime time and the preset execution time reaches a preset threshold value or not;
the restarting module is further configured to restart the timer if a difference between the timeout time and a pre-execution time reaches a preset threshold;
the control module is further configured to control the timer to continue to pause for timing if a difference between the timeout time and the predetermined execution time does not reach a predetermined threshold;
the restarting module is used for restarting the timer when detecting that the task is executed completely;
and the closing module is used for automatically closing the application corresponding to the timer if the timer is overtime.
5. The application management apparatus of claim 4, wherein the apparatus further comprises:
the prompting module is used for generating prompting information for prompting whether to restart the timer immediately if the application switched to the background has a task executed by the background;
and the control module is used for controlling the timer to continue to pause timing if the response instruction for responding to the prompt message is not acquired.
6. The application management device of claim 5, wherein the restart module is further configured to restart the timer if a response instruction obtained in response to the prompt information is yes.
7. A storage medium having stored thereon a computer program, characterized in that, when the computer program is run on a computer, it causes the computer to execute an application management method according to any one of claims 1 to 3.
8. An electronic device comprising a memory and a processor, wherein the processor is configured to perform the application management method of any of claims 1-3 by invoking a computer program stored in the memory.
CN201711047042.0A 2017-10-31 2017-10-31 Application management method and device, storage medium and electronic equipment Expired - Fee Related CN107765834B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201711047042.0A CN107765834B (en) 2017-10-31 2017-10-31 Application management method and device, storage medium and electronic equipment

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201711047042.0A CN107765834B (en) 2017-10-31 2017-10-31 Application management method and device, storage medium and electronic equipment

Publications (2)

Publication Number Publication Date
CN107765834A CN107765834A (en) 2018-03-06
CN107765834B true CN107765834B (en) 2020-05-12

Family

ID=61271545

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201711047042.0A Expired - Fee Related CN107765834B (en) 2017-10-31 2017-10-31 Application management method and device, storage medium and electronic equipment

Country Status (1)

Country Link
CN (1) CN107765834B (en)

Families Citing this family (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN109144728B (en) 2018-08-22 2020-11-06 Oppo广东移动通信有限公司 Occupancy control method and device for camera application
US11442635B2 (en) * 2019-01-10 2022-09-13 Western Digital Technologies, Inc. Data storage systems and methods for optimized scheduling of background management operations

Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
WO2013101289A2 (en) * 2011-04-11 2013-07-04 Microsoft Corporation Management of background tasks
CN103635881A (en) * 2012-06-06 2014-03-12 华为终端有限公司 Method and terminal for managing application
CN106775759A (en) * 2017-01-03 2017-05-31 惠州Tcl移动通信有限公司 Detection method and system that a kind of application based on mobile terminal is closed
CN107231469A (en) * 2017-05-11 2017-10-03 努比亚技术有限公司 A kind of terminal applies management method, terminal and computer-readable recording medium

Family Cites Families (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US9904575B2 (en) * 2013-05-15 2018-02-27 Apple Inc. System and method for selective timer rate limiting

Patent Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
WO2013101289A2 (en) * 2011-04-11 2013-07-04 Microsoft Corporation Management of background tasks
CN103635881A (en) * 2012-06-06 2014-03-12 华为终端有限公司 Method and terminal for managing application
CN106775759A (en) * 2017-01-03 2017-05-31 惠州Tcl移动通信有限公司 Detection method and system that a kind of application based on mobile terminal is closed
CN107231469A (en) * 2017-05-11 2017-10-03 努比亚技术有限公司 A kind of terminal applies management method, terminal and computer-readable recording medium

Also Published As

Publication number Publication date
CN107765834A (en) 2018-03-06

Similar Documents

Publication Publication Date Title
CN107734616B (en) Application program closing method and device, storage medium and electronic equipment
CN108062190B (en) Application running state control method and mobile terminal
CN106507445B (en) Wireless fidelity Wi-Fi scanning method and mobile terminal
US10474507B2 (en) Terminal application process management method and apparatus
CN107783803B (en) System optimization method and device of intelligent terminal, storage medium and intelligent terminal
WO2019024642A1 (en) Process control method and apparatus, storage medium, and electronic device
CN107729216B (en) Application program control method and device, storage medium and electronic equipment
CN107590057B (en) Screen freezing monitoring and solving method, mobile terminal and computer readable storage medium
US20210255746A1 (en) Application control method and electronic device
CN107835984B (en) Thermal mitigation user experience
WO2019007371A1 (en) Method for preventing information from being stolen, storage device, and mobile terminal
WO2020134566A1 (en) Control method for doze mode of mobile terminal, storage medium and mobile terminal
WO2015172283A1 (en) Method, device and mobile terminal for reducing power consumption
CN107765834B (en) Application management method and device, storage medium and electronic equipment
WO2014166307A1 (en) Method for determining performance of process of application and computer system
US20220300328A1 (en) Application optimization method and device, storage medium, and electronic equipment
WO2017206901A1 (en) Process control method and related device
CN111273955A (en) Thermal restoration plug-in optimization method and device, storage medium and electronic equipment
CN114428546A (en) Background application cleaning method and device, storage medium and terminal equipment
US11150913B2 (en) Method, device, and terminal for accelerating startup of application
CN105278942B (en) Component management method and device
CN107404569B (en) System control method, terminal and computer readable storage medium
CN111966425A (en) Process cleaning method and device, storage medium and mobile terminal
CN110989816B (en) Application processing method and device and storage medium
US10178621B2 (en) Automatic notification providing sleep state protection for an unattended computing device

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
CB02 Change of applicant information
CB02 Change of applicant information

Address after: Changan town in Guangdong province Dongguan 523860 usha Beach Road No. 18

Applicant after: GUANGDONG OPPO MOBILE TELECOMMUNICATIONS Corp.,Ltd.

Address before: Changan town in Guangdong province Dongguan 523860 usha Beach Road No. 18

Applicant before: GUANGDONG OPPO MOBILE TELECOMMUNICATIONS Corp.,Ltd.

GR01 Patent grant
GR01 Patent grant
CF01 Termination of patent right due to non-payment of annual fee
CF01 Termination of patent right due to non-payment of annual fee

Granted publication date: 20200512