Movatterモバイル変換


[0]ホーム

URL:


CN106125891A - Terminal power optimization method, device and terminal - Google Patents

Terminal power optimization method, device and terminal
Download PDF

Info

Publication number
CN106125891A
CN106125891ACN201610474587.9ACN201610474587ACN106125891ACN 106125891 ACN106125891 ACN 106125891ACN 201610474587 ACN201610474587 ACN 201610474587ACN 106125891 ACN106125891 ACN 106125891A
Authority
CN
China
Prior art keywords
lock
wake
terminal
application
application request
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.)
Pending
Application number
CN201610474587.9A
Other languages
Chinese (zh)
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 Qihoo Technology Co Ltd
Qizhi Software Beijing Co Ltd
Original Assignee
Beijing Qihoo Technology Co Ltd
Qizhi Software Beijing 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 Qihoo Technology Co Ltd, Qizhi Software Beijing Co LtdfiledCriticalBeijing Qihoo Technology Co Ltd
Priority to CN201610474587.9ApriorityCriticalpatent/CN106125891A/en
Publication of CN106125891ApublicationCriticalpatent/CN106125891A/en
Pendinglegal-statusCriticalCurrent

Links

Classifications

Landscapes

Abstract

Translated fromChinese

本发明公开了一种终端电量优化方法、装置及终端,其中,终端电量优化方法包括:在系统中设置终端应用的锁定机制,当接收到进程发送的用于申请唤醒锁的申请请求时,判断申请请求是否符合预设申请条件;若判断得到申请请求符合预设申请条件,则为进程申请唤醒锁,将唤醒锁的相关信息写入锁列表文件;若判断得到申请请求不符合预设申请条件,则拒绝为进程申请唤醒锁。利用本发明提供的技术方案,通过设置的锁定机制,实现了对唤醒锁申请的有效限制,有效地节省了终端的电量,实现了对终端电量的优化。

The invention discloses a terminal power optimization method, device, and terminal, wherein the terminal power optimization method includes: setting a locking mechanism for terminal applications in the system, and judging when an application request for a wake-up lock sent by a process is received Whether the application request meets the preset application conditions; if it is judged that the application request meets the preset application conditions, apply for a wake lock for the process, and write the relevant information of the wake lock into the lock list file; if it is judged that the application request does not meet the preset application conditions , refuse to apply for a wake lock for the process. Utilizing the technical solution provided by the present invention, through the set locking mechanism, the effective restriction on the wake-up lock application is realized, the power of the terminal is effectively saved, and the power of the terminal is optimized.

Description

Translated fromChinese
终端电量优化方法、装置及终端Terminal power optimization method, device and terminal

技术领域technical field

本发明涉及互联网技术领域,具体涉及一种终端电量优化方法、装置及终端。The present invention relates to the technical field of the Internet, in particular to a method, a device and a terminal for optimizing power consumption of a terminal.

背景技术Background technique

随着互联网技术的快速发展,例如智能手机等终端的处理能力越来越强,可支持多种应用程序,然而耗电量也随之越来越大,极大地缩短了其待机时间,例如智能手机的待机时间大多不超过一天,因此用户需要频繁地为其充电以保证正常使用。然而有很大一部分电量是消耗在隐藏在后台的一些不必要的应用程序上,这些应用程序出于使自己能够实时地向用户推送信息等目的,滥用唤醒锁机制,使终端的CPU一直处于运行状态,无法进入省电的休眠模式,从而导致电池电量消耗很快。With the rapid development of Internet technology, the processing power of terminals such as smartphones is getting stronger and stronger, which can support a variety of applications, but the power consumption is also increasing, which greatly shortens its standby time, such as smart phones The standby time of mobile phones is mostly no more than one day, so users need to charge them frequently to ensure normal use. However, a large part of the power is consumed by some unnecessary applications hidden in the background. These applications abuse the wake-up lock mechanism for the purpose of enabling themselves to push information to users in real time, so that the CPU of the terminal is always running. state, unable to enter power-saving hibernation mode, resulting in rapid battery drain.

在现有技术中,为了解决这个问题,技术人员开发了一些电量优化应用程序,这些电量优化应用程序会不停地检测唤醒锁的使用状况,如果经检测发现某个唤醒锁的占用时间超长时就会对该唤醒锁进行强制解锁处理。然而这些电量优化应用程序由于需要不停地检测唤醒锁的使用状况,其本身也会消耗很多电量。In the existing technology, in order to solve this problem, technicians have developed some power optimization applications. These power optimization applications will continuously detect the usage status of wakelocks. The wake lock will be forcibly unlocked. However, these battery-optimized applications also consume a lot of power because they need to constantly detect the usage of wake locks.

发明内容Contents of the invention

鉴于上述问题,提出了本发明以便提供一种克服上述问题或者至少部分地解决上述问题的终端电量优化方法、装置及终端。In view of the above problems, the present invention is proposed to provide a terminal power optimization method, device, and terminal that overcome the above problems or at least partially solve the above problems.

根据本发明的一个方面,提供了一种终端电量优化方法,该方法包括:According to one aspect of the present invention, a terminal power optimization method is provided, the method comprising:

在系统中设置终端应用的锁定机制,当接收到进程发送的用于申请唤醒锁的申请请求时,判断申请请求是否符合预设申请条件;Set the locking mechanism of the terminal application in the system, and when receiving the application request for applying for a wake lock sent by the process, determine whether the application request meets the preset application conditions;

若判断得到申请请求符合预设申请条件,则为进程申请唤醒锁,将唤醒锁的相关信息写入锁列表文件;If it is determined that the application request meets the preset application conditions, apply for a wake lock for the process, and write the relevant information of the wake lock into the lock list file;

若判断得到申请请求不符合预设申请条件,则拒绝为进程申请唤醒锁。If it is judged that the application request does not meet the preset application conditions, then refuse to apply for the wake lock for the process.

根据本发明的另一方面,提供了一种终端电量优化装置,该装置包括:According to another aspect of the present invention, a terminal power optimization device is provided, which includes:

设置模块,适于在系统中设置终端应用的锁定机制;The setting module is suitable for setting the locking mechanism of the terminal application in the system;

判断模块,适于当接收到进程发送的用于申请唤醒锁的申请请求时,判断申请请求是否符合预设申请条件;The judging module is adapted to judge whether the application request meets the preset application conditions when receiving the application request for applying for the wake lock sent by the process;

申请模块,适于若判断模块判断得到申请请求符合预设申请条件,则为进程申请唤醒锁,将唤醒锁的相关信息写入锁列表文件;The application module is adapted to apply for a wake lock for the process if the judging module judges that the application request meets the preset application conditions, and writes the related information of the wake lock into the lock list file;

拒绝模块,适于若判断模块判断得到申请请求不符合预设申请条件,则拒绝为进程申请唤醒锁。The rejection module is adapted to refuse to apply for the wake lock for the process if the judging module judges that the application request does not meet the preset application conditions.

根据本发明的又一个方面,提供了一种终端,包括上述的终端电量优化装置。According to yet another aspect of the present invention, a terminal is provided, including the above-mentioned terminal power optimization device.

根据本发明提供的技术方案,在系统中设置终端应用的锁定机制,接着当接收到进程发送的用于申请唤醒锁的申请请求时,判断申请请求是否符合预设申请条件;在判断得到申请请求符合预设申请条件的情况下,为进程申请唤醒锁,将唤醒锁的相关信息写入锁列表文件;在判断得到申请请求不符合预设申请条件的情况下,拒绝为进程申请唤醒锁。与现有技术中通过检测唤醒锁进行电量优化的方式相比,利用本发明提供的技术方案,通过设置的锁定机制,不仅实现了对唤醒锁申请的有效限制,避免了滥用唤醒锁的情况出现,还有效地节省了终端的电量,实现了对终端电量的优化。According to the technical solution provided by the present invention, the locking mechanism of the terminal application is set in the system, and then when the application request for applying for a wake lock sent by the process is received, it is judged whether the application request meets the preset application conditions; When the preset application conditions are met, apply for a wake lock for the process, and write the relevant information of the wake lock into the lock list file; when it is judged that the application request does not meet the preset application conditions, refuse to apply for the wake lock for the process. Compared with the method of power optimization by detecting wake locks in the prior art, using the technical solution provided by the present invention and setting the locking mechanism not only realizes effective restrictions on wake lock applications, but also avoids the occurrence of abuse of wake locks , It also effectively saves the power of the terminal, and realizes the optimization of the power of the terminal.

上述说明仅是本发明技术方案的概述,为了能够更清楚了解本发明的技术手段,而可依照说明书的内容予以实施,并且为了让本发明的上述和其它目的、特征和优点能够更明显易懂,以下特举本发明的具体实施方式。The above description is only an overview of the technical solution of the present invention. In order to better understand the technical means of the present invention, it can be implemented according to the contents of the description, and in order to make the above and other purposes, features and advantages of the present invention more obvious and understandable , the specific embodiments of the present invention are enumerated below.

附图说明Description of drawings

通过阅读下文优选实施方式的详细描述,各种其他的优点和益处对于本领域普通技术人员将变得清楚明了。附图仅用于示出优选实施方式的目的,而并不认为是对本发明的限制。而且在整个附图中,用相同的参考符号表示相同的部件。在附图中:Various other advantages and benefits will become apparent to those of ordinary skill in the art upon reading the following detailed description of the preferred embodiment. The drawings are only for the purpose of illustrating a preferred embodiment and are not to be considered as limiting the invention. Also throughout the drawings, the same reference numerals are used to designate the same parts. In the attached picture:

图1示出了根据本发明一个实施例的终端电量优化方法的流程示意图;FIG. 1 shows a schematic flow chart of a terminal power optimization method according to an embodiment of the present invention;

图2示出了根据本发明另一个实施例的终端电量优化方法的流程示意图;FIG. 2 shows a schematic flow chart of a terminal power optimization method according to another embodiment of the present invention;

图3示出了根据本发明一个实施例的终端电量优化装置的结构框图;Fig. 3 shows a structural block diagram of a terminal power optimization device according to an embodiment of the present invention;

图4示出了根据本发明另一个实施例的终端电量优化装置的结构框图。Fig. 4 shows a structural block diagram of an apparatus for optimizing battery capacity of a terminal according to another embodiment of the present invention.

具体实施方式detailed description

下面将参照附图更详细地描述本公开的示例性实施例。虽然附图中显示了本公开的示例性实施例,然而应当理解,可以以各种形式实现本公开而不应被这里阐述的实施例所限制。相反,提供这些实施例是为了能够更透彻地理解本公开,并且能够将本公开的范围完整的传达给本领域的技术人员。Exemplary embodiments of the present disclosure will be described in more detail below with reference to the accompanying drawings. Although exemplary embodiments of the present disclosure are shown in the drawings, it should be understood that the present disclosure may be embodied in various forms and should not be limited by the embodiments set forth herein. Rather, these embodiments are provided for more thorough understanding of the present disclosure and to fully convey the scope of the present disclosure to those skilled in the art.

图1示出了根据本发明一个实施例的终端电量优化方法的流程示意图,其中,终端可以为智能手机、PAD、智能后视镜、智能手表等设备,如图1所示,该方法包括如下步骤:Fig. 1 shows a schematic flow diagram of a method for optimizing terminal power consumption according to an embodiment of the present invention, wherein the terminal may be a smart phone, a PAD, a smart rearview mirror, a smart watch, etc., as shown in Fig. 1 , the method includes the following steps step:

步骤S100,在系统中设置终端应用的锁定机制。Step S100, setting a locking mechanism for terminal applications in the system.

在步骤S100中,在系统中设置终端应用的锁定机制,以便后续根据该锁定机制对终端电量进行优化。具体地,终端应用的锁定机制可包括:唤醒锁分配机制。In step S100, a locking mechanism of the terminal application is set in the system, so as to subsequently optimize the power of the terminal according to the locking mechanism. Specifically, the locking mechanism of the terminal application may include: a wake lock allocation mechanism.

步骤S101,当接收到进程发送的用于申请唤醒锁的申请请求时,判断申请请求是否符合预设申请条件;若是,则执行步骤S102;若否,则执行步骤S103。Step S101, when an application request for applying for a wake lock sent by a process is received, determine whether the application request meets preset application conditions; if yes, execute step S102; if not, execute step S103.

在步骤S100设置了终端应用的锁定机制之后,在步骤S101中,当接收到进程发送的用于申请唤醒锁的申请请求时,根据锁定机制,判断申请请求是否符合预设申请条件。其中,本领域技术人员可根据实际需要对预设申请条件进行设置,此处不做限定。如果判断得到申请请求符合预设申请条件,则执行步骤S102;如果判断得到申请请求不符合预设申请条件,则执行步骤S103。After the locking mechanism of the terminal application is set in step S100, in step S101, when the application request for applying for a wake lock sent by the process is received, according to the locking mechanism, it is judged whether the application request meets the preset application conditions. Among them, those skilled in the art can set the preset application conditions according to actual needs, which are not limited here. If it is determined that the application request meets the preset application conditions, then step S102 is performed; if it is determined that the application request does not meet the preset application conditions, then step S103 is performed.

步骤S102,为进程申请唤醒锁,将唤醒锁的相关信息写入锁列表文件。Step S102, apply for a wake lock for the process, and write related information of the wake lock into a lock list file.

在经步骤S101判断得到申请请求符合预设申请条件的情况下,在步骤S102中,为进程申请唤醒锁,将唤醒锁的相关信息写入锁列表文件。When it is judged in step S101 that the application request meets the preset application conditions, in step S102, apply for a wake lock for the process, and write related information of the wake lock into the lock list file.

步骤S103,拒绝为进程申请唤醒锁。Step S103, refusing to apply for a wake lock for the process.

在经步骤S101判断得到申请请求不符合预设申请条件的情况下,在步骤S103中,拒绝为进程申请唤醒锁。If it is determined in step S101 that the application request does not meet the preset application conditions, in step S103, the process is refused to apply for a wake lock.

根据本实施例提供的终端电量优化方法,在系统中设置终端应用的锁定机制,接着当接收到进程发送的用于申请唤醒锁的申请请求时,判断申请请求是否符合预设申请条件;在判断得到申请请求符合预设申请条件的情况下,为进程申请唤醒锁,将唤醒锁的相关信息写入锁列表文件;在判断得到申请请求不符合预设申请条件的情况下,拒绝为进程申请唤醒锁。与现有技术中通过检测唤醒锁进行电量优化的方式相比,利用本发明提供的技术方案,通过设置的锁定机制,不仅实现了对唤醒锁申请的有效限制,避免了滥用唤醒锁的情况出现,还有效地节省了终端的电量,实现了对终端电量的优化。According to the terminal power optimization method provided in this embodiment, the locking mechanism of the terminal application is set in the system, and then when the application request for applying for a wake lock sent by the process is received, it is judged whether the application request meets the preset application conditions; When the application request meets the preset application conditions, apply for a wake-up lock for the process, and write the relevant information of the wake-up lock into the lock list file; when it is judged that the application request does not meet the preset application conditions, refuse to apply for a wake-up for the process Lock. Compared with the method of power optimization by detecting wake locks in the prior art, using the technical solution provided by the present invention and setting the locking mechanism not only realizes effective restrictions on wake lock applications, but also avoids the occurrence of abuse of wake locks , It also effectively saves the power of the terminal, and realizes the optimization of the power of the terminal.

图2示出了根据本发明另一个实施例的终端电量优化方法的流程示意图,其中,终端可以为智能手机、PAD、智能后视镜、智能手表等设备,如图2所示,该方法包括如下步骤:Fig. 2 shows a schematic flow diagram of a method for optimizing terminal power according to another embodiment of the present invention, wherein the terminal may be a smart phone, a PAD, a smart rearview mirror, a smart watch, etc., as shown in Fig. 2 , the method includes Follow the steps below:

步骤S200,在框架层,修改终端的操作系统的电源管理服务。Step S200, at the framework layer, modify the power management service of the operating system of the terminal.

其中,操作系统的电源管理服务用于管理唤醒锁的申请和释放。为了实现对终端电量的优化,在步骤S200中,在框架层,修改终端的操作系统的电源管理服务。具体地,在框架层,可在电源管理服务的唤醒锁分配机制中增加预设白名单。其中,预设白名单包括:允许申请唤醒锁的进程。本领域技术人员可根据实际需求对预设白名单进行设置,此处不做限定。Wherein, the power management service of the operating system is used to manage the application and release of the wake lock. In order to optimize the power of the terminal, in step S200, the power management service of the operating system of the terminal is modified at the framework layer. Specifically, at the framework layer, a preset whitelist can be added to the wake lock allocation mechanism of the power management service. Wherein, the preset white list includes: processes allowed to apply for wake locks. Those skilled in the art can set the preset whitelist according to actual needs, which is not limited here.

步骤S201,在电源管理服务接收到进程发送的用于申请唤醒锁的申请请求时,判断申请请求是否符合预设申请条件;若是,则执行步骤S202;若否,则执行步骤S205。Step S201, when the power management service receives an application request for applying for a wake lock sent by a process, judge whether the application request meets the preset application conditions; if yes, execute step S202; if not, execute step S205.

在步骤S200修改了终端的操作系统的电源管理服务之后,在步骤S201中,在电源管理服务接收到进程发送的用于申请唤醒锁的申请请求时,判断申请请求是否符合预设申请条件。具体地,可判断申请请求对应的进程是否属于预设白名单。如果判断得到申请请求对应的进程属于预设白名单,则说明该申请请求符合预设申请条件,那么接着执行步骤S202;如果判断得到申请请求对应的进程不属于预设白名单,则说明该申请请求不符合预设申请条件,那么接着执行步骤S205。After modifying the power management service of the operating system of the terminal in step S200, in step S201, when the power management service receives the application request for applying for a wake lock sent by the process, it determines whether the application request meets the preset application conditions. Specifically, it may be determined whether the process corresponding to the application request belongs to the preset white list. If it is determined that the process corresponding to the application request belongs to the preset white list, it means that the application request meets the preset application conditions, and then step S202 is performed; if it is determined that the process corresponding to the application request does not belong to the preset white list, it means that the application If the request does not meet the preset application conditions, step S205 is then performed.

步骤S202,按照预设命名规则命名唤醒锁的锁名,并将唤醒锁对应的进程的名称、锁名以及唤醒锁特性写入锁列表文件。Step S202, naming the lock name of the wake lock according to the preset naming rules, and writing the name of the process corresponding to the wake lock, the lock name and the characteristics of the wake lock into the lock list file.

在经步骤S201判断得到申请请求符合预设申请条件的情况下,在步骤S202中,按照预设命名规则命名唤醒锁的锁名,并将唤醒锁对应的进程的名称、锁名以及唤醒锁特性写入锁列表文件。其中,本领域技术人员可根据实际需要对预设命名规则进行设置,此处不做限定。在现有技术中,唤醒锁的锁名一般是由申请唤醒锁的进程命名的,因此唤醒锁的锁名可能会杂乱无章,十分不便于管理,而本发明提供的技术方案是按照预设命名规则命名唤醒锁的锁名,并将唤醒锁对应的进程的名称、锁名以及唤醒锁特性写入锁列表文件,从而有助于提高对唤醒锁的统一管理的效率。When it is judged by step S201 that the application request meets the preset application conditions, in step S202, name the lock name of the wake-up lock according to the preset naming rules, and the name of the process corresponding to the wake-up lock, the lock name and the characteristics of the wake-up lock Write the lock list file. Wherein, those skilled in the art can set the preset naming rules according to actual needs, which is not limited here. In the prior art, the lock name of the wake-up lock is generally named by the process that applies for the wake-up lock, so the lock name of the wake-up lock may be messy and inconvenient to manage, but the technical solution provided by the present invention is based on the preset naming rules Name the lock name of the wake lock, and write the process name, lock name and wake lock characteristics corresponding to the wake lock into the lock list file, which helps to improve the efficiency of unified management of wake locks.

步骤S203,根据锁列表文件,检测唤醒锁对应的进程是否处于异常运行状态;若是,则执行步骤S204;若否,则该方法结束。Step S203, according to the lock list file, detect whether the process corresponding to the wake lock is in an abnormal running state; if yes, execute step S204; if not, the method ends.

如果唤醒锁对应的进程处于异常运行状态,由于唤醒锁的存在,终端无法进入休眠模式,也将耗费终端的电量,为了进一步对终端电量进行优化,在步骤S203中,根据锁列表文件,检测唤醒锁对应的进程是否处于异常运行状态。如果检测得到唤醒锁对应的进程处于异常运行状态,则执行步骤S204;如果检测得到唤醒锁对应的进程未处于异常运行状态,则该方法结束。可选地,可每隔预设时间间隔检测唤醒锁对应的进程是否处于异常运行状态,本领域技术人员可根据实际需要设置预设时间间隔,此处不做限定。If the process corresponding to the wake lock is in an abnormal running state, due to the existence of the wake lock, the terminal cannot enter the sleep mode, which will also consume the power of the terminal. In order to further optimize the power of the terminal, in step S203, according to the lock list file, detect the wake-up Whether the process corresponding to the lock is in an abnormal running state. If it is detected that the process corresponding to the wake lock is in an abnormal running state, step S204 is performed; if it is detected that the process corresponding to the wake lock is not in an abnormal running state, the method ends. Optionally, it is possible to detect whether the process corresponding to the wake lock is in an abnormal running state every preset time interval, and those skilled in the art can set the preset time interval according to actual needs, which is not limited here.

步骤S204,释放唤醒锁。Step S204, releasing the wake lock.

在经步骤S203检测得到唤醒锁对应的进程处于异常运行状态的情况下,释放唤醒锁。When it is detected in step S203 that the process corresponding to the wake-up lock is in an abnormal running state, the wake-up lock is released.

步骤S205,拒绝为进程申请唤醒锁。Step S205, refusing to apply for a wake lock for the process.

在经步骤S201判断得到申请请求不符合预设申请条件的情况下,拒绝为进程申请唤醒锁。If it is judged in step S201 that the application request does not meet the preset application conditions, it is refused to apply for the wake lock for the process.

可选地,在本实施例的一个可能的实现方式中,该方法还包括为申请请求对应的进程设置级别参数的步骤,那么在步骤S202中,还将唤醒锁对应的进程的级别参数写入锁列表文件,在步骤S203中,根据锁列表文件中的唤醒锁对应的进程的级别参数,检测唤醒锁对应的进程是否处于异常运行状态。例如,为申请请求对应的进程设置的级别参数包括第一级别和第二级别,且第一级别的进程的重要程度高于第二级别的进程的重要程度,那么为了避免因释放第一级别的进程的唤醒锁而给终端造成不良影响的情况的出现,在步骤S203中,可仅检测与唤醒锁对应的且级别参数为第二等级的进程是否处于异常运行状态。Optionally, in a possible implementation of this embodiment, the method further includes the step of setting a level parameter for the process corresponding to the application request, then in step S202, the level parameter of the process corresponding to the wake lock is also written into For the lock list file, in step S203, according to the level parameter of the process corresponding to the wake lock in the lock list file, it is detected whether the process corresponding to the wake lock is in an abnormal running state. For example, if the level parameter set for the process corresponding to the application request includes the first level and the second level, and the importance of the first level process is higher than that of the second level process, then in order to avoid the In the event that the wakelock of the process causes adverse effects on the terminal, in step S203, it may only be detected whether the process corresponding to the wakelock and whose level parameter is the second level is in an abnormal running state.

例如,将该方法应用到智能后视镜中时,可有效地节省智能后视镜的电量,使智能后视镜具有较长的待机时间。For example, when the method is applied to a smart rearview mirror, the power of the smart rearview mirror can be effectively saved, so that the smart rearview mirror has a longer standby time.

根据本实施例提供的终端电量优化方法,在框架层,修改终端的操作系统的电源管理服务,接着在电源管理服务接收到进程发送的用于申请唤醒锁的申请请求时,判断申请请求是否符合预设申请条件,在判断得到申请请求符合预设申请条件的情况下,按照预设命名规则命名唤醒锁的锁名,并将唤醒锁对应的进程的名称、锁名以及唤醒锁特性写入锁列表文件,在判断得到申请请求不符合预设申请条件的情况下,拒绝为进程申请唤醒锁;另外,该方法还根据锁列表文件,检测唤醒锁对应的进程是否处于异常运行状态,如果检测得到唤醒锁对应的进程处于异常运行状态,则释放该唤醒锁。与现有技术中通过检测唤醒锁进行电量优化的方式相比,利用本发明提供的技术方案,通过在框架层修改终端的操作系统的电源管理服务,不仅实现了对唤醒锁申请的有效限制,避免了滥用唤醒锁的情况出现,还有效地节省了终端的电量,另外,该技术方案按照预设命名规则命名唤醒锁的锁名,有助于提高对唤醒锁的统一管理的效率,并在检测得到唤醒锁对应的进程处于异常运行状态时释放唤醒锁,从而进一步节省了终端的电量,实现了对终端电量的优化。According to the terminal power optimization method provided in this embodiment, at the framework layer, the power management service of the operating system of the terminal is modified, and then when the power management service receives the application request for applying for a wake lock sent by the process, it is judged whether the application request meets the requirements. Preset application conditions. When the application request is judged to meet the preset application conditions, name the lock name of the wake-up lock according to the preset naming rules, and write the process name, lock name and wake-up lock characteristics corresponding to the wake-up lock into the lock List file, when it is judged that the application request does not meet the preset application conditions, it refuses to apply for a wake lock for the process; in addition, this method also detects whether the process corresponding to the wake lock is in an abnormal running state according to the lock list file. If the process corresponding to the wake lock is in an abnormal running state, the wake lock is released. Compared with the way of power optimization by detecting wake locks in the prior art, using the technical solution provided by the present invention, by modifying the power management service of the terminal operating system at the framework layer, not only effective restrictions on wake lock applications are realized, It avoids the abuse of wake locks, and effectively saves the power of the terminal. In addition, this technical solution names the lock names of wake locks according to the preset naming rules, which helps to improve the efficiency of unified management of wake locks, and in When it is detected that the process corresponding to the wake-up lock is in an abnormal running state, the wake-up lock is released, thereby further saving the power of the terminal and realizing the optimization of the power of the terminal.

图3示出了根据本发明一个实施例的终端电量优化装置的结构框图,其中,终端可以为智能手机、PAD、智能后视镜、智能手表等设备,如图3所示,该装置包括:设置模块310、判断模块320、申请模块330和拒绝模块340。Fig. 3 shows a structural block diagram of a terminal power optimization device according to an embodiment of the present invention, wherein the terminal can be a smart phone, a PAD, a smart rearview mirror, a smart watch, etc., as shown in Fig. 3 , the device includes: A setting module 310 , a judgment module 320 , an application module 330 and a rejection module 340 .

设置模块310适于:在系统中设置终端应用的锁定机制。The setting module 310 is suitable for: setting the locking mechanism of the terminal application in the system.

具体地,终端应用的锁定机制可包括:唤醒锁分配机制。Specifically, the locking mechanism of the terminal application may include: a wake lock allocation mechanism.

判断模块320适于:当接收到进程发送的用于申请唤醒锁的申请请求时,判断申请请求是否符合预设申请条件。The judging module 320 is adapted to: when receiving an application request for applying for a wake lock sent by a process, judge whether the application request meets a preset application condition.

当接收到进程发送的用于申请唤醒锁的申请请求时,判断模块320根据设置模块310设置的锁定机制,判断申请请求是否符合预设申请条件。其中,本领域技术人员可根据实际需要对预设申请条件进行设置,此处不做限定。When receiving the application request for applying for a wake lock sent by the process, the judging module 320 judges whether the application request meets the preset application conditions according to the locking mechanism set by the setting module 310 . Among them, those skilled in the art can set the preset application conditions according to actual needs, which are not limited here.

申请模块330适于:若判断模块320判断得到申请请求符合预设申请条件,则为进程申请唤醒锁,将唤醒锁的相关信息写入锁列表文件。The application module 330 is adapted to: if the judging module 320 judges that the application request meets the preset application conditions, apply for a wake lock for the process, and write related information of the wake lock into the lock list file.

拒绝模块340适于:若判断模块330判断得到申请请求不符合预设申请条件,则拒绝为进程申请唤醒锁。The rejection module 340 is adapted to: if the judging module 330 judges that the application request does not meet the preset application conditions, then refuse to apply for the wake lock for the process.

根据本实施例提供的终端电量优化装置,设置模块在系统中设置终端应用的锁定机制,判断模块当接收到进程发送的用于申请唤醒锁的申请请求时,判断申请请求是否符合预设申请条件;在判断模块判断得到申请请求符合预设申请条件的情况下,申请模块为进程申请唤醒锁,将唤醒锁的相关信息写入锁列表文件;在判断模块判断得到申请请求不符合预设申请条件的情况下,拒绝模块拒绝为进程申请唤醒锁。与现有技术中通过检测唤醒锁进行电量优化的方式相比,利用本发明提供的技术方案,通过设置的锁定机制,不仅实现了对唤醒锁申请的有效限制,避免了滥用唤醒锁的情况出现,还有效地节省了终端的电量,实现了对终端电量的优化。According to the terminal power optimization device provided in this embodiment, the setting module sets the locking mechanism of the terminal application in the system, and when the judging module receives the application request for applying for a wake lock sent by the process, it judges whether the application request meets the preset application conditions ; When the judgment module judges that the application request meets the preset application conditions, the application module applies for a wake lock for the process, and writes the relevant information of the wake lock into the lock list file; when the judgment module judges that the application request does not meet the preset application conditions In the case of , the rejection module refuses to apply for a wake lock for the process. Compared with the method of power optimization by detecting wake locks in the prior art, using the technical solution provided by the present invention and setting the locking mechanism not only realizes effective restrictions on wake lock applications, but also avoids the occurrence of abuse of wake locks , It also effectively saves the power of the terminal, and realizes the optimization of the power of the terminal.

图4示出了根据本发明另一个实施例的终端电量优化装置的结构框图,如图4所示,该装置包括:设置模块410、判断模块420、申请模块430、拒绝模块440、检测模块450和释放模块460。Fig. 4 shows a structural block diagram of a terminal power optimization device according to another embodiment of the present invention. As shown in Fig. 4, the device includes: a setting module 410, a judgment module 420, an application module 430, a rejection module 440, and a detection module 450 and release module 460 .

设置模块410适于:在框架层,修改终端的操作系统的电源管理服务。The setting module 410 is adapted to: at the framework layer, modify the power management service of the operating system of the terminal.

其中,操作系统的电源管理服务用于管理唤醒锁的申请和释放。为了实现对终端电量的优化,设置模块410在框架层,修改终端的操作系统的电源管理服务。Wherein, the power management service of the operating system is used to manage the application and release of the wake lock. In order to optimize the power of the terminal, the setting module 410 modifies the power management service of the operating system of the terminal at the framework layer.

判断模块420适于:在电源管理服务接收到进程发送的用于申请唤醒锁的申请请求时,判断申请请求是否符合预设申请条件。The judging module 420 is adapted to: when the power management service receives an application request for applying for a wake lock sent by a process, judge whether the application request meets a preset application condition.

其中,本领域技术人员可根据实际需要对预设申请条件进行设置,此处不做限定。如果判断模块420判断得到申请请求符合预设申请条件,则触发申请模块430;如果判断模块420判断得到申请请求不符合预设申请条件,则触发拒绝模块440。Among them, those skilled in the art can set the preset application conditions according to actual needs, which are not limited here. If the judgment module 420 judges that the application request meets the preset application conditions, the application module 430 is triggered; if the judgment module 420 judges that the application request does not meet the preset application conditions, the rejection module 440 is triggered.

具体地,设置模块410进一步适于:在框架层,在电源管理服务的唤醒锁分配机制中增加预设白名单。其中,预设白名单包括:允许申请唤醒锁的进程。本领域技术人员可根据实际需求对预设白名单进行设置,此处不做限定。Specifically, the setting module 410 is further adapted to: at the framework layer, add a preset whitelist in the wake lock allocation mechanism of the power management service. Wherein, the preset white list includes: processes allowed to apply for wake locks. Those skilled in the art can set the preset whitelist according to actual needs, which is not limited here.

判断模块420进一步适于:在电源管理服务接收到进程发送的用于申请唤醒锁的申请请求时,判断申请请求对应的进程是否属于预设白名单。如果判断模块420判断得到申请请求对应的进程属于预设白名单,则说明该申请请求符合预设申请条件,那么触发申请模块430;如果判断模块420判断得到申请请求对应的进程不属于预设白名单,则说明该申请请求不符合预设申请条件,那么触发拒绝模块440。The judging module 420 is further adapted to: when the power management service receives an application request for applying for a wake lock sent by a process, judge whether the process corresponding to the application request belongs to the preset white list. If the judgment module 420 judges that the process corresponding to the application request belongs to the preset white list, it means that the application request meets the preset application conditions, and the application module 430 is triggered; if the judgment module 420 judges that the process corresponding to the application request does not belong to the preset white list list, it means that the application request does not meet the preset application conditions, and then the rejection module 440 is triggered.

申请模块430适于:若判断模块420判断得到申请请求符合预设申请条件,则按照预设命名规则命名唤醒锁的锁名,并将唤醒锁对应的进程的名称、锁名以及唤醒锁特性写入锁列表文件。The application module 430 is adapted to: if the judging module 420 judges that the application request meets the preset application conditions, then name the lock name of the wake lock according to the preset naming rules, and write the name of the process corresponding to the wake lock, the lock name and the wake lock characteristics Enter the locklist file.

其中,本领域技术人员可根据实际需要对预设命名规则进行设置,此处不做限定。本发明提供的技术方案是按照预设命名规则命名唤醒锁的锁名,并将唤醒锁对应的进程的名称、锁名以及唤醒锁特性写入锁列表文件,从而有助于提高对唤醒锁的统一管理的效率。Wherein, those skilled in the art can set the preset naming rules according to actual needs, which is not limited here. The technical solution provided by the present invention is to name the lock name of the wake-up lock according to the preset naming rules, and write the name of the process corresponding to the wake-up lock, the lock name and the characteristics of the wake-up lock into the lock list file, thereby helping to improve the awareness of the wake-up lock. Unified management efficiency.

拒绝模块440适于:若判断模块420判断得到申请请求不符合预设申请条件,则拒绝为进程申请唤醒锁。The rejection module 440 is adapted to: if the judging module 420 judges that the application request does not meet the preset application conditions, then refuse to apply for the wake lock for the process.

检测模块450适于:根据锁列表文件,检测唤醒锁对应的进程是否处于异常运行状态。The detection module 450 is adapted to: according to the lock list file, detect whether the process corresponding to the wake lock is in an abnormal running state.

为了避免出现唤醒锁对应的进程处于异常运行状态而导致终端无法进入休眠模式的情况出现,检测模块450根据锁列表文件,检测唤醒锁对应的进程是否处于异常运行状态。可选地,检测模块450可每隔预设时间间隔检测唤醒锁对应的进程是否处于异常运行状态,本领域技术人员可根据实际需要设置预设时间间隔,此处不做限定。如果检测模块450检测得到唤醒锁对应的进程处于异常运行状态,则触发释放模块460。In order to avoid the situation that the process corresponding to the wake lock is in an abnormal running state and the terminal cannot enter the sleep mode, the detection module 450 detects whether the process corresponding to the wake lock is in an abnormal running state according to the lock list file. Optionally, the detection module 450 can detect whether the process corresponding to the wake lock is in an abnormal running state every preset time interval, and those skilled in the art can set the preset time interval according to actual needs, which is not limited here. If the detection module 450 detects that the process corresponding to the wake lock is in an abnormal running state, the release module 460 is triggered.

释放模块460适于:若检测模块450检测得到唤醒锁对应的进程处于异常运行状态,则释放唤醒锁。The release module 460 is adapted to: release the wake lock if the detection module 450 detects that the process corresponding to the wake lock is in an abnormal running state.

可选地,在本实施例的一个可能的实现方式中,设置模块410进一步适于为申请请求对应的进程设置级别参数,那么申请模块430进一步适于将唤醒锁对应的进程的级别参数写入锁列表文件,检测模块450进一步适于根据锁列表文件中的唤醒锁对应的进程的级别参数,检测唤醒锁对应的进程是否处于异常运行状态。例如,设置模块410为申请请求对应的进程设置的级别参数包括第一级别和第二级别,且第一级别的进程的重要程度高于第二级别的进程的重要程度,为了避免因释放第一级别的进程的唤醒锁而给终端造成不良影响的情况的出现,那么检测模块450可仅检测与唤醒锁对应的且级别参数为第二等级的进程是否处于异常运行状态。Optionally, in a possible implementation of this embodiment, the setting module 410 is further adapted to set the level parameter for the process corresponding to the application request, then the application module 430 is further adapted to write the level parameter of the process corresponding to the wake lock into For the lock list file, the detection module 450 is further adapted to detect whether the process corresponding to the wake lock is in an abnormal running state according to the level parameter of the process corresponding to the wake lock in the lock list file. For example, the level parameter set by the setting module 410 for the process corresponding to the application request includes the first level and the second level, and the importance of the process of the first level is higher than that of the process of the second level. In the event that the wake lock of a process of the first level causes adverse effects on the terminal, the detection module 450 may only detect whether the process corresponding to the wake lock and whose level parameter is the second level is in an abnormal running state.

根据本实施例提供的终端电量优化装置,设置模块在框架层,修改终端的操作系统的电源管理服务,判断模块在电源管理服务接收到进程发送的用于申请唤醒锁的申请请求时,判断申请请求是否符合预设申请条件;在判断模块判断得到申请请求符合预设申请条件的情况下,申请模块按照预设命名规则命名唤醒锁的锁名,并将唤醒锁对应的进程的名称、锁名以及唤醒锁特性写入锁列表文件;在判断模块判断得到申请请求不符合预设申请条件的情况下,拒绝模块拒绝为进程申请唤醒锁;另外,检测模块还根据锁列表文件,检测唤醒锁对应的进程是否处于异常运行状态,如果检测模块检测得到唤醒锁对应的进程处于异常运行状态,则释放模块释放该唤醒锁。与现有技术中通过检测唤醒锁进行电量优化的方式相比,利用本发明提供的技术方案,通过在框架层修改终端的操作系统的电源管理服务,不仅实现了对唤醒锁申请的有效限制,避免了滥用唤醒锁的情况出现,还有效地节省了终端的电量,另外,该技术方案按照预设命名规则命名唤醒锁的锁名,有助于提高对唤醒锁的统一管理的效率,并在检测得到唤醒锁对应的进程处于异常运行状态时释放唤醒锁,从而进一步节省了终端的电量,实现了对终端电量的优化。According to the terminal power optimization device provided in this embodiment, the module is set at the framework layer to modify the power management service of the operating system of the terminal. Whether the request meets the preset application conditions; when the judging module judges that the application request meets the preset application conditions, the application module names the lock name of the wake-up lock according to the preset naming rules, and uses the process name and lock name corresponding to the wake-up lock And the wake lock feature is written into the lock list file; when the judging module judges that the application request does not meet the preset application conditions, the rejection module refuses to apply for the wake lock for the process; in addition, the detection module also detects the corresponding wake lock according to the lock list file. Whether the process is in an abnormal running state, if the detection module detects that the process corresponding to the wake lock is in an abnormal running state, the release module releases the wake lock. Compared with the way of power optimization by detecting wake locks in the prior art, using the technical solution provided by the present invention, by modifying the power management service of the terminal operating system at the framework layer, not only effective restrictions on wake lock applications are realized, It avoids the abuse of wake locks, and effectively saves the power of the terminal. In addition, this technical solution names the lock names of wake locks according to the preset naming rules, which helps to improve the efficiency of unified management of wake locks, and in When it is detected that the process corresponding to the wake-up lock is in an abnormal running state, the wake-up lock is released, thereby further saving the power of the terminal and realizing the optimization of the power of the terminal.

本发明还提供了一种终端,该终端包括上述的终端电量优化装置。具体地,终端可以为智能手机、PAD、智能后视镜、智能手表等设备。与现有技术中通过检测唤醒锁进行电量优化的方式相比,本发明提供的技术方案通过设置的锁定机制,不仅实现了对唤醒锁申请的有效限制,避免了滥用唤醒锁的情况出现,还有效地节省了终端的电量,实现了对终端电量的优化。The present invention also provides a terminal, which includes the above-mentioned terminal power optimization device. Specifically, the terminal may be a device such as a smart phone, a PAD, a smart rearview mirror, or a smart watch. Compared with the method of power optimization by detecting wake locks in the prior art, the technical solution provided by the present invention not only realizes effective restrictions on wake lock applications through the set locking mechanism, but also avoids the abuse of wake locks. The power of the terminal is effectively saved, and the power of the terminal is optimized.

在此提供的算法和显示不与任何特定计算机、虚拟系统或者其它设备固有相关。各种通用系统也可以与基于在此的示教一起使用。根据上面的描述,构造这类系统所要求的结构是显而易见的。此外,本发明也不针对任何特定编程语言。应当明白,可以利用各种编程语言实现在此描述的本发明的内容,并且上面对特定语言所做的描述是为了披露本发明的最佳实施方式。The algorithms and displays presented herein are not inherently related to any particular computer, virtual system, or other device. Various generic systems can also be used with the teachings based on this. The structure required to construct such a system is apparent from the above description. Furthermore, the present invention is not specific to any particular programming language. It should be understood that various programming languages can be used to implement the content of the present invention described herein, and the above description of specific languages is for disclosing the best mode of the present invention.

在此处所提供的说明书中,说明了大量具体细节。然而,能够理解,本发明的实施例可以在没有这些具体细节的情况下实践。在一些实例中,并未详细示出公知的方法、结构和技术,以便不模糊对本说明书的理解。In the description provided herein, numerous specific details are set forth. However, it is understood that embodiments of the invention may be practiced without these specific details. In some instances, well-known methods, structures and techniques have not been shown in detail in order not to obscure the understanding of this description.

类似地,应当理解,为了精简本公开并帮助理解各个发明方面中的一个或多个,在上面对本发明的示例性实施例的描述中,本发明的各个特征有时被一起分组到单个实施例、图、或者对其的描述中。然而,并不应将该公开的方法解释成反映如下意图:即所要求保护的本发明要求比在每个权利要求中所明确记载的特征更多的特征。更确切地说,如下面的权利要求书所反映的那样,发明方面在于少于前面公开的单个实施例的所有特征。因此,遵循具体实施方式的权利要求书由此明确地并入该具体实施方式,其中每个权利要求本身都作为本发明的单独实施例。Similarly, it should be appreciated that in the foregoing description of exemplary embodiments of the invention, in order to streamline this disclosure and to facilitate an understanding of one or more of the various inventive aspects, various features of the invention are sometimes grouped together in a single embodiment, figure, or its description. This method of disclosure, however, is not to be interpreted as reflecting an intention that the claimed invention requires more features than are expressly recited in each claim. Rather, as the following claims reflect, inventive aspects lie in less than all features of a single foregoing disclosed embodiment. Thus, the claims following the Detailed Description are hereby expressly incorporated into this Detailed Description, with each claim standing on its own as a separate embodiment of this invention.

本领域那些技术人员可以理解,可以对实施例中的设备中的模块进行自适应性地改变并且把它们设置在与该实施例不同的一个或多个设备中。可以把实施例中的模块或单元或组件组合成一个模块或单元或组件,以及此外可以把它们分成多个子模块或子单元或子组件。除了这样的特征和/或过程或者单元中的至少一些是相互排斥之外,可以采用任何组合对本说明书(包括伴随的权利要求、摘要和附图)中公开的所有特征以及如此公开的任何方法或者设备的所有过程或单元进行组合。除非另外明确陈述,本说明书(包括伴随的权利要求、摘要和附图)中公开的每个特征可以由提供相同、等同或相似目的的替代特征来代替。Those skilled in the art can understand that the modules in the device in the embodiment can be adaptively changed and arranged in one or more devices different from the embodiment. Modules or units or components in the embodiments may be combined into one module or unit or component, and furthermore may be divided into a plurality of sub-modules or sub-units or sub-assemblies. All features disclosed in this specification (including accompanying claims, abstract and drawings) and any method or method so disclosed may be used in any combination, except that at least some of such features and/or processes or units are mutually exclusive. All processes or units of equipment are combined. Each feature disclosed in this specification (including accompanying claims, abstract and drawings) may be replaced by alternative features serving the same, equivalent or similar purpose, unless expressly stated otherwise.

此外,本领域的技术人员能够理解,尽管在此所述的一些实施例包括其它实施例中所包括的某些特征而不是其它特征,但是不同实施例的特征的组合意味着处于本发明的范围之内并且形成不同的实施例。例如,在下面的权利要求书中,所要求保护的实施例的任意之一都可以以任意的组合方式来使用。Furthermore, those skilled in the art will understand that although some embodiments described herein include some features included in other embodiments but not others, combinations of features from different embodiments are meant to be within the scope of the invention. and form different embodiments. For example, in the following claims, any of the claimed embodiments may be used in any combination.

本发明的各个部件实施例可以以硬件实现,或者以在一个或者多个处理器上运行的软件模块实现,或者以它们的组合实现。本领域的技术人员应当理解,可以在实践中使用微处理器或者数字信号处理器(DSP)来实现根据本发明实施例中的一些或者全部部件的一些或者全部功能。本发明还可以实现为用于执行这里所描述的方法的一部分或者全部的设备或者装置程序(例如,计算机程序和计算机程序产品)。这样的实现本发明的程序可以存储在计算机可读介质上,或者可以具有一个或者多个信号的形式。这样的信号可以从因特网网站上下载得到,或者在载体信号上提供,或者以任何其他形式提供。The various component embodiments of the present invention may be implemented in hardware, or in software modules running on one or more processors, or in a combination thereof. Those skilled in the art should understand that a microprocessor or a digital signal processor (DSP) may be used in practice to implement some or all functions of some or all components in the embodiments of the present invention. The present invention can also be implemented as an apparatus or an apparatus program (for example, a computer program and a computer program product) for performing a part or all of the methods described herein. Such a program for realizing the present invention may be stored on a computer-readable medium, or may be in the form of one or more signals. Such a signal may be downloaded from an Internet site, or provided on a carrier signal, or provided in any other form.

应该注意的是上述实施例对本发明进行说明而不是对本发明进行限制,并且本领域技术人员在不脱离所附权利要求的范围的情况下可设计出替换实施例。在权利要求中,不应将位于括号之间的任何参考符号构造成对权利要求的限制。单词“包含”不排除存在未列在权利要求中的元件或步骤。位于元件之前的单词“一”或“一个”不排除存在多个这样的元件。本发明可以借助于包括有若干不同元件的硬件以及借助于适当编程的计算机来实现。在列举了若干装置的单元权利要求中,这些装置中的若干个可以是通过同一个硬件项来具体体现。单词第一、第二、以及第三等的使用不表示任何顺序。可将这些单词解释为名称。It should be noted that the above-mentioned embodiments illustrate rather than limit the invention, and that those skilled in the art will be able to design alternative embodiments without departing from the scope of the appended claims. In the claims, any reference signs placed between parentheses shall not be construed as limiting the claim. The word "comprising" does not exclude the presence of elements or steps not listed in a claim. The word "a" or "an" preceding an element does not exclude the presence of a plurality of such elements. The invention can be implemented by means of hardware comprising several distinct elements, and by means of a suitably programmed computer. In a unit claim enumerating several means, several of these means can be embodied by one and the same item of hardware. The use of the words first, second, and third, etc. does not indicate any order. These words can be interpreted as names.

本发明公开了:The present invention discloses:

A1、一种终端电量优化方法,包括:A1. A terminal power optimization method, comprising:

在系统中设置终端应用的锁定机制,当接收到进程发送的用于申请唤醒锁的申请请求时,判断所述申请请求是否符合预设申请条件;Setting the locking mechanism of the terminal application in the system, when receiving the application request for applying for a wake lock sent by the process, judging whether the application request meets the preset application conditions;

若判断得到所述申请请求符合预设申请条件,则为所述进程申请唤醒锁,将唤醒锁的相关信息写入锁列表文件;If it is judged that the application request meets the preset application conditions, apply for a wake lock for the process, and write the relevant information of the wake lock into the lock list file;

若判断得到所述申请请求不符合预设申请条件,则拒绝为所述进程申请唤醒锁。If it is determined that the application request does not meet the preset application conditions, then refuse to apply for the wake lock for the process.

A2、根据A1所述的方法,所述在系统中设置终端应用的锁定机制,当接收到进程发送的用于申请唤醒锁的申请请求时,判断所述申请请求是否符合预设申请条件进一步包括:在框架层,修改终端的操作系统的电源管理服务,使得在所述电源管理服务接收到进程发送的用于申请唤醒锁的申请请求时,判断所述申请请求是否符合预设申请条件。A2. According to the method described in A1, the locking mechanism of the terminal application is set in the system, and when the application request for applying for a wake lock sent by the process is received, judging whether the application request meets the preset application conditions further includes : At the framework layer, modify the power management service of the operating system of the terminal, so that when the power management service receives an application request for applying for a wake lock sent by a process, it determines whether the application request meets a preset application condition.

A3、根据A2所述的方法,所述终端应用的锁定机制包括:唤醒锁分配机制;A3. According to the method described in A2, the locking mechanism of the terminal application includes: a wake-up lock allocation mechanism;

所述在框架层,修改终端的操作系统的电源管理服务,使得在所述电源管理服务接收到进程发送的用于申请唤醒锁的申请请求时,判断所述申请请求是否符合预设申请条件具体为:在框架层,在电源管理服务的唤醒锁分配机制中增加预设白名单,使得在所述电源管理服务接收到进程发送的用于申请唤醒锁的申请请求时,判断所述申请请求对应的进程是否属于预设白名单。In the framework layer, modify the power management service of the operating system of the terminal, so that when the power management service receives an application request for applying for a wake lock sent by a process, it determines whether the application request meets the preset application conditions. It is: at the framework layer, add a preset whitelist in the wake lock allocation mechanism of the power management service, so that when the power management service receives an application request for applying for a wake lock sent by a process, it determines that the application request corresponds to Whether the process belongs to the preset whitelist.

A4、根据A1-A3任一项所述的方法,所述为所述进程申请唤醒锁,将唤醒锁的相关信息写入锁列表文件进一步包括:A4, according to the method described in any one of A1-A3, described applying for the wake lock for the process, writing the relevant information of the wake lock into the lock list file further includes:

按照预设命名规则命名唤醒锁的锁名,并将所述唤醒锁对应的进程的名称、锁名以及唤醒锁特性写入锁列表文件。Naming the lock name of the wake lock according to a preset naming rule, and writing the process name, lock name and wake lock characteristics corresponding to the wake lock into the lock list file.

A5、根据A1-A4任一项所述的方法,在所述将唤醒锁的相关信息写入锁列表文件之后,所述方法还包括:A5, according to the method described in any one of A1-A4, after the relevant information of the wake lock is written into the lock list file, the method further includes:

根据所述锁列表文件,检测唤醒锁对应的进程是否处于异常运行状态;According to the lock list file, detect whether the process corresponding to the wake lock is in an abnormal running state;

若检测得到唤醒锁对应的进程处于异常运行状态,则释放所述唤醒锁。If it is detected that the process corresponding to the wake lock is in an abnormal running state, the wake lock is released.

A6、根据A5所述的方法,在判断得到所述申请请求符合预设申请条件之后,所述方法还包括:A6. According to the method described in A5, after judging that the application request meets the preset application conditions, the method further includes:

为所述申请请求对应的进程设置级别参数;Setting a level parameter for the process corresponding to the application request;

所述为所述进程申请唤醒锁,将唤醒锁的相关信息写入锁列表文件具体为:将所述唤醒锁对应的进程的级别参数写入锁列表文件;Said applying for the wake-up lock for the process, writing the relevant information of the wake-up lock into the lock list file is specifically: writing the level parameter of the process corresponding to the wake-up lock into the lock list file;

所述根据所述锁列表文件,检测唤醒锁对应的进程是否处于异常运行状态具体为:根据所述锁列表文件中的唤醒锁对应的进程的级别参数,检测唤醒锁对应的进程是否处于异常运行状态。According to the lock list file, detecting whether the process corresponding to the wake lock is in an abnormal operation state is specifically: according to the level parameter of the process corresponding to the wake lock in the lock list file, detecting whether the process corresponding to the wake lock is in abnormal operation state.

B7、一种终端电量优化装置,包括:B7. A terminal power optimization device, comprising:

设置模块,适于在系统中设置终端应用的锁定机制;The setting module is suitable for setting the locking mechanism of the terminal application in the system;

判断模块,适于当接收到进程发送的用于申请唤醒锁的申请请求时,判断所述申请请求是否符合预设申请条件;The judging module is adapted to judge whether the application request meets the preset application conditions when receiving the application request for applying for a wake lock sent by the process;

申请模块,适于若所述判断模块判断得到所述申请请求符合预设申请条件,则为所述进程申请唤醒锁,将唤醒锁的相关信息写入锁列表文件;The application module is adapted to apply for a wake-up lock for the process if the judgment module determines that the application request meets the preset application conditions, and write the related information of the wake-up lock into a lock list file;

拒绝模块,适于若所述判断模块判断得到所述申请请求不符合预设申请条件,则拒绝为所述进程申请唤醒锁。The rejection module is adapted to refuse to apply for the wake lock for the process if the judging module judges that the application request does not meet the preset application conditions.

B8、根据B7所述的装置,所述设置模块进一步适于:在框架层,修改终端的操作系统的电源管理服务;B8. According to the device described in B7, the setting module is further adapted to: modify the power management service of the operating system of the terminal at the framework layer;

所述判断模块进一步适于:在所述电源管理服务接收到进程发送的用于申请唤醒锁的申请请求时,判断所述申请请求是否符合预设申请条件。The judging module is further adapted to: when the power management service receives an application request for applying for a wake lock sent by a process, judge whether the application request meets a preset application condition.

B9、根据B8所述的装置,所述终端应用的锁定机制包括:唤醒锁分配机制;B9. According to the device described in B8, the locking mechanism of the terminal application includes: a wake-up lock allocation mechanism;

所述设置模块进一步适于:在框架层,在电源管理服务的唤醒锁分配机制中增加预设白名单;The setting module is further adapted to: at the framework layer, add a preset whitelist in the wake lock allocation mechanism of the power management service;

所述判断模块进一步适于:在所述电源管理服务接收到进程发送的用于申请唤醒锁的申请请求时,判断所述申请请求对应的进程是否属于预设白名单。The judging module is further adapted to: when the power management service receives an application request for applying for a wake lock sent by a process, judge whether the process corresponding to the application request belongs to a preset white list.

B10、根据B7-B9任一项所述的装置,所述申请模块进一步适于:B10. According to the device according to any one of B7-B9, the application module is further adapted to:

按照预设命名规则命名唤醒锁的锁名,并将所述唤醒锁对应的进程的名称、锁名以及唤醒锁特性写入锁列表文件。Naming the lock name of the wake lock according to a preset naming rule, and writing the process name, lock name and wake lock characteristics corresponding to the wake lock into the lock list file.

B11、根据B7-B10任一项所述的装置,所述装置还包括:B11. The device according to any one of B7-B10, said device also comprising:

检测模块,适于根据所述锁列表文件,检测唤醒锁对应的进程是否处于异常运行状态;The detection module is adapted to detect whether the process corresponding to the wake lock is in an abnormal running state according to the lock list file;

释放模块,适于若所述检测模块检测得到唤醒锁对应的进程处于异常运行状态,则释放所述唤醒锁。The release module is adapted to release the wake lock if the detection module detects that the process corresponding to the wake lock is in an abnormal running state.

B12、根据B11所述的装置,所述设置模块进一步适于:为所述申请请求对应的进程设置级别参数;B12. According to the device described in B11, the setting module is further adapted to: set a level parameter for the process corresponding to the application request;

所述申请模块进一步适于:将所述唤醒锁对应的进程的级别参数写入锁列表文件;The application module is further adapted to: write the level parameter of the process corresponding to the wake lock into a lock list file;

所述检测模块进一步适于:根据所述锁列表文件中的唤醒锁对应的进程的级别参数,检测唤醒锁对应的进程是否处于异常运行状态。The detection module is further adapted to: detect whether the process corresponding to the wake lock is in an abnormal running state according to the level parameter of the process corresponding to the wake lock in the lock list file.

C13、一种终端,包括如B7-B12任一项所述的终端电量优化装置。C13. A terminal, including the terminal power optimization device described in any one of B7-B12.

Claims (10)

Translated fromChinese
1.一种终端电量优化方法,包括:1. A terminal power optimization method, comprising:在系统中设置终端应用的锁定机制,当接收到进程发送的用于申请唤醒锁的申请请求时,判断所述申请请求是否符合预设申请条件;Setting the locking mechanism of the terminal application in the system, when receiving the application request for applying for a wake lock sent by the process, judging whether the application request meets the preset application conditions;若判断得到所述申请请求符合预设申请条件,则为所述进程申请唤醒锁,将唤醒锁的相关信息写入锁列表文件;If it is judged that the application request meets the preset application conditions, apply for a wake lock for the process, and write the relevant information of the wake lock into the lock list file;若判断得到所述申请请求不符合预设申请条件,则拒绝为所述进程申请唤醒锁。If it is determined that the application request does not meet the preset application conditions, then refuse to apply for the wake lock for the process.2.根据权利要求1所述的方法,所述在系统中设置终端应用的锁定机制,当接收到进程发送的用于申请唤醒锁的申请请求时,判断所述申请请求是否符合预设申请条件进一步包括:在框架层,修改终端的操作系统的电源管理服务,使得在所述电源管理服务接收到进程发送的用于申请唤醒锁的申请请求时,判断所述申请请求是否符合预设申请条件。2. The method according to claim 1, wherein the locking mechanism of the terminal application is set in the system, and when the application request for applying for a wake lock sent by the process is received, it is judged whether the application request meets the preset application conditions It further includes: at the framework layer, modifying the power management service of the operating system of the terminal, so that when the power management service receives an application request for applying for a wake lock sent by a process, it is judged whether the application request meets the preset application conditions .3.根据权利要求2所述的方法,所述终端应用的锁定机制包括:唤醒锁分配机制;3. The method according to claim 2, wherein the locking mechanism of the terminal application comprises: a wakelock allocation mechanism;所述在框架层,修改终端的操作系统的电源管理服务,使得在所述电源管理服务接收到进程发送的用于申请唤醒锁的申请请求时,判断所述申请请求是否符合预设申请条件具体为:在框架层,在电源管理服务的唤醒锁分配机制中增加预设白名单,使得在所述电源管理服务接收到进程发送的用于申请唤醒锁的申请请求时,判断所述申请请求对应的进程是否属于预设白名单。In the framework layer, modify the power management service of the operating system of the terminal, so that when the power management service receives an application request for applying for a wake lock sent by a process, it determines whether the application request meets the preset application conditions. It is: at the framework layer, add a preset whitelist in the wake lock allocation mechanism of the power management service, so that when the power management service receives an application request for applying for a wake lock sent by a process, it determines that the application request corresponds to Whether the process belongs to the preset whitelist.4.根据权利要求1-3任一项所述的方法,所述为所述进程申请唤醒锁,将唤醒锁的相关信息写入锁列表文件进一步包括:4. The method according to any one of claims 1-3, wherein the applying for a wake lock for the process, and writing the relevant information of the wake lock into a lock list file further comprises:按照预设命名规则命名唤醒锁的锁名,并将所述唤醒锁对应的进程的名称、锁名以及唤醒锁特性写入锁列表文件。Naming the lock name of the wake lock according to a preset naming rule, and writing the process name, lock name and wake lock characteristics corresponding to the wake lock into the lock list file.5.根据权利要求1-4任一项所述的方法,在所述将唤醒锁的相关信息写入锁列表文件之后,所述方法还包括:5. The method according to any one of claims 1-4, after writing the related information of the wake lock into the lock list file, the method further comprises:根据所述锁列表文件,检测唤醒锁对应的进程是否处于异常运行状态;According to the lock list file, detect whether the process corresponding to the wake lock is in an abnormal running state;若检测得到唤醒锁对应的进程处于异常运行状态,则释放所述唤醒锁。If it is detected that the process corresponding to the wake lock is in an abnormal running state, the wake lock is released.6.根据权利要求5所述的方法,在判断得到所述申请请求符合预设申请条件之后,所述方法还包括:6. The method according to claim 5, after judging that the application request meets the preset application conditions, the method further comprises:为所述申请请求对应的进程设置级别参数;Setting a level parameter for the process corresponding to the application request;所述为所述进程申请唤醒锁,将唤醒锁的相关信息写入锁列表文件具体为:将所述唤醒锁对应的进程的级别参数写入锁列表文件;Said applying for the wake-up lock for the process, writing the relevant information of the wake-up lock into the lock list file is specifically: writing the level parameter of the process corresponding to the wake-up lock into the lock list file;所述根据所述锁列表文件,检测唤醒锁对应的进程是否处于异常运行状态具体为:根据所述锁列表文件中的唤醒锁对应的进程的级别参数,检测唤醒锁对应的进程是否处于异常运行状态。According to the lock list file, detecting whether the process corresponding to the wake lock is in an abnormal operation state is specifically: according to the level parameter of the process corresponding to the wake lock in the lock list file, detecting whether the process corresponding to the wake lock is in abnormal operation state.7.一种终端电量优化装置,包括:7. A terminal power optimization device, comprising:设置模块,适于在系统中设置终端应用的锁定机制;The setting module is suitable for setting the locking mechanism of the terminal application in the system;判断模块,适于当接收到进程发送的用于申请唤醒锁的申请请求时,判断所述申请请求是否符合预设申请条件;The judging module is adapted to judge whether the application request meets the preset application conditions when receiving the application request for applying for a wake lock sent by the process;申请模块,适于若所述判断模块判断得到所述申请请求符合预设申请条件,则为所述进程申请唤醒锁,将唤醒锁的相关信息写入锁列表文件;The application module is adapted to apply for a wake-up lock for the process if the judgment module determines that the application request meets the preset application conditions, and write the related information of the wake-up lock into a lock list file;拒绝模块,适于若所述判断模块判断得到所述申请请求不符合预设申请条件,则拒绝为所述进程申请唤醒锁。The rejection module is adapted to refuse to apply for the wake lock for the process if the judging module judges that the application request does not meet the preset application conditions.8.根据权利要求7所述的装置,所述设置模块进一步适于:在框架层,修改终端的操作系统的电源管理服务;8. The device according to claim 7, the setting module is further adapted to: at the framework layer, modify the power management service of the operating system of the terminal;所述判断模块进一步适于:在所述电源管理服务接收到进程发送的用于申请唤醒锁的申请请求时,判断所述申请请求是否符合预设申请条件。The judging module is further adapted to: when the power management service receives an application request for applying for a wake lock sent by a process, judge whether the application request meets a preset application condition.9.根据权利要求8所述的装置,所述终端应用的锁定机制包括:唤醒锁分配机制;9. The device according to claim 8, wherein the locking mechanism of the terminal application comprises: a wakelock allocation mechanism;所述设置模块进一步适于:在框架层,在电源管理服务的唤醒锁分配机制中增加预设白名单;The setting module is further adapted to: at the framework layer, add a preset whitelist in the wake lock allocation mechanism of the power management service;所述判断模块进一步适于:在所述电源管理服务接收到进程发送的用于申请唤醒锁的申请请求时,判断所述申请请求对应的进程是否属于预设白名单。The judging module is further adapted to: when the power management service receives an application request for applying for a wake lock sent by a process, judge whether the process corresponding to the application request belongs to a preset white list.10.一种终端,包括如权利要求7-9任一项所述的终端电量优化装置。10. A terminal, comprising the terminal power optimization device according to any one of claims 7-9.
CN201610474587.9A2016-06-242016-06-24Terminal power optimization method, device and terminalPendingCN106125891A (en)

Priority Applications (1)

Application NumberPriority DateFiling DateTitle
CN201610474587.9ACN106125891A (en)2016-06-242016-06-24Terminal power optimization method, device and terminal

Applications Claiming Priority (1)

Application NumberPriority DateFiling DateTitle
CN201610474587.9ACN106125891A (en)2016-06-242016-06-24Terminal power optimization method, device and terminal

Publications (1)

Publication NumberPublication Date
CN106125891Atrue CN106125891A (en)2016-11-16

Family

ID=57265559

Family Applications (1)

Application NumberTitlePriority DateFiling Date
CN201610474587.9APendingCN106125891A (en)2016-06-242016-06-24Terminal power optimization method, device and terminal

Country Status (1)

CountryLink
CN (1)CN106125891A (en)

Cited By (6)

* Cited by examiner, † Cited by third party
Publication numberPriority datePublication dateAssigneeTitle
CN108121570A (en)*2017-12-212018-06-05深圳市沃特沃德股份有限公司The method and apparatus of onboard system dormancy
CN108848417A (en)*2018-07-202018-11-20晶晨半导体(上海)股份有限公司Wake up the control method and control system of lock
CN109412891A (en)*2018-10-192019-03-01郑州云海信息技术有限公司A kind of method and apparatus detecting client state
CN110572866A (en)*2019-07-262019-12-13华为技术有限公司 A wake-up lock management method and electronic equipment
CN110688165A (en)*2019-09-262020-01-14珠海市魅族科技有限公司Application wake-up lock management method and device, terminal, storage medium and electronic device
CN110837290A (en)*2019-09-302020-02-25华为终端有限公司Management method of kernel lock and terminal equipment

Citations (5)

* Cited by examiner, † Cited by third party
Publication numberPriority datePublication dateAssigneeTitle
JP2014075722A (en)*2012-10-052014-04-24Sharp CorpPortable terminal device
CN104221445A (en)*2013-11-152014-12-17华为终端有限公司 Method and terminal for waking up terminal system
CN105183137A (en)*2015-09-092015-12-23厦门美图移动科技有限公司Mobile terminal and wake lock control method and system thereof
CN105306743A (en)*2015-09-302016-02-03小米科技有限责任公司Screen control method and device
CN105474125A (en)*2013-09-272016-04-06英特尔公司Techniques for tracing wakelock usage

Patent Citations (5)

* Cited by examiner, † Cited by third party
Publication numberPriority datePublication dateAssigneeTitle
JP2014075722A (en)*2012-10-052014-04-24Sharp CorpPortable terminal device
CN105474125A (en)*2013-09-272016-04-06英特尔公司Techniques for tracing wakelock usage
CN104221445A (en)*2013-11-152014-12-17华为终端有限公司 Method and terminal for waking up terminal system
CN105183137A (en)*2015-09-092015-12-23厦门美图移动科技有限公司Mobile terminal and wake lock control method and system thereof
CN105306743A (en)*2015-09-302016-02-03小米科技有限责任公司Screen control method and device

Cited By (9)

* Cited by examiner, † Cited by third party
Publication numberPriority datePublication dateAssigneeTitle
CN108121570A (en)*2017-12-212018-06-05深圳市沃特沃德股份有限公司The method and apparatus of onboard system dormancy
CN108121570B (en)*2017-12-212021-01-19深圳市沃特沃德股份有限公司Method and device for sleeping vehicle-mounted system
CN108848417A (en)*2018-07-202018-11-20晶晨半导体(上海)股份有限公司Wake up the control method and control system of lock
CN109412891A (en)*2018-10-192019-03-01郑州云海信息技术有限公司A kind of method and apparatus detecting client state
CN109412891B (en)*2018-10-192022-04-22郑州云海信息技术有限公司Method and device for detecting client state
CN110572866A (en)*2019-07-262019-12-13华为技术有限公司 A wake-up lock management method and electronic equipment
WO2021017935A1 (en)*2019-07-262021-02-04华为技术有限公司Wakelock management method and electronic device
CN110688165A (en)*2019-09-262020-01-14珠海市魅族科技有限公司Application wake-up lock management method and device, terminal, storage medium and electronic device
CN110837290A (en)*2019-09-302020-02-25华为终端有限公司Management method of kernel lock and terminal equipment

Similar Documents

PublicationPublication DateTitle
CN106125891A (en)Terminal power optimization method, device and terminal
EP2893444B1 (en)Quota-based resource management
JP5960262B2 (en) Suspend and / or limit processes for connected standby
JP5951771B2 (en) Suspend and / or limit processes for connected standby
CN110018901B (en) Memory recovery method, apparatus, computer device, and computer-readable storage medium
JP5960263B2 (en) Suspend and / or limit processes for connected standby
CN104199731A (en)Method and device for managing application program processes
CN113326498B (en)Authority multiplexing method, resource access method based on authority multiplexing and related equipment
CN106095288A (en) A processing method and device based on wake lock
CN103473142A (en)Virtual machine transferring method and device under cloud computing operating system
CN112988375B (en) Process management method and device, and electronic equipment
CN110045809A (en)Information processing method, information processing device, computer equipment and computer readable storage medium
CN106095419A (en) Wake lock release method and device
US10545562B2 (en)Electronic device and method for operating the same
CN106020426B (en)Method and device for releasing wake-up lock
CN106095051A (en)The processing method of a kind of application program for mobile terminal, device and mobile terminal
CN109992397A (en)Process processing method and device, electronic equipment and computer readable storage medium
WO2015172283A1 (en)Method, device and mobile terminal for reducing power consumption
CN110018905B (en) Information processing method, device, computer device, and computer-readable storage medium
WO2024119988A1 (en)Process scheduling method and apparatus in multi-cpu environment, electronic device, and medium
CN114816031B (en)Power saving method for terminal equipment, terminal equipment and medium
CN105700942B (en) Application process associated startup method and associated startup device
CN102970355A (en)Management of capacity in data center through suspended state of renter
CN115756868A (en) Memory allocation method, device, device, storage medium and computer program product
CN105242770B (en) A method and system for realizing the opening and closing cover of an Android device

Legal Events

DateCodeTitleDescription
C06Publication
PB01Publication
C10Entry into substantive examination
SE01Entry into force of request for substantive examination
RJ01Rejection of invention patent application after publication
RJ01Rejection of invention patent application after publication

Application publication date:20161116


[8]ページ先頭

©2009-2025 Movatter.jp