[go: up one dir, main page]

CN107797645B - Resource control method and device - Google Patents

Resource control method and device Download PDF

Info

Publication number
CN107797645B
CN107797645B CN201710949290.8A CN201710949290A CN107797645B CN 107797645 B CN107797645 B CN 107797645B CN 201710949290 A CN201710949290 A CN 201710949290A CN 107797645 B CN107797645 B CN 107797645B
Authority
CN
China
Prior art keywords
application
running state
type
resource request
preset
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
CN201710949290.8A
Other languages
Chinese (zh)
Other versions
CN107797645A (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.)
Beijing Xiaomi Mobile Software Co Ltd
Original Assignee
Beijing Xiaomi Mobile Software Co 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 Beijing Xiaomi Mobile Software Co Ltd filed Critical Beijing Xiaomi Mobile Software Co Ltd
Priority to CN201710949290.8A priority Critical patent/CN107797645B/en
Publication of CN107797645A publication Critical patent/CN107797645A/en
Application granted granted Critical
Publication of CN107797645B publication Critical patent/CN107797645B/en
Active 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/3234Power saving characterised by the action undertaken
    • G06F1/3237Power saving characterised by the action undertaken by disabling clock generation or distribution
    • 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/3287Power saving characterised by the action undertaken by switching off individual functional units in the computer system
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F21/00Security arrangements for protecting computers, components thereof, programs or data against unauthorised activity
    • G06F21/10Protecting distributed programs or content, e.g. vending or licensing of copyrighted material ; Digital rights management [DRM]
    • G06F21/12Protecting executable software
    • G06F21/121Restricting unauthorised execution of programs
    • 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/50Allocation of resources, e.g. of the central processing unit [CPU]
    • G06F9/5005Allocation of resources, e.g. of the central processing unit [CPU] to service a request
    • G06F9/5027Allocation of resources, e.g. of the central processing unit [CPU] to service a request the resource being a machine, e.g. CPUs, Servers, Terminals
    • 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/50Allocation of resources, e.g. of the central processing unit [CPU]
    • G06F9/5005Allocation of resources, e.g. of the central processing unit [CPU] to service a request
    • G06F9/5027Allocation of resources, e.g. of the central processing unit [CPU] to service a request the resource being a machine, e.g. CPUs, Servers, Terminals
    • G06F9/5044Allocation of resources, e.g. of the central processing unit [CPU] to service a request the resource being a machine, e.g. CPUs, Servers, Terminals considering hardware capabilities
    • YGENERAL TAGGING OF NEW TECHNOLOGICAL DEVELOPMENTS; GENERAL TAGGING OF CROSS-SECTIONAL TECHNOLOGIES SPANNING OVER SEVERAL SECTIONS OF THE IPC; TECHNICAL SUBJECTS COVERED BY FORMER USPC CROSS-REFERENCE ART COLLECTIONS [XRACs] AND DIGESTS
    • Y02TECHNOLOGIES OR APPLICATIONS FOR MITIGATION OR ADAPTATION AGAINST CLIMATE CHANGE
    • Y02DCLIMATE CHANGE MITIGATION TECHNOLOGIES IN INFORMATION AND COMMUNICATION TECHNOLOGIES [ICT], I.E. INFORMATION AND COMMUNICATION TECHNOLOGIES AIMING AT THE REDUCTION OF THEIR OWN ENERGY USE
    • Y02D10/00Energy efficient computing, e.g. low power processors, power management or thermal management

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Software Systems (AREA)
  • General Engineering & Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • General Physics & Mathematics (AREA)
  • Computer Hardware Design (AREA)
  • Computer Security & Cryptography (AREA)
  • Computing Systems (AREA)
  • Multimedia (AREA)
  • Technology Law (AREA)
  • Telephone Function (AREA)

Abstract

The disclosure relates to a resource control method and device. The method comprises the following steps: receiving a resource request of an application; acquiring the running state of an application; the running state of the application comprises a foreground running state or a background running state; and controlling the system resource corresponding to the resource request of the application according to the running state of the application, the type of the application and a preset application type. The method and the device can avoid that the application installed on the terminal abuses system resources at will to cause the terminal to consume too fast, can save power consumption, improve the standby time of the terminal, avoid privacy disclosure and improve user experience.

Description

Resource control method and device
Technical Field
The present disclosure relates to the field of terminal technologies, and in particular, to a resource control method and apparatus.
Background
With the popularization of mobile internet, mobile phones are becoming communication tools that many people cannot lack in life. More and more applications are installed in the mobile phone, and the colorful applications bring great convenience to the life and work of users.
However, in the related art, some applications have a problem that the user is not allowed to abuse System resources, for example, some applications need to continuously collect the location information of the user in the background in order to directionally push advertisements, which causes a Global Positioning System (GPS) of the mobile phone to be in a working state all the time, so that power consumption is accelerated, and there is a risk of revealing privacy of the user; some applications frequently scan the bluetooth for detecting the surrounding bluetooth devices, so that the power consumption is high, and the user needs to frequently charge the mobile phone, thereby bringing some troubles to the user.
Disclosure of Invention
In order to overcome the problems in the related art, embodiments of the present disclosure provide a resource control method and apparatus. The technical scheme is as follows:
according to a first aspect of the embodiments of the present disclosure, there is provided a resource control method, including:
receiving a resource request of an application;
acquiring the running state of the application; the running state of the application comprises a foreground running state or a background running state;
and controlling the system resource corresponding to the resource request of the application according to the running state of the application, the type of the application and a preset application type.
In one embodiment, the controlling the system resource corresponding to the resource request of the application according to the running state of the application, the type of the application, and a preset application type includes:
when the application is in a background running state and the type of the application is not matched with a preset application type, shielding a resource request of the application; or,
and when the application is in a background running state and the type of the application is matched with a preset application type, responding to the resource request of the application, and allocating system resources corresponding to the resource request of the application to the application.
In one embodiment, the controlling the system resource corresponding to the resource request of the application according to the running state of the application, the type of the application, and a preset application type includes:
and when the application is in a foreground running state, responding to the resource request of the application, and allocating system resources corresponding to the resource request of the application to the application.
In one embodiment, the controlling the system resource corresponding to the resource request of the application according to the running state of the application, the type of the application, and a preset application type includes:
when the application is switched from a foreground running state to a background running state, responding to a resource request of the application, allocating system resources corresponding to the resource request of the application to the application, and starting a first timer;
when the timing of the first timer reaches a first preset duration and the type of the application is matched with a preset application type, responding to the resource request of the application, and allocating system resources corresponding to the resource request of the application to the application; or,
when the timing of the first timer reaches a first preset time length and the type of the application is not matched with a preset application type, refusing to allocate peripheral resources to the application and starting a second timer; when the timing of the second timer reaches a second preset time length, refusing to allocate peripheral resources and processor resources to the application, and starting a third timer; and when the timing of the third timer reaches a third preset time length, shielding the resource request of the application to any type of system resource.
In one embodiment, the refusing to allocate the peripheral resource and the processor resource to the application when the timing of the second timer reaches a second preset time comprises:
when the timing of the second timer reaches a second preset duration and the processor occupancy rate of the application is smaller than a preset threshold value, refusing to allocate peripheral resources and processor resources to the application; or,
and when the timing of the second timer reaches a second preset duration and the processor occupancy rate of the application is greater than or equal to the preset threshold, refusing to allocate peripheral resources to the application and allocating processor resources corresponding to the resource request of the application to the application.
In one embodiment, the preset application types include at least any one or a combination of the following:
the method comprises the steps of system application, application in a white list, application with a desktop plug-in on a terminal foreground and application with a preset function as a currently running function.
According to a second aspect of the embodiments of the present disclosure, there is provided a resource control apparatus, including:
the receiving module is used for receiving a resource request of an application;
the acquisition module is used for acquiring the running state of the application; the running state of the application comprises a foreground running state or a background running state;
and the resource control module is used for controlling the system resource corresponding to the resource request of the application according to the running state of the application, the type of the application and a preset application type.
In one embodiment, the resource control module includes:
the shielding submodule is used for shielding the resource request of the application when the application is in a background running state and the type of the application is not matched with a preset application type;
and the resource allocation submodule is used for responding to the resource request of the application and allocating the system resource corresponding to the resource request of the application to the application when the application is in a background running state and the type of the application is matched with a preset application type.
In one embodiment, when the application is in a foreground running state, the resource control module responds to the resource request of the application, and allocates the system resource corresponding to the resource request of the application to the application.
In one embodiment, the resource control module:
when the application is switched from a foreground running state to a background running state, responding to a resource request of the application, allocating system resources corresponding to the resource request of the application to the application, and starting a first timer;
when the timing of the first timer reaches a first preset duration and the type of the application is matched with a preset application type, responding to the resource request of the application, and allocating system resources corresponding to the resource request of the application to the application;
when the timing of the first timer reaches a first preset time length and the type of the application is not matched with a preset application type, refusing to allocate peripheral resources to the application and starting a second timer; when the timing of the second timer reaches a second preset time length, refusing to allocate peripheral resources and processor resources to the application, and starting a third timer; and when the timing of the third timer reaches a third preset time length, shielding the resource request of the application to any type of system resource.
In one embodiment, the resource control module:
when the timing of the second timer reaches a second preset duration and the processor occupancy rate of the application is smaller than a preset threshold value, refusing to allocate peripheral resources and processor resources to the application;
and when the timing of the second timer reaches a second preset duration and the processor occupancy rate of the application is greater than or equal to the preset threshold, refusing to allocate peripheral resources to the application and allocating processor resources corresponding to the resource request of the application to the application.
According to a third aspect of the embodiments of the present disclosure, there is provided a resource control apparatus, including:
a processor;
a memory for storing processor-executable instructions;
wherein the processor is configured to:
receiving a resource request of an application;
acquiring the running state of the application; the running state of the application comprises a foreground running state or a background running state;
and controlling the system resource corresponding to the resource request of the application according to the running state of the application, the type of the application and a preset application type.
According to a fourth aspect of embodiments of the present disclosure, there is provided a computer-readable storage medium having stored thereon computer instructions which, when executed by a processor, implement the steps of the method of the first aspect described above.
The technical scheme provided by the embodiment of the disclosure can have the following beneficial effects: according to the technical scheme, the system resources used by the current application request are controlled according to the running state and the type of the application, the phenomenon that the power consumption of the terminal is too fast due to the fact that the application installed on the terminal abuses the system resources at will is avoided, the power consumption can be saved, the standby time of the terminal is prolonged, the situation that some applications acquire the privacy of the user on the premise that the user does not allow the applications can be avoided by controlling the system resources, the privacy leakage is avoided, and the user experience can be improved.
It is to be understood that both the foregoing general description and the following detailed description are exemplary and explanatory only and are not restrictive of the disclosure.
Drawings
The accompanying drawings, which are incorporated in and constitute a part of this specification, illustrate embodiments consistent with the present disclosure and together with the description, serve to explain the principles of the disclosure.
FIG. 1 is a flow diagram illustrating a resource control method according to an example embodiment.
FIG. 2 is a flow diagram illustrating a resource control method according to an example embodiment.
Fig. 3 is a block diagram illustrating a resource control apparatus according to an example embodiment.
Fig. 4 is a block diagram illustrating a resource control apparatus according to an example embodiment.
Fig. 5 is a block diagram illustrating a resource control apparatus according to an example embodiment.
FIG. 6 is a block diagram illustrating a resource control device according to an example embodiment.
Fig. 7 is a block diagram illustrating a resource control apparatus according to an example embodiment.
Detailed Description
Reference will now be made in detail to the exemplary embodiments, examples of which are illustrated in the accompanying drawings. When the following description refers to the accompanying drawings, like numbers in different drawings represent the same or similar elements unless otherwise indicated. The implementations described in the exemplary embodiments below are not intended to represent all implementations consistent with the present disclosure. Rather, they are merely examples of apparatus and methods consistent with certain aspects of the present disclosure, as detailed in the appended claims.
In the related art, a terminal, for example, a mobile phone, has a problem that some applications in the mobile phone do not allow users to abuse system resources, for example, some applications need to continuously collect location information of the users in the background in order to directionally push advertisements, which causes the GPS of the mobile phone to be always in a working state, so that power consumption is accelerated, and a risk of revealing privacy of the users exists; some applications frequently scan the bluetooth for detecting the surrounding bluetooth devices, so that the power consumption is high, and the user needs to frequently charge the mobile phone, thereby bringing some troubles to the user and causing poor user experience.
In order to solve the above problem, an embodiment of the present disclosure provides a resource control method, where the method includes: receiving a resource request of an application; acquiring the running state of an application; the running state of the application comprises a foreground running state or a background running state; and controlling the system resource corresponding to the resource request of the application according to the running state of the application, the type of the application and a preset application type.
According to the resource control method provided by the embodiment of the disclosure, the system resources currently requested to be used by the application are controlled according to the running state and the type of the application, so that the situation that the power consumption of the terminal is too high due to the fact that the application installed on the terminal abuses the system resources at will is avoided, the power consumption can be saved, the standby time of the terminal is prolonged, the situation that some applications acquire the user privacy without the permission of the user can be avoided by controlling the system resources, the privacy is prevented from being leaked, and the user experience can be improved.
Based on the above analysis, the following specific examples are proposed.
Fig. 1 is a flowchart illustrating a resource control method according to an exemplary embodiment, where an execution subject of the method may be a terminal, and the terminal is, for example, a mobile phone, a tablet computer, a desktop computer, a notebook computer, or a wearable device; as shown in fig. 1, the method comprises the following steps 101-103:
in step 101, receiving a resource request of an application;
in step 102, acquiring the running state of the application; the running state of the application comprises a foreground running state or a background running state;
illustratively, an application is in a foreground running state when running in the foreground; the application is in a background running state when running in a background; the application may switch the running state between a foreground running state and a background running state.
In step 103, the system resource corresponding to the resource request of the application is controlled according to the running state of the application, the type of the application, and a preset application type.
Exemplary system resources include peripheral resources such as hardware resources of the terminal, e.g., network modules, sensors, positioning modules, and bluetooth scanning modules, and processor (CPU) resources. The preset application types at least comprise any one or combination of the following types: the method comprises the steps of system application, application in a white list, application with a desktop plug-in (widget) in a terminal foreground, and application with a current running function as a preset function. System applications such as input methods; a user can set a white list in the terminal, applications in the white list, such as social software, continue to run after being switched from a foreground to a background, and the terminal provides system resources required by the applications; the currently running function is an application with a preset function, which means that the application is running a preset function allowed by a user, such as music playing, navigation or downloading.
For example, the manner of controlling the system resource corresponding to the resource request of the application according to the running state of the application, the type of the application, and the preset application type in step 103 may include:
1. and when the application is in a foreground running state, responding to the resource request of the application, and allocating system resources corresponding to the resource request of the application to the application.
Specifically, when the application runs in the foreground, the application is in a foreground use state, and the application can use the system resource corresponding to the resource request without being limited.
2. When the application is in a background running state and the type of the application is not matched with the preset application type, shielding the resource request of the application; the shielding means that the terminal does not respond to the resource request of the application when receiving the resource request of the application.
3. And when the application is in a background running state and the type of the application is matched with the preset application type, responding to the resource request of the application, and allocating system resources corresponding to the resource request of the application for the application.
According to the technical scheme provided by the embodiment of the disclosure, the system resources which are currently requested to be used by the application are controlled according to the running state and the type of the application, the phenomenon that the power consumption of the terminal is too high due to the fact that the application installed on the terminal abuses the system resources at will is avoided, the power consumption can be saved, the standby time of the terminal is prolonged, the situation that some applications acquire the privacy of the user on the premise that the privacy is not allowed by the user can be avoided by controlling the system resources, the privacy leakage is avoided, and the user experience.
FIG. 2 is a flow diagram illustrating a resource control method in accordance with an example embodiment. As shown in fig. 2, on the basis of the embodiment shown in fig. 1, the resource control method according to the present disclosure may include the following steps 201 and 208:
in step 201, a resource request of an application is received.
In step 202, the running state of the application is acquired; the running state of the application comprises a foreground running state or a background running state.
It should be noted that, the execution manner of the steps 201-202 can refer to the description of the steps 101-102 in the embodiment shown in fig. 1, and is not repeated here.
In step 203, when the application is switched from the foreground running state to the background running state, the system resource corresponding to the resource request of the application is allocated to the application in response to the resource request of the application, and the first timer is started.
Illustratively, when the application is in a foreground running state, in response to a resource request of the application, the terminal allocates a system resource corresponding to the resource request of the application to the application; when the application is switched from the foreground running state to the background running state, the application can still use the system resource corresponding to the resource request of the application; when the application is switched from the foreground running state to the background running state, a first timer is started.
In step 204, when the timing of the first timer reaches a first preset time length, determining whether the type of the application is matched with a preset application type; when the type of the application is matched with the preset application type, turning to step 205; if the application type does not match the predetermined application type, go to step 206.
For example, when the timing of the first timer reaches a first preset time, whether the type of the application is matched with a preset application type is judged; for example, check if the application is in the white list; checking whether the application is an application being used by a terminal operating system, such as an input method; checking whether the application has a widget on the desktop; checking whether the application is running preset functions allowed or known by a user, such as music playing, navigation or downloading and the like; if the type of the application is matched with the preset application type, the application can continue to use the system resource; if the application type does not match the predetermined application type, go to step 206 and refuse to allocate peripheral resources to the application.
In step 205, when the timing of the first timer reaches a first preset duration and the type of the application matches a preset application type, responding to the resource request of the application, and allocating system resources corresponding to the resource request of the application to the application; the flow ends.
In step 206, when the first timer reaches a first preset duration and the type of the application is not matched with the preset application type, the allocation of the peripheral resource to the application is rejected, and a second timer is started.
Illustratively, the peripheral resources are hardware resources of the terminal, such as a network module, a sensor, a positioning module, a bluetooth scanning module, and the like.
In step 207, when the second timer reaches a second preset time, the allocation of the peripheral resources and the processor resources to the application is denied, and a third timer is started.
For example, when the timing of the second timer reaches a second preset duration and the processor occupancy rate of the application is less than a preset threshold, the peripheral resource and the processor resource are refused to be allocated to the application; or, when the timing of the second timer reaches a second preset duration and the processor occupancy rate of the application is greater than or equal to a preset threshold, refusing to allocate the peripheral resource to the application, and at this time, allocating the processor resource corresponding to the resource request of the application to the application.
In step 208, the resource request of the application for any type of system resource is masked when the timing of the third timer reaches a third preset time duration.
For example, for convenience of illustration, the operation state of the application is subdivided in this embodiment to include: foreground use state, background active state, background slight inactive state, background moderate inactive state and background severe inactive state; the foreground use state, the background active state, the background light inactive state, the background moderate inactive state and the background heavy inactive state sequentially represent that the activity of the application is continuously reduced. The following states are described below:
1) the foreground using state is also the foreground running state, and when the application is in the foreground using state, the application uses any system resource without limitation.
2) When the application is switched from the foreground running state to the background running state, the application is in a background active state, and a first timer is started; in a time period when the timing of the first timer does not reach a first preset time length, the application still can use the system resource corresponding to the resource request of the application; when the timing of the first timer reaches a first preset time length, judging whether the type of the application is matched with a preset application type; if the type of the application is matched with the preset application type, the application can be kept in an active state in the background, and the application can continue to use system resources; if the type of the application does not match the preset application type, the application enters a background light inactive state.
3) When the application is in a background slight inactive state, refusing to allocate peripheral resources for the application, controlling the peripheral resources such as a network module, a sensor, a positioning module, a Bluetooth scanning module and the like, and starting a second timer; when the timing of the second timer reaches a second preset time length, judging whether the occupancy rate of the applied processor is smaller than a preset threshold value; if the processor occupancy rate of the application is not less than the preset threshold value, continuously refusing to allocate the peripheral resources to the application; if the processor occupancy of the application is less than the predetermined threshold, it may indicate that the application is not currently running an important function, and the application may enter a background moderate inactive state.
4) When the application is in a background moderate inactive state, refusing to allocate peripheral resources and processor resources to the application, and further controlling system resources such as a scheduler (jobScheduler), a broadcast (broadcast), an alarm clock (alarm), a dormant lock (wakelock) and a background service (bgService) and starting a third timer on the basis of 3); when the timing of the third timer reaches a third preset time, the application enters a background severe inactive state;
5) when the application is in a background heavy inactive state, shielding the resource request of the application for any type of resource; the application is frozen, and the application can not obtain CPU resources any more, so that the power consumption of the application is reduced to the maximum extent; when the application is in the background severe inactive state, no resource is allocated to the application, but the application is not closed, so that the user can conveniently reopen the application, and the opening time is saved.
It should be noted that, when the application is in the background running state, once the user reopens the application, that is, at the time when the application is switched from the background to the foreground, the application enters the foreground running state, and the application can reuse all the allowed system resources of the terminal.
According to the technical scheme provided by the embodiment of the disclosure, the running states of the application are classified, and the distribution of system resources is differentially controlled for different running states, so that the purposes of preventing the application from abusing resources and saving power consumption are achieved. Because the limitation to the system resources is performed step by step, the power consumption is saved on the premise of not influencing the user experience, and the user experience and the power consumption control of the terminal are well balanced.
The following are embodiments of the disclosed apparatus that may be used to perform embodiments of the disclosed methods.
FIG. 3 is a block diagram illustrating a resource control apparatus that may be implemented in various ways, such as implementing all of the components of the apparatus in a terminal or implementing the components of the apparatus in a coupled manner on the terminal side, according to an example embodiment; the apparatus may implement the method related to the present disclosure through software, hardware, or a combination of the two, as shown in fig. 3, the resource control apparatus includes: a receiving module 301, an obtaining module 302, and a resource control module 303, wherein:
the receiving module 301 is configured to receive a resource request of an application;
the obtaining module 302 is configured to obtain an operating state of an application; the running state of the application comprises a foreground running state or a background running state;
the resource control module 303 is configured to control the system resource corresponding to the resource request of the application according to the running state of the application, the type of the application, and a preset application type.
The device provided by the embodiment of the disclosure can be used for executing the technical scheme of the embodiment shown in fig. 1, and the execution mode and the beneficial effect are similar, and are not described again here.
In one possible embodiment, as shown in fig. 4, the resource control apparatus shown in fig. 3 may further include a resource control module 303 configured to include: a shielding submodule 401 and a resource allocation submodule 402, wherein:
the shielding submodule 401 is configured to shield the resource request of the application when the application is in a background running state and the type of the application is not matched with the preset application type;
the resource allocation submodule 402 is configured to, when the application is in the background running state and the type of the application matches the preset application type, allocate a system resource corresponding to the resource request of the application to the application in response to the resource request of the application.
For example, when the application is in the foreground operating state, the resource control module 303 allocates the system resource corresponding to the resource request of the application to the application in response to the resource request of the application.
For example, when the application is switched from the foreground running state to the background running state, the resource control module 303 responds to the resource request of the application, allocates the system resource corresponding to the resource request of the application to the application, and starts a first timer;
when the timing of the first timer reaches a first preset duration and the type of the application is matched with the preset application type, the resource control module 303 responds to the resource request of the application and allocates the system resource corresponding to the resource request of the application to the application;
when the timing of the first timer reaches a first preset time and the type of the application is not matched with the preset application type, the resource control module 303 refuses to allocate the external resource to the application and starts a second timer;
the resource control module 303 refuses to allocate the peripheral resource and the processor resource to the application when the timing of the second timer reaches a second preset time length, and starts a third timer;
the resource control module 303 masks the resource request of the application for any type of system resource when the timing of the third timer reaches a third preset time length.
For example, the resource control module 303 refuses to allocate the peripheral resource and the processor resource to the application when the timing of the second timer reaches a second preset duration and the processor occupancy rate of the application is less than a preset threshold; when the timing of the second timer reaches a second preset duration and the processor occupancy rate of the application is greater than or equal to a preset threshold, the resource control module 303 rejects to allocate the peripheral resource to the application and allocate the processor resource corresponding to the resource request of the application to the application.
Fig. 5 is a block diagram illustrating a resource control apparatus 500 according to an exemplary embodiment, where the resource control apparatus 500 is applied to a terminal, and the resource control apparatus 500 includes:
a processor 501;
a memory 502 for storing processor-executable instructions;
wherein the processor 501 is configured to:
receiving a resource request of an application;
acquiring the running state of an application; the running state of the application comprises a foreground running state or a background running state;
and controlling the system resource corresponding to the resource request of the application according to the running state of the application, the type of the application and a preset application type.
In one embodiment, the processor 501 may be further configured to: controlling system resources corresponding to the resource request of the application according to the running state of the application, the type of the application and a preset application type, wherein the control method comprises the following steps:
when the application is in a background running state and the type of the application is not matched with the preset application type, shielding the resource request of the application; or,
and when the application is in a background running state and the type of the application is matched with the preset application type, responding to the resource request of the application, and allocating system resources corresponding to the resource request of the application for the application.
In one embodiment, the processor 501 may be further configured to: controlling system resources corresponding to the resource request of the application according to the running state of the application, the type of the application and a preset application type, wherein the control method comprises the following steps:
and when the application is in a foreground running state, responding to the resource request of the application, and allocating system resources corresponding to the resource request of the application to the application.
In one embodiment, the processor 501 may be further configured to: controlling system resources corresponding to the resource request of the application according to the running state of the application, the type of the application and a preset application type, wherein the control method comprises the following steps:
when the application is switched from the foreground running state to the background running state, responding to the resource request of the application, allocating system resources corresponding to the resource request of the application for the application, and starting a first timer;
when the timing of the first timer reaches a first preset duration and the type of the application is matched with the preset application type, responding to the resource request of the application, and allocating system resources corresponding to the resource request of the application to the application; or,
when the timing of the first timer reaches a first preset time length and the type of the application is not matched with the preset application type, refusing to allocate peripheral resources to the application, and starting a second timer;
when the timing of the second timer reaches a second preset time length, refusing to allocate peripheral resources and processor resources for the application, and starting a third timer;
and when the timing of the third timer reaches a third preset time length, shielding the resource request of the application to any type of system resource.
In one embodiment, the processor 501 may be further configured to: when the timing of the second timer reaches a second preset time, refusing to allocate the peripheral resource and the processor resource to the application comprises:
when the timing of the second timer reaches a second preset duration and the processor occupancy rate of the application is smaller than a preset threshold value, refusing to allocate the peripheral resources and the processor resources to the application; or,
and when the timing of the second timer reaches a second preset duration and the processor occupancy rate of the application is greater than or equal to a preset threshold value, refusing to allocate the peripheral resources to the application and allocate the processor resources corresponding to the resource request of the application to the application.
In one embodiment, the processor 501 may be further configured to: the preset application types at least comprise any one or combination of the following types:
the method comprises the steps of system application, application in a white list, application with a desktop plug-in on a terminal foreground and application with a preset function as a currently running function.
With regard to the apparatus in the above-described embodiment, the specific manner in which each module performs the operation has been described in detail in the embodiment related to the method, and will not be elaborated here.
FIG. 6 is a block diagram illustrating a resource control apparatus in accordance with an example embodiment; the resource control apparatus 600 is applicable to a terminal; resource control device 600 may include one or more of the following components: processing component 602, memory 604, power component 606, multimedia component 608, audio component 610, input/output (I/O) interface 612, sensor component 614, and communication component 616.
The processing component 602 generally controls overall operation of the resource control device 600, such as operations associated with display, telephone calls, data communications, camera operations, and recording operations. The processing component 602 may include one or more processors 620 to execute instructions to perform all or a portion of the steps of the methods described above. Further, the processing component 602 can include one or more modules that facilitate interaction between the processing component 602 and other components. For example, the processing component 602 can include a multimedia module to facilitate interaction between the multimedia component 608 and the processing component 602.
The memory 604 is configured to store various types of data to support operations at the resource control device 600. Examples of such data include instructions for any application or method operating on the resource control device 600, contact data, phonebook data, messages, pictures, videos, and the like. The memory 604 may be implemented by any type or combination of volatile or non-volatile memory devices such as Static Random Access Memory (SRAM), electrically erasable programmable read-only memory (EEPROM), erasable programmable read-only memory (EPROM), programmable read-only memory (PROM), read-only memory (ROM), magnetic memory, flash memory, magnetic or optical disks.
The power supply component 606 provides power to the various components of the resource control device 600. The power components 606 may include a power management system, one or more power supplies, and other components associated with generating, managing, and distributing power for the resource control device 600.
The multimedia component 608 includes a screen that provides an output interface between the resource control device 600 and the user. In some embodiments, the screen may include a Liquid Crystal Display (LCD) and a Touch Panel (TP). If the screen includes a touch panel, the screen may be implemented as a touch screen to receive an input signal from a user. The touch panel includes one or more touch sensors to sense touch, slide, and gestures on the touch panel. The touch sensor may not only sense the boundary of a touch or slide action, but also detect the duration and pressure associated with the touch or slide operation. In some embodiments, the multimedia component 608 includes a front facing camera and/or a rear facing camera. When the resource control device 600 is in an operation mode, such as a shooting mode or a video mode, the front camera and/or the rear camera can receive external multimedia data. Each front camera and rear camera may be a fixed optical lens system or have a focal length and optical zoom capability.
The audio component 610 is configured to output and/or input audio signals. For example, audio component 610 includes a Microphone (MIC) configured to receive external audio signals when resource control device 600 is in an operating mode, such as a call mode, a recording mode, and a voice recognition mode. The received audio signal may further be stored in the memory 604 or transmitted via the communication component 616. In some embodiments, audio component 610 further includes a speaker for outputting audio signals.
The I/O interface 612 provides an interface between the processing component 602 and peripheral interface modules, which may be keyboards, click wheels, buttons, etc. These buttons may include, but are not limited to: a home button, a volume button, a start button, and a lock button.
The sensor component 614 includes one or more sensors for providing status assessment of various aspects to the resource control device 600. For example, the sensor component 614 may detect an open/closed status of the resource control device 600, the relative positioning of components, such as a display and keypad of the resource control device 600, the sensor component 614 may also detect a change in the position of the resource control device 600 or a component of the resource control device 600, the presence or absence of user contact with the resource control device 600, the orientation or acceleration/deceleration of the resource control device 600, and a change in the temperature of the resource control device 600. The sensor assembly 614 may include a proximity sensor configured to detect the presence of a nearby object without any physical contact. The sensor assembly 614 may also include a light sensor, such as a CMOS or CCD image sensor, for use in imaging applications. In some embodiments, the sensor assembly 614 may also include an acceleration sensor, a gyroscope sensor, a magnetic sensor, a pressure sensor, or a temperature sensor.
The communication component 616 is configured to facilitate communications between the resource control apparatus 600 and other devices in a wired or wireless manner. The resource control device 600 may access a wireless network based on a communication standard, such as WiFi, 2G or 3G, or a combination thereof. In an exemplary embodiment, the communication component 616 receives broadcast signals or broadcast related information from an external broadcast management system via a broadcast channel. In an exemplary embodiment, the communication component 616 further includes a Near Field Communication (NFC) module to facilitate short-range communications. For example, the NFC module may be implemented based on Radio Frequency Identification (RFID) technology, infrared data association (IrDA) technology, Ultra Wideband (UWB) technology, Bluetooth (BT) technology, and other technologies.
In an exemplary embodiment, the resource control device 600 may be implemented by one or more Application Specific Integrated Circuits (ASICs), Digital Signal Processors (DSPs), Digital Signal Processing Devices (DSPDs), Programmable Logic Devices (PLDs), Field Programmable Gate Arrays (FPGAs), controllers, micro-controllers, microprocessors, or other electronic components for performing the above-described methods.
In an exemplary embodiment, a non-transitory computer readable storage medium comprising instructions, such as the memory 604 comprising instructions, executable by the processor 620 of the resource control device 600 to perform the above-described method is also provided. For example, the non-transitory computer readable storage medium may be a ROM, a Random Access Memory (RAM), a CD-ROM, a magnetic tape, a floppy disk, an optical data storage device, and the like.
A non-transitory computer readable storage medium having instructions therein which, when executed by a processor of a resource control apparatus 600, enable the resource control apparatus 600 to perform a resource control method comprising:
receiving a resource request of an application;
acquiring the running state of an application; the running state of the application comprises a foreground running state or a background running state;
and controlling the system resource corresponding to the resource request of the application according to the running state of the application, the type of the application and a preset application type.
Fig. 7 is a block diagram illustrating a resource control apparatus according to an example embodiment. For example, the resource control device 700 may be provided as a server. The resource control device 700 includes a processing component 702 that further includes one or more processors, and memory resources, represented by memory 703, for storing instructions, such as application programs, that are executable by the processing component 702. The application programs stored in memory 703 may include one or more modules that each correspond to a set of instructions. Further, the processing component 702 is configured to execute instructions to perform the above-described methods.
The resource control device 700 may also include a power component 706 configured to perform power management of the resource control device 700, a wired or wireless network interface 705 configured to connect the resource control device 700 to a network, and an input/output (I/O) interface 707. The resource control device 700 may operate based on an operating system stored in memory 703, such as Windows Server, Mac OS XTM, UnixTM, LinuxTM, FreeBSDTM, or the like.
Other embodiments of the disclosure will be apparent to those skilled in the art from consideration of the specification and practice of the disclosure disclosed herein. This application is intended to cover any variations, uses, or adaptations of the disclosure following, in general, the principles of the disclosure and including such departures from the present disclosure as come within known or customary practice within the art to which the disclosure pertains. It is intended that the specification and examples be considered as exemplary only, with a true scope and spirit of the disclosure being indicated by the following claims.
It will be understood that the present disclosure is not limited to the precise arrangements described above and shown in the drawings and that various modifications and changes may be made without departing from the scope thereof. The scope of the present disclosure is limited only by the appended claims.

Claims (9)

1. A method for resource control, comprising:
receiving a resource request of an application;
acquiring the running state of the application; the running state of the application comprises a foreground running state or a background running state;
controlling system resources corresponding to the resource request of the application according to the running state of the application, the type of the application and a preset application type; the system resources comprise peripheral resources and processor resources;
the controlling the system resource corresponding to the resource request of the application according to the running state of the application, the type of the application and a preset application type comprises:
when the application is switched from a foreground running state to a background running state, responding to a resource request of the application, allocating system resources corresponding to the resource request of the application to the application, and starting a first timer;
when the timing of the first timer reaches a first preset duration and the type of the application is matched with a preset application type, responding to the resource request of the application, and allocating system resources corresponding to the resource request of the application to the application;
when the timing of the first timer reaches a first preset time length and the type of the application is not matched with a preset application type, refusing to allocate peripheral resources to the application and starting a second timer; when the timing of the second timer reaches a second preset time length, refusing to allocate peripheral resources and processor resources to the application, and starting a third timer; and when the timing of the third timer reaches a third preset time length, shielding the resource request of the application to any type of system resource.
2. The method according to claim 1, wherein the controlling the system resource corresponding to the resource request of the application according to the running state of the application, the type of the application, and a preset application type includes:
and when the application is in a foreground running state, responding to the resource request of the application, and allocating system resources corresponding to the resource request of the application to the application.
3. The method of claim 1, wherein denying allocation of peripheral resources and processor resources to the application when the timing of the second timer reaches a second predetermined time comprises:
when the timing of the second timer reaches a second preset duration and the processor occupancy rate of the application is smaller than a preset threshold value, refusing to allocate peripheral resources and processor resources to the application; or,
and when the timing of the second timer reaches a second preset duration and the processor occupancy rate of the application is greater than or equal to the preset threshold, refusing to allocate peripheral resources to the application and allocating processor resources corresponding to the resource request of the application to the application.
4. The method according to claim 1, wherein the preset application types include at least any one or a combination of the following:
the method comprises the steps of system application, application in a white list, application with a desktop plug-in on a terminal foreground and application with a preset function as a currently running function.
5. A resource control apparatus, comprising:
the receiving module is used for receiving a resource request of an application;
the acquisition module is used for acquiring the running state of the application; the running state of the application comprises a foreground running state or a background running state;
the resource control module is used for controlling the system resource corresponding to the resource request of the application according to the running state of the application, the type of the application and a preset application type; the system resources comprise peripheral resources and processor resources;
the resource control module:
when the application is switched from a foreground running state to a background running state, responding to a resource request of the application, allocating system resources corresponding to the resource request of the application to the application, and starting a first timer;
when the timing of the first timer reaches a first preset duration and the type of the application is matched with a preset application type, responding to the resource request of the application, and allocating system resources corresponding to the resource request of the application to the application;
when the timing of the first timer reaches a first preset time length and the type of the application is not matched with a preset application type, refusing to allocate peripheral resources to the application and starting a second timer; when the timing of the second timer reaches a second preset time length, refusing to allocate peripheral resources and processor resources to the application, and starting a third timer; and when the timing of the third timer reaches a third preset time length, shielding the resource request of the application to any type of system resource.
6. The apparatus according to claim 5, wherein the resource control module allocates, when the application is in a foreground running state, a system resource corresponding to the resource request of the application to the application in response to the resource request of the application.
7. The apparatus of claim 5, wherein the resource control module:
when the timing of the second timer reaches a second preset duration and the processor occupancy rate of the application is smaller than a preset threshold value, refusing to allocate peripheral resources and processor resources to the application;
and when the timing of the second timer reaches a second preset duration and the processor occupancy rate of the application is greater than or equal to the preset threshold, refusing to allocate peripheral resources to the application and allocating processor resources corresponding to the resource request of the application to the application.
8. A resource control apparatus, comprising:
a processor;
a memory for storing processor-executable instructions;
wherein the processor is configured to:
receiving a resource request of an application;
acquiring the running state of the application; the running state of the application comprises a foreground running state or a background running state;
controlling system resources corresponding to the resource request of the application according to the running state of the application, the type of the application and a preset application type; the system resources comprise peripheral resources and processor resources;
the processor is further configured to: the controlling the system resource corresponding to the resource request of the application according to the running state of the application, the type of the application and a preset application type comprises:
when the application is switched from a foreground running state to a background running state, responding to a resource request of the application, allocating system resources corresponding to the resource request of the application to the application, and starting a first timer;
when the timing of the first timer reaches a first preset duration and the type of the application is matched with a preset application type, responding to the resource request of the application, and allocating system resources corresponding to the resource request of the application to the application;
when the timing of the first timer reaches a first preset time length and the type of the application is not matched with a preset application type, refusing to allocate peripheral resources to the application and starting a second timer; when the timing of the second timer reaches a second preset time length, refusing to allocate peripheral resources and processor resources to the application, and starting a third timer; and when the timing of the third timer reaches a third preset time length, shielding the resource request of the application to any type of system resource.
9. A computer-readable storage medium having stored thereon computer instructions, which, when executed by a processor, carry out the steps of the method according to any one of claims 1 to 4.
CN201710949290.8A 2017-10-12 2017-10-12 Resource control method and device Active CN107797645B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201710949290.8A CN107797645B (en) 2017-10-12 2017-10-12 Resource control method and device

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201710949290.8A CN107797645B (en) 2017-10-12 2017-10-12 Resource control method and device

Publications (2)

Publication Number Publication Date
CN107797645A CN107797645A (en) 2018-03-13
CN107797645B true CN107797645B (en) 2020-12-04

Family

ID=61532691

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201710949290.8A Active CN107797645B (en) 2017-10-12 2017-10-12 Resource control method and device

Country Status (1)

Country Link
CN (1) CN107797645B (en)

Families Citing this family (1)

* 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

Citations (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101573691A (en) * 2006-12-28 2009-11-04 微软公司 Time based permissioning
CN106445063A (en) * 2015-08-12 2017-02-22 三星电子株式会社 Method of managing application and electronic device therefor

Family Cites Families (12)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
KR101380966B1 (en) * 2011-08-24 2014-05-02 주식회사 팬택 Security device in portable terminal system
CN103885763A (en) * 2012-12-21 2014-06-25 腾讯科技(深圳)有限公司 Operating system resource access method and system
CN104516783B (en) * 2013-09-27 2019-04-23 华为终端(东莞)有限公司 Authority control method and device
CN106845174B (en) * 2015-12-03 2020-07-10 福州瑞芯微电子股份有限公司 Application authority management method and system under security system
CN105550587A (en) * 2015-12-11 2016-05-04 北京元心科技有限公司 Method and device for controlling system resource access in multi-system terminal equipment
CN105607979B (en) * 2015-12-18 2018-05-08 小米科技有限责任公司 Networking control method and device
CN105653323B (en) * 2015-12-28 2019-07-02 小米科技有限责任公司 Application management method and device
CN105631270A (en) * 2015-12-30 2016-06-01 浙江德景电子科技有限公司 Double-system resource management method and system
CN105868624A (en) * 2016-03-23 2016-08-17 北京小米移动软件有限公司 Application program authority management method and device
CN105955441B (en) * 2016-04-21 2019-08-06 北京小米移动软件有限公司 Application management method and device
CN105975344B (en) * 2016-05-10 2019-12-13 北京小米移动软件有限公司 Control method and device for preventing excessive occupancy of sensor by application
CN107147648A (en) * 2017-05-11 2017-09-08 北京奇虎科技有限公司 Resource request processing method, client, server and system

Patent Citations (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101573691A (en) * 2006-12-28 2009-11-04 微软公司 Time based permissioning
CN106445063A (en) * 2015-08-12 2017-02-22 三星电子株式会社 Method of managing application and electronic device therefor

Also Published As

Publication number Publication date
CN107797645A (en) 2018-03-13

Similar Documents

Publication Publication Date Title
US9588805B2 (en) Method and terminal device for controlling background application
US10282561B2 (en) Method and apparatus for managing application
US9860844B2 (en) Method and apparatus of temperature control
US11910377B2 (en) Method and apparatus for requesting scheduling sidelink resource, and storage medium
EP3151117B1 (en) Method and device for delaying information broadcasting
US12082130B2 (en) Method and apparatus for sending synchronization signal
US20170060599A1 (en) Method and apparatus for awakening electronic device
CN110262692B (en) Touch screen scanning method, device and medium
CN106537344A (en) A method and apparatus for managing application calls
CN107094094B (en) Application networking method and device and terminal
CN105511922A (en) Application startup controlling method and device
CN110637502B (en) Data processing method and device, electronic equipment and computer readable storage medium
CN109062625B (en) Application program loading method and device and readable storage medium
CN108874450B (en) Method and device for waking up voice assistant
EP2985697A1 (en) Method and device for controlling router plug-in
CN105786561B (en) Method and device for calling process
CN107797645B (en) Resource control method and device
CN105991626A (en) Network access method and network access device
CN111240456A (en) Power saving setting method, power saving setting device and computer storage medium
US20210400588A1 (en) Configuration adjustment methods, apparatuses, electronic device and computer readable storage medium
CN111722919A (en) Method and device for running background application program, storage medium and electronic equipment
CN112083841B (en) Information input method, device and storage medium
CN105100135A (en) Network sharing setting method and device
CN106502719A (en) The method and device of the component of management application program
CN114253385A (en) Power consumption management method and device of mobile terminal and computer readable storage medium

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