WO2019084783A1 - Service scheduling method and apparatus, computer device, and computer readable storage medium - Google Patents

Service scheduling method and apparatus, computer device, and computer readable storage medium Download PDF

Info

Publication number
WO2019084783A1
WO2019084783A1 PCT/CN2017/108628 CN2017108628W WO2019084783A1 WO 2019084783 A1 WO2019084783 A1 WO 2019084783A1 CN 2017108628 W CN2017108628 W CN 2017108628W WO 2019084783 A1 WO2019084783 A1 WO 2019084783A1
Authority
WO
WIPO (PCT)
Prior art keywords
service
application
target application
identifier
foreground
Prior art date
Application number
PCT/CN2017/108628
Other languages
French (fr)
Chinese (zh)
Inventor
任超
Original Assignee
深圳市云中飞网络科技有限公司
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 深圳市云中飞网络科技有限公司 filed Critical 深圳市云中飞网络科技有限公司
Priority to PCT/CN2017/108628 priority Critical patent/WO2019084783A1/en
Priority to CN201780092177.0A priority patent/CN110753909B/en
Publication of WO2019084783A1 publication Critical patent/WO2019084783A1/en

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/46Multiprogramming arrangements
    • G06F9/48Program initiating; Program switching, e.g. by interrupt

Definitions

  • the present application relates to the field of computer technology, and in particular, to a service scheduling method and apparatus, a computer device, and a computer readable storage medium.
  • a service without an interface which is generally divided into two types: a foreground service and a background service.
  • a foreground service When the front-end service is running, it has a higher priority.
  • the terminal system When the terminal system has insufficient memory and the CPU (Central Processing Unit) occupancy rate is too high, it will not be actively shut down by the terminal.
  • the background service has a lower priority.
  • the terminal system runs out of memory and the CPU usage is too high, it may be shut down by the terminal to recover resources. If the developer does not follow the rules of the foreground service, many useless application services in the terminal system will run in the form of foreground services, resulting in the terminal resources being occupied.
  • the embodiment of the present application provides a service scheduling method and apparatus, a computer device, and a computer readable storage medium, which can reduce resource occupation.
  • a service scheduling method comprising:
  • the service white list corresponding to the application is obtained, where the service white list includes one or more service identifiers, and each of the service identifiers is used for An application service that uniquely identifies the application;
  • the foreground application service is run in the foreground.
  • a service scheduling device comprising:
  • a list obtaining module configured to: if a target application service that detects an application in the terminal starts a foreground service, obtain a service white list corresponding to the application, where the service white list includes one or more service identifiers, each of which includes one or more service identifiers, each The service identifier is used to uniquely identify an application service of the application;
  • An identifier matching module configured to determine whether the service identifier of the target application service is included in the service whitelist
  • the service running module is configured to: if the service whitelist includes the service identifier of the target application service, run the target application service in the foreground.
  • a computer device comprising a memory and a processor, wherein the memory stores computer readable instructions, and when the instructions are executed by the processor, the processor performs the following steps:
  • the service white list corresponding to the application is obtained, where the service white list includes one or more service identifiers, and each of the service identifiers is used for An application service that uniquely identifies the application;
  • the foreground application service is run in the foreground.
  • One or more non-transitory computer readable storage media containing computer executable instructions that, when executed by one or more processors, cause the processor to perform the following steps:
  • the service white list corresponding to the application is obtained, where the service white list includes one or more service identifiers, and each of the service identifiers is used for An application service that uniquely identifies the application;
  • the foreground application service is run in the foreground.
  • 1 is an application environment diagram of a service scheduling method in an embodiment
  • FIG. 2 is a flow chart of a service scheduling method in an embodiment
  • FIG. 3 is a flow chart of a service scheduling method in another embodiment
  • FIG. 5 is a diagram of a terminal interface for modifying a service white list in an embodiment
  • FIG. 6 is a flow chart of a service scheduling method in still another embodiment
  • FIG. 7 is a schematic structural diagram of a service invoking device in an embodiment
  • FIG. 8 is a schematic structural diagram of a service invoking device in another embodiment
  • FIG. 9 is a schematic diagram showing the internal structure of a server in an embodiment
  • FIG. 10 is a block diagram showing a part of a structure of a mobile phone related to a computer device according to an embodiment of the present invention.
  • FIG. 1 is an application environment diagram of a service scheduling method in an embodiment.
  • the application environment includes a user terminal 102 and a server 104.
  • the server 104 can send an installation package of the application to the user terminal, and the user terminal 102 can install the application through the installation package, and perform application interaction with the server 104 through the application to transmit the application data.
  • the service whitelist corresponding to the application is obtained, and the service white list includes one or more a service identifier, each of the service identifiers being used to uniquely identify an application service of the application; Determining whether the service whitelist includes the service identifier of the target application service; if the service whitelist includes the service identifier of the target application service, the foreground application service is run in the foreground.
  • the user terminal 102 is an electronic device that is mainly used for inputting user information and outputting processing results at the outermost periphery of the computer network, and may be, for example, a personal computer, a mobile terminal, a personal digital assistant, a wearable electronic device, or the like.
  • the server 104 is a device for providing a computing service in response to a service request, and may be, for example, one or more computers. It can be understood that, in other embodiments provided by the present application, the application environment of the service scheduling method may include only the user terminal 102.
  • the service scheduling method includes steps 202 to 206. among them:
  • Step 202 If it is detected in the terminal that the target application service of the application starts the foreground service, the service white list corresponding to the application is obtained, and the service white list includes one or more service identifiers, and each service identifier is used to uniquely identify the application. An application service for the program.
  • An application is a software written for an application purpose in an electronic device, and the electronic device implements a service demanded by the user through an application.
  • One or more applications can be installed in the terminal, and the user can achieve the application purpose by operating the application, for example, the user can operate the shopping APP (Application) to purchase the product, and can also listen to the music through the music APP, and can also Play games and more through the game app.
  • the application is running, the application is completed by an application service.
  • An application can simultaneously enable one or more application services, for example, an application may include a data update service, a music playback service, Multiple services such as data transfer services.
  • application services can be divided into foreground services and background services.
  • Front-end services refer to services running in the foreground of the terminal.
  • Background services refer to services running in the background of the terminal. The front-end service has a higher priority and will not be actively shut down during the running of the terminal; the background service has a lower priority, and may be shut down by the system
  • the service whitelist is stored in the terminal, and the service whitelist is in one-to-one correspondence with the application, and the service whitelist is used to store the service identifier corresponding to the application service that is allowed to run in the foreground service mode.
  • the service whitelist can include one or more service identifiers, and each service identifier is used to uniquely identify an application service of the application.
  • Service whitelist can be stored It can also be stored in a file in the terminal's database. According to the application identifier, the corresponding service whitelist can be obtained, and then the service identifier in the service whitelist is obtained.
  • the application identifier refers to a unique identifier that distinguishes different applications.
  • the application identifier can be, but is not limited to, the application package name.
  • the application package name can be com.qin.appinfo.
  • the service identifier is a unique identifier of the application service, and may be, but is not limited to, the class name of the application service.
  • Step 204 Determine whether the service identifier of the target application service is included in the service white list.
  • the service whitelist can be displayed through the interface of the terminal, and the user can view the service whitelist through the terminal interface, and can modify, add, delete, etc. the service identifier in the service whitelist as needed.
  • an operation instruction input by the user for modifying the service white list is received, and the service white list is modified according to an operation instruction input by the user.
  • the user may first select an application to be operated through the terminal interface, and the terminal displays the service white list corresponding to the application and the service identifier of all the application services, and then the user can edit the service white list through the terminal interface. It can be understood that the service white list can be pushed to the terminal through the server.
  • the server when the server sends the installation package of the application to the terminal, the server simultaneously sends a corresponding service white list to the terminal.
  • the service whitelist of the service service with a higher priority can be stored in the service whitelist sent by the server to the terminal.
  • the user service of the higher priority application service in the service whitelist cannot be arbitrarily changed.
  • the service identifier of the target application service is obtained.
  • the ActivityManager.RunningServiceInfo class encapsulates all the application service information, and can obtain the service identifier of the application service by calling the ActivityManager.RunningServiceInfo class.
  • the service identifier in the service whitelist is traversed, and the service identifier corresponding to the target application service is compared with the service identifier in the service whitelist to determine whether the service whitelist is included.
  • the service identifier corresponding to the target application service is obtained.
  • Step 206 If the service whitelist includes the service identifier of the target application service, the foreground application service is run in the foreground.
  • the application service can be displayed in the notification bar of the terminal, and the user can view the application service running in the foreground service through the notification bar.
  • the information about the application service displayed in the notification bar will also disappear. If the app service runs as a background service, the app service will not be displayed in the notification bar.
  • the service scheduling method provided in the above embodiment detects that the target application service of the application starts the foreground service, and obtains the service white list corresponding to the application, and determines the operation mode of the target application service through the service white list.
  • the malicious application service can be prevented from occupying the front-end service arbitrarily, resulting in system resources being occupied, thereby improving the utilization of system resources.
  • the service scheduling method includes steps 302 to 324. among them:
  • Step 302 If it is detected in the terminal that the target application service of the application starts the foreground service, the service level of the target application service is obtained.
  • the service level of the target application service may be first obtained, and whether the service is performed in the form of the foreground service according to the service level of the target application service.
  • the application service can be prioritized, and the service level refers to the priority of the application service.
  • the application service can be classified according to different standards, and can be divided into multiple levels, which is not limited in this embodiment.
  • the application services are classified according to the operating range, and can be classified into a local service (Local Service) and a remote service (Remote Sercie), and the level of the application service of the local operation can be defined to be higher than that of the remotely operated application service. It can also be classified according to the importance of the application service, and is divided into three levels: level 1, level 2, level 3, and the like.
  • Step 304 Determine whether the service level is less than a preset level, and if yes, perform step 306; if not, Then step 318 is performed.
  • the target application service Determining whether the service level of the target application service is less than a preset level. If the level is greater than or equal to the preset level, the target application service is directly operated in the form of a foreground service; if less than the preset level, the service white list corresponding to the application is obtained. And running according to the matching result of the service identifier of the target application service and the service whitelist.
  • Step 306 Obtain a service white list corresponding to the application, where the service white list includes one or more service identifiers, and each service identifier is used to uniquely identify an application service of the application.
  • the service whitelist may be stored in the form of a file, and each application corresponds to a service whitelist file.
  • the service whitelist file can be stored in the memory of the terminal, and the corresponding service whitelist file is obtained according to the package name of the application.
  • the terminal obtains the application name input by the user, searches for the corresponding application package name according to the application name, and then searches for a corresponding service whitelist file in the memory according to the application package name.
  • the terminal then reads the service identifier in the service whitelist file and displays the read service identifier in the terminal interface. You can also add or delete service IDs in the service whitelist through the terminal interface.
  • Step 308 Obtain a service identifier of the target application service, and match the service identifier of the target application service with the service identifier in the service whitelist.
  • the service identifier corresponding to the target application service is obtained, and the service identifier in the service whitelist is searched, and the service identifier of the target application service is matched with the service identifier in the service whitelist to determine whether there is a matching item.
  • the service identifier stored in the service whitelist includes service 1, service 2, service 3, service 4, service 5, and service 6. If the service identifier of the obtained application service is service 4, the service identifier of the application service is The service whitelist exists.
  • Step 310 Determine whether the service identifier of the target application service is included in the service whitelist, and if yes, execute step 318; if no, execute step 312.
  • the service identifier of the target application service is run in the form of a foreground service; The service ID corresponding to the service does not exist in the service whitelist. At the same time, the service identifier is matched with the service blacklist.
  • Step 312 Determine whether the service identifier of the target application service is included in the service blacklist. If yes, go to step 328; if no, go to step 314.
  • the service whitelist and the service blacklist may be simultaneously stored in the terminal, and the application service management is implemented through the service whitelist and the service blacklist.
  • the service blacklist is used to store a service identifier corresponding to an application service that is prohibited from running in the form of a foreground service. For example, some application services with large memory consumption may be set to be prohibited from running in the form of a foreground service, the service identifier of the application service is added to the service blacklist, and the application service runs directly as a background service, or Not running.
  • the service ID in the service blacklist can be set through the system, and the user can also customize the settings.
  • the target application service is directly executed in the form of a background service; If the service identifier of the target application service does not exist in the service blacklist, it indicates that the service identifier of the target application service does not exist in the service whitelist and the service blacklist, and the running permission of the target application service may be performed by the user. Settings.
  • Step 314 receiving the calling permission input by the terminal.
  • the user may input the calling permission of the target application service through the terminal, and invoke the right to indicate whether the target application service is allowed to run in the form of the foreground service. If the user inputs an allowable call through the terminal, the target application service is run in the form of a foreground service; if the user inputs a forbidden call through the terminal, the target application service is run in the form of a background service.
  • Figure 4 is a diagram of an input interface for invoking permissions in one embodiment. As shown in FIG.
  • the terminal interface prompts the user to input the calling permission in the form of a popup window, and the user selects whether to allow the target application service to be in the form of the foreground service according to the popup interface. If the user selects "Yes”, the target application service is run in the form of a foreground service, and the service identifier corresponding to the target application service is added to the service white list. If the user selects "No”, the target application service is run in the form of a background service, and the service identifier corresponding to the target application service is added to the service blacklist.
  • Step 316 If the calling permission is allowed to be invoked, the service identifier corresponding to the target application service is added to the service whitelist.
  • step 318 the foreground application service is run in the foreground.
  • the user enters the permission input by the terminal, the user is allowed to run the target application service in the form of the foreground service, and the service identifier corresponding to the target application service is added to the service white list, and the next time the target application service is served.
  • the target application service can be directly run as a foreground service. Specifically, if the calling permission input by the terminal is an allowable call, the target application service is run in the form of a foreground service, and the service identifier corresponding to the target application service is added to the service white list.
  • Step 320 If the duration of the target application service running in the foreground exceeds the duration threshold, the target application service is run in the background.
  • a duration threshold may also be stored in the service whitelist, and the duration threshold refers to a length of time that the application service is allowed to run in the form of a foreground service.
  • the relationship between the service identifier and the duration threshold in the service whitelist is one-to-one.
  • the corresponding duration threshold can be obtained according to the service identifier. Specifically, the time is started from the time when the target application service runs in the foreground mode, and the running time of the current time is obtained in real time. If the running time exceeds the duration threshold, the target application service is converted into the background service to run.
  • the application service 1 corresponds to a duration of 30 minutes, and the application service 1 runs as a foreground service from 12:00. When the time reaches 12:30, the application service 1 is turned into a background service.
  • Step 322 Obtain a resource occupancy rate of the terminal, and obtain a service identifier corresponding to the resource occupancy rate in the service whitelist, and run the application service corresponding to the obtained service identifier in the form of a background service.
  • the resource usage ratio refers to the proportion of the terminal resources that are occupied, and may include a memory usage ratio, a CPU usage, and the like, which are not limited herein.
  • the CPU refers to a structure that provides arithmetic and control functions in an electronic device, and can be a large-scale integrated circuit mainly used to interpret computer instructions and process data in computer software.
  • the electronic device is running computer software, and the application event needs to be processed by the CPU, and the CPU resource is occupied by the application event.
  • CPU usage can It refers to the ratio of occupied CPU resources to all CPU resources. It can also refer to the ratio of the time that the CPU performs tasks to the total working time.
  • the CPU usage may be, but is not limited to, expressed in the form of a percentage, and the specific percentage value indicates how much CPU resources are occupied or CPU resources are occupied. For example, if the CPU usage is 50%, it means that 50% of the CPU resources are occupied. It can also be said that in the total working time, 50% of the time CPU resources are occupied.
  • the resource occupancy rate may be associated with the service identifier, or the resource occupancy rate may be associated with the service level to obtain the corresponding service identifier.
  • the service level is divided into level 1, level 2, and level 3.
  • the application service corresponding to level 3 is operated as a background service; when the memory occupancy is greater than 70%, level 2 is The application service corresponding to level 3 runs in the form of a background service; when the memory usage is greater than 90%, the application services corresponding to level 1, level 2, and level 3 are run in the form of background services.
  • the resource usage rate corresponding to each application may be obtained, and the corresponding service identifier is obtained according to the resource occupancy rate of each application, and the application service corresponding to the obtained service identifier is operated in the form of a background service. For example, if the CPU usage of an application is higher than 20%, the application service with the service level of level 3 corresponding to the application is run as a background service, so that the resources of the terminal can be managed reasonably.
  • the monitoring log file may be obtained in a preset storage address, and the CPU usage rate is obtained according to the monitoring log file.
  • the preset storage address is a preset address for storing the monitoring log file, and the monitoring log file records the change of the specific running condition of the CPU from the opening to the current time.
  • the monitoring log file can be found according to the monitoring log file identifier.
  • the monitoring log file identifier refers to the unique identifier that distinguishes the monitoring log file, such as the name and number of the monitoring log file.
  • the preset storage address may include several subfolders, where each process log file is stored. The process log file records the changes in the specific running status of the process from the start to the current time.
  • the log file can be obtained.
  • the CPU usage of the process can be obtained by taking the CPU resources occupied by the process.
  • the process refers to the basic unit of the CPU to perform resource allocation scheduling, and is also the basic unit of the CPU to perform tasks.
  • Each application contains one or more processes. Therefore, the CPU usage of each application can be obtained according to the CPU usage of the process and the corresponding relationship between the process and the application.
  • a monitoring log file storing the total CPU usage information can be read in the /proc directory.
  • the /proc directory contains multiple subfolders, which store the process log files of CPU usage information corresponding to each process.
  • the file name of the monitoring log file stored in the /proc directory is "stat".
  • the process log file is stored in the subfolder in the /proc directory.
  • the file name of the process log file is "stat”.
  • the stat file in the /proc directory records the total CPU usage information.
  • the stat file in the subfolder under the /proc directory records the CPU usage information of each process.
  • the stat file in the /proc/pid directory records the CPU usage information of the pid process, where pid is the process ID.
  • Step 324 If it is detected that the application is deleted, the service white list corresponding to the application is deleted.
  • the service whitelist corresponds to the application, and when it is detected that the application is deleted, the service whitelist corresponding to the application may be deleted at the same time. It can be understood that the service blacklist also corresponds to the application. When it is detected that the application is deleted, the service blacklist corresponding to the application may also be deleted. When the application is installed again, create a corresponding service whitelist and service blacklist.
  • Step 326 If the calling permission is forbidden, the service identifier corresponding to the target application service is added to the service blacklist.
  • step 328 the target application service is run in the background.
  • the user enters the forbidden call through the terminal, the user is prohibited from running the target application service in the form of the foreground service, and the service identifier corresponding to the target application service is added to the service blacklist, and the target application service is next time.
  • the target application service is prohibited from running in the form of a foreground service, and the target application service is directly operated in the form of a background service.
  • the target application service is The background service runs in the form, and the service identifier corresponding to the target application service is added to the service blacklist.
  • FIG. 5 is a diagram of a terminal interface for modifying a service whitelist in an embodiment.
  • the user can select an application to be modified, and then the terminal selects a service whitelist corresponding to the application for display.
  • the user can select the service identifier to be modified in the service white list, and click the "delete” button to delete the selected service identifier.
  • You can also add a new service ID by clicking the "Add" button.
  • the service scheduling method provided in the above embodiment detects that the target application service of the application starts the foreground service, and obtains the service white list corresponding to the target application, and determines the operation mode of the target application service through the service white list.
  • the malicious application service can be prevented from occupying the front-end service arbitrarily, resulting in system resources being occupied, thereby improving the utilization of system resources.
  • the service scheduling method includes steps 602 to 614. among them:
  • Step 602 detecting that the target application service of the application starts the foreground service.
  • Step 604 it is determined whether the target application service has a call permission, and if so, step 614 is performed; otherwise, step 606 is performed.
  • step 606 it is determined whether the target application service has been rejected. If yes, step 612 is performed; otherwise, step 608 is performed.
  • Step 608 receiving the calling permission input by the user.
  • step 610 it is determined whether the calling permission input by the user is an allowable call. If yes, step 614 is performed; otherwise, step 612 is performed.
  • Step 612 running the target application service in the background.
  • step 614 the foreground application service is run in the foreground.
  • FIG. 7 is a schematic structural diagram of a service invoking device in an embodiment.
  • the service invoking device 700 includes a list obtaining module 702, an identifier matching module 704, and a service running module 706. among them:
  • the list obtaining module 702 is configured to: if the target application service that detects the application in the terminal starts the foreground service, obtain a service white list corresponding to the application, where the service white list includes one or more service identifiers, and each of the service white lists includes one or more service identifiers.
  • the service identifier is used to uniquely identify an application service of the application.
  • the identifier matching module 704 is configured to determine whether the service identifier of the target application service is included in the service white list.
  • the service running module 706 is configured to: if the service whitelist includes the service identifier of the target application service, run the target application service in the foreground.
  • the service scheduling apparatus detects that the target application service of the application program starts the foreground service, and obtains the corresponding service white list, and determines the operation mode of the target application service through the service white list.
  • the malicious application service can be prevented from occupying the front-end service arbitrarily, resulting in system resources being occupied, thereby improving the utilization of system resources.
  • FIG. 8 is a schematic structural diagram of a service invoking device in another embodiment.
  • the service invoking device 800 includes a list obtaining module 802, an identifier matching module 804, a service running module 806, a resource obtaining module 808, and a list deleting module 810. among them:
  • the list obtaining module 802 is configured to: if the target application service that detects the application in the terminal starts the foreground service, obtain a service white list corresponding to the application, and the service white list includes One or more service identifiers, each of which identifies an application service that uniquely identifies the application.
  • the identifier matching module 804 is configured to determine whether the service identifier of the target application service is included in the service white list.
  • the service running module 806 is configured to: if the service whitelist includes the service identifier of the target application service, run the target application service in the foreground.
  • the resource obtaining module 808 is configured to acquire the resource occupancy rate of the terminal, and obtain the service identifier corresponding to the resource occupancy rate in the service whitelist; and run the application service corresponding to the obtained service identifier in the form of a background service.
  • the list deletion module 810 deletes the service white list corresponding to the application if it detects that the application is deleted.
  • the service scheduling apparatus detects that the target application service of the application program starts the foreground service, and obtains the corresponding service white list, and determines the operation mode of the target application service through the service white list.
  • the malicious application service can be prevented from occupying the front-end service arbitrarily, resulting in system resources being occupied, thereby improving the utilization of system resources.
  • the list obtaining module 802 is further configured to: if the target application service of the application is detected in the terminal, start the foreground service, obtain the service level of the target application service; if the service level is less than the preset level, Then, obtain a service white list corresponding to the application.
  • the service running module 806 is further configured to run the target application service in the foreground if the service level is greater than or equal to a preset level.
  • the service running module 806 is further configured to obtain a duration threshold corresponding to the service identifier in the service whitelist; if the duration of the target application service running in the foreground exceeds the duration threshold, the background running Target application service.
  • the service running module 806 is further configured to run the target application service in the background if the service whitelist does not include the service identifier of the target application service.
  • the service execution module 806 receives the call permission input by the terminal, and the call permission is used. The permission to indicate whether to allow the foreground to run the target application service; and to run the target application service according to the calling permission.
  • the service running module 806 is further configured to: if the service whitelist does not include the service identifier of the target application service, match the service identifier with a service blacklist, where the service blacklist is used. And storing, by the service identifier, the service identifier corresponding to the application service running in the foreground; if the service blacklist does not include the service identifier of the target application service, receiving the call permission input by the terminal; Target application service.
  • each module in the above service invoking device is for illustrative purposes only. In other embodiments, the service invoking device may be divided into different modules as needed to complete all or part of the functions of the above service invoking device.
  • the embodiment of the present application also provides a storage medium.
  • One or more non-volatile storage media containing computer-executable instructions that, when executed by one or more processors, cause the processor to perform the following steps:
  • the service white list corresponding to the application is obtained, where the service white list includes one or more service identifiers, and each of the service identifiers is used for An application service that uniquely identifies the application;
  • the foreground application service is run in the foreground.
  • the service white list corresponding to the application includes:
  • the service white list corresponding to the application is obtained.
  • the method performed by the processor further includes:
  • the foreground application service is run in the foreground.
  • the method performed by the processor further includes:
  • the target application service is run in the background.
  • the method performed by the processor further includes:
  • the target application service is run in the background.
  • the method performed by the processor further includes:
  • the service whitelist does not include the service identifier of the target application service, receiving the call permission input by the terminal, where the call permission is used to indicate whether to allow the foreground to run the target application service;
  • the method performed by the processor further includes:
  • the service whitelist does not include the service identifier of the target application service, the service identifier is matched with the service blacklist, and the service blacklist is used to store the service corresponding to the application service that is prohibited from running in the foreground.
  • the running, by the processor, the running the target application service according to the calling permission comprises:
  • the service identifier corresponding to the target application service is added to the service blacklist, and the target application service is run in the background.
  • the method performed by the processor further includes:
  • the application service corresponding to the obtained service identifier is operated in the form of a background service.
  • the method performed by the processor further includes:
  • the service white list corresponding to the application is deleted.
  • FIG. 9 is a schematic diagram showing the internal structure of a server in an embodiment.
  • the server includes a processor, a non-volatile storage medium, an internal memory, and a network interface connected by a system bus.
  • the non-volatile storage medium of the server stores an operating system and a computer program.
  • the computer program is executed by the processor to implement a service scheduling method.
  • the server's processor is used to provide computing and control capabilities that support the operation of the entire server.
  • the network interface of the server is used to communicate with an external terminal through a network connection, such as receiving an installation package acquisition request sent by the terminal, and returning an installation package and a service white list to the terminal.
  • the server can be implemented with a stand-alone server or a server cluster consisting of multiple servers.
  • FIG. 9 is only a block diagram of a part of the structure related to the solution of the present application, and does not constitute a limitation on the server to which the solution of the present application is applied.
  • the specific server may include a ratio. More or fewer components are shown in the figures, or some components are combined, or have different component arrangements.
  • the embodiment of the invention also provides a computer device. As shown in FIG. 10, for the convenience of description, only parts related to the embodiment of the present invention are shown. Without specific details, please refer to the method part of the embodiment of the present invention.
  • the computer device may be any terminal device including a mobile phone, a tablet computer, a PDA (Personal Digital Assistant), a POS (Point of Sales), a vehicle-mounted computer, a wearable device, and the like, taking a computer device as a mobile phone as an example. :
  • FIG. 10 is a block diagram showing a part of a structure of a mobile phone related to a computer device according to an embodiment of the present invention.
  • the mobile phone includes: a radio frequency (RF) circuit 1010, a memory 1020, an input unit 1030, a display unit 1040, a sensor 1050, and an audio circuit 1060.
  • RF radio frequency
  • WiFi wireless fidelity
  • FIG. 10 does not constitute a limitation to the handset, and may include more or less components than those illustrated, or some components may be combined, or different components may be arranged.
  • the RF circuit 1010 can be used for receiving and transmitting signals during the transmission and reception of information or during a call.
  • the downlink information of the base station can be received and processed by the processor 1080.
  • the uplink data can also be sent to the base station.
  • RF circuits include, but are not limited to, an antenna, at least one amplifier, a transceiver, a coupler, a Low Noise Amplifier (LNA), a duplexer, and the like.
  • LNA Low Noise Amplifier
  • RF circuit 1010 can also communicate with the network and other devices via wireless communication.
  • the above wireless communication may use any communication standard or protocol, including but not limited to Global System of Mobile communication (GSM), General Packet Radio Service (GPRS), Code Division Multiple Access (Code Division). Multiple Access (CDMA), Wideband Code Division Multiple Access (WCDMA), Long Term Evolution (LTE), e-mail, Short Messaging Service (SMS), and the like.
  • GSM Global System of Mobile communication
  • GPRS General Pack
  • the memory 1020 can be used to store software programs and modules, and the processor 1080 executes various functional applications and data processing of the mobile phone by running software programs and modules stored in the memory 1020.
  • the memory 1020 may mainly include a program storage area and a data storage area, wherein the program storage area may store an operating system, an application required for at least one function (such as an application of a sound playing function, an application of an image playing function, etc.);
  • the data storage area can store data (such as audio data, address book, etc.) created according to the use of the mobile phone.
  • memory 1020 can include high speed random access memory, and can also include non-volatile memory, such as at least one magnetic disk storage device, flash memory device, or other volatile solid state storage device.
  • the input unit 1030 can be configured to receive input numeric or character information and to generate key signal inputs related to user settings and function control of the handset 1000.
  • the input unit 1030 may include a touch panel 1031 and other input devices 1032.
  • the touch panel 1031 which may also be referred to as a touch screen, can collect touch operations on or near the user (such as a user using a finger or a stylus) And any suitable object or accessory on the touch panel 1031 or in the vicinity of the touch panel 1031), and drive the corresponding connecting device according to a preset program.
  • the touch panel 1031 can include two portions of a touch detection device and a touch controller.
  • the touch detection device detects the touch orientation of the user, and detects a signal brought by the touch operation, and transmits the signal to the touch controller; the touch controller receives the touch information from the touch detection device, converts the touch information into contact coordinates, and sends the touch information.
  • the processor 1080 is provided and can receive commands from the processor 1080 and execute them.
  • the touch panel 1031 can be implemented in various types such as resistive, capacitive, infrared, and surface acoustic waves.
  • the input unit 1030 may also include other input devices 1032.
  • other input devices 1032 may include, but are not limited to, one or more of a physical keyboard, function keys (such as volume control buttons, switch buttons, etc.).
  • the display unit 1040 can be used to display information input by the user or information provided to the user as well as various menus of the mobile phone.
  • the display unit 1040 may include a display panel 1041.
  • the display panel 1041 may be configured in the form of a liquid crystal display (LCD), an organic light-emitting diode (OLED), or the like.
  • the touch panel 1031 can cover the display panel 1041. When the touch panel 1031 detects a touch operation thereon or nearby, the touch panel 1031 transmits to the processor 1080 to determine the type of the touch event, and then the processor 1080 is The type of touch event provides a corresponding visual output on display panel 1041.
  • touch panel 1031 and the display panel 1041 are used as two independent components to implement the input and input functions of the mobile phone in FIG. 10, in some embodiments, the touch panel 1031 may be integrated with the display panel 1041. Realize the input and output functions of the phone.
  • the handset 1000 can also include at least one type of sensor 1050, such as a light sensor, motion sensor, and other sensors.
  • the light sensor may include an ambient light sensor and a proximity sensor, wherein the ambient light sensor may adjust the brightness of the display panel 1041 according to the brightness of the ambient light, and the proximity sensor may close the display panel 1041 and/or when the mobile phone moves to the ear. Or backlight.
  • the motion sensor may include an acceleration sensor, and the acceleration sensor can detect the magnitude of the acceleration in each direction, and the magnitude and direction of the gravity can be detected at rest, and can be used to identify the gesture of the mobile phone (such as horizontal and vertical screen switching), and vibration recognition related functions (such as Pedometer, tapping, etc.;
  • the mobile phone can also be equipped with other sensors such as gyroscopes, barometers, hygrometers, thermometers, and infrared sensors.
  • Audio circuitry 1060, speaker 1061, and microphone 1062 can provide an audio interface between the user and the handset.
  • the audio circuit 1060 can transmit the converted electrical data of the received audio data to the speaker 1061, and convert it into a sound signal output by the speaker 1061; on the other hand, the microphone 1062 converts the collected sound signal into an electrical signal, by the audio circuit 1060. After receiving, it is converted into audio data, and then processed by the audio data output processor 1080, transmitted to another mobile phone via the RF circuit 1010, or outputted to the memory 1020 for subsequent processing.
  • WiFi is a short-range wireless transmission technology.
  • the mobile phone through the WiFi module 1070 can help users to send and receive e-mail, browse the web and access streaming media, etc. It provides users with wireless broadband Internet access.
  • FIG. 10 shows the WiFi module 1070, it can be understood that it does not belong to the essential configuration of the mobile phone 1000 and can be omitted as needed.
  • the processor 1080 is the control center of the handset, which connects various portions of the entire handset using various interfaces and lines, by executing or executing software programs and/or modules stored in the memory 1020, and invoking data stored in the memory 1020, The phone's various functions and processing data, so that the overall monitoring of the phone.
  • processor 1080 can include one or more processing units.
  • the processor 1080 can integrate an application processor and a modem processor, wherein the application processor primarily processes an operating system, a user interface, an application, and the like; the modem processor primarily processes wireless communications. It will be appreciated that the above described modem processor may also not be integrated into the processor 1080.
  • the mobile phone 1000 also includes a power source 1090 (such as a battery) for powering various components.
  • a power source 1090 such as a battery
  • the power source can be logically coupled to the processor 1080 through a power management system to manage functions such as charging, discharging, and power management through the power management system.
  • the handset 1000 may also include a camera, a Bluetooth module, and the like.
  • the processor 1080 included in the mobile terminal implements the service scheduling method provided by the foregoing embodiment when executing the computer program stored in the memory.
  • a computer program product comprising instructions that, when run on a computer, cause the computer
  • the service scheduling method provided by the foregoing embodiment is performed.
  • the storage medium may be a magnetic disk, an optical disk, a read-only memory (ROM), or the like.
  • Non-volatile memory can include read only memory (ROM), programmable ROM (PROM), electrically programmable ROM (EPROM), electrically erasable programmable ROM (EEPROM), or flash memory.
  • Volatile memory can include random access memory (RAM), which acts as an external cache.
  • RAM is available in a variety of forms, such as static RAM (SRAM), dynamic RAM (DRAM), synchronous DRAM (SDRAM), dual data rate SDRAM (DDR SDRAM), enhanced SDRAM (ESDRAM), synchronization.
  • SRAM static RAM
  • DRAM dynamic RAM
  • SDRAM synchronous DRAM
  • DDR SDRAM dual data rate SDRAM
  • ESDRAM enhanced SDRAM
  • synchronization Link (Synchlink) DRAM (SLDRAM), Memory Bus (Rambus) Direct RAM (RDRAM), Direct Memory Bus Dynamic RAM (DRDRAM), and Memory Bus Dynamic RAM (RDRAM).

Abstract

A service scheduling method comprises: if it is detected in a terminal that a target application service of an application program starts a foreground service, obtaining a service whitelist corresponding to the application program, the service whitelist comprising one or more service identifiers, and each service identifier being used for uniquely indentifying an application service of the application program; determining whether the service whitelist comprises a service identifier of the target application service; and if the service whitelist comprises the service identifier of the target application service, running the application service on the foreground.

Description

服务调度方法和装置、计算机设备、计算机可读存储介质Service scheduling method and device, computer device, computer readable storage medium 技术领域Technical field
本申请涉及计算机技术领域,特别是涉及服务调度方法和装置、计算机设备、计算机可读存储介质。The present application relates to the field of computer technology, and in particular, to a service scheduling method and apparatus, a computer device, and a computer readable storage medium.
背景技术Background technique
在智能终端中,存在一种没有界面的服务,一般分为前台服务和后台服务等两种类型。前台服务在运行的时候,具有较高的优先级,在终端系统内存不足和CPU(Central Processing Unit,中央处理器)占用率过高时,不会被终端主动关闭。后台服务的优先级较低,在终端系统内存不足和CPU占用率过高时,可能会被终端关闭以回收资源。开发者如果不遵循前台服务的规则,就会导致终端系统中很多无用的应用服务以前台服务的形式运行,从而导致终端资源被占用。In a smart terminal, there is a service without an interface, which is generally divided into two types: a foreground service and a background service. When the front-end service is running, it has a higher priority. When the terminal system has insufficient memory and the CPU (Central Processing Unit) occupancy rate is too high, it will not be actively shut down by the terminal. The background service has a lower priority. When the terminal system runs out of memory and the CPU usage is too high, it may be shut down by the terminal to recover resources. If the developer does not follow the rules of the foreground service, many useless application services in the terminal system will run in the form of foreground services, resulting in the terminal resources being occupied.
发明内容Summary of the invention
本申请实施例提供一种服务调度方法和装置、计算机设备、计算机可读存储介质,可以减少资源占用。The embodiment of the present application provides a service scheduling method and apparatus, a computer device, and a computer readable storage medium, which can reduce resource occupation.
一种服务调度方法,所述方法包括:A service scheduling method, the method comprising:
若在终端中检测到应用程序的目标应用服务启动前台服务,则获取所述应用程序对应的服务白名单,所述服务白名单中包括一个或多个服务标识,每个所述服务标识用于唯一标示所述应用程序的一个应用服务;If the target application service of the application is detected in the terminal, the service white list corresponding to the application is obtained, where the service white list includes one or more service identifiers, and each of the service identifiers is used for An application service that uniquely identifies the application;
判断所述服务白名单中,是否包括所述目标应用服务的服务标识;Determining whether the service identifier of the target application service is included in the service white list;
若所述服务白名单中包括所述目标应用服务的服务标识,则前台运行所述目标应用服务。If the service whitelist includes the service identifier of the target application service, the foreground application service is run in the foreground.
一种服务调度装置,所述装置包括: A service scheduling device, the device comprising:
名单获取模块,用于若在终端中检测到应用程序的目标应用服务启动前台服务,则获取所述应用程序对应的服务白名单,所述服务白名单中包括一个或多个服务标识,每个所述服务标识用于唯一标示所述应用程序的一个应用服务;a list obtaining module, configured to: if a target application service that detects an application in the terminal starts a foreground service, obtain a service white list corresponding to the application, where the service white list includes one or more service identifiers, each of which includes one or more service identifiers, each The service identifier is used to uniquely identify an application service of the application;
标识匹配模块,用于判断所述服务白名单中,是否包括所述目标应用服务的服务标识;An identifier matching module, configured to determine whether the service identifier of the target application service is included in the service whitelist;
服务运行模块,用于若所述服务白名单中包括所述目标应用服务的服务标识,则前台运行所述目标应用服务。The service running module is configured to: if the service whitelist includes the service identifier of the target application service, run the target application service in the foreground.
一种计算机设备,包括存储器及处理器,所述存储器中储存有计算机可读指令,所述指令被所述处理器执行时,使得所述处理器执行如下步骤:A computer device comprising a memory and a processor, wherein the memory stores computer readable instructions, and when the instructions are executed by the processor, the processor performs the following steps:
若在终端中检测到应用程序的目标应用服务启动前台服务,则获取所述应用程序对应的服务白名单,所述服务白名单中包括一个或多个服务标识,每个所述服务标识用于唯一标示所述应用程序的一个应用服务;If the target application service of the application is detected in the terminal, the service white list corresponding to the application is obtained, where the service white list includes one or more service identifiers, and each of the service identifiers is used for An application service that uniquely identifies the application;
判断所述服务白名单中,是否包括所述目标应用服务的服务标识;Determining whether the service identifier of the target application service is included in the service white list;
若所述服务白名单中包括所述目标应用服务的服务标识,则前台运行所述目标应用服务。If the service whitelist includes the service identifier of the target application service, the foreground application service is run in the foreground.
一个或多个包含计算机可执行指令的非易失性计算机可读存储介质,当所述计算机可执行指令被一个或多个处理器执行时,使得所述处理器执行如下步骤:One or more non-transitory computer readable storage media containing computer executable instructions that, when executed by one or more processors, cause the processor to perform the following steps:
若在终端中检测到应用程序的目标应用服务启动前台服务,则获取所述应用程序对应的服务白名单,所述服务白名单中包括一个或多个服务标识,每个所述服务标识用于唯一标示所述应用程序的一个应用服务;If the target application service of the application is detected in the terminal, the service white list corresponding to the application is obtained, where the service white list includes one or more service identifiers, and each of the service identifiers is used for An application service that uniquely identifies the application;
判断所述服务白名单中,是否包括所述目标应用服务的服务标识;Determining whether the service identifier of the target application service is included in the service white list;
若所述服务白名单中包括所述目标应用服务的服务标识,则前台运行所述目标应用服务。If the service whitelist includes the service identifier of the target application service, the foreground application service is run in the foreground.
附图说明 DRAWINGS
为了更清楚地说明本申请实施例或现有技术中的技术方案,下面将对实施例或现有技术描述中所需要使用的附图作简单地介绍,显而易见地,下面描述中的附图仅仅是本申请的一些实施例,对于本领域普通技术人员来讲,在不付出创造性劳动的前提下,还可以根据这些附图获得其他的附图;In order to more clearly illustrate the embodiments of the present application or the technical solutions in the prior art, the drawings to be used in the embodiments or the prior art description will be briefly described below. Obviously, the drawings in the following description are only It is a certain embodiment of the present application, and other drawings can be obtained according to the drawings without any creative work for those skilled in the art;
图1为一个实施例中服务调度方法的应用环境图;1 is an application environment diagram of a service scheduling method in an embodiment;
图2为一个实施例中服务调度方法的流程图;2 is a flow chart of a service scheduling method in an embodiment;
图3为另一个实施例中服务调度方法的流程图;3 is a flow chart of a service scheduling method in another embodiment;
图4为一个实施例中调用权限的输入界面图;4 is an input interface diagram of calling rights in an embodiment;
图5为一个实施例中修改服务白名单的终端界面图;FIG. 5 is a diagram of a terminal interface for modifying a service white list in an embodiment; FIG.
图6为又一个实施例中服务调度方法的流程图;6 is a flow chart of a service scheduling method in still another embodiment;
图7为一个实施例中服务调用装置的结构示意图;7 is a schematic structural diagram of a service invoking device in an embodiment;
图8为另一个实施例中服务调用装置的结构示意图;8 is a schematic structural diagram of a service invoking device in another embodiment;
图9为一个实施例中服务器的内部结构示意图;9 is a schematic diagram showing the internal structure of a server in an embodiment;
图10为与本发明实施例提供的计算机设备相关的手机的部分结构的框图。FIG. 10 is a block diagram showing a part of a structure of a mobile phone related to a computer device according to an embodiment of the present invention.
具体实施方式Detailed ways
为了使本申请的目的、技术方案及优点更加清楚明白,以下结合附图及实施例,对本申请进行进一步详细说明。应当理解,此处所描述的具体实施例仅仅用以解释本申请,并不用于限定本申请。In order to make the objects, technical solutions, and advantages of the present application more comprehensible, the present application will be further described in detail below with reference to the accompanying drawings and embodiments. It is understood that the specific embodiments described herein are merely illustrative of the application and are not intended to be limiting.
图1为一个实施例中服务调度方法的应用环境图。如图1所示,该应用环境中包括用户终端102和服务器104。服务器104可以向用户终端发送应用程序的安装包,用户终端102可以通过安装包来安装应用程序,并通过应用程序与服务器104进行应用交互,传输应用数据。在用户终端102运行应用程序的过程中,若在终端中检测到应用程序的目标应用服务启动前台服务,则获取所述应用程序对应的服务白名单,所述服务白名单中包括一个或多个服务标识,每个所述服务标识用于唯一标示所述应用程序的一个应用服务; 判断所述服务白名单中,是否包括所述目标应用服务的服务标识;若所述服务白名单中包括所述目标应用服务的服务标识,则前台运行所述目标应用服务。其中,用户终端102为处于计算机网络最外围,主要用于输入用户信息以及输出处理结果的电子设备,例如可以是个人电脑、移动终端、个人数字助理、可穿戴电子设备等。服务器104是用于响应服务请求,同时提供计算服务的设备,例如可以是一台或者多台计算机。可以理解的是,在本申请提供的其他实施例中,服务调度方法的应用环境中可以只包括用户终端102。FIG. 1 is an application environment diagram of a service scheduling method in an embodiment. As shown in FIG. 1, the application environment includes a user terminal 102 and a server 104. The server 104 can send an installation package of the application to the user terminal, and the user terminal 102 can install the application through the installation package, and perform application interaction with the server 104 through the application to transmit the application data. In the process of running the application by the user terminal 102, if the target application service of the application is detected in the terminal, the service whitelist corresponding to the application is obtained, and the service white list includes one or more a service identifier, each of the service identifiers being used to uniquely identify an application service of the application; Determining whether the service whitelist includes the service identifier of the target application service; if the service whitelist includes the service identifier of the target application service, the foreground application service is run in the foreground. The user terminal 102 is an electronic device that is mainly used for inputting user information and outputting processing results at the outermost periphery of the computer network, and may be, for example, a personal computer, a mobile terminal, a personal digital assistant, a wearable electronic device, or the like. The server 104 is a device for providing a computing service in response to a service request, and may be, for example, one or more computers. It can be understood that, in other embodiments provided by the present application, the application environment of the service scheduling method may include only the user terminal 102.
图2为一个实施例中服务调度方法的流程图。如图2所示,该服务调度方法包括步骤202至步骤206。其中:2 is a flow chart of a service scheduling method in an embodiment. As shown in FIG. 2, the service scheduling method includes steps 202 to 206. among them:
步骤202,若在终端中检测到应用程序的目标应用服务启动前台服务,则获取应用程序对应的服务白名单,服务白名单中包括一个或多个服务标识,每个服务标识用于唯一标示应用程序的一个应用服务。Step 202: If it is detected in the terminal that the target application service of the application starts the foreground service, the service white list corresponding to the application is obtained, and the service white list includes one or more service identifiers, and each service identifier is used to uniquely identify the application. An application service for the program.
应用程序是指电子设备中针对某种应用目的所撰写的软体,电子设备通过应用程序实现对用户的需求服务。终端中可以安装一个或多个应用程序,用户通过对应用程序的操作来实现应用目的,例如用户可以操作购物APP(Application,应用程序)来购买商品,也可以通过音乐APP来收听音乐,还可以通过游戏APP来打游戏等。应用程序在终端运行的时候,都是通过应用服务(service)来完成应用操作的,一个应用程序可以同时启用一个或多个应用服务,例如一个应用程序中可以包括数据更新服务、音乐播放服务、数据传输服务等多个服务。通常情况下,应用服务可以分为前台服务和后台服务,前台服务是指在终端前台运行的服务,后台服务是指在终端后台运行的服务。前台服务具有较高的优先级,在终端运行过程中不会被主动关闭;后台服务的优先级较低,一般在终端资源不足的情况下,可能会被系统关闭。An application is a software written for an application purpose in an electronic device, and the electronic device implements a service demanded by the user through an application. One or more applications can be installed in the terminal, and the user can achieve the application purpose by operating the application, for example, the user can operate the shopping APP (Application) to purchase the product, and can also listen to the music through the music APP, and can also Play games and more through the game app. When the application is running, the application is completed by an application service. An application can simultaneously enable one or more application services, for example, an application may include a data update service, a music playback service, Multiple services such as data transfer services. Generally, application services can be divided into foreground services and background services. Front-end services refer to services running in the foreground of the terminal. Background services refer to services running in the background of the terminal. The front-end service has a higher priority and will not be actively shut down during the running of the terminal; the background service has a lower priority, and may be shut down by the system when the terminal resources are insufficient.
在一个实施例中,终端中存储着服务白名单,该服务白名单与应用程序一一对应,服务白名单用于存储允许以前台服务形式运行的应用服务所对应的服务标识。可以理解的是,服务白名单中可以包括一个或多个服务标识,每个服务标识用于唯一标示应用程序的一个应用服务。服务白名单可以存储 在终端的数据库中,也可以存储在文件中。根据应用程序标识可以获取对应的服务白名单,然后再获取服务白名单中的服务标识。应用程序标识是指区分不同应用程序的唯一标识,应用程序标识可以但不限于是应用程序的包名,例如在Android系统中,应用程序的包名可以是com.qin.appinfo。服务标识是应用服务的唯一标识,可以但不限于是应用服务的类名。In an embodiment, the service whitelist is stored in the terminal, and the service whitelist is in one-to-one correspondence with the application, and the service whitelist is used to store the service identifier corresponding to the application service that is allowed to run in the foreground service mode. It can be understood that the service whitelist can include one or more service identifiers, and each service identifier is used to uniquely identify an application service of the application. Service whitelist can be stored It can also be stored in a file in the terminal's database. According to the application identifier, the corresponding service whitelist can be obtained, and then the service identifier in the service whitelist is obtained. The application identifier refers to a unique identifier that distinguishes different applications. The application identifier can be, but is not limited to, the application package name. For example, in the Android system, the application package name can be com.qin.appinfo. The service identifier is a unique identifier of the application service, and may be, but is not limited to, the class name of the application service.
步骤204,判断服务白名单中,是否包括目标应用服务的服务标识。Step 204: Determine whether the service identifier of the target application service is included in the service white list.
在一个实施例中,服务白名单可以通过终端的界面进行显示,用户可以通过终端界面查看服务白名单,并可以根据需要对服务白名单中的服务标识进行修改、添加、删除等操作。具体地,接收用户输入的用于修改服务白名单的操作指令,根据用户输入的操作指令对该服务白名单进行修改。例如,用户可以首先通过终端界面选择需要操作的应用程序,终端将应用程序对应的服务白名单和所有的应用服务的服务标识进行显示,然后用户可以通过终端界面对服务白名单进行编辑。可以理解的是,该服务白名单可以通过服务器推送给终端。具体地,服务器在向终端发送应用程序的安装包时,同时向终端发送对应的服务白名单。服务器向终端发送的服务白名单中可以存储优先级较高的应用服务的服务标识,对于服务白名单中这些优先级较高的应用服务,用户不可以进行随意地更改。In one embodiment, the service whitelist can be displayed through the interface of the terminal, and the user can view the service whitelist through the terminal interface, and can modify, add, delete, etc. the service identifier in the service whitelist as needed. Specifically, an operation instruction input by the user for modifying the service white list is received, and the service white list is modified according to an operation instruction input by the user. For example, the user may first select an application to be operated through the terminal interface, and the terminal displays the service white list corresponding to the application and the service identifier of all the application services, and then the user can edit the service white list through the terminal interface. It can be understood that the service white list can be pushed to the terminal through the server. Specifically, when the server sends the installation package of the application to the terminal, the server simultaneously sends a corresponding service white list to the terminal. The service whitelist of the service service with a higher priority can be stored in the service whitelist sent by the server to the terminal. The user service of the higher priority application service in the service whitelist cannot be arbitrarily changed.
当检测到目标应用服务启动前台服务时,获取该目标应用服务的服务标识。例如,在Android系统中,ActivityManager.RunningServiceInfo类中封装了所有应用服务的信息,可以通过调用该ActivityManager.RunningServiceInfo类来获取应用服务的服务标识。获取到该目标应用服务的服务标识之后,遍历服务白名单中的服务标识,并将该目标应用服务对应的服务标识与服务白名单中的服务标识一一进行对比,判断服务白名单中是否包含目标应用服务对应的服务标识。When it is detected that the target application service starts the foreground service, the service identifier of the target application service is obtained. For example, in the Android system, the ActivityManager.RunningServiceInfo class encapsulates all the application service information, and can obtain the service identifier of the application service by calling the ActivityManager.RunningServiceInfo class. After the service identifier of the target application service is obtained, the service identifier in the service whitelist is traversed, and the service identifier corresponding to the target application service is compared with the service identifier in the service whitelist to determine whether the service whitelist is included. The service identifier corresponding to the target application service.
步骤206,若服务白名单中包括目标应用服务的服务标识,则前台运行目标应用服务。Step 206: If the service whitelist includes the service identifier of the target application service, the foreground application service is run in the foreground.
在将目标应用服务的服务标识与服务白名单中的服务标识进行比较之 后,可以查找匹配项。具体地,如果存在匹配项,说明服务白名单中包括目标应用服务的服务标识,则前台运行目标应用服务。前台运行目标应用服务是指将应用服务以前台服务的形式进行运行。如果不存在匹配项,说明服务白名单中不包括目标应用服务的服务标识,则后台运行该目标应用服务,也可以不运行该目标应用服务。一般地,若将应用服务以前台服务的形式进行运行,则应用服务可以在终端的通知栏进行显示,用户可以通过通知栏查看以前台服务运行的应用服务。当应用服务终止的时候,通知栏中显示的该应用服务的相关信息也会消失。若应用服务以后台服务的形式运行,则该应用服务不会在通知栏中显示。Comparing the service identifier of the target application service with the service identifier in the service whitelist After that, you can find a match. Specifically, if there is a matching item, indicating that the service whitelist includes the service identifier of the target application service, the foreground application running the target application service. Running the target application service in the foreground means that the application service runs in the form of a foreground service. If there is no match, it indicates that the service whitelist of the target application service is not included in the service whitelist, and the target application service may be run in the background, or the target application service may not be run. Generally, if the application service is run in the form of a foreground service, the application service can be displayed in the notification bar of the terminal, and the user can view the application service running in the foreground service through the notification bar. When the application service is terminated, the information about the application service displayed in the notification bar will also disappear. If the app service runs as a background service, the app service will not be displayed in the notification bar.
上述实施例提供的服务调度方法,在终端中检测到应用程序的目标应用服务在启动前台服务,则获取应用程序对应的服务白名单,通过服务白名单来判断该目标应用服务的运行方式。可以防止恶意应用服务随意地占用前台服务,导致系统资源被占用,从而提高了系统资源的利用率。The service scheduling method provided in the above embodiment detects that the target application service of the application starts the foreground service, and obtains the service white list corresponding to the application, and determines the operation mode of the target application service through the service white list. The malicious application service can be prevented from occupying the front-end service arbitrarily, resulting in system resources being occupied, thereby improving the utilization of system resources.
图3为另一个实施例中服务调度方法的流程图。如图3所示,该服务调度方法包括步骤302至步骤324。其中:3 is a flow chart of a service scheduling method in another embodiment. As shown in FIG. 3, the service scheduling method includes steps 302 to 324. among them:
步骤302,若在终端中检测到应用程序的目标应用服务启动前台服务,则获取目标应用服务的服务等级。Step 302: If it is detected in the terminal that the target application service of the application starts the foreground service, the service level of the target application service is obtained.
在一个实施例中,在检测到目标应用服务在启动前台服务的时候,可以首先获取目标应用服务的服务等级,根据目标应用服务的服务等级来判断是否以前台服务的形式进行运行。一般可以对应用服务进行优先级的划分,服务等级就是指应用服务的优先级。应用服务可以根据不同的标准进行分类,可以划分为多个等级,在本实施例中不做限定。例如,根据操作范围将应用服务进行分类,可分为本地服务(Local Service)和远程服务(Remote Sercie),可以定义本地操作的应用服务的等级高于远程操作的应用服务。还可以根据应用服务的重要性进行分类,划分为等级1、等级2、等级3等三个等级。In an embodiment, when detecting that the target application service starts the foreground service, the service level of the target application service may be first obtained, and whether the service is performed in the form of the foreground service according to the service level of the target application service. Generally, the application service can be prioritized, and the service level refers to the priority of the application service. The application service can be classified according to different standards, and can be divided into multiple levels, which is not limited in this embodiment. For example, the application services are classified according to the operating range, and can be classified into a local service (Local Service) and a remote service (Remote Sercie), and the level of the application service of the local operation can be defined to be higher than that of the remotely operated application service. It can also be classified according to the importance of the application service, and is divided into three levels: level 1, level 2, level 3, and the like.
步骤304,判断服务等级是否小于预设等级,若是则执行步骤306;若否, 则执行步骤318。Step 304: Determine whether the service level is less than a preset level, and if yes, perform step 306; if not, Then step 318 is performed.
判断目标应用服务的服务等级是否小于预设等级,若大于或等于预设等级,则直接将该目标应用服务以前台服务的形式运行;若小于预设等级,则获取应用程序对应的服务白名单,并根据该目标应用服务的服务标识与服务白名单的匹配结果进行运行。Determining whether the service level of the target application service is less than a preset level. If the level is greater than or equal to the preset level, the target application service is directly operated in the form of a foreground service; if less than the preset level, the service white list corresponding to the application is obtained. And running according to the matching result of the service identifier of the target application service and the service whitelist.
步骤306,获取应用程序对应的服务白名单,服务白名单中包括一个或多个服务标识,每个服务标识用于唯一标示应用程序的一个应用服务。Step 306: Obtain a service white list corresponding to the application, where the service white list includes one or more service identifiers, and each service identifier is used to uniquely identify an application service of the application.
在本申请提供的实施例中,服务白名单可以以文件的形式进行存储,每个应用程序对应一个服务白名单文件。服务白名单文件可以存储在终端的内存中,根据应用程序的包名获取对应的服务白名单文件。当用户需要查看服务白名单时,终端获取用户输入的应用程序名称,根据所述应用程序名称查找对应的应用程序包名,然后根据应用程序包名在内存中查找对应的服务白名单文件。然后终端读取服务白名单文件中的服务标识,并将读取的服务标识在终端界面中进行显示。用户还可以通过终端界面对服务白名单中的服务标识进行添加、删除等操作。In the embodiment provided by the present application, the service whitelist may be stored in the form of a file, and each application corresponds to a service whitelist file. The service whitelist file can be stored in the memory of the terminal, and the corresponding service whitelist file is obtained according to the package name of the application. When the user needs to view the service whitelist, the terminal obtains the application name input by the user, searches for the corresponding application package name according to the application name, and then searches for a corresponding service whitelist file in the memory according to the application package name. The terminal then reads the service identifier in the service whitelist file and displays the read service identifier in the terminal interface. You can also add or delete service IDs in the service whitelist through the terminal interface.
步骤308,获取目标应用服务的服务标识,并将目标应用服务的服务标识与服务白名单中的服务标识进行匹配。Step 308: Obtain a service identifier of the target application service, and match the service identifier of the target application service with the service identifier in the service whitelist.
获取目标应用服务对应的服务标识,并查找服务白名单中的服务标识,将目标应用服务的服务标识与服务白名单中的服务标识进行匹配,确定是否存在匹配项。例如,服务白名单中存储的服务标识包括服务1、服务2、服务3、服务4、服务5、服务6,若获取的应用服务的服务标识为服务4,则说明该应用服务的服务标识在服务白名单中存在。The service identifier corresponding to the target application service is obtained, and the service identifier in the service whitelist is searched, and the service identifier of the target application service is matched with the service identifier in the service whitelist to determine whether there is a matching item. For example, the service identifier stored in the service whitelist includes service 1, service 2, service 3, service 4, service 5, and service 6. If the service identifier of the obtained application service is service 4, the service identifier of the application service is The service whitelist exists.
步骤310,判断服务白名单中是否包括目标应用服务的服务标识,若是则执行步骤318;若否,则执行步骤312。Step 310: Determine whether the service identifier of the target application service is included in the service whitelist, and if yes, execute step 318; if no, execute step 312.
将目标应用服务的服务标识与服务白名单中的服务标识进行匹配,若该目标应用服务所对应的服务标识在服务白名单中存在,则将应用服务以前台服务的形式进行运行;若该应用服务所对应的服务标识在服务白名单中不存 在,则将服务标识与服务黑名单进行匹配。Matching the service identifier of the target application service with the service identifier in the service whitelist. If the service identifier corresponding to the target application service exists in the service whitelist, the application service is run in the form of a foreground service; The service ID corresponding to the service does not exist in the service whitelist. At the same time, the service identifier is matched with the service blacklist.
步骤312,判断服务黑名单中是否包括目标应用服务的服务标识,若是则执行步骤328;若否,则执行步骤314。Step 312: Determine whether the service identifier of the target application service is included in the service blacklist. If yes, go to step 328; if no, go to step 314.
在一个实施例中,终端中可以同时存储服务白名单和服务黑名单,通过服务白名单和服务黑名单共同实现对应用服务的管理。其中,服务黑名单用于存储禁止以前台服务形式运行的应用服务所对应的服务标识。例如,一些内存消耗较大的应用服务可以设置为禁止以前台服务形式运行,将该应用服务的服务标识添加到服务黑名单中,当该应用服务运行时直接以后台服务的形式进行运行,或者不运行。服务黑名单中的服务标识可以通过系统进行设置,用户也可以进行自定义设置。In an embodiment, the service whitelist and the service blacklist may be simultaneously stored in the terminal, and the application service management is implemented through the service whitelist and the service blacklist. The service blacklist is used to store a service identifier corresponding to an application service that is prohibited from running in the form of a foreground service. For example, some application services with large memory consumption may be set to be prohibited from running in the form of a foreground service, the service identifier of the application service is added to the service blacklist, and the application service runs directly as a background service, or Not running. The service ID in the service blacklist can be set through the system, and the user can also customize the settings.
将目标应用服务的服务标识与服务黑名单中的服务标识进行匹配,若该目标应用服务的服务标识在服务黑名单中存在,则直接将该目标应用服务以后台服务的形式进行运行;若该目标应用服务的服务标识在服务黑名单中不存在,则说明该目标应用服务的服务标识在服务白名单和服务黑名单中都不存在,则可以通过用户来对该目标应用服务的运行权限进行设置。Matching the service identifier of the target application service with the service identifier in the service blacklist. If the service identifier of the target application service exists in the service blacklist, the target application service is directly executed in the form of a background service; If the service identifier of the target application service does not exist in the service blacklist, it indicates that the service identifier of the target application service does not exist in the service whitelist and the service blacklist, and the running permission of the target application service may be performed by the user. Settings.
步骤314,接收终端输入的调用权限。 Step 314, receiving the calling permission input by the terminal.
具体地,用户可以通过终端输入该目标应用服务的调用权限,调用权限用于表示是否允许目标应用服务以前台服务的形式运行的权限。若用户通过终端输入的为允许调用,则将该目标应用服务以前台服务的形式运行;若用户通过终端输入的为禁止调用,则将该目标应用服务以后台服务的形式运行。图4为一个实施例中调用权限的输入界面图。如图4所示,当终端检测到目标应用服务启动前台服务时,终端界面以弹窗的形式提示用户输入调用权限,用户根据该弹窗界面选择是否允许该目标应用服务以前台服务的形式进行运行,若用户选择“是”,则将该目标应用服务以前台服务的形式进行运行,并将该目标应用服务对应的服务标识添加到服务白名单中。若用户选择“否”,则将该目标应用服务以后台服务的形式进行运行,并将该目标应用服务对应的服务标识添加到服务黑名单中。 Specifically, the user may input the calling permission of the target application service through the terminal, and invoke the right to indicate whether the target application service is allowed to run in the form of the foreground service. If the user inputs an allowable call through the terminal, the target application service is run in the form of a foreground service; if the user inputs a forbidden call through the terminal, the target application service is run in the form of a background service. Figure 4 is a diagram of an input interface for invoking permissions in one embodiment. As shown in FIG. 4, when the terminal detects that the target application service starts the foreground service, the terminal interface prompts the user to input the calling permission in the form of a popup window, and the user selects whether to allow the target application service to be in the form of the foreground service according to the popup interface. If the user selects "Yes", the target application service is run in the form of a foreground service, and the service identifier corresponding to the target application service is added to the service white list. If the user selects "No", the target application service is run in the form of a background service, and the service identifier corresponding to the target application service is added to the service blacklist.
步骤316,若调用权限为允许调用,则将目标应用服务对应的服务标识添加到服务白名单中。Step 316: If the calling permission is allowed to be invoked, the service identifier corresponding to the target application service is added to the service whitelist.
步骤318,前台运行目标应用服务。In step 318, the foreground application service is run in the foreground.
若用户通过终端输入的为允许调用,则说明用户允许该目标应用服务以前台服务的形式进行运行,则将该目标应用服务对应的服务标识添加到服务白名单中,等到下次该目标应用服务再启用前台服务时,可以直接将该目标应用服务以前台服务的形式进行运行。具体地,若终端输入的调用权限为允许调用,则将该目标应用服务以前台服务的形式运行,并将目标应用服务对应的服务标识添加到服务白名单中。If the user enters the permission input by the terminal, the user is allowed to run the target application service in the form of the foreground service, and the service identifier corresponding to the target application service is added to the service white list, and the next time the target application service is served. When the foreground service is enabled, the target application service can be directly run as a foreground service. Specifically, if the calling permission input by the terminal is an allowable call, the target application service is run in the form of a foreground service, and the service identifier corresponding to the target application service is added to the service white list.
步骤320,若目标应用服务在前台运行的时长超过时长阈值,则后台运行目标应用服务。Step 320: If the duration of the target application service running in the foreground exceeds the duration threshold, the target application service is run in the background.
在一个实施例中,服务白名单中还可以存储时长阈值,时长阈值是指允许应用服务以前台服务形式运行的时间长度。服务白名单中服务标识与时长阈值为一一对应的关系,根据服务标识可以获取对应的时长阈值。具体地,从目标应用服务以前台形式运行的时刻开始计时,实时获取到当前时刻的运行时长,若运行时长超过时长阈值,则将该目标应用服务转为后台服务的形式进行运行。例如,应用服务1对应的时长阈值为30分钟,应用服务1从12:00开始以前台服务的形式运行,当时间到达12:30时,将应用服务1转为后台服务的形式运行。In an embodiment, a duration threshold may also be stored in the service whitelist, and the duration threshold refers to a length of time that the application service is allowed to run in the form of a foreground service. The relationship between the service identifier and the duration threshold in the service whitelist is one-to-one. The corresponding duration threshold can be obtained according to the service identifier. Specifically, the time is started from the time when the target application service runs in the foreground mode, and the running time of the current time is obtained in real time. If the running time exceeds the duration threshold, the target application service is converted into the background service to run. For example, the application service 1 corresponds to a duration of 30 minutes, and the application service 1 runs as a foreground service from 12:00. When the time reaches 12:30, the application service 1 is turned into a background service.
步骤322,获取终端的资源占用率,并获取服务白名单中资源占用率对应的服务标识,将获取的服务标识对应的应用服务以后台服务的形式进行运行。Step 322: Obtain a resource occupancy rate of the terminal, and obtain a service identifier corresponding to the resource occupancy rate in the service whitelist, and run the application service corresponding to the obtained service identifier in the form of a background service.
在一个实施例中,资源占用率是指终端资源被占用的比例,具体可以包括内存占用率、CPU占用率等,在此不做限定。其中,CPU是指电子设备中提供运算和控制功能的结构,可以是一块大规模的集成电路,主要用于解释计算机指令和处理计算机软件中的数据。电子设备在运行计算机软件,需要通过CPU处理应用事件,CPU资源就被应用事件所占用。CPU占用率可以 是指被占用的CPU资源与全部的CPU资源的比率,也可以是指CPU执行任务的时间与总工作时间的比率。一般地,CPU占用率可以但不限于是用百分比的形式来体现,以具体的百分比数值来表示具体被占用的CPU资源多少或CPU资源被占用的时间长短。例如,CPU占用率为50%,则表示有50%的CPU资源被占用,也可以表示在总的工作时间中,有50%的时间CPU资源是被占用的。In one embodiment, the resource usage ratio refers to the proportion of the terminal resources that are occupied, and may include a memory usage ratio, a CPU usage, and the like, which are not limited herein. The CPU refers to a structure that provides arithmetic and control functions in an electronic device, and can be a large-scale integrated circuit mainly used to interpret computer instructions and process data in computer software. The electronic device is running computer software, and the application event needs to be processed by the CPU, and the CPU resource is occupied by the application event. CPU usage can It refers to the ratio of occupied CPU resources to all CPU resources. It can also refer to the ratio of the time that the CPU performs tasks to the total working time. Generally, the CPU usage may be, but is not limited to, expressed in the form of a percentage, and the specific percentage value indicates how much CPU resources are occupied or CPU resources are occupied. For example, if the CPU usage is 50%, it means that 50% of the CPU resources are occupied. It can also be said that in the total working time, 50% of the time CPU resources are occupied.
可以将资源占用率与服务标识建立对应关系,也可以将资源占用率与服务等级建立对应关系,从而获取对应的服务标识。根据资源占用率获取对应的服务标识,并将获取的服务标识对应的应用服务以后台服务的形式进行运行。例如,服务等级分为等级1、等级2和等级3,当内存占用率大于50%时,将等级3对应的应用服务以后台服务的形式运行;当内存占用率大于70%时,将等级2和等级3对应的应用服务以后台服务的形式运行;当内存占用率大于90%时,将等级1、等级2和等级3对应的应用服务以后台服务的形式运行。The resource occupancy rate may be associated with the service identifier, or the resource occupancy rate may be associated with the service level to obtain the corresponding service identifier. Obtain a corresponding service identifier according to the resource occupancy rate, and run the application service corresponding to the obtained service identifier in the form of a background service. For example, the service level is divided into level 1, level 2, and level 3. When the memory usage is greater than 50%, the application service corresponding to level 3 is operated as a background service; when the memory occupancy is greater than 70%, level 2 is The application service corresponding to level 3 runs in the form of a background service; when the memory usage is greater than 90%, the application services corresponding to level 1, level 2, and level 3 are run in the form of background services.
具体地,可以获取各个应用程序对应的资源占用率,并根据各个应用程序对应的资源占用率获取对应的服务标识,并将获取的服务标识对应的应用服务以后台服务的形式进行运行。例如,若某个应用程序的CPU占用率高于20%,则将该应用程序对应的服务等级为等级3的应用服务以后台服务形式进行运行,这样可以合理的管理终端的资源。Specifically, the resource usage rate corresponding to each application may be obtained, and the corresponding service identifier is obtained according to the resource occupancy rate of each application, and the application service corresponding to the obtained service identifier is operated in the form of a background service. For example, if the CPU usage of an application is higher than 20%, the application service with the service level of level 3 corresponding to the application is run as a background service, so that the resources of the terminal can be managed reasonably.
在一个实施例中,可以在预设存储地址中获取监控日志文件,并根据该监控日志文件获取CPU占用率。其中,预设存储地址是指预先设置的存放监控日志文件的地址,监控日志文件中记录了CPU从开启到当前时刻的具体运行情况的变化。在预设存储地址中,可以根据监控日志文件标识查找监控日志文件。监控日志文件标识就是指区分监控日志文件的唯一标识,例如监控日志文件的名称和编号等。具体地,该预设存储地址中可以包含若干个子文件夹,这些子文件夹中存储着各个进程日志文件。进程日志文件记录了进程从开启到当前时刻的具体运行情况的变化,根据这些进程日志文件就可以获 取该进程所占用CPU资源的情况,即可获取进程的CPU占用率。其中,进程是指CPU进行资源分配的调度的基本单位,也是CPU执行任务的基本单位。每个应用程序包含了一条或多条进程,因此可以根据进程的CPU占用率和进程与应用程序的对应关系,获取各个应用程序对应的CPU占用率。In an embodiment, the monitoring log file may be obtained in a preset storage address, and the CPU usage rate is obtained according to the monitoring log file. The preset storage address is a preset address for storing the monitoring log file, and the monitoring log file records the change of the specific running condition of the CPU from the opening to the current time. In the preset storage address, the monitoring log file can be found according to the monitoring log file identifier. The monitoring log file identifier refers to the unique identifier that distinguishes the monitoring log file, such as the name and number of the monitoring log file. Specifically, the preset storage address may include several subfolders, where each process log file is stored. The process log file records the changes in the specific running status of the process from the start to the current time. According to the log files of these processes, the log file can be obtained. The CPU usage of the process can be obtained by taking the CPU resources occupied by the process. Among them, the process refers to the basic unit of the CPU to perform resource allocation scheduling, and is also the basic unit of the CPU to perform tasks. Each application contains one or more processes. Therefore, the CPU usage of each application can be obtained according to the CPU usage of the process and the corresponding relationship between the process and the application.
例如,Android系统中,在/proc目录中可以读取到存储CPU总占用信息的监控日志文件。其中,/proc目录下包含了多个子文件夹,这些子文件夹中存储了各个进程对应的CPU占用信息的进程日志文件。/proc目录中存储的监控日志文件的文件名为“stat”,/proc目录中的子文件夹中存储了进程日志文件,进程日志文件的文件名为“stat”。/proc目录下的stat文件记录了CPU的总占用信息,/proc目录下的子文件夹中的stat文件记录了各个进程的CPU占用信息。比如,/proc/pid目录下的stat文件记录了pid进程的CPU占用信息,其中pid为进程标识。For example, in the Android system, a monitoring log file storing the total CPU usage information can be read in the /proc directory. The /proc directory contains multiple subfolders, which store the process log files of CPU usage information corresponding to each process. The file name of the monitoring log file stored in the /proc directory is "stat". The process log file is stored in the subfolder in the /proc directory. The file name of the process log file is "stat". The stat file in the /proc directory records the total CPU usage information. The stat file in the subfolder under the /proc directory records the CPU usage information of each process. For example, the stat file in the /proc/pid directory records the CPU usage information of the pid process, where pid is the process ID.
步骤324,若检测到应用程序被删除,则将应用程序对应的服务白名单进行删除。Step 324: If it is detected that the application is deleted, the service white list corresponding to the application is deleted.
在一个实施例中,服务白名单与应用程序是对应的,当检测到应用程序被删除时,可以将该应用程序对应的服务白名单同时进行删除。可以理解的是,服务黑名单与应用程序也是对应的,当检测到应用程序被删除时,可以将该应用程序对应的服务黑名单也进行删除。当再次安装该应用程序时,再新建对应的服务白名单和服务黑名单。In one embodiment, the service whitelist corresponds to the application, and when it is detected that the application is deleted, the service whitelist corresponding to the application may be deleted at the same time. It can be understood that the service blacklist also corresponds to the application. When it is detected that the application is deleted, the service blacklist corresponding to the application may also be deleted. When the application is installed again, create a corresponding service whitelist and service blacklist.
步骤326,若调用权限为禁止调用,则将目标应用服务对应的服务标识添加到服务黑名单中。Step 326: If the calling permission is forbidden, the service identifier corresponding to the target application service is added to the service blacklist.
步骤328,后台运行目标应用服务。In step 328, the target application service is run in the background.
若用户通过终端输入的为禁止调用,则说明用户禁止该目标应用服务以前台服务的形式进行运行,则将该目标应用服务对应的服务标识添加到服务黑名单中,等到下次该目标应用服务再启用前台服务时,则禁止该目标应用服务以前台服务的形式运行,直接将该目标应用服务以后台服务的形式进行运行。具体地,若终端输入的调用权限为禁止调用,则将该目标应用服务以 后台服务的形式运行,并将目标应用服务对应的服务标识添加到服务黑名单中。If the user enters the forbidden call through the terminal, the user is prohibited from running the target application service in the form of the foreground service, and the service identifier corresponding to the target application service is added to the service blacklist, and the target application service is next time. When the foreground service is enabled, the target application service is prohibited from running in the form of a foreground service, and the target application service is directly operated in the form of a background service. Specifically, if the calling permission input by the terminal is forbidden, the target application service is The background service runs in the form, and the service identifier corresponding to the target application service is added to the service blacklist.
图5为一个实施例中修改服务白名单的终端界面图。如图5所示,在服务白名单的修改界面中,用户可以选择需要修改的应用程序,然后终端会选择该应用程序对应的服务白名单进行展示。用户可以在服务白名单中选择需要修改的服务标识,并点击“删除”按钮将选择的服务标识进行删除。还可以点击“添加”按钮,添加新的服务标识。FIG. 5 is a diagram of a terminal interface for modifying a service whitelist in an embodiment. As shown in FIG. 5, in the modification interface of the service whitelist, the user can select an application to be modified, and then the terminal selects a service whitelist corresponding to the application for display. The user can select the service identifier to be modified in the service white list, and click the "delete" button to delete the selected service identifier. You can also add a new service ID by clicking the "Add" button.
上述实施例提供的服务调度方法,在终端中检测到应用程序的目标应用服务在启动前台服务,则获取目标应用程序对应的服务白名单,通过服务白名单来判断该目标应用服务的运行方式。可以防止恶意应用服务随意地占用前台服务,导致系统资源被占用,从而提高了系统资源的利用率。The service scheduling method provided in the above embodiment detects that the target application service of the application starts the foreground service, and obtains the service white list corresponding to the target application, and determines the operation mode of the target application service through the service white list. The malicious application service can be prevented from occupying the front-end service arbitrarily, resulting in system resources being occupied, thereby improving the utilization of system resources.
图6为又一个实施例中服务调度方法的流程图。该服务调度方法包括步骤602至步骤614。其中:6 is a flow chart of a service scheduling method in still another embodiment. The service scheduling method includes steps 602 to 614. among them:
步骤602,检测到应用程序的目标应用服务启动前台服务。 Step 602, detecting that the target application service of the application starts the foreground service.
步骤604,判断该目标应用服务是否有调用权限,若是,则执行步骤614;否则执行步骤606。 Step 604, it is determined whether the target application service has a call permission, and if so, step 614 is performed; otherwise, step 606 is performed.
获取目标应用服务的服务标识,将该目标应用服务的服务标识与服务白名单中的服务标识进行匹配,若该目标应用服务的服务标识在服务白名单中存在,则该目标应用服务有调用权限;若该目标应用服务的服务标识在服务白名单中不存在,则该目标应用服务没有调用权限。Obtaining a service identifier of the target application service, and matching the service identifier of the target application service with the service identifier in the service whitelist. If the service identifier of the target application service exists in the service whitelist, the target application service has a call permission. If the service identifier of the target application service does not exist in the service whitelist, the target application service does not have the call permission.
步骤606,判断该目标应用服务是否已经被拒绝调用,若是,则执行步骤612;否则执行步骤608。In step 606, it is determined whether the target application service has been rejected. If yes, step 612 is performed; otherwise, step 608 is performed.
将该目标应用服务的服务标识与服务黑名单中的服务标识进行匹配,若该目标应用服务的服务标识在服务黑名单中存在,则说明该目标应用服务已经被拒绝调用前台服务;若该目标应用服务的服务标识在服务白名单中不存在,则说明该目标应用服务没有被拒绝过调用前台服务。 Matching the service identifier of the target application service with the service identifier in the service blacklist. If the service identifier of the target application service exists in the service blacklist, the target application service has been rejected from calling the foreground service; If the service identifier of the application service does not exist in the service whitelist, it indicates that the target application service has not been rejected to call the foreground service.
步骤608,接收用户输入的调用权限。 Step 608, receiving the calling permission input by the user.
步骤610,判断用户输入的调用权限是否为允许调用,若是,则执行步骤614;否则执行步骤612。In step 610, it is determined whether the calling permission input by the user is an allowable call. If yes, step 614 is performed; otherwise, step 612 is performed.
步骤612,后台运行该目标应用服务。 Step 612, running the target application service in the background.
步骤614,前台运行该目标应用服务。In step 614, the foreground application service is run in the foreground.
图7为一个实施例中服务调用装置的结构示意图。如图7所示,该服务调用装置700包括名单获取模块702、标识匹配模块704和服务运行模块706。其中:FIG. 7 is a schematic structural diagram of a service invoking device in an embodiment. As shown in FIG. 7, the service invoking device 700 includes a list obtaining module 702, an identifier matching module 704, and a service running module 706. among them:
名单获取模块702,用于若在终端中检测到应用程序的目标应用服务启动前台服务,则获取所述应用程序对应的服务白名单,所述服务白名单中包括一个或多个服务标识,每个所述服务标识用于唯一标示所述应用程序的一个应用服务。The list obtaining module 702 is configured to: if the target application service that detects the application in the terminal starts the foreground service, obtain a service white list corresponding to the application, where the service white list includes one or more service identifiers, and each of the service white lists includes one or more service identifiers. The service identifier is used to uniquely identify an application service of the application.
标识匹配模块704,用于判断所述服务白名单中,是否包括所述目标应用服务的服务标识。The identifier matching module 704 is configured to determine whether the service identifier of the target application service is included in the service white list.
服务运行模块706,用于若所述服务白名单中包括所述目标应用服务的服务标识,则前台运行所述目标应用服务。The service running module 706 is configured to: if the service whitelist includes the service identifier of the target application service, run the target application service in the foreground.
上述实施例提供的服务调度装置,在终端中检测到有应用程序的目标应用服务在启动前台服务,则获取对应的服务白名单,通过服务白名单来判断该目标应用服务的运行方式。可以防止恶意应用服务随意地占用前台服务,导致系统资源被占用,从而提高了系统资源的利用率。The service scheduling apparatus provided in the above embodiment detects that the target application service of the application program starts the foreground service, and obtains the corresponding service white list, and determines the operation mode of the target application service through the service white list. The malicious application service can be prevented from occupying the front-end service arbitrarily, resulting in system resources being occupied, thereby improving the utilization of system resources.
图8为另一个实施例中服务调用装置的结构示意图。如图7所示,该服务调用装置800包括名单获取模块802、标识匹配模块804、服务运行模块806、资源获取模块808和名单删除模块810。其中:FIG. 8 is a schematic structural diagram of a service invoking device in another embodiment. As shown in FIG. 7, the service invoking device 800 includes a list obtaining module 802, an identifier matching module 804, a service running module 806, a resource obtaining module 808, and a list deleting module 810. among them:
名单获取模块802,用于若在终端中检测到应用程序的目标应用服务启动前台服务,则获取所述应用程序对应的服务白名单,所述服务白名单中包 括一个或多个服务标识,每个所述服务标识用于唯一标示所述应用程序的一个应用服务。The list obtaining module 802 is configured to: if the target application service that detects the application in the terminal starts the foreground service, obtain a service white list corresponding to the application, and the service white list includes One or more service identifiers, each of which identifies an application service that uniquely identifies the application.
标识匹配模块804,用于判断所述服务白名单中,是否包括所述目标应用服务的服务标识。The identifier matching module 804 is configured to determine whether the service identifier of the target application service is included in the service white list.
服务运行模块806,用于若所述服务白名单中包括所述目标应用服务的服务标识,则前台运行所述目标应用服务。The service running module 806 is configured to: if the service whitelist includes the service identifier of the target application service, run the target application service in the foreground.
资源获取模块808,用于获取终端的资源占用率,并获取所述服务白名单中所述资源占用率对应的服务标识;将获取的服务标识对应的应用服务以后台服务的形式进行运行。The resource obtaining module 808 is configured to acquire the resource occupancy rate of the terminal, and obtain the service identifier corresponding to the resource occupancy rate in the service whitelist; and run the application service corresponding to the obtained service identifier in the form of a background service.
名单删除模块810,若检测到应用程序被删除,则将所述应用程序对应的服务白名单进行删除。The list deletion module 810 deletes the service white list corresponding to the application if it detects that the application is deleted.
上述实施例提供的服务调度装置,在终端中检测到有应用程序的目标应用服务在启动前台服务,则获取对应的服务白名单,通过服务白名单来判断该目标应用服务的运行方式。可以防止恶意应用服务随意地占用前台服务,导致系统资源被占用,从而提高了系统资源的利用率。The service scheduling apparatus provided in the above embodiment detects that the target application service of the application program starts the foreground service, and obtains the corresponding service white list, and determines the operation mode of the target application service through the service white list. The malicious application service can be prevented from occupying the front-end service arbitrarily, resulting in system resources being occupied, thereby improving the utilization of system resources.
在一个实施例中,名单获取模块802还用于若在终端中检测到应用程序的目标应用服务启动前台服务,则获取所述目标应用服务的服务等级;若所述服务等级小于预设等级,则获取所述应用程序对应的服务白名单。In an embodiment, the list obtaining module 802 is further configured to: if the target application service of the application is detected in the terminal, start the foreground service, obtain the service level of the target application service; if the service level is less than the preset level, Then, obtain a service white list corresponding to the application.
在一个实施例中,服务运行模块806还用于若所述服务等级大于或等于预设等级,则前台运行所述目标应用服务。In one embodiment, the service running module 806 is further configured to run the target application service in the foreground if the service level is greater than or equal to a preset level.
在一个实施例中,服务运行模块806还用于获取所述服务白名单中所述服务标识对应的时长阈值;若所述目标应用服务在前台运行的时长超过所述时长阈值,则后台运行所述目标应用服务。In an embodiment, the service running module 806 is further configured to obtain a duration threshold corresponding to the service identifier in the service whitelist; if the duration of the target application service running in the foreground exceeds the duration threshold, the background running Target application service.
在一个实施例中,服务运行模块806还用于若所述服务白名单中不包括所述目标应用服务的服务标识,则后台运行所述目标应用服务。In an embodiment, the service running module 806 is further configured to run the target application service in the background if the service whitelist does not include the service identifier of the target application service.
在一个实施例中,服务运行模块806若所述服务白名单中不包括所述目标应用服务的服务标识,则接收所述终端输入的调用权限,所述调用权限用 于表示是否允许前台运行所述目标应用服务的权限;根据所述调用权限运行所述目标应用服务。In an embodiment, if the service whitelist does not include the service identifier of the target application service, the service execution module 806 receives the call permission input by the terminal, and the call permission is used. The permission to indicate whether to allow the foreground to run the target application service; and to run the target application service according to the calling permission.
在一个实施例中,服务运行模块806还用于若所述服务白名单中不包括所述目标应用服务的服务标识,则将所述服务标识与服务黑名单进行匹配,所述服务黑名单用于存储禁止以前台运行的应用服务所对应的服务标识;若所述服务黑名单中不包括所述目标应用服务的服务标识,则接收所述终端输入的调用权限;根据所述调用权限运行所述目标应用服务。In an embodiment, the service running module 806 is further configured to: if the service whitelist does not include the service identifier of the target application service, match the service identifier with a service blacklist, where the service blacklist is used. And storing, by the service identifier, the service identifier corresponding to the application service running in the foreground; if the service blacklist does not include the service identifier of the target application service, receiving the call permission input by the terminal; Target application service.
上述服务调用装置中各个模块的划分仅用于举例说明,在其他实施例中,可将服务调用装置按照需要划分为不同的模块,以完成上述服务调用装置的全部或部分功能。The division of each module in the above service invoking device is for illustrative purposes only. In other embodiments, the service invoking device may be divided into different modules as needed to complete all or part of the functions of the above service invoking device.
本申请实施例还提供了一种存储介质。一个或多个包含计算机可执行指令的非易失性存储介质,当所述计算机可执行指令被一个或多个处理器执行时,使得所述处理器执行以下步骤:The embodiment of the present application also provides a storage medium. One or more non-volatile storage media containing computer-executable instructions that, when executed by one or more processors, cause the processor to perform the following steps:
若在终端中检测到应用程序的目标应用服务启动前台服务,则获取所述应用程序对应的服务白名单,所述服务白名单中包括一个或多个服务标识,每个所述服务标识用于唯一标示所述应用程序的一个应用服务;If the target application service of the application is detected in the terminal, the service white list corresponding to the application is obtained, where the service white list includes one or more service identifiers, and each of the service identifiers is used for An application service that uniquely identifies the application;
判断所述服务白名单中,是否包括所述目标应用服务的服务标识;Determining whether the service identifier of the target application service is included in the service white list;
若所述服务白名单中包括所述目标应用服务的服务标识,则前台运行所述目标应用服务。If the service whitelist includes the service identifier of the target application service, the foreground application service is run in the foreground.
在一个实施例中,所述处理器执行的所述若在终端中检测到应用程序的目标应用服务启动前台服务,则获取所述应用程序对应的服务白名单包括:In an embodiment, if the target application service that detects the application in the terminal starts the foreground service, the service white list corresponding to the application includes:
若在终端中检测到应用程序的目标应用服务启动前台服务,则获取所述目标应用服务的服务等级;Obtaining a service level of the target application service if the target application service of the application is detected in the terminal to start the foreground service;
若所述服务等级小于预设等级,则获取所述应用程序对应的服务白名单。If the service level is less than the preset level, the service white list corresponding to the application is obtained.
在一个实施例中,所述处理器执行的所述方法还包括:In one embodiment, the method performed by the processor further includes:
若所述服务等级大于或等于预设等级,则前台运行所述目标应用服务。 If the service level is greater than or equal to the preset level, the foreground application service is run in the foreground.
在一个实施例中,所述处理器执行的所述方法还包括:In one embodiment, the method performed by the processor further includes:
获取所述服务白名单中所述服务标识对应的时长阈值;Obtaining a duration threshold corresponding to the service identifier in the service whitelist;
若所述目标应用服务在前台运行的时长超过所述时长阈值,则后台运行所述目标应用服务。If the duration of the target application service running in the foreground exceeds the duration threshold, the target application service is run in the background.
在一个实施例中,所述处理器执行的所述方法还包括:In one embodiment, the method performed by the processor further includes:
若所述服务白名单中不包括所述目标应用服务的服务标识,则后台运行所述目标应用服务。If the service identifier of the target application service is not included in the service whitelist, the target application service is run in the background.
在一个实施例中,所述处理器执行的所述方法还包括:In one embodiment, the method performed by the processor further includes:
若所述服务白名单中不包括所述目标应用服务的服务标识,则接收所述终端输入的调用权限,所述调用权限用于表示是否允许前台运行所述目标应用服务的权限;And if the service whitelist does not include the service identifier of the target application service, receiving the call permission input by the terminal, where the call permission is used to indicate whether to allow the foreground to run the target application service;
根据所述调用权限运行所述目标应用服务。Running the target application service according to the calling authority.
在一个实施例中,所述处理器执行的所述方法还包括:In one embodiment, the method performed by the processor further includes:
若所述服务白名单中不包括所述目标应用服务的服务标识,则将所述服务标识与服务黑名单进行匹配,所述服务黑名单用于存储禁止以前台运行的应用服务所对应的服务标识;If the service whitelist does not include the service identifier of the target application service, the service identifier is matched with the service blacklist, and the service blacklist is used to store the service corresponding to the application service that is prohibited from running in the foreground. Identification
若所述服务黑名单中不包括所述目标应用服务的服务标识,则接收所述终端输入的调用权限;And if the service blacklist does not include the service identifier of the target application service, receiving the call permission input by the terminal;
根据所述调用权限运行所述目标应用服务。Running the target application service according to the calling authority.
在一个实施例中,所述处理器执行的所述根据所述调用权限运行所述目标应用服务包括:In an embodiment, the running, by the processor, the running the target application service according to the calling permission comprises:
若所述调用权限为允许调用,则将所述目标应用服务对应的服务标识添加到所述服务白名单中,并前台运行所述目标应用服务;And if the calling permission is an allowable call, adding a service identifier corresponding to the target application service to the service white list, and running the target application service in a foreground;
若所述调用权限为禁止调用,则将所述目标应用服务对应的服务标识添加到所述服务黑名单中,并后台运行所述目标应用服务。If the calling permission is forbidden, the service identifier corresponding to the target application service is added to the service blacklist, and the target application service is run in the background.
在一个实施例中,所述处理器执行的所述方法还包括:In one embodiment, the method performed by the processor further includes:
获取终端的资源占用率,并获取所述服务白名单中所述资源占用率对应 的服务标识;Obtaining a resource occupancy rate of the terminal, and obtaining the resource usage ratio corresponding to the service whitelist Service identifier;
将获取的服务标识对应的应用服务以后台服务的形式进行运行。The application service corresponding to the obtained service identifier is operated in the form of a background service.
在一个实施例中,所述处理器执行的所述方法还包括:In one embodiment, the method performed by the processor further includes:
若检测到应用程序被删除,则将所述应用程序对应的服务白名单进行删除。If it is detected that the application is deleted, the service white list corresponding to the application is deleted.
图9为一个实施例中服务器的内部结构示意图。如图9所示,该服务器包括通过系统总线连接的处理器、非易失性存储介质、内存储器和网络接口。其中,该服务器的非易失性存储介质存储有操作系统和计算机程序。该计算机程序被处理器执行时以实现一种服务调度方法。该服务器的处理器用于提供计算和控制能力,支撑整个服务器的运行。该服务器的网络接口用于据以与外部的终端通过网络连接通信,比如接收终端发送的安装包获取请求以及向终端返回安装包和服务白名单等。服务器可以用独立的服务器或者是多个服务器组成的服务器集群来实现。本领域技术人员可以理解,图9中示出的结构,仅仅是与本申请方案相关的部分结构的框图,并不构成对本申请方案所应用于其上的服务器的限定,具体的服务器可以包括比图中所示更多或更少的部件,或者组合某些部件,或者具有不同的部件布置。FIG. 9 is a schematic diagram showing the internal structure of a server in an embodiment. As shown in FIG. 9, the server includes a processor, a non-volatile storage medium, an internal memory, and a network interface connected by a system bus. The non-volatile storage medium of the server stores an operating system and a computer program. The computer program is executed by the processor to implement a service scheduling method. The server's processor is used to provide computing and control capabilities that support the operation of the entire server. The network interface of the server is used to communicate with an external terminal through a network connection, such as receiving an installation package acquisition request sent by the terminal, and returning an installation package and a service white list to the terminal. The server can be implemented with a stand-alone server or a server cluster consisting of multiple servers. It will be understood by those skilled in the art that the structure shown in FIG. 9 is only a block diagram of a part of the structure related to the solution of the present application, and does not constitute a limitation on the server to which the solution of the present application is applied. The specific server may include a ratio. More or fewer components are shown in the figures, or some components are combined, or have different component arrangements.
本发明实施例还提供了一种计算机设备。如图10所示,为了便于说明,仅示出了与本发明实施例相关的部分,具体技术细节未揭示的,请参照本发明实施例方法部分。该计算机设备可以为包括手机、平板电脑、PDA(Personal Digital Assistant,个人数字助理)、POS(Point of Sales,销售终端)、车载电脑、穿戴式设备等任意终端设备,以计算机设备为手机为例:The embodiment of the invention also provides a computer device. As shown in FIG. 10, for the convenience of description, only parts related to the embodiment of the present invention are shown. Without specific details, please refer to the method part of the embodiment of the present invention. The computer device may be any terminal device including a mobile phone, a tablet computer, a PDA (Personal Digital Assistant), a POS (Point of Sales), a vehicle-mounted computer, a wearable device, and the like, taking a computer device as a mobile phone as an example. :
图10为与本发明实施例提供的计算机设备相关的手机的部分结构的框图。参考图10,手机包括:射频(Radio Frequency,RF)电路1010、存储器1020、输入单元1030、显示单元1040、传感器1050、音频电路1060、 无线保真(wireless fidelity,WiFi)模块1070、处理器1080、以及电源1090等部件。本领域技术人员可以理解,图10所示的手机结构并不构成对手机的限定,可以包括比图示更多或更少的部件,或者组合某些部件,或者不同的部件布置。FIG. 10 is a block diagram showing a part of a structure of a mobile phone related to a computer device according to an embodiment of the present invention. Referring to FIG. 10, the mobile phone includes: a radio frequency (RF) circuit 1010, a memory 1020, an input unit 1030, a display unit 1040, a sensor 1050, and an audio circuit 1060. A component of a wireless fidelity (WiFi) module 1070, a processor 1080, and a power source 1090. It will be understood by those skilled in the art that the structure of the handset shown in FIG. 10 does not constitute a limitation to the handset, and may include more or less components than those illustrated, or some components may be combined, or different components may be arranged.
其中,RF电路1010可用于收发信息或通话过程中,信号的接收和发送,可将基站的下行信息接收后,给处理器1080处理;也可以将上行的数据发送给基站。通常,RF电路包括但不限于天线、至少一个放大器、收发信机、耦合器、低噪声放大器(Low Noise Amplifier,LNA)、双工器等。此外,RF电路1010还可以通过无线通信与网络和其他设备通信。上述无线通信可以使用任一通信标准或协议,包括但不限于全球移动通讯系统(Global System of Mobile communication,GSM)、通用分组无线服务(General Packet Radio Service,GPRS)、码分多址(Code Division Multiple Access,CDMA)、宽带码分多址(Wideband Code Division Multiple Access,WCDMA)、长期演进(Long Term Evolution,LTE))、电子邮件、短消息服务(Short Messaging Service,SMS)等。The RF circuit 1010 can be used for receiving and transmitting signals during the transmission and reception of information or during a call. The downlink information of the base station can be received and processed by the processor 1080. The uplink data can also be sent to the base station. Generally, RF circuits include, but are not limited to, an antenna, at least one amplifier, a transceiver, a coupler, a Low Noise Amplifier (LNA), a duplexer, and the like. In addition, RF circuit 1010 can also communicate with the network and other devices via wireless communication. The above wireless communication may use any communication standard or protocol, including but not limited to Global System of Mobile communication (GSM), General Packet Radio Service (GPRS), Code Division Multiple Access (Code Division). Multiple Access (CDMA), Wideband Code Division Multiple Access (WCDMA), Long Term Evolution (LTE), e-mail, Short Messaging Service (SMS), and the like.
存储器1020可用于存储软件程序以及模块,处理器1080通过运行存储在存储器1020的软件程序以及模块,从而执行手机的各种功能应用以及数据处理。存储器1020可主要包括程序存储区和数据存储区,其中,程序存储区可存储操作系统、至少一个功能所需的应用程序(比如声音播放功能的应用程序、图像播放功能的应用程序等)等;数据存储区可存储根据手机的使用所创建的数据(比如音频数据、通讯录等)等。此外,存储器1020可以包括高速随机存取存储器,还可以包括非易失性存储器,例如至少一个磁盘存储器件、闪存器件、或其他易失性固态存储器件。The memory 1020 can be used to store software programs and modules, and the processor 1080 executes various functional applications and data processing of the mobile phone by running software programs and modules stored in the memory 1020. The memory 1020 may mainly include a program storage area and a data storage area, wherein the program storage area may store an operating system, an application required for at least one function (such as an application of a sound playing function, an application of an image playing function, etc.); The data storage area can store data (such as audio data, address book, etc.) created according to the use of the mobile phone. Moreover, memory 1020 can include high speed random access memory, and can also include non-volatile memory, such as at least one magnetic disk storage device, flash memory device, or other volatile solid state storage device.
输入单元1030可用于接收输入的数字或字符信息,以及产生与手机1000的用户设置以及功能控制有关的键信号输入。具体地,输入单元1030可包括触控面板1031以及其他输入设备1032。触控面板1031,也可称为触摸屏,可收集用户在其上或附近的触摸操作(比如用户使用手指、触笔 等任何适合的物体或附件在触控面板1031上或在触控面板1031附近的操作),并根据预先设定的程式驱动相应的连接装置。在一个实施例中,触控面板1031可包括触摸检测装置和触摸控制器两个部分。其中,触摸检测装置检测用户的触摸方位,并检测触摸操作带来的信号,将信号传送给触摸控制器;触摸控制器从触摸检测装置上接收触摸信息,并将它转换成触点坐标,再送给处理器1080,并能接收处理器1080发来的命令并加以执行。此外,可以采用电阻式、电容式、红外线以及表面声波等多种类型实现触控面板1031。除了触控面板1031,输入单元1030还可以包括其他输入设备1032。具体地,其他输入设备1032可以包括但不限于物理键盘、功能键(比如音量控制按键、开关按键等)等中的一种或多种。The input unit 1030 can be configured to receive input numeric or character information and to generate key signal inputs related to user settings and function control of the handset 1000. Specifically, the input unit 1030 may include a touch panel 1031 and other input devices 1032. The touch panel 1031, which may also be referred to as a touch screen, can collect touch operations on or near the user (such as a user using a finger or a stylus) And any suitable object or accessory on the touch panel 1031 or in the vicinity of the touch panel 1031), and drive the corresponding connecting device according to a preset program. In one embodiment, the touch panel 1031 can include two portions of a touch detection device and a touch controller. Wherein, the touch detection device detects the touch orientation of the user, and detects a signal brought by the touch operation, and transmits the signal to the touch controller; the touch controller receives the touch information from the touch detection device, converts the touch information into contact coordinates, and sends the touch information. The processor 1080 is provided and can receive commands from the processor 1080 and execute them. In addition, the touch panel 1031 can be implemented in various types such as resistive, capacitive, infrared, and surface acoustic waves. In addition to the touch panel 1031, the input unit 1030 may also include other input devices 1032. Specifically, other input devices 1032 may include, but are not limited to, one or more of a physical keyboard, function keys (such as volume control buttons, switch buttons, etc.).
显示单元1040可用于显示由用户输入的信息或提供给用户的信息以及手机的各种菜单。显示单元1040可包括显示面板1041。在一个实施例中,可以采用液晶显示器(Liquid Crystal Display,LCD)、有机发光二极管(Organic Light-Emitting Diode,OLED)等形式来配置显示面板1041。在一个实施例中,触控面板1031可覆盖显示面板1041,当触控面板1031检测到在其上或附近的触摸操作后,传送给处理器1080以确定触摸事件的类型,随后处理器1080根据触摸事件的类型在显示面板1041上提供相应的视觉输出。虽然在图10中,触控面板1031与显示面板1041是作为两个独立的部件来实现手机的输入和输入功能,但是在某些实施例中,可以将触控面板1031与显示面板1041集成而实现手机的输入和输出功能。The display unit 1040 can be used to display information input by the user or information provided to the user as well as various menus of the mobile phone. The display unit 1040 may include a display panel 1041. In one embodiment, the display panel 1041 may be configured in the form of a liquid crystal display (LCD), an organic light-emitting diode (OLED), or the like. In one embodiment, the touch panel 1031 can cover the display panel 1041. When the touch panel 1031 detects a touch operation thereon or nearby, the touch panel 1031 transmits to the processor 1080 to determine the type of the touch event, and then the processor 1080 is The type of touch event provides a corresponding visual output on display panel 1041. Although the touch panel 1031 and the display panel 1041 are used as two independent components to implement the input and input functions of the mobile phone in FIG. 10, in some embodiments, the touch panel 1031 may be integrated with the display panel 1041. Realize the input and output functions of the phone.
手机1000还可包括至少一种传感器1050,比如光传感器、运动传感器以及其他传感器。具体地,光传感器可包括环境光传感器及接近传感器,其中,环境光传感器可根据环境光线的明暗来调节显示面板1041的亮度,接近传感器可在手机移动到耳边时,关闭显示面板1041和/或背光。运动传感器可包括加速度传感器,通过加速度传感器可检测各个方向上加速度的大小,静止时可检测出重力的大小及方向,可用于识别手机姿态的应用(比如横竖屏切换)、振动识别相关功能(比如计步器、敲击)等;此外, 手机还可配置陀螺仪、气压计、湿度计、温度计、红外线传感器等其他传感器等。The handset 1000 can also include at least one type of sensor 1050, such as a light sensor, motion sensor, and other sensors. Specifically, the light sensor may include an ambient light sensor and a proximity sensor, wherein the ambient light sensor may adjust the brightness of the display panel 1041 according to the brightness of the ambient light, and the proximity sensor may close the display panel 1041 and/or when the mobile phone moves to the ear. Or backlight. The motion sensor may include an acceleration sensor, and the acceleration sensor can detect the magnitude of the acceleration in each direction, and the magnitude and direction of the gravity can be detected at rest, and can be used to identify the gesture of the mobile phone (such as horizontal and vertical screen switching), and vibration recognition related functions (such as Pedometer, tapping, etc.; The mobile phone can also be equipped with other sensors such as gyroscopes, barometers, hygrometers, thermometers, and infrared sensors.
音频电路1060、扬声器1061和传声器1062可提供用户与手机之间的音频接口。音频电路1060可将接收到的音频数据转换后的电信号,传输到扬声器1061,由扬声器1061转换为声音信号输出;另一方面,传声器1062将收集的声音信号转换为电信号,由音频电路1060接收后转换为音频数据,再将音频数据输出处理器1080处理后,经RF电路1010可以发送给另一手机,或者将音频数据输出至存储器1020以便后续处理。 Audio circuitry 1060, speaker 1061, and microphone 1062 can provide an audio interface between the user and the handset. The audio circuit 1060 can transmit the converted electrical data of the received audio data to the speaker 1061, and convert it into a sound signal output by the speaker 1061; on the other hand, the microphone 1062 converts the collected sound signal into an electrical signal, by the audio circuit 1060. After receiving, it is converted into audio data, and then processed by the audio data output processor 1080, transmitted to another mobile phone via the RF circuit 1010, or outputted to the memory 1020 for subsequent processing.
WiFi属于短距离无线传输技术,手机通过WiFi模块1070可以帮助用户收发电子邮件、浏览网页和访问流式媒体等,它为用户提供了无线的宽带互联网访问。虽然图10示出了WiFi模块1070,但是可以理解的是,其并不属于手机1000的必须构成,可以根据需要而省略。WiFi is a short-range wireless transmission technology. The mobile phone through the WiFi module 1070 can help users to send and receive e-mail, browse the web and access streaming media, etc. It provides users with wireless broadband Internet access. Although FIG. 10 shows the WiFi module 1070, it can be understood that it does not belong to the essential configuration of the mobile phone 1000 and can be omitted as needed.
处理器1080是手机的控制中心,利用各种接口和线路连接整个手机的各个部分,通过运行或执行存储在存储器1020内的软件程序和/或模块,以及调用存储在存储器1020内的数据,执行手机的各种功能和处理数据,从而对手机进行整体监控。在一个实施例中,处理器1080可包括一个或多个处理单元。在一个实施例中,处理器1080可集成应用处理器和调制解调处理器,其中,应用处理器主要处理操作系统、用户界面和应用程序等;调制解调处理器主要处理无线通信。可以理解的是,上述调制解调处理器也可以不集成到处理器1080中。The processor 1080 is the control center of the handset, which connects various portions of the entire handset using various interfaces and lines, by executing or executing software programs and/or modules stored in the memory 1020, and invoking data stored in the memory 1020, The phone's various functions and processing data, so that the overall monitoring of the phone. In one embodiment, processor 1080 can include one or more processing units. In one embodiment, the processor 1080 can integrate an application processor and a modem processor, wherein the application processor primarily processes an operating system, a user interface, an application, and the like; the modem processor primarily processes wireless communications. It will be appreciated that the above described modem processor may also not be integrated into the processor 1080.
手机1000还包括给各个部件供电的电源1090(比如电池),优选的,电源可以通过电源管理系统与处理器1080逻辑相连,从而通过电源管理系统实现管理充电、放电、以及功耗管理等功能。The mobile phone 1000 also includes a power source 1090 (such as a battery) for powering various components. Preferably, the power source can be logically coupled to the processor 1080 through a power management system to manage functions such as charging, discharging, and power management through the power management system.
在一个实施例中,手机1000还可以包括摄像头、蓝牙模块等。In one embodiment, the handset 1000 may also include a camera, a Bluetooth module, and the like.
在本发明实施例中,该移动终端所包括的处理器1080执行存储在存储器上的计算机程序时实现上述实施例提供的服务调度方法。In the embodiment of the present invention, the processor 1080 included in the mobile terminal implements the service scheduling method provided by the foregoing embodiment when executing the computer program stored in the memory.
一种包含指令的计算机程序产品,当其在计算机上运行时,使得计算机 执行上述实施例提供的服务调度方法。A computer program product comprising instructions that, when run on a computer, cause the computer The service scheduling method provided by the foregoing embodiment is performed.
本领域普通技术人员可以理解实现上述实施例方法中的全部或部分流程,是可以通过计算机程序来指令相关的硬件来完成,所述的程序可存储于一非易失性计算机可读取存储介质中,该程序在执行时,可包括如上述各方法的实施例的流程。其中,所述的存储介质可为磁碟、光盘、只读存储记忆体(Read-Only Memory,ROM)等。One of ordinary skill in the art can understand that all or part of the process of implementing the above embodiments can be completed by a computer program to instruct related hardware, and the program can be stored in a non-volatile computer readable storage medium. Wherein, the program, when executed, may include the flow of an embodiment of the methods as described above. The storage medium may be a magnetic disk, an optical disk, a read-only memory (ROM), or the like.
如此处所使用的对存储器、存储、数据库或其它介质的任何引用可包括非易失性和/或易失性存储器。合适的非易失性存储器可包括只读存储器(ROM)、可编程ROM(PROM)、电可编程ROM(EPROM)、电可擦除可编程ROM(EEPROM)或闪存。易失性存储器可包括随机存取存储器(RAM),它用作外部高速缓冲存储器。作为说明而非局限,RAM以多种形式可得,诸如静态RAM(SRAM)、动态RAM(DRAM)、同步DRAM(SDRAM)、双数据率SDRAM(DDR SDRAM)、增强型SDRAM(ESDRAM)、同步链路(Synchlink)DRAM(SLDRAM)、存储器总线(Rambus)直接RAM(RDRAM)、直接存储器总线动态RAM(DRDRAM)、以及存储器总线动态RAM(RDRAM)。Any reference to a memory, storage, database or other medium as used herein may include non-volatile and/or volatile memory. Suitable non-volatile memories can include read only memory (ROM), programmable ROM (PROM), electrically programmable ROM (EPROM), electrically erasable programmable ROM (EEPROM), or flash memory. Volatile memory can include random access memory (RAM), which acts as an external cache. By way of illustration and not limitation, RAM is available in a variety of forms, such as static RAM (SRAM), dynamic RAM (DRAM), synchronous DRAM (SDRAM), dual data rate SDRAM (DDR SDRAM), enhanced SDRAM (ESDRAM), synchronization. Link (Synchlink) DRAM (SLDRAM), Memory Bus (Rambus) Direct RAM (RDRAM), Direct Memory Bus Dynamic RAM (DRDRAM), and Memory Bus Dynamic RAM (RDRAM).
以上所述实施例仅表达了本发明的几种实施方式,其描述较为具体和详细,但并不能因此而理解为对本发明专利范围的限制。应当指出的是,对于本领域的普通技术人员来说,在不脱离本发明构思的前提下,还可以做出若干变形和改进,这些都属于本发明的保护范围。因此,本发明专利的保护范围应以所附权利要求为准。 The above-mentioned embodiments are merely illustrative of several embodiments of the present invention, and the description thereof is more specific and detailed, but is not to be construed as limiting the scope of the invention. It should be noted that a number of variations and modifications may be made by those skilled in the art without departing from the spirit and scope of the invention. Therefore, the scope of the invention should be determined by the appended claims.

Claims (13)

  1. 一种服务调度方法,所述方法包括:A service scheduling method, the method comprising:
    若在终端中检测到应用程序的目标应用服务启动前台服务,则获取所述应用程序对应的服务白名单,所述服务白名单中包括一个或多个服务标识,每个所述服务标识用于唯一标示所述应用程序的一个应用服务;If the target application service of the application is detected in the terminal, the service white list corresponding to the application is obtained, where the service white list includes one or more service identifiers, and each of the service identifiers is used for An application service that uniquely identifies the application;
    判断所述服务白名单中,是否包括所述目标应用服务的服务标识;Determining whether the service identifier of the target application service is included in the service white list;
    若所述服务白名单中包括所述目标应用服务的服务标识,则前台运行所述目标应用服务。If the service whitelist includes the service identifier of the target application service, the foreground application service is run in the foreground.
  2. 根据权利要求1所述的服务调度方法,其特征在于,所述若在终端中检测到应用程序的目标应用服务启动前台服务,则获取所述应用程序对应的服务白名单包括:The service scheduling method according to claim 1, wherein if the target application service of the application is detected in the terminal to start the foreground service, obtaining the service white list corresponding to the application comprises:
    若在终端中检测到应用程序的目标应用服务启动前台服务,则获取所述目标应用服务的服务等级;Obtaining a service level of the target application service if the target application service of the application is detected in the terminal to start the foreground service;
    若所述服务等级小于预设等级,则获取所述应用程序对应的服务白名单。If the service level is less than the preset level, the service white list corresponding to the application is obtained.
  3. 根据权利要求2所述的服务调度方法,其特征在于,所述方法还包括:The service scheduling method according to claim 2, wherein the method further comprises:
    若所述服务等级大于或等于预设等级,则前台运行所述目标应用服务。If the service level is greater than or equal to the preset level, the foreground application service is run in the foreground.
  4. 根据权利要求1所述的服务调度方法,其特征在于,所述方法还包括:The service scheduling method according to claim 1, wherein the method further comprises:
    获取所述服务白名单中所述服务标识对应的时长阈值;Obtaining a duration threshold corresponding to the service identifier in the service whitelist;
    若所述目标应用服务在前台运行的时长超过所述时长阈值,则后台运行所述目标应用服务。If the duration of the target application service running in the foreground exceeds the duration threshold, the target application service is run in the background.
  5. 根据权利要求1所述的服务调度方法,其特征在于,所述方法还包括:The service scheduling method according to claim 1, wherein the method further comprises:
    若所述服务白名单中不包括所述目标应用服务的服务标识,则后台运行所述目标应用服务。If the service identifier of the target application service is not included in the service whitelist, the target application service is run in the background.
  6. 根据权利要求1所述的服务调度方法,其特征在于,所述方法还包括:The service scheduling method according to claim 1, wherein the method further comprises:
    若所述服务白名单中不包括所述目标应用服务的服务标识,则接收所述终端输入的调用权限,所述调用权限用于表示是否允许前台运行所述目标应用服务的权限; And if the service whitelist does not include the service identifier of the target application service, receiving the call permission input by the terminal, where the call permission is used to indicate whether to allow the foreground to run the target application service;
    根据所述调用权限运行所述目标应用服务。Running the target application service according to the calling authority.
  7. 根据权利要求1所述的服务调度方法,其特征在于,所述方法还包括:The service scheduling method according to claim 1, wherein the method further comprises:
    若所述服务白名单中不包括所述目标应用服务的服务标识,则将所述服务标识与服务黑名单进行匹配,所述服务黑名单用于存储禁止以前台运行的应用服务所对应的服务标识;If the service whitelist does not include the service identifier of the target application service, the service identifier is matched with the service blacklist, and the service blacklist is used to store the service corresponding to the application service that is prohibited from running in the foreground. Identification
    若所述服务黑名单中不包括所述目标应用服务的服务标识,则接收所述终端输入的调用权限;And if the service blacklist does not include the service identifier of the target application service, receiving the call permission input by the terminal;
    根据所述调用权限运行所述目标应用服务。Running the target application service according to the calling authority.
  8. 根据权利要求6或7所述的服务调度方法,其特征在于,所述根据所述调用权限运行所述目标应用服务包括:The service scheduling method according to claim 6 or 7, wherein the running the target application service according to the calling permission comprises:
    若所述调用权限为允许调用,则将所述目标应用服务对应的服务标识添加到所述服务白名单中,并前台运行所述目标应用服务;And if the calling permission is an allowable call, adding a service identifier corresponding to the target application service to the service white list, and running the target application service in a foreground;
    若所述调用权限为禁止调用,则将所述目标应用服务对应的服务标识添加到所述服务黑名单中,并后台运行所述目标应用服务。If the calling permission is forbidden, the service identifier corresponding to the target application service is added to the service blacklist, and the target application service is run in the background.
  9. 根据权利要求1至7任一项所述的服务调度方法,其特征在于,所述方法还包括:The service scheduling method according to any one of claims 1 to 7, wherein the method further comprises:
    获取终端的资源占用率,并获取所述服务白名单中所述资源占用率对应的服务标识;Obtaining a resource occupancy rate of the terminal, and acquiring a service identifier corresponding to the resource occupancy rate in the service whitelist;
    将获取的服务标识对应的应用服务以后台服务的形式进行运行。The application service corresponding to the obtained service identifier is operated in the form of a background service.
  10. 根据权利要求1至7任一项所述的服务调度方法,其特征在于,所述方法还包括:The service scheduling method according to any one of claims 1 to 7, wherein the method further comprises:
    若检测到应用程序被删除,则将所述应用程序对应的服务白名单进行删除。If it is detected that the application is deleted, the service white list corresponding to the application is deleted.
  11. 一种服务调度装置,所述装置包括:A service scheduling device, the device comprising:
    名单获取模块,用于若在终端中检测到应用程序的目标应用服务启动前台服务,则获取所述应用程序对应的服务白名单,所述服务白名单中包括一个或多个服务标识,每个所述服务标识用于唯一标示所述应用程序的一个应 用服务;a list obtaining module, configured to: if a target application service that detects an application in the terminal starts a foreground service, obtain a service white list corresponding to the application, where the service white list includes one or more service identifiers, each of which includes one or more service identifiers, each The service identifier is used to uniquely identify one of the applications Service
    标识匹配模块,用于判断所述服务白名单中,是否包括所述目标应用服务的服务标识;An identifier matching module, configured to determine whether the service identifier of the target application service is included in the service whitelist;
    服务运行模块,用于若所述服务白名单中包括所述目标应用服务的服务标识,则前台运行所述目标应用服务。The service running module is configured to: if the service whitelist includes the service identifier of the target application service, run the target application service in the foreground.
  12. 一种计算机设备,包括存储器及处理器,所述存储器中储存有计算机可读指令,所述指令被所述处理器执行时,使得所述处理器执行如权利要求1至10中任一项所述的服务调度方法。A computer device comprising a memory and a processor, the memory storing computer readable instructions, the instructions being executed by the processor, causing the processor to perform any of claims 1 to 10 The service scheduling method described.
  13. 一个或多个包含计算机可执行指令的非易失性计算机可读存储介质,当所述计算机可执行指令被一个或多个处理器执行时,使得所述处理器执行如权利要求1至10中任一项所述的服务调度方法。 One or more non-transitory computer readable storage media containing computer executable instructions that, when executed by one or more processors, cause the processor to perform as claimed in claims 1 to 10 The service scheduling method of any of the above.
PCT/CN2017/108628 2017-10-31 2017-10-31 Service scheduling method and apparatus, computer device, and computer readable storage medium WO2019084783A1 (en)

Priority Applications (2)

Application Number Priority Date Filing Date Title
PCT/CN2017/108628 WO2019084783A1 (en) 2017-10-31 2017-10-31 Service scheduling method and apparatus, computer device, and computer readable storage medium
CN201780092177.0A CN110753909B (en) 2017-10-31 2017-10-31 Service scheduling method and device, computer equipment and computer readable storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
PCT/CN2017/108628 WO2019084783A1 (en) 2017-10-31 2017-10-31 Service scheduling method and apparatus, computer device, and computer readable storage medium

Publications (1)

Publication Number Publication Date
WO2019084783A1 true WO2019084783A1 (en) 2019-05-09

Family

ID=66332823

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2017/108628 WO2019084783A1 (en) 2017-10-31 2017-10-31 Service scheduling method and apparatus, computer device, and computer readable storage medium

Country Status (2)

Country Link
CN (1) CN110753909B (en)
WO (1) WO2019084783A1 (en)

Families Citing this family (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN112202728B (en) * 2020-09-11 2023-06-23 广州宸祺出行科技有限公司 Method and system for mobile terminal to call module through routing protocol

Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN103927485A (en) * 2014-04-24 2014-07-16 东南大学 Android application program risk assessment method based on dynamic monitoring
CN104298549A (en) * 2014-09-30 2015-01-21 北京金山安全软件有限公司 Method and device for cleaning application programs in mobile terminal and mobile terminal
CN105183135A (en) * 2015-09-02 2015-12-23 北京奇虎科技有限公司 Method for saving power consumption of smart phone and smart phone
EP3062193A1 (en) * 2013-12-10 2016-08-31 Huawei Device Co., Ltd. Task management method and device
CN106909447A (en) * 2015-12-23 2017-06-30 北京金山安全软件有限公司 Background application processing method and device and terminal

Family Cites Families (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN103164269B (en) * 2011-12-08 2017-05-03 中兴通讯股份有限公司 Method and terminal achieving multi-window display of application programs
CN104135504B (en) * 2014-02-11 2015-12-30 腾讯科技(深圳)有限公司 A kind of service providing method, Apparatus and system based on application

Patent Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
EP3062193A1 (en) * 2013-12-10 2016-08-31 Huawei Device Co., Ltd. Task management method and device
CN103927485A (en) * 2014-04-24 2014-07-16 东南大学 Android application program risk assessment method based on dynamic monitoring
CN104298549A (en) * 2014-09-30 2015-01-21 北京金山安全软件有限公司 Method and device for cleaning application programs in mobile terminal and mobile terminal
CN105183135A (en) * 2015-09-02 2015-12-23 北京奇虎科技有限公司 Method for saving power consumption of smart phone and smart phone
CN106909447A (en) * 2015-12-23 2017-06-30 北京金山安全软件有限公司 Background application processing method and device and terminal

Also Published As

Publication number Publication date
CN110753909B (en) 2024-04-02
CN110753909A (en) 2020-02-04

Similar Documents

Publication Publication Date Title
US10635449B2 (en) Method and apparatus for running game client
WO2017206916A1 (en) Method for determining kernel running configuration in processor and related product
US9800609B2 (en) Method, device and system for detecting malware in a mobile terminal
TWI606360B (en) Method, apparatus and system for detecting webpages
CN107734616B (en) Application program closing method and device, storage medium and electronic equipment
WO2018153100A1 (en) Method for displaying collected object, and terminal
JP6492184B2 (en) Method, device, and system for managing information recommendations
CN106713608B (en) Application function state modification method and device and terminal
AU2016422505A1 (en) Data sharing method and terminal
WO2015027856A1 (en) Information feedback method, apparatus, and terminal
CN109992965B (en) Process processing method and device, electronic equipment and computer readable storage medium
EP2869604B1 (en) Method, apparatus and device for processing a mobile terminal resource
WO2017161994A1 (en) Method and device for displaying page, and computer storage medium
WO2019184617A1 (en) Information sharing method and device, computer-readable storage medium and terminal
WO2019128571A1 (en) Resource management method and device, mobile terminal, as well as computer readable storage medium
US10298590B2 (en) Application-based service providing method, apparatus, and system
WO2019184631A1 (en) Information processing method and apparatus, computer-readable storage medium, and terminal
WO2018161788A1 (en) Multimedia data sharing method and device
WO2015101302A1 (en) Data sharing method, system, user end and background server
WO2019071581A1 (en) Application startup control method and user terminal
CN106095423B (en) Method, terminal and server for providing browsing service
WO2015062240A1 (en) Application installation method, apparatus and device
KR101876394B1 (en) Method and device for playing media data on a terminal
CN106850957B (en) Application notification management method and device and mobile terminal
CN107463395B (en) Component calling method and device

Legal Events

Date Code Title Description
121 Ep: the epo has been informed by wipo that ep was designated in this application

Ref document number: 17930188

Country of ref document: EP

Kind code of ref document: A1

NENP Non-entry into the national phase

Ref country code: DE

32PN Ep: public notification in the ep bulletin as address of the adressee cannot be established

Free format text: NOTING OF LOSS OF RIGHTS PURSUANT TO RULE 112(1) EPC (EPO FORM 1205A DATED 10.09.2020)

122 Ep: pct application non-entry in european phase

Ref document number: 17930188

Country of ref document: EP

Kind code of ref document: A1