CN106095412B - Application program closing method and device - Google Patents
Application program closing method and device Download PDFInfo
- Publication number
- CN106095412B CN106095412B CN201610379851.0A CN201610379851A CN106095412B CN 106095412 B CN106095412 B CN 106095412B CN 201610379851 A CN201610379851 A CN 201610379851A CN 106095412 B CN106095412 B CN 106095412B
- Authority
- CN
- China
- Prior art keywords
- function
- application program
- level
- wake
- closing
- Prior art date
- Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
- Expired - Fee Related
Links
Classifications
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F9/00—Arrangements for program control, e.g. control units
- G06F9/06—Arrangements 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/44—Arrangements for executing specific programs
Landscapes
- Engineering & Computer Science (AREA)
- Software Systems (AREA)
- Theoretical Computer Science (AREA)
- Physics & Mathematics (AREA)
- General Engineering & Computer Science (AREA)
- General Physics & Mathematics (AREA)
- Computer Security & Cryptography (AREA)
- Telephone Function (AREA)
- Stored Programmes (AREA)
Abstract
Description
技术领域technical field
本发明涉及终端技术领域,具体涉及一种应用程序的关闭方法和装置。The present invention relates to the technical field of terminals, in particular to a method and device for closing an application program.
背景技术Background technique
随着智能终端的发展,智能终端能够兼容的功能越来越多,不仅丰富用户的生活,还给用户带来便利。随着移动终端设备日益融入人们生活、应用功能日趋完善,给用户带来了极大便利以及提高用户体验。With the development of smart terminals, more and more functions can be compatible with smart terminals, which not only enriches the life of users, but also brings convenience to users. With the increasing integration of mobile terminal devices into people's lives and the increasingly perfect application functions, it brings great convenience to users and improves user experience.
为了实现各种功能以满足用户的各种需求,通常智能终端会安装各种各样的应用程序(可以简称为应用),例如,社交应用、视频应用、游戏应用等。不同的应用程序在运行时,对于智能终端各个组件的运行需求不同,对于智能终端的功率消耗也不同。例如,社交应用(例如,微信)在运行时,通过CPU(中央处理器,Central Processing Unit)唤醒锁来保持智能终端的CPU处于运行状态;视频应用(例如,优酷)在运行时,通过CPU唤醒锁和屏幕唤醒锁来保持智能终端的CPU和屏幕都处于运行状态。因此,智能终端上安装的应用程序在运行时,会消耗大量的电量,降低智能终端的续航能力。In order to implement various functions to meet various demands of users, various application programs (may be referred to as applications for short) are usually installed on the smart terminal, for example, social applications, video applications, game applications, and the like. When different applications are running, the operation requirements for each component of the smart terminal are different, and the power consumption for the smart terminal is also different. For example, when a social application (for example, WeChat) is running, the CPU (Central Processing Unit, Central Processing Unit) wake-up lock is used to keep the CPU of the smart terminal in a running state; when a video application (for example, Youku) is running, it is woken up by the CPU Lock and screen wake-up lock to keep the CPU and screen of the smart terminal running. Therefore, when the application installed on the smart terminal is running, a large amount of power is consumed, which reduces the battery life of the smart terminal.
通常,应用程序在运行时,会运行一个主函数以及被主函数调用的多个子函数。目前,为了减少智能终端电量的消耗,进而提升智能终端的续航能力,智能终端在关闭应用程序时会关闭应用程序中所有的函数(包括主函数、子函数等等)。Usually, when an application is running, it will run a main function and multiple sub-functions called by the main function. At present, in order to reduce the power consumption of the smart terminal and thereby improve the battery life of the smart terminal, when the smart terminal closes the application program, all functions (including main functions, sub-functions, etc.) in the application program are closed.
然而,目前应用程序的关闭方案虽然可以降低终端电量消耗,但是由于该方案是关闭应用程序中所有的函数,如果在关闭应用程序之后,智能终端需要重新启动该应用程序,那么此时,智能终端需要重新调用该应用程序的所有函数,会导致应用程序重新启动的速度比较慢。However, although the current application closing scheme can reduce the power consumption of the terminal, since this scheme closes all functions in the application, if the smart terminal needs to restart the application after closing the application, then at this time, the smart terminal All functions of the application need to be called again, causing the application to restart slowly.
发明内容SUMMARY OF THE INVENTION
本发明实施例提供一种应用程序的关闭方法和装置,可以在降低终端电量消耗的同时,提升应用程序重新启动的速度。The embodiments of the present invention provide a method and device for closing an application program, which can improve the restart speed of the application program while reducing the power consumption of the terminal.
本发明实施例提供一种应用程序的关闭方法,包括:An embodiment of the present invention provides a method for closing an application, including:
对应用程序中的函数设置函数级别;Set the function level for functions in the application;
接收所述应用程序的关闭指令,并根据所述关闭指令获取所述应用程序在预设时间段内通过唤醒锁唤醒系统的唤醒特征;Receive the shutdown instruction of the application, and obtain the wake-up feature that the application wakes up the system through a wake-up lock within a preset time period according to the shutdown instruction;
根据所述唤醒特征获取相应的第一目标函数级别;Obtain a corresponding first objective function level according to the wake-up feature;
根据所述第一目标函数级别关闭所述应用程序中相应的函数。The corresponding function in the application is closed according to the first objective function level.
进一步地,所述对应用程序中的函数设置函数级别的步骤具体包括:Further, the step of setting the function level to the function in the application program specifically includes:
获取应用程序中函数之间的调用关系;Get the calling relationship between functions in the application;
根据所述调用关系对所述应用程序中的函数设置函数级别。A function level is set for the function in the application program according to the calling relationship.
进一步地,所述唤醒特征包括唤醒次数,所述根据所述唤醒特征获取相应的第一目标函数级别的步骤具体包括:Further, the wake-up feature includes wake-up times, and the step of acquiring the corresponding first objective function level according to the wake-up feature specifically includes:
确定所述唤醒次数所处的唤醒次数区间;Determine the wake-up times interval in which the wake-up times are located;
根据所述唤醒次数区间获取相应的第一目标函数级别。The corresponding first objective function level is obtained according to the wake-up times interval.
进一步地,所述第一目标函数级别低于最高函数级别,所述根据所述第一目标函数级别关闭所述应用程序中相应的函数的步骤具体包括:Further, the first objective function level is lower than the highest function level, and the step of closing the corresponding function in the application program according to the first objective function level specifically includes:
判断所述第一目标函数级别是否为最低函数级别;Judging whether the first objective function level is the lowest function level;
若是,则关闭所述应用程序中所述第一目标函数级别对应的函数;If so, then close the function corresponding to the first objective function level in the application;
若否,则关闭所述应用程序中所述第一目标函数级别对应的函数,以及函数级别低于所述第一目标函数级别的函数。If not, close the function corresponding to the first objective function level in the application program, and the function whose function level is lower than the first objective function level.
进一步地,所述根据所述第一目标函数级别关闭所述应用程序中相应的函数的步骤之后,所述关闭方法还包括:Further, after the step of closing the corresponding function in the application according to the first target function level, the closing method further includes:
获取终端当前的电量信息;Get the current battery information of the terminal;
根据所述电量信息获取相应的第二目标函数级别,所述第二目标函数级别高于所述第一目标函数级别;Acquire a corresponding second objective function level according to the power information, where the second objective function level is higher than the first objective function level;
根据所述第二目标函数级别关闭所述应用程序中相应的函数。The corresponding function in the application is closed according to the second objective function level.
进一步地,所述对应用程序中的函数设置函数级别的步骤具体包括:Further, the step of setting the function level to the function in the application program specifically includes:
获取应用程序中调用传感器的调用函数的集合;Get the collection of calling functions that call the sensor in the application;
对所述集合中的调用函数设置函数级别;setting a function level for the calling function in the set;
所述根据所述第一目标函数级别关闭所述应用程序中相应的函数的步骤具体包括:The step of closing the corresponding function in the application program according to the first objective function level specifically includes:
根据所述第一目标函数级别关闭所述集合中相应的调用函数。Close the corresponding calling function in the set according to the first target function level.
相应的,本发明实施例还提供一种应用程序的关闭装置,包括:Correspondingly, an embodiment of the present invention also provides a device for closing an application, including:
设置模块,用于对应用程序中的函数设置函数级别;The settings module is used to set the function level for functions in the application;
第一获取模块,用于接收所述应用程序的关闭指令,并根据所述关闭指令获取所述应用程序在预设时间段内通过唤醒锁唤醒系统的唤醒特征;a first acquiring module, configured to receive a shutdown instruction of the application, and acquire, according to the shutdown instruction, a wake-up feature of the application that wakes up the system through a wake-up lock within a preset time period;
第二获取模块,用于根据所述唤醒特征获取相应的第一目标函数级别;a second acquisition module, configured to acquire a corresponding first objective function level according to the wake-up feature;
第一处理模块,用于根据所述第一目标函数级别关闭所述应用程序中相应的函数。The first processing module is configured to close the corresponding function in the application program according to the first target function level.
进一步地,所述设置模块具体包括:Further, the setting module specifically includes:
第一获取子模块,用于获取应用程序中函数之间的调用关系;The first acquisition sub-module is used to acquire the calling relationship between functions in the application;
设置子模块,用于根据所述调用关系对所述应用程序中的函数设置函数级别。A setting submodule is used to set a function level for the function in the application program according to the calling relationship.
进一步地,所述唤醒特征包括唤醒次数,所述第二获取模块具体包括:Further, the wake-up feature includes wake-up times, and the second acquisition module specifically includes:
确定子模块,用于确定所述唤醒次数所处的唤醒次数区间;A determination submodule, used for determining the wake-up times interval in which the wake-up times are located;
第二获取子模块,用于根据所述唤醒次数区间获取相应的第一目标函数级别。The second obtaining sub-module is configured to obtain the corresponding first objective function level according to the wake-up times interval.
进一步地,所述第一目标函数级别低于最高函数级别,所述第一处理模块具体包括:Further, the first objective function level is lower than the highest function level, and the first processing module specifically includes:
判断子模块,用于判断所述第一目标函数级别是否为最低函数级别;A judging submodule for judging whether the first objective function level is the lowest function level;
处理子模块,用于在所述判断子模块判断为是时,关闭所述应用程序中所述第一目标函数级别对应的函数;在所述判断子模块判断为否时,关闭所述应用程序中所述第一目标函数级别对应的函数,以及函数级别低于所述第一目标函数级别的函数。A processing submodule, for closing the function corresponding to the first target function level in the application program when the judgment submodule judges it to be yes; and closing the application program when the judgment submodule judges it to be no The function corresponding to the first objective function level in , and the function whose function level is lower than the first objective function level.
进一步地,所述关闭装置还包括第二处理模块,所述第二处理模块用于:Further, the closing device further includes a second processing module, and the second processing module is used for:
获取终端当前的电量信息;Get the current battery information of the terminal;
根据所述电量信息获取相应的第二目标函数级别,所述第二目标函数级别高于所述第一目标函数级别;Acquire a corresponding second objective function level according to the power information, where the second objective function level is higher than the first objective function level;
根据所述第二目标函数级别关闭所述应用程序中相应的函数。The corresponding function in the application is closed according to the second objective function level.
本发明实施例采用对应用程序中的函数设置函数级别,接收该应用程序的关闭指令,并根据该关闭指令获取该应用程序在预设时间段内通过唤醒锁唤醒系统的唤醒特征,根据该唤醒特征获取相应的第一目标函数级别,并根据该第一目标函数级别关闭该应用程序中相应的函数;该方案首先对应用程序中的函数设置函数级别,然后根据应用程序在预设时间段内通过唤醒锁唤醒系统的唤醒特征获取目标函数级别,并关闭应用程序中与该目标函数级别相应的函数,由于该方案并没有直接关闭应用程序,而是关闭应用程序中相应的函数,因此,在需要重新启动该应用程序时,只需要重新调用被关闭的函数即可,相对于现有技术而言,可以在降低终端电量消耗的同时,提升应用程序重新启动的速度。The embodiment of the present invention adopts setting the function level for the function in the application program, receives the shutdown instruction of the application program, and obtains the wake-up feature that the application program wakes up the system through the wake-up lock within a preset time period according to the shutdown instruction, and according to the wake-up The feature obtains the corresponding first objective function level, and closes the corresponding function in the application program according to the first objective function level; the scheme first sets the function level for the function in the application program, and then according to the application program within a preset time period The target function level is obtained by the wake-up feature of the wake-up system by the wake-up lock, and the function corresponding to the target function level in the application program is closed. Since this scheme does not directly close the application program, but closes the corresponding function in the application program, therefore, in the When the application needs to be restarted, it is only necessary to re-call the closed function. Compared with the prior art, the restarting speed of the application can be improved while reducing the power consumption of the terminal.
附图说明Description of drawings
为了更清楚地说明本发明实施例中的技术方案,下面将对实施例描述中所需要使用的附图作简单地介绍,显而易见地,下面描述中的附图仅仅是本发明的一些实施例,对于本领域技术人员来讲,在不付出创造性劳动的前提下,还可以根据这些附图获得其他的附图。In order to illustrate the technical solutions in the embodiments of the present invention more clearly, the following briefly introduces the accompanying drawings used in the description of the embodiments. Obviously, the accompanying drawings in the following description are only some embodiments of the present invention. For those skilled in the art, other drawings can also be obtained from these drawings without creative effort.
图1是本发明实施例一提供的应用程序的关闭方法的流程示意图;1 is a schematic flowchart of a method for closing an application program provided by Embodiment 1 of the present invention;
图2是本发明实施例二提供的应用程序的关闭方法的流程示意图;2 is a schematic flowchart of a method for closing an application program provided by Embodiment 2 of the present invention;
图3是本发明实施例三提供的应用程序的关闭方法的流程示意图;3 is a schematic flowchart of a method for closing an application program provided by Embodiment 3 of the present invention;
图4a是本发明实施例四提供的第一种应用程序的关闭装置的结构示意图;4a is a schematic structural diagram of a first application closing device provided in Embodiment 4 of the present invention;
图4b是本发明实施例四提供的第二种应用程序的关闭装置的结构示意图;4b is a schematic structural diagram of a device for closing a second application program according to Embodiment 4 of the present invention;
图4c是本发明实施例四提供的第三种应用程序的关闭装置的结构示意图;4c is a schematic structural diagram of a device for closing a third application program according to Embodiment 4 of the present invention;
图4d是本发明实施例四提供的第四种应用程序的关闭装置的结构示意图;4d is a schematic structural diagram of a device for closing a fourth application program according to Embodiment 4 of the present invention;
图4e是本发明实施例四提供的第五种应用程序的关闭装置的结构示意图。FIG. 4e is a schematic structural diagram of a fifth application closing device according to Embodiment 4 of the present invention.
具体实施方式Detailed ways
下面将结合本发明实施例中的附图,对本发明实施例中的技术方案进行清楚、完整地描述,显然,所描述的实施例仅仅是本发明一部分实施例,而不是全部的实施例。基于本发明中的实施例,本领域技术人员在没有作出创造性劳动前提下所获得的所有其他实施例,都属于本发明保护的范围。The technical solutions in the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings in the embodiments of the present invention. Obviously, the described embodiments are only a part of the embodiments of the present invention, but not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative efforts shall fall within the protection scope of the present invention.
本发明实施例提供一种应用程序的关闭方法和装置,以下将分别进行详细说明。Embodiments of the present invention provide a method and device for closing an application program, which will be described in detail below.
实施例一Example 1
本实施例将从应用程序的关闭装置的角度进行描述,该装置具体可以集成在终端中,该终端可以为智能手机、平板电脑等设备。This embodiment will be described from the perspective of a device for closing an application. The device may be specifically integrated in a terminal, and the terminal may be a device such as a smart phone or a tablet computer.
一种应用程序的关闭方法,包括:对应用程序中的函数设置函数级别,接收该应用程序的关闭指令,并根据该关闭指令获取该应用程序在预设时间段内通过唤醒锁唤醒系统的唤醒特征,根据该唤醒特征获取相应的第一目标函数级别,并根据该第一目标函数级别关闭该应用程序中相应的函数。A method for closing an application program, comprising: setting a function level for a function in the application program, receiving a shutdown instruction of the application program, and obtaining, according to the shutdown instruction, that the application program wakes up a system through a wake-up lock within a preset time period feature, obtain the corresponding first target function level according to the wake-up feature, and close the corresponding function in the application according to the first target function level.
如图1所示,该应用程序的关闭方法,具体流程可以包括:As shown in Figure 1, the closing method of the application, the specific process may include:
S101,对应用程序中的函数设置函数级别。S101, setting a function level for a function in an application program.
具体地,能够在操作系统(例如,安卓系统,Android)上运行的任何一个应用程序,都需要有一个主函数(或称为一级函数),主函数是应用程序的入口,用于对其它的各种函数(子函数)进行调用,由被调用的子函数来执行各种功能,同时由于主函数需要给出应用程序的运行结果,因此主函数也是应用程序的出口。通常主函数比较简洁,应用程序需要实现的功能的具体细节被封装到子函数里面供主函数调用,此外,子函数也可以调用其它的子函数。Specifically, any application that can run on an operating system (eg, Android system, Android) needs to have a main function (or called a first-level function), and the main function is the entry of the application and is used for other applications. Various functions (sub-functions) are called, and various functions are performed by the called sub-functions. At the same time, since the main function needs to give the running result of the application, the main function is also the exit of the application. Usually the main function is relatively simple, and the specific details of the functions to be implemented by the application are encapsulated into sub-functions for the main function to call. In addition, the sub-functions can also call other sub-functions.
对应用程序中的函数设置函数级别可以有多种实现方法,本发明实施例中可以根据函数之间的调用关系来设置函数级别,例如,主函数的级别设置为1级,1级函数调用的函数的级别设置为2级,2级函数调用的函数的级别设置为3级,3级函数调用的函数的级别设置为4级,以此类推。函数级别的数值越大表明该函数在调用关系中处于越下层的位置,即该函数的级别越低。There may be various implementation methods for setting the function level of a function in an application program. In this embodiment of the present invention, the function level may be set according to the calling relationship between functions. The level of the function is set to level 2, the level of the function called by the level 2 function is set to level 3, the level of the function called by the level 3 function is set to level 4, and so on. The larger the value of the function level, the lower the position of the function in the calling relationship, that is, the lower the level of the function.
根据函数之间的调用关系来设置函数级别时,对应用程序中的函数设置函数级别具体可以包括以下步骤:When the function level is set according to the calling relationship between functions, the setting of the function level for the function in the application may specifically include the following steps:
获取应用程序中函数之间的调用关系;Get the calling relationship between functions in the application;
根据该调用关系对该应用程序中的函数设置函数级别。Set the function level for the functions in the application according to the calling relationship.
具体地,获取应用程序中函数之间的调用关系的实现方式可以有多种,例如,可以根据函数代码中的调用命令来获取函数之间的调用关系。例如,函数A的代码中包括对函数B的调用命令,函数B的代码中包括对函数C的调用命令,函数C的代码中包括对函数D的调用命令,则可以获取到函数之间的调用关系为:函数A调用函数B,函数B调用函数C,函数C调用函数D。Specifically, there may be various implementations for obtaining the calling relationship between functions in the application. For example, the calling relationship between functions may be obtained according to the calling command in the function code. For example, if the code of function A includes a call command to function B, the code of function B includes a call command to function C, and the code of function C includes a call command to function D, the call between functions can be obtained. The relationship is: function A calls function B, function B calls function C, and function C calls function D.
当获取到函数之间的调用关系后,可以根据该调用关系来设置函数的函数级别,例如,设置函数A的级别为1级,函数B的级别为2级,函数C的级别为3级,函数D的级别为4级。After obtaining the calling relationship between functions, you can set the function level of the function according to the calling relationship. For example, set the level of function A to level 1, the level of function B to level 2, and the level of function C to level 3. The level of function D is level 4.
S102,接收该应用程序的关闭指令,并根据该关闭指令获取该应用程序在预设时间段内通过唤醒锁唤醒系统的唤醒特征。S102: Receive a shutdown instruction of the application, and obtain a wake-up feature of the application that wakes up the system through a wake-up lock within a preset time period according to the shutdown instruction.
具体地,接收应用程序的关闭指令的方式可以有多种,例如,可以通过屏幕接收用户的触摸操作发送的关闭指令,也可以接收用户通过远程操作发送的关闭指令,还可以是接收终端内部的定时器触发的关闭指令。Specifically, there are many ways to receive the closing instruction of the application. For example, the closing instruction sent by the user's touch operation can be received through the screen, the closing instruction sent by the user through the remote operation can also be received, and the closing instruction sent by the user through the remote operation can also be received. Timer-triggered shutdown command.
接收到关闭指令后,获取应用程序在预设时间段内通过唤醒锁唤醒系统的唤醒特征。该预设时间段可以是预先存储在终端内置存储区域的一个时间值,也可以是用户设置并存储在终端内置存储区域的一个时间值,例如,1分钟。该唤醒特征可以是预设时间段内的唤醒次数或唤醒频率等特征,例如,该应用程序在1分钟内通过唤醒锁唤醒终端系统5次。After receiving the shutdown instruction, obtain the wake-up feature that the application wakes up the system through the wake-up lock within a preset time period. The preset time period may be a time value pre-stored in the built-in storage area of the terminal, or may be a time value set by the user and stored in the built-in storage area of the terminal, for example, 1 minute. The wake-up feature may be features such as the number of wake-up times or the wake-up frequency within a preset time period. For example, the application wakes up the terminal system 5 times through the wake-up lock within 1 minute.
S103,根据该唤醒特征获取相应的第一目标函数级别。S103: Acquire a corresponding first objective function level according to the wake-up feature.
具体地,可以在终端的内置存储区域中预先存储唤醒特征与目标函数级别之间的映射关系,该映射关系也可以由用户设置并存储在终端的内置存储区域中。当获取到唤醒特征后,调用存储在终端内置存储区域中的映射关系,根据该映射关系获取目标函数级别。例如,映射关系中唤醒次数5次对应的目标函数级别为3级,则当获取到唤醒特征为唤醒次数是5次时,可以根据该映射关系获取到对应的目标函数级别为3级。Specifically, the mapping relationship between the wake-up feature and the target function level may be pre-stored in the built-in storage area of the terminal, and the mapping relationship may also be set by the user and stored in the built-in storage area of the terminal. After the wake-up feature is acquired, the mapping relationship stored in the built-in storage area of the terminal is called, and the target function level is acquired according to the mapping relationship. For example, in the mapping relationship, the target function level corresponding to 5 wake-up times is level 3, then when the acquired wake-up feature is that the number of wake-up times is 5 times, the corresponding target function level can be obtained according to the mapping relationship as level 3.
实际应用中,可能存在多个唤醒特征都对应着同一个目标函数级别,例如,唤醒次数5次和6次对应的目标函数级别都是3级,因此,在本发明的一个优选实施例中,当唤醒特征包括唤醒次数时,根据该唤醒特征获取相应的第一目标函数级别可以具体包括以下步骤:In practical applications, there may be multiple wake-up features corresponding to the same target function level. For example, the target function levels corresponding to 5 and 6 wake-up times are both level 3. Therefore, in a preferred embodiment of the present invention, When the wake-up feature includes wake-up times, acquiring the corresponding first objective function level according to the wake-up feature may specifically include the following steps:
确定该唤醒次数所处的唤醒次数区间;Determine the wake-up times interval in which the wake-up times are located;
根据该唤醒次数区间获取相应的第一目标函数级别。The corresponding first objective function level is obtained according to the wake-up times interval.
具体地,可以在终端的内置存储区域中预先存储唤醒次数区间与目标函数级别之间的映射关系,例如,唤醒次数区间[5,10)对应的目标函数级别为3级,唤醒次数区间[10,15)对应的目标函数级别为2级。Specifically, the mapping relationship between the wake-up times interval and the target function level may be pre-stored in the built-in storage area of the terminal. For example, the target function level corresponding to the wake-up times interval [5, 10) is level 3, and the wake-up times interval [10] , 15) The corresponding objective function level is level 2.
当获取到应用程序在预设时间段内通过唤醒锁唤醒系统的唤醒次数后,确定该唤醒次数所处的唤醒次数区间。例如,获取到唤醒次数为5时,可以确定该唤醒次数所处的唤醒次数区间为[5,10),然后调用预先存储的映射关系可以获取到相应的目标函数级别为3级。After obtaining the wake-up times that the application program wakes up the system through the wake-up lock within the preset time period, determine the wake-up times interval in which the wake-up times are located. For example, when the number of awakenings is 5, it can be determined that the number of awakenings in which the number of awakenings is located is [5, 10), and then the corresponding target function level can be obtained by calling the pre-stored mapping relationship to be level 3.
S104,根据该第一目标函数级别关闭该应用程序中相应的函数。S104, close the corresponding function in the application program according to the first target function level.
具体地,当获取到目标函数级别时,关闭应用程序中相应的函数,例如,获取到目标函数级别为3级时,关闭应用程序中所有的3级函数。Specifically, when the target function level is obtained, the corresponding function in the application is closed. For example, when the target function level is obtained as level 3, all the level 3 functions in the application are closed.
为了保证应用程序在下次启动时能够加快启动速度,需要保持应用程序中主函数的持续运行,即主函数不能被关闭,因此,该第一目标函数级别应当低于最高函数级别(最高函数级别即为主函数的级别)。In order to ensure that the application can start up faster at the next startup, it is necessary to keep the main function in the application running continuously, that is, the main function cannot be closed. Therefore, the first objective function level should be lower than the highest function level (the highest function level is level of the main function).
具体应用中,当某个函数被关闭后,被该函数调用的子函数将无法发挥作用(因为被调用的子函数无法将其函数返回值输入到应用程序中),因此,若存在被该函数调用的子函数,可以进一步关闭被该函数调用的子函数。因此,根据该第一目标函数级别关闭该应用程序中相应的函数可以具体包括以下步骤:In a specific application, when a function is closed, the sub-function called by the function will not be able to function (because the called sub-function cannot input its function return value into the application), therefore, if there is a function called by the function The called subfunction can further close the subfunction called by this function. Therefore, closing the corresponding function in the application according to the first objective function level may specifically include the following steps:
判断该第一目标函数级别是否为最低函数级别;Determine whether the first objective function level is the lowest function level;
若是,则关闭该应用程序中该第一目标函数级别对应的函数;If so, close the function corresponding to the first target function level in the application;
若否,则关闭该应用程序中该第一目标函数级别对应的函数,以及函数级别低于该第一目标函数级别的函数。If not, close the function corresponding to the first objective function level in the application program, and the function whose function level is lower than the first objective function level.
具体地,判断该第一目标函数级别是否为最低函数级别的方法可以有多种,例如,查询该应用程序在系统中运行的所有函数中,是否存在被该目标函数级别对应的函数调用的子函数。例如,该目标函数级别为3级,则判断是否存在被3级函数调用的4级函数。Specifically, there can be various methods for judging whether the first target function level is the lowest function level, for example, querying all functions running in the system by the application, whether there is a subroutine called by the function corresponding to the target function level function. For example, if the target function level is level 3, it is determined whether there is a level 4 function called by the level 3 function.
当判断该第一目标函数级别是最低函数级别时,关闭该第一目标函数级别对应的函数,例如,关闭所有的3级函数;当判断该第一目标函数级别不是最低函数级别时,关闭函数级别小于或等于该目标函数级别的函数,例如,关闭所有的3级函数、4级函数以及5级函数(若存在被调用的5级函数)。When judging that the first objective function level is the lowest function level, close the function corresponding to the first objective function level, for example, close all 3-level functions; when judging that the first objective function level is not the lowest function level, close the function Functions whose level is less than or equal to the level of the target function, for example, close all level 3 functions, level 4 functions, and level 5 functions (if there are called level 5 functions).
实际应用中,在根据第一目标函数级别关闭应用程序中相应的函数后,可能会存在以下情况,即终端当前电量不多,用户希望能进一步关闭应用程序中剩余的未关闭函数,因此,该应用程序的关闭方法可进一步包括以下步骤:In practical applications, after closing the corresponding functions in the application according to the first target function level, there may be the following situations, that is, the current terminal power is not much, and the user hopes to further close the remaining unclosed functions in the application. Therefore, this The closing method of the application may further include the following steps:
获取终端当前的电量信息;Get the current battery information of the terminal;
根据该电量信息获取相应的第二目标函数级别,该第二目标函数级别高于该第一目标函数级别;Acquire a corresponding second objective function level according to the electric quantity information, where the second objective function level is higher than the first objective function level;
根据该第二目标函数级别关闭该应用程序中相应的函数。The corresponding function in the application is closed according to the second objective function level.
具体地,获取终端当前的电量信息的实现方式有多种,例如,可以通过终端自带的电源管理程序获取电量信息,该电量信息可以是剩余电量占电池总容量的百分比,例如,电量信息为30%表示终端当前剩余30%电量。Specifically, there are many ways to obtain the current power information of the terminal. For example, the power information can be obtained through the power management program that comes with the terminal, and the power information can be the percentage of the remaining power to the total battery capacity. For example, the power information is 30% means that the terminal currently has 30% power remaining.
可以在终端的内置存储区域中预先存储电量信息与第二目标函数级别之间的映射关系,例如30%电量对应的目标函数级别为3级,20%电量对应的目标函数级别为2级等,获取到终端的电量信息后,调用终端中存储的映射关系来获取相应的第二目标函数级别;也可以在终端的内置存储区域中预先存储电量信息区间与第二目标函数级别之间的映射关系,例如,电量信息[30%,40%)对应的目标函数级别为3级,[20%,30%)对应的目标函数级别为2级等,则获取到终端的电量信息后,先确定该电量信息所处的电量信息区间,随后根据该电量信息区间和映射关系获取第二目标函数级别。The mapping relationship between the power information and the second objective function level can be pre-stored in the built-in storage area of the terminal, for example, the objective function level corresponding to 30% power is level 3, and the objective function level corresponding to 20% power is level 2, etc. After acquiring the power information of the terminal, call the mapping relationship stored in the terminal to obtain the corresponding second objective function level; it is also possible to pre-store the mapping relationship between the power information interval and the second objective function level in the built-in storage area of the terminal , for example, the objective function level corresponding to the power information [30%, 40%) is level 3, and the objective function level corresponding to [20%, 30%) is level 2, etc. After obtaining the power information of the terminal, first determine the The electric quantity information interval in which the electric quantity information is located, and then the second objective function level is obtained according to the electric quantity information interval and the mapping relationship.
根据上文的描述,第一目标函数级别对应的函数已经都被关闭,剩余的未关闭函数的函数级别应当高于第一目标函数级别,因此,该第二目标函数级别应当高于该第一目标函数级别。According to the above description, the functions corresponding to the first objective function level have been closed, and the function levels of the remaining unclosed functions should be higher than the first objective function level. Therefore, the second objective function level should be higher than the first objective function level. Objective function level.
根据该第二目标函数级别关闭该应用程序中相应的函数,具体地,获取到第二目标函数级别后,例如,根据电量信息20%获取到第二目标函数级别为2级,则关闭应用程序中所有的2级函数,或者关闭应用程序中所有的2级函数以及函数级别低于2级的函数(3级函数、4级函数等)。Close the corresponding function in the application program according to the second objective function level. Specifically, after the second objective function level is obtained, for example, according to the 20% power information, the second objective function level is obtained as level 2, then the application program is closed. All level 2 functions in the application, or close all level 2 functions in the application and functions whose function level is lower than level 2 (level 3 functions, level 4 functions, etc.).
由上可知,本发明实施例提供的应用程序的关闭方法,采用对应用程序中的函数设置函数级别,接收该应用程序的关闭指令,并根据该关闭指令获取该应用程序在预设时间段内通过唤醒锁唤醒系统的唤醒特征,根据该唤醒特征获取相应的第一目标函数级别,并根据该第一目标函数级别关闭该应用程序中相应的函数;该方案首先对应用程序中的函数设置函数级别,然后根据应用程序在预设时间段内通过唤醒锁唤醒系统的唤醒特征获取目标函数级别,并关闭应用程序中与该目标函数级别相应的函数,由于该方案并没有直接关闭应用程序,而是关闭应用程序中相应的函数,因此,在需要重新启动该应用程序时,只需要重新调用被关闭的函数即可,相对于现有技术而言,可以在降低终端电量消耗的同时,提升应用程序重新启动的速度。As can be seen from the above, the method for closing an application program provided by the embodiment of the present invention adopts the function level of the function in the application program to be set, receives the closing instruction of the application program, and obtains the application program within a preset time period according to the closing instruction. Wake up the wake-up feature of the system through the wake-up lock, obtain the corresponding first target function level according to the wake-up feature, and close the corresponding function in the application program according to the first target function level; this scheme first sets the function of the function in the application program. level, and then obtain the target function level according to the wake-up feature of the application program to wake up the system through the wake-up lock within a preset time period, and close the function corresponding to the target function level in the application program. It is to close the corresponding function in the application. Therefore, when the application needs to be restarted, it is only necessary to call the closed function again. Compared with the existing technology, it can reduce the power consumption of the terminal and improve the application. The speed at which the program restarts.
实施例二Embodiment 2
根据实施例一所描述的应用程序的关闭方法,以下将举例作进一步详细说明。According to the method for closing an application program described in the first embodiment, the following examples will be used for further detailed description.
在本实施例中,将以应用程序的关闭装置具体集成在智能手机中,以智能手机中应用程序的关闭方法为例进行详细描述。In this embodiment, the device for closing an application program is specifically integrated in a smart phone, and a method for closing an application program in a smart phone is taken as an example for detailed description.
如图2所示,该应用程序的关闭方法,具体流程可以如下:As shown in Figure 2, the closing method of the application, the specific process can be as follows:
S201,获取应用程序中函数之间的调用关系。S201, acquiring a calling relationship between functions in an application program.
具体地,获取应用程序中函数之间的调用关系的实现方式可以有多种,例如,可以根据函数代码中的调用命令来获取函数之间的调用关系。例如,函数A的代码中包括对函数B的调用命令,函数B的代码中包括对函数C的调用命令,函数C的代码中包括对函数D的调用命令,则可以获取到函数之间的调用关系为:函数A调用函数B,函数B调用函数C,函数C调用函数D。Specifically, there may be various implementation manners for obtaining the calling relationship between functions in the application. For example, the calling relationship between functions may be obtained according to the calling command in the function code. For example, if the code of function A includes a call command to function B, the code of function B includes a call command to function C, and the code of function C includes a call command to function D, the call between functions can be obtained. The relationship is: function A calls function B, function B calls function C, and function C calls function D.
S202,根据该调用关系对该应用程序中的函数设置函数级别。S202: Set a function level for the function in the application program according to the calling relationship.
具体地,当获取到函数之间的调用关系后,可以根据该调用关系来设置函数的函数级别,例如,设置函数A的级别为1级,函数B的级别为2级,函数C的级别为3级,函数D的级别为4级。函数级别的数值越大表明该函数在调用关系中处于越下层的位置,即该函数的级别越低。Specifically, after the calling relationship between functions is obtained, the function level of the function can be set according to the calling relationship. For example, the level of function A is set to level 1, the level of function B is set to level 2, and the level of function C is set to Level 3, the level of function D is level 4. The larger the value of the function level, the lower the position of the function in the calling relationship, that is, the lower the level of the function.
S203,接收该应用程序的关闭指令,并根据该关闭指令获取该应用程序在预设时间段内通过唤醒锁唤醒系统的唤醒次数。S203: Receive a shutdown instruction of the application program, and acquire the number of times that the application program wakes up the system through a wake-up lock within a preset time period according to the shutdown instruction.
具体地,智能手机可以通过屏幕接收用户的触摸操作发送的关闭指令,例如,用户点击触摸屏上该应用程序的关闭按钮(虚拟按钮),智能手机向该应用程序发送关闭指令以响应用户的触摸操作。预设时间段可以是智能手机中预先存储的一个时间值,例如,预设时间段为1分钟,在1分钟内,通过计数函数来对应用程序通过唤醒锁唤醒系统的次数进行计数,该应用程序每通过唤醒锁(例如,CPU唤醒锁、屏幕唤醒锁等)唤醒智能手机系统一次,计数函数的计数数值增加1。当智能手机接收到该应用程序的关闭指令时,获取1分钟内该计数函数的计数数值,作为该应用程序在预设时间段内通过唤醒锁唤醒系统的唤醒次数。Specifically, the smartphone can receive the closing instruction sent by the user's touch operation through the screen. For example, the user clicks the close button (virtual button) of the application on the touch screen, and the smartphone sends the closing instruction to the application in response to the user's touch operation. . The preset time period may be a time value pre-stored in the smartphone, for example, the preset time period is 1 minute, and within 1 minute, the number of times the application wakes up the system through the wake lock is counted by the counting function, and the application Every time the program wakes up the smartphone system through a wake-up lock (for example, CPU wake-up lock, screen wake-up lock, etc.), the count value of the counting function increases by 1. When the smartphone receives the closing instruction of the application, the count value of the counting function within 1 minute is obtained as the number of times the application wakes up the system through the wake-up lock within a preset time period.
S204,确定该唤醒次数所处的唤醒次数区间。S204: Determine the wake-up times interval in which the wake-up times are located.
具体地,可以预先对唤醒次数划分多个区间,例如,可将唤醒次数划分为[5,10)、[10,15)、[15,20)等多个区间,当获取到应用程序在预设时间段内通过唤醒锁唤醒系统的唤醒次数后,确定该唤醒次数所处的唤醒次数区间。例如,获取到唤醒次数为5时,可以确定该唤醒次数所处的唤醒次数区间为[5,10)。Specifically, the wake-up times can be divided into multiple intervals in advance, for example, the wake-up times can be divided into multiple intervals such as [5, 10), [10, 15), [15, 20), etc. After setting the wake-up times of the system through the wake-up lock within the time period, determine the wake-up times interval in which the wake-up times are located. For example, when the acquired number of wake-up times is 5, it can be determined that the number of wake-up times in which the number of wake-up times is located is [5, 10).
S205,根据该唤醒次数区间获取相应的第一目标函数级别。S205: Acquire a corresponding first objective function level according to the wake-up times interval.
具体地,可以在终端的内置存储区域中预先存储唤醒次数区间与目标函数级别之间的映射关系,例如,唤醒次数区间[5,10)对应的目标函数级别为3级,唤醒次数区间[10,15)对应的目标函数级别为2级;当确定唤醒次数所处的唤醒次数区间后,例如,确定的唤醒次数区间为[5,10),则可以调用预先存储的映射关系获取到相应的目标函数级别为3级。Specifically, the mapping relationship between the wake-up times interval and the target function level may be pre-stored in the built-in storage area of the terminal. For example, the target function level corresponding to the wake-up times interval [5, 10) is level 3, and the wake-up times interval [10] , 15) The corresponding target function level is level 2; when the wake-up times interval in which the wake-up times are located is determined, for example, the determined wake-up times interval is [5, 10), the pre-stored mapping relationship can be called to obtain the corresponding The objective function level is level 3.
S206,判断该第一目标函数级别是否为最低函数级别。S206, determine whether the first objective function level is the lowest function level.
具体地,判断该第一目标函数级别是否为最低函数级别的方法可以有多种,例如,查询该应用程序在系统中运行的所有函数中,是否存在被该目标函数级别对应的函数调用的子函数。例如,该目标函数级别为3级,则判断是否存在被3级函数调用的4级函数;若不存在,则判断为该第一目标函数级别是最低函数级别,随后执行步骤S207,若存在,则判断为该第一目标函数级别不是最低函数级别,随后执行步骤S208。Specifically, there can be various methods for judging whether the first target function level is the lowest function level, for example, querying all functions running in the system of the application program, whether there is a sub-function called by the function corresponding to the target function level function. For example, if the objective function level is level 3, it is judged whether there is a level 4 function called by the level 3 function; if not, it is judged that the first objective function level is the lowest function level, and then step S207 is executed, if it exists, Then, it is determined that the first objective function level is not the lowest function level, and then step S208 is executed.
S207,关闭该应用程序中该第一目标函数级别对应的函数。S207, close the function corresponding to the first target function level in the application program.
具体地,当判断该第一目标函数级别是最低函数级别时,关闭该第一目标函数级别对应的函数,例如,第一目标函数级别为3级,则关闭所有的3级函数。Specifically, when it is determined that the first objective function level is the lowest function level, the function corresponding to the first objective function level is closed. For example, if the first objective function level is level 3, all level 3 functions are closed.
S208,关闭该应用程序中该第一目标函数级别对应的函数,以及函数级别低于该第一目标函数级别的函数。S208, close the function corresponding to the first objective function level in the application program, and the function whose function level is lower than the first objective function level.
具体地,当判断该第一目标函数级别不是最低函数级别时,关闭函数级别小于或等于该目标函数级别的函数,例如,第一目标函数级别为3级,则关闭所有的3级函数、4级函数以及5级函数(若存在被调用的5级函数)。Specifically, when judging that the first objective function level is not the lowest function level, close functions whose function level is less than or equal to the objective function level. For example, if the first objective function level is level 3, then close all level 3 functions, 4 level function and level 5 function (if there is a called level 5 function).
S209,获取终端当前的电量信息。S209: Acquire current power information of the terminal.
具体地,获取终端当前的电量信息的实现方式有多种,例如,可以通过终端自带的电源管理程序获取电量信息,该电量信息可以是剩余电量占电池总容量的百分比,例如,电量信息为30%表示终端当前剩余30%电量。Specifically, there are many ways to obtain the current power information of the terminal. For example, the power information can be obtained through the power management program that comes with the terminal, and the power information can be the percentage of the remaining power to the total battery capacity. For example, the power information is 30% means that the terminal currently has 30% power remaining.
S210,根据该电量信息获取相应的第二目标函数级别,该第二目标函数级别高于该第一目标函数级别。S210: Acquire a corresponding second objective function level according to the electric quantity information, where the second objective function level is higher than the first objective function level.
具体地,可以在终端的内置存储区域中预先存储电量信息区间与第二目标函数级别之间的映射关系,例如,电量信息[30%,40%)对应的目标函数级别为3级,电量信息[20%,30%)对应的目标函数级别为2级等,则获取到终端的电量信息后,先确定该电量信息所处的电量信息区间,随后根据该电量信息区间和预先存储的映射关系获取第二目标函数级别。Specifically, the mapping relationship between the power information interval and the second objective function level can be pre-stored in the built-in storage area of the terminal. For example, the objective function level corresponding to the power information [30%, 40%) is level 3, and the power information [20%, 30%) corresponding to the objective function level is level 2, etc., after obtaining the power information of the terminal, first determine the power information interval where the power information is located, and then according to the power information interval and the pre-stored mapping relationship Get the second objective function level.
S211,根据该第二目标函数级别关闭该应用程序中相应的函数。S211, close the corresponding function in the application program according to the second target function level.
具体地,获取到第二目标函数级别后,例如,根据电量信息20%获取到第二目标函数级别为2级,则关闭应用程序中所有的2级函数,或者关闭应用程序中所有的2级函数以及函数级别低于2级的函数(3级函数、4级函数等)。Specifically, after the second objective function level is acquired, for example, according to the 20% power information, the second objective function level is acquired as level 2, then all level 2 functions in the application are closed, or all level 2 functions in the application are closed. Functions and functions with a function level lower than level 2 (level 3 functions, level 4 functions, etc.).
由上可知,本发明实施例提供的应用程序的关闭方法,采用获取应用程序中函数之间的调用关系,然后根据该调用关系对该应用程序中的函数设置函数级别,接收该应用程序的关闭指令,并根据该关闭指令获取该应用程序在预设时间段内通过唤醒锁唤醒系统的唤醒次数,确定该唤醒次数所处的唤醒次数区间,并根据该唤醒次数区间获取相应的第一目标函数级别,判断该第一目标函数级别是否为最低函数级别,若是则关闭该应用程序中该第一目标函数级别对应的函数,若否则关闭该应用程序中该第一目标函数级别对应的函数,以及函数级别低于该第一目标函数级别的函数,随后获取终端当前的电量信息,根据该电量信息获取相应的第二目标函数级别,并根据该第二目标函数级别关闭该应用程序中相应的函数;该方案根据应用程序在预设时间段内通过唤醒锁唤醒系统的唤醒次数来关闭相应的函数,并进一步根据终端的电量信息来关闭相应的函数,由于该方案并没有直接关闭应用程序,而是只关闭应用程序中相应的函数,因此,在需要重新启动该应用程序时,只需要重新调用被关闭的函数即可,相对于现有技术而言,可以在降低终端电量消耗的同时,提升应用程序重新启动的速度。As can be seen from the above, the method for closing an application program provided by the embodiment of the present invention adopts the method of acquiring the calling relationship between functions in the application program, and then setting the function level of the function in the application program according to the calling relationship, and receiving the closing of the application program. instruction, and according to the shutdown instruction, obtain the number of wake-up times that the application wakes up the system through the wake-up lock within a preset time period, determine the wake-up times interval in which the wake-up times are located, and obtain the corresponding first target function according to the wake-up times interval. level, determine whether the first objective function level is the lowest function level, if so, close the function corresponding to the first objective function level in the application program, if not, close the function corresponding to the first objective function level in the application program, and A function whose function level is lower than the first objective function level, then acquires the current power level information of the terminal, acquires a corresponding second objective function level according to the power level information, and closes the corresponding function in the application program according to the second objective function level ; This scheme closes the corresponding function according to the number of times the application wakes up the system through the wake-up lock within a preset time period, and further closes the corresponding function according to the power information of the terminal, because the scheme does not directly close the application, but It only closes the corresponding function in the application. Therefore, when the application needs to be restarted, it is only necessary to call the closed function again. Compared with the existing technology, it can reduce the power consumption of the terminal and improve the The speed at which the application restarts.
实施例三Embodiment 3
目前的智能终端都设置有很多的传感器,例如,GPS(Global PositioningSystem,全球定位系统)传感器、重力传感器、指纹传感器、图像传感器、音频传感器等,应用程序通过应用程序中的传感器调用函数来调用这些传感器,每个传感器可以被多个应用程序调用,每个应用程序也可以调用多个传感器。At present, smart terminals are equipped with many sensors, such as GPS (Global Positioning System) sensors, gravity sensors, fingerprint sensors, image sensors, audio sensors, etc. The application calls these functions through the sensor call function in the application. Sensors, each sensor can be called by multiple applications, and each application can also call multiple sensors.
在应用程序关闭时,通常应用程序中调用传感器的调用函数并未关闭,调用函数在应用程序关闭后依然保持运行会增加终端的功率消耗,进而增加终端的电量消耗,降低终端的续航能力。When the application is closed, the calling function that calls the sensor in the application is usually not closed, and the calling function keeps running after the application is closed, which will increase the power consumption of the terminal, thereby increasing the power consumption of the terminal and reducing the battery life of the terminal.
本实施例将从应用程序的关闭装置的角度进行描述,该装置具体可以集成在终端中,该终端可以为智能手机、平板电脑等设备。This embodiment will be described from the perspective of a device for closing an application. The device may be specifically integrated in a terminal, and the terminal may be a device such as a smart phone or a tablet computer.
如图3所示,该应用程序的关闭方法,具体流程可以如下:As shown in Figure 3, the closing method of the application, the specific process can be as follows:
S301,获取应用程序中调用传感器的调用函数的集合。S301 , acquiring a collection of calling functions for calling sensors in an application.
具体地,应用程序中存在多个调用函数用于调用多个传感器,例如,调用函数E用于调用指纹传感器,调用函数F用于调用图像传感器,调用函数G用于调用音频传感器,则可以获取到该集合包括调用函数E、调用函数F、调用函数G。Specifically, there are multiple calling functions in the application for calling multiple sensors, for example, calling function E for calling the fingerprint sensor, calling function F for calling the image sensor, calling function G for calling the audio sensor, then you can obtain To this set includes calling function E, calling function F, and calling function G.
S302,对该集合中的调用函数设置函数级别。S302, setting a function level for the calling function in the set.
具体地,设置函数级别时,可以根据该多个调用函数所调用的传感器的功能重要性来进行设置,例如,指纹传感器是进入该应用程序时的鉴权方式,则指纹传感器的重要性最高,可设置指纹传感器调用函数E的级别为2级,图像传感器是用于实现该应用程序的基本功能,则图像传感器的重要性次之,可设置图像传感器调用函数F的级别为3级,音频传感器是用于实现该应用程序的附加功能,则音频传感器的重要性最低,可将音频传感器调用函数G的级别设置为4级。Specifically, when setting the function level, it can be set according to the functional importance of the sensors called by the multiple calling functions. For example, if the fingerprint sensor is the authentication method when entering the application, the importance of the fingerprint sensor is the highest. The level of the fingerprint sensor calling function E can be set to level 2, and the image sensor is used to implement the basic functions of the application, then the importance of the image sensor is second, the level of the image sensor calling function F can be set to level 3, and the audio sensor can be set to level 3. is an additional function used to implement the application, the importance of the audio sensor is the least, and the level of the audio sensor calling function G can be set to level 4.
在本发明的一个优选实施例中,可以对集合中的调用函数设置标识位,例如,将集合中的所有调用函数的标识位设置为1,标识位还可以包括颜色,例如,将集合中的所有调用函数的标识位设置为绿色。In a preferred embodiment of the present invention, an identification bit may be set for the calling functions in the set, for example, the identification bits of all calling functions in the set are set to 1, and the identification bit may also include a color, for example, the The flags of all calling functions are set to green.
S303,接收该应用程序的关闭指令,并根据该关闭指令获取该应用程序在预设时间段内通过唤醒锁唤醒系统的唤醒特征。S303: Receive a shutdown instruction of the application, and obtain a wake-up feature of the application that wakes up the system through a wake-up lock within a preset time period according to the shutdown instruction.
具体地,接收应用程序的关闭指令的方式可以有多种,例如,可以通过屏幕接收用户的触摸操作发送的关闭指令,也可以接收用户通过远程操作发送的关闭指令,还可以是接收终端内部的定时器触发的关闭指令。Specifically, there are many ways to receive the closing instruction of the application. For example, the closing instruction sent by the user's touch operation can be received through the screen, the closing instruction sent by the user through the remote operation can also be received, and the closing instruction sent by the user through the remote operation can also be received. Timer-triggered shutdown command.
接收到关闭指令后,获取应用程序在预设时间段内通过唤醒锁唤醒系统的唤醒特征。该预设时间段可以是预先存储在终端内置存储区域的一个时间值,也可以是用户设置并存储在终端内置存储区域的一个时间值,例如,1分钟。该唤醒特征可以是预设时间段内的唤醒次数或唤醒频率等特征,例如,该应用程序在1分钟内通过唤醒锁唤醒终端系统5次。After receiving the shutdown instruction, obtain the wake-up feature that the application wakes up the system through the wake-up lock within a preset time period. The preset time period may be a time value pre-stored in the built-in storage area of the terminal, or may be a time value set by the user and stored in the built-in storage area of the terminal, for example, 1 minute. The wake-up feature may be features such as the number of wake-up times or the wake-up frequency within a preset time period. For example, the application wakes up the terminal system 5 times through the wake-up lock within 1 minute.
S304,根据该唤醒特征获取相应的第一目标函数级别。S304: Acquire a corresponding first objective function level according to the wake-up feature.
具体地,可以在终端的内置存储区域中预先存储唤醒特征与目标函数级别之间的映射关系,该映射关系也可以由用户设置并存储在终端的内置存储区域中。当获取到唤醒特征后,调用存储在终端内置存储区域中的映射关系,根据该映射关系获取目标函数级别。例如,映射关系中唤醒次数5次对应的目标函数级别为3级,则当获取到唤醒特征为唤醒次数是5次时,可以根据该映射关系获取到对应的目标函数级别为3级。Specifically, the mapping relationship between the wake-up feature and the target function level may be pre-stored in the built-in storage area of the terminal, and the mapping relationship may also be set by the user and stored in the built-in storage area of the terminal. After the wake-up feature is acquired, the mapping relationship stored in the built-in storage area of the terminal is called, and the target function level is acquired according to the mapping relationship. For example, in the mapping relationship, the target function level corresponding to 5 wake-up times is level 3, then when the acquired wake-up feature is that the number of wake-up times is 5 times, the corresponding target function level can be obtained according to the mapping relationship as level 3.
S305,根据该第一目标函数级别关闭该集合中相应的调用函数。S305, close the corresponding calling function in the set according to the first target function level.
具体地,当获取到目标函数级别时,关闭集合中相应的调用函数,例如,获取到目标函数级别为3级时,关闭集合中所有的3级调用函数,也可以关闭集合中所有的3级调用函数和4级调用函数。Specifically, when the target function level is obtained, the corresponding calling function in the set is closed. For example, when the target function level is obtained, all the third-level calling functions in the set are closed, and all the third-level calling functions in the set can also be closed. Call function and level 4 call function.
在本发明的一个优选实施例中,在关闭集合中相应的调用函数后,还可以更改被关闭的调用函数的标识位,例如,将集合中被关闭的所有调用函数的标识位由1更改为2,标识位还可以包括颜色,例如,将集合中被关闭的所有调用函数的标识位由绿色更改为红色。In a preferred embodiment of the present invention, after the corresponding calling functions in the set are closed, the identification bits of the closed calling functions can also be changed, for example, the identification bits of all closed calling functions in the set are changed from 1 to 2. The identification bit may also include a color. For example, the identification bit of all calling functions that are closed in the set is changed from green to red.
由上可知,本发明实施例提供的应用程序的关闭方法,采用获取应用程序中调用传感器的调用函数的集合,对该集合中的调用函数设置函数级别,接收该应用程序的关闭指令,并根据该关闭指令获取该应用程序在预设时间段内通过唤醒锁唤醒系统的唤醒特征,根据该唤醒特征获取相应的第一目标函数级别,并根据该第一目标函数级别关闭该集合中相应的调用函数;该方案首先对集合中的调用函数设置函数级别,然后根据应用程序在预设时间段内通过唤醒锁唤醒系统的唤醒特征获取相应的第一目标函数级别,并关闭集合中与该目标函数级别相应的调用函数,由于该方案并没有直接关闭应用程序,而是关闭应用程序中相应的调用函数,因此,在需要重新启动该应用程序时,只需要重新调用被关闭的调用函数即可,相对于现有技术而言,可以在降低终端电量消耗的同时,提升应用程序重新启动的速度。As can be seen from the above, the method for closing an application program provided by the embodiment of the present invention adopts a collection of calling functions for calling sensors in an application program, sets a function level for the calling functions in the collection, receives a closing instruction of the application program, and according to The shutdown instruction acquires a wake-up feature of the application that wakes up the system through a wake-up lock within a preset time period, acquires a corresponding first target function level according to the wake-up feature, and closes corresponding calls in the set according to the first target function level function; this scheme first sets the function level for the calling function in the set, and then obtains the corresponding first target function level according to the wake-up feature of the application program to wake up the system through the wake-up lock within a preset time period, and closes the target function in the set. The corresponding calling function of the level, because this scheme does not directly close the application, but closes the corresponding calling function in the application, therefore, when the application needs to be restarted, it is only necessary to re-call the closed calling function. Compared with the prior art, the speed of restarting the application program can be improved while reducing the power consumption of the terminal.
实施例四Embodiment 4
为了更好地实施以上方法,本发明实施例还提供一种应用程序的关闭装置,该应用程序的关闭装置可以集成在终端中,该终端具体可以是智能手机、平板电脑等设备。In order to better implement the above method, an embodiment of the present invention further provides a device for closing an application program. The device for closing an application program may be integrated in a terminal, and the terminal may specifically be a device such as a smart phone or a tablet computer.
如图4a所示,该应用程序的关闭装置可以包括:设置模块401、第一获取模块402、第二获取模块403、第一处理模块404,具体描述如下:As shown in FIG. 4a, the device for closing the application may include: a setting module 401, a first obtaining module 402, a second obtaining module 403, and a first processing module 404, which are specifically described as follows:
该设置模块401,用于对应用程序中的函数设置函数级别;The setting module 401 is used to set the function level for the function in the application;
该第一获取模块402,用于接收该应用程序的关闭指令,并根据该关闭指令获取该应用程序在预设时间段内通过唤醒锁唤醒系统的唤醒特征;The first obtaining module 402 is configured to receive a shutdown instruction of the application, and obtain a wake-up feature of the application that wakes up the system through a wake-up lock within a preset time period according to the shutdown instruction;
该第二获取模块403,用于根据该唤醒特征获取相应的第一目标函数级别;The second obtaining module 403 is configured to obtain the corresponding first objective function level according to the wake-up feature;
该第一处理模块404,用于根据该第一目标函数级别关闭该应用程序中相应的函数。The first processing module 404 is configured to close the corresponding function in the application program according to the first target function level.
优选地,如图4b所示,该设置模块401可以包括:第一获取子模块4011、设置子模块4012,具体如下:Preferably, as shown in FIG. 4b, the setting module 401 may include: a first acquisition sub-module 4011 and a setting sub-module 4012, as follows:
该第一获取子模块4011,用于获取应用程序中函数之间的调用关系;The first acquisition sub-module 4011 is used to acquire the calling relationship between functions in the application;
该设置子模块4012,用于根据该调用关系对该应用程序中的函数设置函数级别。The setting sub-module 4012 is used to set the function level of the function in the application program according to the calling relationship.
优选地,该唤醒特征包括唤醒次数,如图4c所示,该第二获取模块403可以包括:确定子模块4031、第二获取子模块4032,具体如下:Preferably, the wake-up feature includes wake-up times. As shown in FIG. 4c, the second acquisition module 403 may include: a determination sub-module 4031 and a second acquisition sub-module 4032, as follows:
该确定子模块4031,用于确定该唤醒次数所处的唤醒次数区间;The determination sub-module 4031 is used to determine the wake-up times interval in which the wake-up times are located;
该第二获取子模块4032,用于根据该唤醒次数区间获取相应的第一目标函数级别。The second obtaining sub-module 4032 is configured to obtain the corresponding first objective function level according to the wake-up times interval.
优选地,第一目标函数级别低于最高函数级别,如图4d所示,该第一处理模块404可以包括:判断子模块4041、处理子模块4042,具体如下:Preferably, the first objective function level is lower than the highest function level. As shown in FIG. 4d, the first processing module 404 may include: a judgment submodule 4041 and a processing submodule 4042, as follows:
该判断子模块4041,用于判断该第一目标函数级别是否为最低函数级别;The judging submodule 4041 is used to judge whether the first objective function level is the lowest function level;
该处理子模块4042,用于在该判断子模块4041判断为是时,关闭该应用程序中该第一目标函数级别对应的函数;在该判断子模块4041判断为否时,关闭该应用程序中该第一目标函数级别对应的函数,以及函数级别低于该第一目标函数级别的函数。The processing submodule 4042 is used to close the function corresponding to the first target function level in the application program when the judgment submodule 4041 judges it to be yes; when the judgment submodule 4041 judges it to be no, close the function in the application program A function corresponding to the first objective function level, and a function whose function level is lower than the first objective function level.
优选地,如图4e所示,该应用程序的关闭装置还可以包括:第二处理模块405;该第二处理模块405用于:Preferably, as shown in FIG. 4e, the device for closing the application may further include: a second processing module 405; the second processing module 405 is used for:
获取终端当前的电量信息;Get the current battery information of the terminal;
根据该电量信息获取相应的第二目标函数级别,该第二目标函数级别高于该第一目标函数级别;Acquire a corresponding second objective function level according to the electric quantity information, where the second objective function level is higher than the first objective function level;
根据该第二目标函数级别关闭该应用程序中相应的函数。The corresponding function in the application is closed according to the second objective function level.
由上可知,本发明实施例提供的应用程序的关闭装置,通过设置模块401对应用程序中的函数设置函数级别,第一获取模块402接收该应用程序的关闭指令,并根据该关闭指令获取该应用程序在预设时间段内通过唤醒锁唤醒系统的唤醒特征,第二获取模块403根据该唤醒特征获取相应的第一目标函数级别,第一处理模块404根据该第一目标函数级别关闭该应用程序中相应的函数;由于该方案并没有直接关闭应用程序,而是关闭应用程序中相应的函数,因此,在需要重新启动该应用程序时,只需要重新调用被关闭的函数即可,相对于现有技术而言,可以在降低终端电量消耗的同时,提升应用程序重新启动的速度。As can be seen from the above, in the device for closing an application program provided by the embodiment of the present invention, the function level is set for the function in the application program by the setting module 401, and the first obtaining module 402 receives the closing instruction of the application program, and obtains the closing instruction according to the closing instruction. The application wakes up the wake-up feature of the system through a wake-up lock within a preset time period, the second acquisition module 403 obtains the corresponding first target function level according to the wake-up feature, and the first processing module 404 closes the application according to the first target function level The corresponding function in the program; because the program does not directly close the application, but closes the corresponding function in the application, therefore, when the application needs to be restarted, it is only necessary to call the closed function again. In the prior art, the speed of restarting the application program can be improved while reducing the power consumption of the terminal.
具体实施时,以上各个模块可以作为独立的实体来实现,也可以进行任意组合,作为同一或若干个实体来实现,以上各个模块的具体实施可参见前面的方法实施例,在此不再赘述。During specific implementation, the above modules can be implemented as independent entities, or can be arbitrarily combined to be implemented as the same or several entities. The specific implementation of the above modules can refer to the previous method embodiments, which will not be repeated here.
需要说明的是,本领域普通技术人员可以理解上述实施例的各种方法中的全部或部分步骤是可以通过程序来指令相关的硬件来完成,该程序可以存储于计算机可读存储介质中,存储介质可以包括:只读存储器(ROM,Read Only Memory)、随机存取存储器(RAM,Random Access Memory)、磁盘或光盘等。It should be noted that those of ordinary skill in the art can understand that all or part of the steps in the various methods of the above embodiments can be completed by instructing the relevant hardware through a program, and the program can be stored in a computer-readable storage medium. The medium may include: Read Only Memory (ROM, Read Only Memory), Random Access Memory (RAM, Random Access Memory), magnetic disk or optical disk, and the like.
以上对本发明实施例所提供的一种应用程序的关闭方法和装置进行了详细介绍,本文中应用了具体个例对本发明的原理及实施方式进行了阐述,以上实施例的说明只是用于帮助理解本发明的方法及其核心思想;同时,对于本领域的技术人员,依据本发明的思想,在具体实施方式及应用范围上均会有改变之处,综上所述,本说明书内容不应理解为对本发明的限制。The method and device for closing an application program provided by the embodiments of the present invention have been described in detail above. The principles and implementations of the present invention are described in this paper by using specific examples. The descriptions of the above embodiments are only used to help understanding The method of the present invention and its core idea; at the same time, for those skilled in the art, according to the idea of the present invention, there will be changes in the specific implementation and application scope. In summary, the content of this description should not be understood to limit the present invention.
Claims (8)
Priority Applications (2)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201610379851.0A CN106095412B (en) | 2016-05-31 | 2016-05-31 | Application program closing method and device |
PCT/CN2017/086468 WO2017206871A1 (en) | 2016-05-31 | 2017-05-29 | Application program shutdown method and apparatus, storage medium, and electronic device |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201610379851.0A CN106095412B (en) | 2016-05-31 | 2016-05-31 | Application program closing method and device |
Publications (2)
Publication Number | Publication Date |
---|---|
CN106095412A CN106095412A (en) | 2016-11-09 |
CN106095412B true CN106095412B (en) | 2019-07-16 |
Family
ID=57230637
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN201610379851.0A Expired - Fee Related CN106095412B (en) | 2016-05-31 | 2016-05-31 | Application program closing method and device |
Country Status (2)
Country | Link |
---|---|
CN (1) | CN106095412B (en) |
WO (1) | WO2017206871A1 (en) |
Families Citing this family (4)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN106095412B (en) * | 2016-05-31 | 2019-07-16 | Oppo广东移动通信有限公司 | Application program closing method and device |
CN110099404B (en) * | 2018-01-30 | 2022-07-15 | 中国移动通信有限公司研究院 | A method and device for testing battery life |
WO2020133437A1 (en) * | 2018-12-29 | 2020-07-02 | 深圳市欢太科技有限公司 | Application program managing method and device, storage medium and electronic device |
CN111723016B (en) * | 2020-06-24 | 2024-06-04 | 湖南国科微电子股份有限公司 | File closing method, device, electronic equipment and storage medium |
Citations (5)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN103176842A (en) * | 2013-03-15 | 2013-06-26 | 广东欧珀移动通信有限公司 | Background process management method and mobile terminal thereof |
CN104298336A (en) * | 2013-07-19 | 2015-01-21 | 贝壳网际(北京)安全技术有限公司 | Mobile terminal and control method and device of application program of mobile terminal |
CN105100429A (en) * | 2015-06-08 | 2015-11-25 | 北京金山安全软件有限公司 | Method and device for determining use time of residual electric quantity of mobile terminal |
CN105260117A (en) * | 2015-09-30 | 2016-01-20 | 小米科技有限责任公司 | Application control method and apparatus |
CN105425934A (en) * | 2014-07-16 | 2016-03-23 | 联发科技股份有限公司 | Power saving method and electronic device thereof |
Family Cites Families (6)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
US20040100457A1 (en) * | 2002-11-21 | 2004-05-27 | Mandle Thomas C. | Method and system for switching power and loading and closing applications in a portable computing device using a removable pointing device |
CN104199669B (en) * | 2014-09-12 | 2017-12-15 | 北京奇虎科技有限公司 | The method and device being managed to the process of application program |
CN104866069A (en) * | 2015-06-12 | 2015-08-26 | 广东小天才科技有限公司 | Method and device for automatically cleaning background application program |
CN106095412B (en) * | 2016-05-31 | 2019-07-16 | Oppo广东移动通信有限公司 | Application program closing method and device |
CN106095054B (en) * | 2016-05-31 | 2019-02-12 | Oppo广东移动通信有限公司 | Method and device for closing application program |
CN106020907B (en) * | 2016-05-31 | 2019-12-03 | Oppo广东移动通信有限公司 | Method and device for closing application program |
-
2016
- 2016-05-31 CN CN201610379851.0A patent/CN106095412B/en not_active Expired - Fee Related
-
2017
- 2017-05-29 WO PCT/CN2017/086468 patent/WO2017206871A1/en active Application Filing
Patent Citations (5)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN103176842A (en) * | 2013-03-15 | 2013-06-26 | 广东欧珀移动通信有限公司 | Background process management method and mobile terminal thereof |
CN104298336A (en) * | 2013-07-19 | 2015-01-21 | 贝壳网际(北京)安全技术有限公司 | Mobile terminal and control method and device of application program of mobile terminal |
CN105425934A (en) * | 2014-07-16 | 2016-03-23 | 联发科技股份有限公司 | Power saving method and electronic device thereof |
CN105100429A (en) * | 2015-06-08 | 2015-11-25 | 北京金山安全软件有限公司 | Method and device for determining use time of residual electric quantity of mobile terminal |
CN105260117A (en) * | 2015-09-30 | 2016-01-20 | 小米科技有限责任公司 | Application control method and apparatus |
Also Published As
Publication number | Publication date |
---|---|
WO2017206871A1 (en) | 2017-12-07 |
CN106095412A (en) | 2016-11-09 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
CN106020907B (en) | Method and device for closing application program | |
CN109213539B (en) | Memory recovery method and device | |
CN104199669B (en) | The method and device being managed to the process of application program | |
CN105740690B (en) | A kind of unlocking method and mobile terminal | |
CN109803359B (en) | Method for awakening terminal system and terminal | |
WO2017206107A1 (en) | Charging method and terminal | |
CN107943269B (en) | Scheduling operation control method, device, terminal device and storage medium | |
CN106227585B (en) | Application program starting method, device and equipment | |
CN106095412B (en) | Application program closing method and device | |
CN112805987B (en) | A boot process control method, a boot process control device, a terminal device, and a computer-readable storage medium | |
WO2018082412A1 (en) | Electronic equipment control method, device and electronic equipment | |
CN107783803B (en) | System optimization method and device of intelligent terminal, storage medium and intelligent terminal | |
CN104199731A (en) | Method and device for managing application program processes | |
WO2018010409A1 (en) | Power consumption warning method and apparatus | |
CN107844341B (en) | Process starting control method and device, storage medium and mobile terminal | |
CN106095288A (en) | A processing method and device based on wake lock | |
CN107748684A (en) | Realize processing method, device, storage medium and the mobile terminal of self-starting | |
CN106020426B (en) | Method and device for releasing wake-up lock | |
CN106095492A (en) | Method and device for closing an application program | |
CN105005489B (en) | A kind of the starting method and terminal device of terminal device | |
CN106095055B (en) | Application program closing method and device | |
CN106125889B (en) | Awakening source processing method and device | |
CN107277906B (en) | Mode selection method, device, terminal and computer readable storage medium | |
CN106095054A (en) | The method for closing of a kind of application program and device | |
CN107295193A (en) | Jingle bell control method, device, storage medium and electronic equipment |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
C06 | Publication | ||
PB01 | Publication | ||
C10 | Entry into substantive examination | ||
SE01 | Entry into force of request for substantive examination | ||
CB02 | Change of applicant information | ||
CB02 | Change of applicant information |
Address after: 523860 No. 18, Wu Sha Beach Road, Changan Town, Dongguan, Guangdong Applicant after: GUANGDONG OPPO MOBILE TELECOMMUNICATIONS Corp.,Ltd. Address before: 523860 No. 18, Wu Sha Beach Road, Changan Town, Dongguan, Guangdong Applicant before: GUANGDONG OPPO MOBILE TELECOMMUNICATIONS Corp.,Ltd. |
|
GR01 | Patent grant | ||
GR01 | Patent grant | ||
CF01 | Termination of patent right due to non-payment of annual fee | ||
CF01 | Termination of patent right due to non-payment of annual fee |
Granted publication date: 20190716 |