WO2016029642A1 - 后台应用程序的控制方法、装置及终端设备 - Google Patents

后台应用程序的控制方法、装置及终端设备 Download PDF

Info

Publication number
WO2016029642A1
WO2016029642A1 PCT/CN2015/071367 CN2015071367W WO2016029642A1 WO 2016029642 A1 WO2016029642 A1 WO 2016029642A1 CN 2015071367 W CN2015071367 W CN 2015071367W WO 2016029642 A1 WO2016029642 A1 WO 2016029642A1
Authority
WO
WIPO (PCT)
Prior art keywords
identifier
application
current identifier
duration
current
Prior art date
Application number
PCT/CN2015/071367
Other languages
English (en)
French (fr)
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 MX2015003748A priority Critical patent/MX356378B/es
Priority to RU2015113734A priority patent/RU2637474C2/ru
Priority to KR1020157009919A priority patent/KR101706359B1/ko
Priority to BR112015008641A priority patent/BR112015008641A2/pt
Priority to JP2016544717A priority patent/JP6134074B2/ja
Priority to US14/696,486 priority patent/US9588805B2/en
Publication of WO2016029642A1 publication Critical patent/WO2016029642A1/zh

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
    • G06F9/4806Task transfer initiation or dispatching
    • G06F9/4843Task transfer initiation or dispatching by program, e.g. task dispatcher, supervisor, operating system
    • G06F9/485Task life-cycle, e.g. stopping, restarting, resuming execution
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/46Multiprogramming arrangements
    • G06F9/50Allocation of resources, e.g. of the central processing unit [CPU]
    • G06F9/5005Allocation of resources, e.g. of the central processing unit [CPU] to service a request
    • G06F9/5011Allocation of resources, e.g. of the central processing unit [CPU] to service a request the resources being hardware resources other than CPUs, Servers and Terminals
    • G06F9/5022Mechanisms to release resources
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/44Arrangements for executing specific programs

Definitions

  • the present disclosure relates to the field of terminal devices, and in particular, to a method, an apparatus, and a terminal device for controlling a background application.
  • the method for controlling the background application in the related art is: setting a maximum threshold, and the terminal device monitors whether the number of background applications exceeds a maximum threshold. If the number of background applications is less than or equal to a maximum threshold, the background application is allowed to maintain the background running state; When the number of background applications is greater than the maximum threshold, the background application that consumes the most memory is ended.
  • the maximum threshold is 25, and if the number of background applications is 24, the background application is allowed to remain in the background running state; if the number of background applications is 26, the background application that occupies the largest memory is ended to release the memory.
  • the above method it is only determined whether to end a certain background application according to whether the number of background applications exceeds the maximum threshold.
  • the background application is larger than the maximum threshold, the background application that occupies the largest memory is ended, and the maximum memory is occupied.
  • the background application may be that the user wants to keep running in the background, and ending these background applications will affect the user experience. Therefore, the above method does not well control the background application of the terminal device and affects the user experience.
  • the present disclosure provides a method, an apparatus, and a terminal device for controlling a background application.
  • a method for controlling a background application includes:
  • the traversed identifier is a current identifier, and determining whether the application corresponding to the current identifier is a background application;
  • the application corresponding to the current identifier is a background application, determining whether the current identifier is saved in the preset whitelist, and whether the number of identifiers of the corresponding application in the program list is the background application exceeds a preset threshold, where the whitelist saves the identifier of the background application specified by the user;
  • the corresponding application is selected from the program list as an identifier of the background application, and the application corresponding to the selected identifier is closed. program;
  • the step of establishing a program list according to an application running in an operating system includes:
  • the running state priority is sorted from high to low to foreground, visible, perceptible, and background;
  • the application's identity is ranked in descending order of the application's operating state priority, resulting in a list of programs.
  • the determining, by the determining, whether the application corresponding to the current identifier is a background application comprises:
  • the selecting the corresponding one from the program list include:
  • any identifier that is found is selected or the identifier that is found closest to the current identifier is selected;
  • the current identifier is selected.
  • the method further includes:
  • the application corresponding to the current identifier is closed.
  • the method further includes:
  • the inactive duration exceeds the second preset duration
  • the memory occupied by the user interface in the application corresponding to the current identifier is released, and the second preset duration is less than the first preset duration.
  • the method further includes:
  • the inactivity duration of the application corresponding to the current identifier is obtained;
  • the memory occupied by the user interface in the application corresponding to the current identifier is released.
  • the fifth possible implementation of the first aspect, or the sixth possible implementation of the first aspect in a seventh possible implementation of the first aspect includes:
  • the duration of the statistics is determined as the inactivity duration of the application corresponding to the current identifier.
  • a control device for a background application comprising:
  • a establishing unit configured to establish a program list according to an application running in the operating system, where the program list at least saves an identifier of an application running in the operating system;
  • a traversing unit for traversing an identifier in the program list
  • a first determining unit configured to traverse the identifier into a current identifier, and determine whether the application corresponding to the current identifier is a background application
  • a second determining unit configured to: when the application corresponding to the current identifier is a background application, determine whether the current identifier is saved in the preset whitelist, and the corresponding application in the program list is a background application Whether the number of identifiers exceeds a preset threshold, and the whitelist stores the identifier of the background application specified by the user;
  • a first closing unit configured to: when the current identifier is saved in the whitelist, and the number exceeds the preset threshold, select a corresponding application from the program list as an identifier of a background application, Close the application corresponding to the selected identifier; when the current identifier is not saved in the whitelist and the number exceeds the preset threshold, the application is closed.
  • the application corresponding to the current identifier when the current identifier is saved in the whitelist, and the number exceeds the preset threshold, select a corresponding application from the program list as an identifier of a background application, Close the application corresponding to the selected identifier; when the current identifier is not saved in the whitelist and the number exceeds the preset threshold, the application is closed. The application corresponding to the current identifier.
  • the establishing unit includes:
  • a computing sub-unit for calculating a running state priority of each application running in the operating system, the running state priority being sorted from high to low as foreground, visible, perceptible, and background;
  • a sort subunit that arranges the application's identity in descending order of the application's running state priority to get a list of programs.
  • the first determining unit includes:
  • Obtaining a subunit configured to obtain an operating state priority of an application corresponding to the current identifier
  • a first determining subunit configured to determine, when the running state priority of the application corresponding to the current identifier is the background, the application corresponding to the current identifier is a background application.
  • the first closing unit includes:
  • Searching a subunit configured to search, in the program list, an identifier that is located before the current identifier and that is not saved in the whitelist;
  • Selecting a subunit configured to: when any at least one identifier that is not saved in the whitelist and that is not saved in the whitelist is found, select any identifier that is found or select a identifier that is closest to the current identifier. When the identifier that is located before the current identifier and is not saved in the whitelist is not found, the current identifier is selected.
  • the device further includes:
  • a first obtaining unit configured to: when the current identifier is saved in the whitelist, and the number does not exceed the preset threshold, obtain an inactivity duration of the application corresponding to the current identifier;
  • a third determining unit configured to determine whether the inactivity duration exceeds a first preset duration
  • the second closing unit is configured to close the application corresponding to the current identifier when the inactive duration exceeds the first preset duration.
  • the device further includes:
  • a detecting unit configured to detect whether the inactivity duration exceeds a second preset duration when the inactive duration does not exceed the first preset duration
  • a first release unit configured to release, when the inactive duration exceeds the second preset duration, a memory occupied by a user interface in an application corresponding to the current identifier, where the second preset duration is less than The first preset duration is described.
  • the device further includes:
  • a second acquiring unit configured to: when the current identifier is not saved in the whitelist, and the number does not exceed the preset threshold When the value is obtained, obtaining an inactivity duration of the application corresponding to the current identifier;
  • a fourth determining unit configured to determine whether the inactivity duration exceeds a third preset duration
  • the second release unit is configured to release the memory occupied by the user interface in the application corresponding to the current identifier when the inactivity duration exceeds the third preset duration.
  • the first obtaining unit and the second obtaining unit include:
  • a statistic sub-unit configured to count the duration of the process of the application corresponding to the current identifier not interacting with other processes in the operating system
  • a second determining subunit configured to determine a duration of the statistic as an inactivity duration of the application corresponding to the current identifier.
  • a terminal device including:
  • Memory for storing processor executable instructions:
  • processor is configured to:
  • the traversed identifier is a current identifier, and determining whether the application corresponding to the current identifier is a background application;
  • the application corresponding to the current identifier is a background application, determining whether the current identifier is saved in the preset whitelist, and whether the number of identifiers of the corresponding application in the program list is the background application exceeds a preset threshold, where the whitelist saves the identifier of the background application specified by the user;
  • the corresponding application is selected from the program list as an identifier of the background application, and the application corresponding to the selected identifier is closed. program;
  • the technical solution provided by the embodiment of the present disclosure may include the following beneficial effects: when determining the background application to be closed, the terminal device not only considers whether the number of background applications exceeds a preset threshold, but also needs to consider whether the identifier of the background application is It is saved in the preset whitelist.
  • the whitelist saves the identifier of the background application specified by the user.
  • the background application corresponding to the identifier in these whitelists is the user who does not want to close, for the current traversal ID:
  • a background application is selected and closed;
  • the current identifier is not saved in the whitelist and the number of background applications exceeds the preset threshold , close the current standard
  • FIG. 1 is a flowchart of a method for controlling a background application according to an exemplary embodiment.
  • FIG. 2 is a flowchart of another method for controlling a background application according to an exemplary embodiment.
  • FIG. 3 is a block diagram of a control device of a background application, according to an exemplary embodiment.
  • FIG. 4 is a block diagram of a terminal device according to an exemplary embodiment.
  • FIG. 1 is a flowchart of a method for controlling a background application according to an exemplary embodiment. As shown in FIG. 1 , the method is used in a terminal device, and includes the following steps.
  • step S11 a program list is created based on the application running in the operating system.
  • the operating system is usually installed on the terminal device. Android, Windows, IOS, etc. are commonly used. Many applications are usually installed on the terminal to meet the various needs of users. Users also install the applications they need. These applications need to be run in the operating system of the terminal device, so when controlling the background application, you can first create a list of programs based on the running application in the operating system, and save the identity of the running application in the operating system. In the program list, the identity of the application can be, but is not limited to, the name of the application, the icon, and the like.
  • the program list can save the ID of the running application in the operating system, the time of the last activation, the priority of the running status, etc., and at least the identifier of the running application in the operating system.
  • step S12 the identification in the program list is traversed.
  • step S13 the traversed identifier is the current identifier, and it is determined whether the application corresponding to the current identifier is a background. Use the program.
  • the identifier in the program list may be traversed, and the identifier traversed is the current identifier. Since the present invention controls the background application, it may first determine whether the application corresponding to the current identifier is a background application.
  • step S14 it is determined whether the current whitelist is saved in the preset whitelist, and whether the number of the corresponding application in the program list is the background application exceeds the pre-predetermined number. Set the threshold.
  • step S12 is performed.
  • the whitelist saves the identifier of the background application specified by the user, that is, the identifier of the background application that the user does not want to close.
  • the background application specified by the user is QQ, WeChat, Fetion, Baidu map, etc., in the white list. You can save the logo of QQ, WeChat, Fetion, Baidu map and other applications.
  • the preset threshold can be set according to the hardware configuration and actual needs of the terminal device, for example, it can be set to 10, 20, 25, and the like.
  • step S15 When the current identifier is saved in the white list and the number exceeds the preset threshold, in step S15, the corresponding application is selected as an identifier of the background application from the program list, and the application corresponding to the selected identifier is closed.
  • a background application may be selected and the selection may be closed. Background application.
  • step S16 the application corresponding to the current identifier is closed.
  • the application corresponding to the current identifier may be directly closed, because the current identifier is not saved in the whitelist. That is to say, the application corresponding to the current identifier is not a background application specified by the user, so it can be directly closed, thereby saving memory resources and improving the user experience.
  • step S12 is performed.
  • the terminal device when determining the background application to be closed, not only considers whether the number of background applications exceeds a preset threshold, but also needs to consider whether the identifier of the background application is saved in a preset white list, and the white list.
  • the identifier of the background application specified by the user is saved, that is, the background application corresponding to the identifier in the white list is that the user does not want to be closed.
  • the current identifier is saved in the white list and the background is saved.
  • a background application is selected and closed.
  • the application corresponding to the current identifier is closed. It will easily close the user-specified background application, which is the largest and possibly user-specified background application compared to the related technology. The way to better control the background application and enhance the user experience.
  • the step of establishing a program list according to an application running in the operating system in S11 includes:
  • the application's identity is ranked in descending order of the application's operating state priority, resulting in a list of programs.
  • the terminal device can calculate the running state priority of each application running in the operating system, and then run according to the application.
  • the state priority ranks the application's identity in descending order, resulting in a list of programs.
  • the terminal device can set a cycle to calculate the operating state priority of each application running in the operating system, and the setting period can be Set according to actual needs, for example, set to 30 seconds, 45 seconds, 60 seconds, and so on.
  • the step of determining, in S13, whether the application corresponding to the current identifier is a background application comprises:
  • the background application can be determined according to the running state priority of the application corresponding to the current identifier, and the application whose operating state priority is the background is determined. For the background application.
  • the step of selecting the corresponding application as an identifier of the background application from the program list in S15 includes:
  • any identifier that is found is selected or the identifier that is found closest to the current identifier is selected;
  • the current identifier is selected.
  • the corresponding application As an identifier of the background application in the program list, you can first find the identifier in the program list that is not saved in the whitelist before the current identifier, that is, first find a background application that is not specified by the user. If at least one identifier is found, the selected identifier may be selected or the closest identifier of the current identifier may be selected; if not, the background application corresponding to the identifier before the current identifier is the background specified by the user. Application, select the current ID.
  • the method further includes:
  • the inactivity duration of the application corresponding to the current identifier is obtained.
  • the application corresponding to the current identifier is closed.
  • the inactivity duration of the application corresponding to the current identifier may also be obtained, if the inactivity duration exceeds the first pre- If the duration is long, the application corresponding to the current identifier can be directly closed. That is, even if the current identifier is saved in the whitelist and the number does not exceed the preset threshold, the application corresponding to the current identifier is inactive for a long time. , can also be closed.
  • the first preset duration can be set according to actual needs, for example, can be set to 3 minutes, 5 minutes, 10 minutes, and the like.
  • the user turns to the background running state after using it. If the inactivity time is longer than 10 minutes, although the QQ identifier is saved in the whitelist, the QQ can be closed to save memory resources.
  • the method further includes:
  • the memory occupied by the user interface in the application corresponding to the current identifier is released, and the second preset duration is less than the first preset duration.
  • the second preset duration is less than the first preset duration. If the duration is exceeded, the second preset duration is longer than the first preset duration.
  • the memory occupied by the user interface in the application corresponding to the current identifier; if not exceeded, the next identifier in the program list may be traversed.
  • the second preset duration can be set according to actual needs, for example, can be set to 3 minutes, 5 minutes, 10 minutes, and the like.
  • the user turns to the background running state after using it. If the inactivity time exceeds 5 minutes, although the QQ identifier is saved in the whitelist, the memory occupied by the QQ user interface can still be released to save. Memory resources.
  • An application generally consists of two parts: logic code and a user interface (UI).
  • the UI usually includes elements such as images, animations, etc. Normally, both parts are stored in memory.
  • the UI is mainly the application components (Acts), and the Activities is the container for the UI of the application. Since the logic code occupies less memory, the logic code of the application is not destroyed in the present invention, but the memory occupied by the UI of the application whose inactivity time exceeds the second preset duration is released, thereby saving a large amount of memory.
  • the UI can be automatically rebuilt without affecting the user's use because the logic code of the application is saved.
  • the method further includes:
  • the inactivity duration of the application corresponding to the current identifier is obtained.
  • the memory occupied by the user interface in the application corresponding to the current identifier is released.
  • the inactivity duration of the application corresponding to the current identifier may also be obtained, if the inactivity duration exceeds the The three preset durations can release the memory occupied by the user interface in the application corresponding to the current identifier.
  • the third preset duration can be set according to actual needs, for example, can be set to 3 minutes, 5 minutes, 10 minutes, and the like.
  • the user turns to the background running state after using it. If the inactivity time exceeds 5 minutes, since the identifier of the calculator is not saved in the white list, the memory occupied by the calculator's user interface can be released to save. Memory resources.
  • the step of obtaining the inactive duration of the application corresponding to the current identifier includes:
  • the duration of the statistics is determined as the inactivity duration of the application corresponding to the current identifier.
  • the inactive state of the application refers to a state in which the application's process does not interact with other processes in the operating system.
  • the interaction may include sending a data request, responding to a data request sent by another process, a communication request, and the like.
  • FIG. 2 is a flowchart of another method for controlling a background application according to an exemplary embodiment. As shown in FIG. 2, the method is used in a terminal device, and includes the following steps.
  • step S21 the operational status priority of each application running in the operating system is calculated.
  • the application's running state priority is sorted from high to low to foreground, visible, perceptible, and background.
  • Different operating systems may have different methods for calculating the running state priority of an application.
  • the operating state priority of the application may be calculated through an Activity Manager Service.
  • step S22 the identification of the application is arranged in descending order of the operating state priorities of the application, and a program list is obtained.
  • the identity of the application can be, but is not limited to, the name of the application, the icon, and the like.
  • step S23 the identification in the program list is traversed.
  • control process of the background application is the same each time the traversal is identifiable.
  • step S24 the traversed identifier is the current identifier, and the running state priority of the application corresponding to the current identifier is obtained.
  • step S25 the application corresponding to the current identifier is the background application, and S26 is executed.
  • step S26 it is determined whether the current identifier is saved in the preset whitelist.
  • the whitelist saves the identifier of the background application specified by the user, that is, the identifier of the background application that the user does not want to close.
  • the background application specified by the user is QQ, WeChat, Fetion, Baidu map, etc., in the white list. You can save the logo of QQ, WeChat, Fetion, Baidu map and other applications.
  • step S27 it is determined whether the corresponding application in the program list is the number of identifiers of the background application exceeds a preset threshold.
  • the preset threshold can be set according to the hardware configuration and actual needs of the terminal device, for example, it can be set to 10, 20, 25, and the like.
  • step S28 the identifier in the program list that is located before the current identifier and is not saved in the white list is searched for.
  • step S29 When at least one of the identifiers is found, in step S29, any of the found identifiers or the found identifiers closest to the current identifier are selected, and S31 is performed.
  • step S30 the current identification is selected, and S31 is executed.
  • step S31 the application corresponding to the selected identifier is closed, and S40 is executed.
  • step S32 the inactivity duration of the application corresponding to the current identifier is obtained.
  • step S33 the application corresponding to the current identifier is closed, and S40 is executed.
  • the inactivity duration of the application corresponding to the current identifier may also be obtained, if the inactivity duration exceeds the first pre- If the duration is long, the application corresponding to the current identifier can be directly closed. That is, even if the current identifier is saved in the whitelist and the number does not exceed the preset threshold, the application corresponding to the current identifier is inactive for a long time. , can also be closed.
  • the first preset duration can be set according to actual needs, for example, can be set to 3 minutes, 5 minutes, 10 minutes, and the like.
  • the user turns to the background running state after using it. If the inactivity time is longer than 10 minutes, although the QQ identifier is saved in the whitelist, the QQ can be closed to save memory resources.
  • step S34 it is detected whether the inactivity duration exceeds the second preset duration.
  • step S35 the memory occupied by the user interface in the application corresponding to the current identifier is released, and S40 is performed.
  • the second preset duration is less than the first preset duration. If the duration is exceeded, the second preset duration is longer than the first preset duration.
  • the memory occupied by the user interface in the application corresponding to the current identifier; if not exceeded, the next identifier in the program list may be traversed.
  • the second preset duration can be set according to actual needs, for example, can be set to 3 minutes, 5 minutes, 10 minutes, and the like.
  • step S36 it is determined whether the corresponding application in the program list is the number of identifiers of the background application exceeds a preset threshold.
  • step S37 the application corresponding to the current identifier is closed, and S40 is executed.
  • the application corresponding to the current identifier may be directly closed, because the current identifier is not saved in the whitelist. That is to say, the application corresponding to the current identifier is not a background application specified by the user, so it can be directly closed, thereby saving memory resources and improving the user experience.
  • step S38 the inactivity duration of the application corresponding to the current identifier is obtained, and it is determined whether the inactivity duration exceeds the third preset duration.
  • step S39 the memory occupied by the user interface in the application corresponding to the current identifier is released, and S40 is performed.
  • the inactivity duration of the application corresponding to the current identifier may also be obtained, if the inactivity duration exceeds the The three preset durations can release the memory occupied by the user interface in the application corresponding to the current identifier.
  • the third preset duration can be set according to actual needs, for example, can be set to 3 minutes, 5 minutes, 10 minutes, and the like.
  • the user turns to the background running state after using it. If the inactivity time exceeds 5 minutes, since the identifier of the calculator is not saved in the white list, the memory occupied by the calculator's user interface can be released to save. Memory resources.
  • step S40 it ends.
  • FIG. 3 is a block diagram of a control device of a background application according to an exemplary embodiment.
  • the apparatus includes an establishing unit 31, a traversing unit 32, a first determining unit 33, a second determining unit 34, and a first closing unit 35.
  • the establishing unit 31 is configured to establish a program list based on an application running in the operating system, at least the identifier of the running application in the operating system is stored in the program list.
  • the traversal unit 32 is configured to traverse the identification in the program list.
  • the first determining unit 33 is configured to determine whether the application corresponding to the current identifier is a background application, and the identifier that is traversed is the current identifier.
  • the second determining unit 34 is configured to: when the application corresponding to the current identifier is a background application, determine whether the current identifier is saved in the preset whitelist, and the corresponding application in the program list is the identifier of the background application. Whether the number exceeds the preset threshold, and the whitelist saves the identifier of the background application specified by the user.
  • the first closing unit 35 is configured to: when the current identifier is saved in the white list and the number exceeds a preset threshold, select a corresponding application from the program list as an identifier of the background application, and close the selected identifier. The application is closed; when the current identifier is not saved in the whitelist and the number exceeds a preset threshold, the application corresponding to the current identifier is closed.
  • the terminal device when determining the background application to be closed, not only considers whether the number of background applications exceeds a preset threshold, but also needs to consider whether the identifier of the background application is saved in a preset white list, and the white list.
  • the identifier of the background application specified by the user is saved, that is, the background application corresponding to the identifier in the white list is that the user does not want to be closed.
  • the current identifier is saved in the white list and the background is saved.
  • a background application is selected and closed.
  • the application corresponding to the current identifier is closed.
  • the user-specified background application can be easily closed, and the background application can be better controlled and the user experience can be improved as compared with the related art method of ending the largest memory and possibly a user-specified background application.
  • the establishing unit 31 includes a calculating subunit and a sorting subunit.
  • the computing sub-unit is configured to calculate a running state priority of each application running in the operating system, and the running state priority is sorted from high to low to foreground, visible, perceptible, and background.
  • the sorting subunit is configured to arrange the identification of the application in descending order of priority of the application's operating state to obtain a list of programs.
  • the first determining unit 33 includes an obtaining subunit and a first determining subunit.
  • the obtaining subunit is configured to obtain an operating state priority of an application corresponding to the current identifier.
  • the first determining subunit is configured to determine that the application corresponding to the current identifier is a background application when the running state priority of the application corresponding to the current identifier is the background.
  • the first closing unit 35 includes a searching subunit and a selecting subunit.
  • the lookup subunit is configured to look in the program list for an identifier that is not in front of the current identity and that is not saved in the whitelist.
  • the selecting sub-unit is configured to: when at least one identifier that is not saved in the white list before the current identifier is found, select any identifier that is found or select the identifier that is found closest to the current identifier; when not found Select the current ID when it is located before the current ID and is not saved in the whitelist.
  • the device further includes a first acquiring unit, a third determining unit, and a second closing unit.
  • the first obtaining unit is configured to obtain an inactivity duration of the application corresponding to the current identifier when the current identifier is saved in the whitelist and the number does not exceed the preset threshold.
  • the third determining unit is configured to determine whether the inactivity duration exceeds the first preset duration.
  • the second closing unit is configured to close the application corresponding to the current identifier when the inactivity time exceeds the first preset duration.
  • the device further includes a detecting unit and a first releasing unit.
  • the detecting unit is configured to detect whether the inactive duration exceeds the second preset duration when the inactive duration does not exceed the first preset duration.
  • the first release unit is configured to release the memory occupied by the user interface in the application corresponding to the current identifier when the inactive duration exceeds the second preset duration, and the second preset duration is less than the first preset duration.
  • the device further includes a second obtaining unit, a fourth determining unit and a second releasing unit.
  • the second obtaining unit is configured to obtain an inactivity duration of the application corresponding to the current identifier when the current identifier is not saved in the whitelist and the number does not exceed the preset threshold.
  • the fourth determining unit is configured to determine whether the inactivity duration exceeds a third preset duration.
  • the second release unit is configured to release the memory occupied by the user interface in the application corresponding to the current identifier when the inactivity time exceeds the third preset duration.
  • the first obtaining unit and the second obtaining unit comprise a statistical subunit and a second determining subunit.
  • the statistic subunit is configured to count the duration of the process of the application corresponding to the current identifier not interacting with other processes in the operating system.
  • the second determining subunit is configured to determine the duration of the statistics as the inactivity duration of the application corresponding to the current identifier.
  • FIG. 4 is a block diagram of a control apparatus 800 for a background application, according to an exemplary embodiment.
  • device 800 can be a mobile phone, a computer, a digital broadcast terminal, a messaging device, a game console, a tablet device, Medical equipment, fitness equipment, personal digital assistants, etc.
  • apparatus 800 can include one or more of the following components: processing component 802, memory 804, power component 806, multimedia component 808, audio component 810, input/output (I/O) interface 812, sensor component 814, And a communication component 816.
  • Processing component 802 typically controls the overall operation of device 800, such as operations associated with display, telephone calls, data communications, camera operations, and recording operations.
  • Processing component 802 can include one or more processors 820 to execute instructions to perform all or part of the steps of the above described methods.
  • processing component 802 can include one or more modules to facilitate interaction between component 802 and other components.
  • processing component 802 can include a multimedia module to facilitate interaction between multimedia component 808 and processing component 802.
  • Memory 804 is configured to store various types of data to support operation at device 800. Examples of such data include instructions for any application or method operating on device 800, contact data, phone book data, messages, pictures, videos, and the like.
  • the memory 804 can be implemented by any type of volatile or non-volatile storage device, or a combination thereof, such as static random access memory (SRAM), electrically erasable programmable read only memory (EEPROM), erasable.
  • SRAM static random access memory
  • EEPROM electrically erasable programmable read only memory
  • EPROM Electrically erasable programmable read only memory
  • PROM Programmable Read Only Memory
  • ROM Read Only Memory
  • Magnetic Memory Flash Memory
  • Disk Disk or Optical Disk.
  • Power component 806 provides power to various components of device 800.
  • Power component 806 can include a power control system, one or more power sources, and other components associated with generating, controlling, and distributing power for device 800.
  • the multimedia component 808 includes a screen between the device 800 and the user that provides an output interface.
  • the screen can include a liquid crystal display (LCD) and a touch panel (TP). If the screen includes a touch panel, the screen can be implemented as a touch screen to receive input signals from the user.
  • the touch panel includes one or more touch sensors to sense touches, slides, and gestures on the touch panel. The touch sensor may sense not only the boundary of the touch or sliding action, but also the duration and pressure associated with the touch or slide operation.
  • the multimedia component 808 includes a front camera and/or a rear camera. When the device 800 is in an operation mode, such as a shooting mode or a video mode, the front camera and/or the rear camera can receive external multimedia data. Each front and rear camera can be a fixed optical lens system or have focal length and optical zoom capabilities.
  • the audio component 810 is configured to output and/or input an audio signal.
  • the audio component 810 includes a microphone (MIC) that is configured to receive an external audio signal when the device 800 is in an operational mode, such as a call mode, a recording mode, and a voice recognition mode.
  • the received audio signal may be further stored in memory 804 or transmitted via communication component 816.
  • the audio component 810 also includes a speaker for outputting an audio signal.
  • the I/O interface 812 provides an interface between the processing component 802 and the peripheral interface module, which may be a keyboard, a click wheel, a button, or the like. These buttons may include, but are not limited to, a home button, a volume button, a start button, and a lock button.
  • Sensor assembly 814 includes one or more sensors for providing device 800 with a status assessment of various aspects.
  • sensor component 814 can detect an open/end state of device 800, a relative positioning of components, such as the display and keypad of device 800, and sensor component 814 can also detect a change in position of one component of device 800 or device 800. The presence or absence of user contact with device 800, device 800 orientation or acceleration/deceleration, and temperature variation of device 800.
  • Sensor assembly 814 can include a proximity sensor configured to detect the presence of nearby objects without any physical contact.
  • Sensor assembly 814 may also include a light sensor, such as a CMOS or CCD image sensor, for use in imaging applications.
  • the sensor assembly 814 can also include an acceleration sensor, a gyro sensor, a magnetic sensor, a pressure sensor, or a temperature sensor.
  • Communication component 816 is configured to facilitate wired or wireless communication between device 800 and other devices.
  • the device 800 can access a wireless network based on a communication standard, such as WiFi, 2G or 3G, or a combination thereof.
  • communication component 816 receives broadcast signals or broadcast associated information from an external broadcast control system via a broadcast channel.
  • the communication component 816 also includes a near field communication (NFC) module to facilitate short range communication.
  • NFC near field communication
  • the NFC module can be implemented based on radio frequency identification (RFID) technology, infrared data association (IrDA) technology, ultra-wideband (UWB) technology, Bluetooth (BT) technology, and other technologies.
  • RFID radio frequency identification
  • IrDA infrared data association
  • UWB ultra-wideband
  • Bluetooth Bluetooth
  • device 800 may be implemented by one or more application specific integrated circuits (ASICs), digital signal processors (DSPs), digital signal processing devices (DSPDs), programmable logic devices (PLDs), field programmable A gate array (FPGA), controller, microcontroller, microprocessor, or other electronic component implementation for performing the above methods.
  • ASICs application specific integrated circuits
  • DSPs digital signal processors
  • DSPDs digital signal processing devices
  • PLDs programmable logic devices
  • FPGA field programmable A gate array
  • controller microcontroller, microprocessor, or other electronic component implementation for performing the above methods.
  • non-transitory computer readable storage medium comprising instructions, such as a memory 804 comprising instructions executable by processor 820 of apparatus 800 to perform the above method.
  • the non-transitory computer readable storage medium may be a ROM, a random access memory (RAM), a CD-ROM, a magnetic tape, a floppy disk, and an optical data storage device.
  • a non-transitory computer readable storage medium when the instructions in the storage medium are executed by a processor of the terminal device, enabling the terminal device to perform a control method of the background application, the method comprising:
  • the traversed identifier is a current identifier, and determining whether the application corresponding to the current identifier is a background application;
  • the application corresponding to the current identifier is a background application, determining whether the current identifier is saved in the preset whitelist, and whether the number of identifiers of the corresponding application in the program list is the background application exceeds a preset threshold, where the whitelist saves the identifier of the background application specified by the user;

Abstract

本公开是关于一种后台应用程序的控制方法、装置及终端设备,该方法包括:根据操作系统中正在运行的应用程序建立程序列表;遍历程序列表中的标识;遍历到的标识为当前标识,确定当前标识对应的应用程序是否为后台应用程序;当当前标识对应的应用程序为后台应用程序时,确定预设的白名单中是否保存当前标识、以及程序列表中对应的应用程序为后台应用程序的标识的个数是否超过预设阈值;当白名单中保存当前标识且个数超过预设阈值时,从程序列表中选取对应的应用程序为后台应用程序的一个标识,关闭选取的标识对应的应用程序;当白名单中未保存当前标识且个数超过预设阈值时,关闭当前标识对应的应用程序。该方案能够更好地控制后台应用程序。

Description

后台应用程序的控制方法、装置及终端设备
相关申请的交叉引用
本申请基于申请号为201410436455.8、申请日为2014年8月29日的中国专利申请提出,并要求该中国专利申请的优先权,该中国专利申请的全部内容在此引入本申请作为参考。
技术领域
本公开涉及终端设备技术领域,尤其涉及一种后台应用程序的控制方法、装置及终端设备。
背景技术
随着终端设备朝着智能化的方向发展,应用程序(Application,APP)越来越多,用户享受到了终端设备智能化带来的便捷。用户在使用终端设备时,习惯将一些常用应用程序一直保持后台运行状态,常用应用程序包括微博、微信、QQ等等,终端设备上保持后台运行状态的应用程序可以称为后台应用程序,当后台应程序数量较少时,占用终端设备的内存资源也较少;当后台应用程序数量较多时,占用终端设备的内存资源也较多,会影响终端设备的处理速度,因此,如何控制终端设备的后台应用程序变得非常重要。
相关技术中控制后台应用程序的方法是:设置最大阈值,终端设备监控后台应用程序的数量是否超过最大阈值,若后台应用程序的数量小于或等于最大阈值,允许后台应用程序保持后台运行状态;若后台应用程序的数量大于最大阈值,则会结束占用内存最大的后台应用程序。例如,最大阈值为25,若后台应用程序的数量为24,则允许后台应用程序保持后台运行状态;若后台应用程序的数量为26,则会结束占用内存最大的后台应用程序,以释放内存。
上述方法中,仅仅是根据后台应用程序的数量是否超过最大阈值来确定是否要结束某个后台应用程序,在后台应用程序大于最大阈值时,会结束占用内存最大的后台应用程序,而占用内存最大的后台应用程序可能是用户希望一直保持后台运行状态的,结束这些后台应用程序会影响用户体验。因此,上述方法并不能很好地控制终端设备的后台应用程序,影响用户体验。
发明内容
为克服相关技术中存在的问题,本公开提供一种后台应用程序的控制方法、装置及终端设备。
根据本公开实施例的第一方面,提供一种后台应用程序的控制方法,包括:
根据操作系统中正在运行的应用程序建立程序列表,所述程序列表中至少保存有所述操作系统中正在运行的应用程序的标识;
遍历所述程序列表中的标识;
遍历到的标识为当前标识,确定所述当前标识对应的应用程序是否为后台应用程序;
当所述当前标识对应的应用程序为后台应用程序时,确定预设的白名单中是否保存所述当前标识、以及所述程序列表中对应的应用程序为后台应用程序的标识的个数是否超过预设阈值,所述白名单中保存的是用户指定的后台应用程序的标识;
当所述白名单中保存所述当前标识且所述个数超过所述预设阈值时,从所述程序列表中选取对应的应用程序为后台应用程序的一个标识,关闭选取的标识对应的应用程序;
当所述白名单中未保存所述当前标识且所述个数超过所述预设阈值时,关闭所述当前标识对应的应用程序。
结合第一方面,在第一方面的第一种可能的实现方式中,所述根据操作系统中正在运行的应用程序建立程序列表的步骤包括:
计算操作系统中正在运行的每个应用程序的运行状态优先级,所述运行状态优先级由高到低排序为前台、可见、可感知、后台;
按照应用程序的运行状态优先级由高到低的顺序排列应用程序的标识,得到程序列表。
结合第一方面的第一种可能的实现方式,在第一方面的第二种可能的实现方式中,所述确定所述当前标识对应的应用程序是否为后台应用程序的步骤包括:
获取所述当前标识对应的应用程序的运行状态优先级;
当所述当前标识对应的应用程序的运行状态优先级为后台时,确定所述当前标识对应的应用程序为后台应用程序。
结合第一方面的第一种可能的实现方式或者第一方面的第二种可能的实现方式,在第一方面的第三种可能的实现方式中,所述从所述程序列表中选取对应的应用程序为后台应用程序的一个标识的步骤包括:
在所述程序列表中查找位于所述当前标识之前且所述白名单中未保存的标识;
当查找到至少一个位于所述当前标识之前且所述白名单中未保存的标识时,选取查找到的任一标识或者选取查找到的距离所述当前标识最近的标识;
当未查找到位于所述当前标识之前且所述白名单中未保存的标识时,选取所述当前标识。
结合第一方面,在第一方面的第四种可能的实现方式中,所述方法还包括:
当所述白名单中保存所述当前标识且所述个数未超过所述预设阈值时,获取所述当前标 识对应的应用程序的不活跃时长;
确定所述不活跃时长是否超过第一预设时长;
当所述不活跃时长超过所述第一预设时长时,关闭所述当前标识对应的应用程序。
结合第一方面的第四种可能的实现方式中,在第一方面的第五种可能的实现方式中,所述方法还包括:
当所述不活跃时长未超过所述第一预设时长时,检测所述不活跃时长是否超过第二预设时长;
当所述不活跃时长超过所述第二预设时长时,释放所述当前标识对应的应用程序中的用户界面所占用的内存,所述第二预设时长小于所述第一预设时长。
结合第一方面,在第一方面的第六种可能的实现方式中,所述方法还包括:
当所述白名单中未保存所述当前标识且所述个数未超过所述预设阈值时,获取所述当前标识对应的应用程序的不活跃时长;
确定所述不活跃时长是否超过第三预设时长;
当所述不活跃时长超过所述第三预设时长时,释放所述当前标识对应的应用程序中的用户界面所占用的内存。
结合第一方面的第四种可能的实现方式、第一方面的第五种可能的实现方式或者第一方面的第六种可能的实现方式,在第一方面的第七种可能的实现方式中,所述获取所述当前标识对应的应用程序的不活跃时长的步骤包括:
统计所述当前标识对应的应用程序的进程未与所述操作系统中其他进程交互的时长;
将统计的时长确定为所述当前标识对应的应用程序的不活跃时长。
根据本公开实施例的第二方面,提供一种后台应用程序的控制装置,包括:
建立单元,用于根据操作系统中正在运行的应用程序建立程序列表,所述程序列表中至少保存有所述操作系统中正在运行的应用程序的标识;
遍历单元,用于遍历所述程序列表中的标识;
第一确定单元,用于遍历到的标识为当前标识,确定所述当前标识对应的应用程序是否为后台应用程序;
第二确定单元,用于当所述当前标识对应的应用程序为后台应用程序时,确定预设的白名单中是否保存所述当前标识、以及所述程序列表中对应的应用程序为后台应用程序的标识的个数是否超过预设阈值,所述白名单中保存的是用户指定的后台应用程序的标识;
第一关闭单元,用于当所述白名单中保存所述当前标识且所述个数超过所述预设阈值时,从所述程序列表中选取对应的应用程序为后台应用程序的一个标识,关闭选取的标识对应的应用程序;当所述白名单中未保存所述当前标识且所述个数超过所述预设阈值时,关闭 所述当前标识对应的应用程序。
结合第二方面,在第二方面的第一种可能的实现方式中,所述建立单元包括:
计算子单元,用于计算操作系统中正在运行的每个应用程序的运行状态优先级,所述运行状态优先级由高到低排序为前台、可见、可感知、后台;
排序子单元,用于按照应用程序的运行状态优先级由高到低的顺序排列应用程序的标识,得到程序列表。
结合第二方面的第一种可能的实现方式,在第二方面的第二种可能的实现方式中,所述第一确定单元包括:
获取子单元,用于获取所述当前标识对应的应用程序的运行状态优先级;
第一确定子单元,用于当所述当前标识对应的应用程序的运行状态优先级为后台时,确定所述当前标识对应的应用程序为后台应用程序。
结合第二方面的第一种可能的实现方式或者第二方面的第二种可能的实现方式,在第二方面的第三种可能的实现方式中,所述第一关闭单元包括:
查找子单元,用于在所述程序列表中查找位于所述当前标识之前且所述白名单中未保存的标识;
选取子单元,用于当查找到至少一个位于所述当前标识之前且所述白名单中未保存的标识时,选取查找到的任一标识或者选取查找到的距离所述当前标识最近的标识;当未查找到位于所述当前标识之前且所述白名单中未保存的标识时,选取所述当前标识。
结合第二方面,在第二方面的第四种可能的实现方式中,所述装置还包括:
第一获取单元,用于当所述白名单中保存所述当前标识且所述个数未超过所述预设阈值时,获取所述当前标识对应的应用程序的不活跃时长;
第三确定单元,用于确定所述不活跃时长是否超过第一预设时长;
第二关闭单元,用于当所述不活跃时长超过所述第一预设时长时,关闭所述当前标识对应的应用程序。
结合第二方面的第四种可能的实现方式中,在第二方面的第五种可能的实现方式中,所述装置还包括:
检测单元,用于当所述不活跃时长未超过所述第一预设时长时,检测所述不活跃时长是否超过第二预设时长;
第一释放单元,用于当所述不活跃时长超过所述第二预设时长时,释放所述当前标识对应的应用程序中的用户界面所占用的内存,所述第二预设时长小于所述第一预设时长。
结合第二方面,在第二方面的第六种可能的实现方式中,所述装置还包括:
第二获取单元,用于当所述白名单中未保存所述当前标识且所述个数未超过所述预设阈 值时,获取所述当前标识对应的应用程序的不活跃时长;
第四确定单元,用于确定所述不活跃时长是否超过第三预设时长;
第二释放单元,用于当所述不活跃时长超过所述第三预设时长时,释放所述当前标识对应的应用程序中的用户界面所占用的内存。
结合第二方面的第四种可能的实现方式、第二方面的第五种可能的实现方式或者第二方面的第六种可能的实现方式,在第二方面的第七种可能的实现方式中,所述第一获取单元和所述第二获取单元包括:
统计子单元,用于统计所述当前标识对应的应用程序的进程未与所述操作系统中其他进程交互的时长;
第二确定子单元,用于将统计的时长确定为所述当前标识对应的应用程序的不活跃时长。
根据本公开实施例的第三方面,提供一种终端设备,包括:
处理器;
用于存储处理器可执行指令的存储器:
其中,所述处理器被配置为:
根据操作系统中正在运行的应用程序建立程序列表,所述程序列表中至少保存有所述操作系统中正在运行的应用程序的标识;
遍历所述程序列表中的标识;
遍历到的标识为当前标识,确定所述当前标识对应的应用程序是否为后台应用程序;
当所述当前标识对应的应用程序为后台应用程序时,确定预设的白名单中是否保存所述当前标识、以及所述程序列表中对应的应用程序为后台应用程序的标识的个数是否超过预设阈值,所述白名单中保存的是用户指定的后台应用程序的标识;
当所述白名单中保存所述当前标识且所述个数超过所述预设阈值时,从所述程序列表中选取对应的应用程序为后台应用程序的一个标识,关闭选取的标识对应的应用程序;
当所述白名单中未保存所述当前标识且所述个数超过所述预设阈值时,关闭所述当前标识对应的应用程序。
本公开的实施例提供的技术方案可以包括以下有益效果:终端设备在确定要关闭的后台应用程序时,不仅考虑后台应用程序的数量是否超过预设阈值,还需要考虑该后台应用程序的标识是否保存在预设的白名单中,白名单中保存的是用户指定的后台应用程序的标识,也就是说这些白名单中的标识对应的后台应用程序是用户不希望关闭的,对于遍历到的当前标识,当白名单中保存当前标识且后台应用程序的个数超过预设阈值时,选取一个后台应用程序并关闭;当白名单中未保存当前标识且后台应用程序的个数超过预设阈值时,关闭当前标 识对应的应用程序,由于不会轻易关闭用户指定的后台应用程序,相对于相关技术中结束占用内存最大且可能是用户指定的后台应用程序的方法,能够更好地控制后台应用程序,提升用户体验。
应当理解的是,以上的一般描述和后文的细节描述仅是示例性和解释性的,并不能限制本公开。
附图说明
此处的附图被并入说明书中并构成本说明书的一部分,示出了符合本发明的实施例,并与说明书一起用于解释本发明的原理。
图1是根据一示例性实施例示出的一种后台应用程序的控制方法的流程图。
图2是根据一示例性实施例示出的另一种后台应用程序的控制方法的流程图。
图3是根据一示例性实施例示出的一种后台应用程序的控制装置的框图。
图4是根据一示例性实施例示出的一种终端设备的框图。
具体实施方式
这里将详细地对示例性实施例进行说明,其示例表示在附图中。下面的描述涉及附图时,除非另有表示,不同附图中的相同数字表示相同或相似的要素。以下示例性实施例中所描述的实施方式并不代表与本发明相一致的所有实施方式。相反,它们仅是与如所附权利要求书中所详述的、本发明的一些方面相一致的装置和方法的例子。
图1是根据一示例性实施例示出的一种后台应用程序的控制方法的流程图,如图1所示,该方法用于终端设备中,包括以下步骤。
在步骤S11中,根据操作系统中正在运行的应用程序建立程序列表。
终端设备上通常会安装操作系统,常用的有安卓系统、Windows系统、IOS系统等等;终端设备上通常还会安装很多应用程序来满足用户的各种需求,用户也会安装自己需要的应用程序,这些应用程序需要在终端设备的操作系统中才能运行,因此在控制后台应用程序时,可以首先根据操作系统中正在运行的应用程序建立程序列表,将操作系统中正在运行的应用程序的标识保存在程序列表中,应用程序的标识可以但不限于是应用程序的名称、图标等等信息。
程序列表中可以保存操作系统中正在运行的应用程序的标识、上一次被激活的时间、运行状态优先级等信息,至少保存有操作系统中正在运行的应用程序的标识。
在步骤S12中,遍历程序列表中的标识。
在步骤S13中,遍历到的标识为当前标识,确定当前标识对应的应用程序是否为后台应 用程序。
可以遍历程序列表中的标识,遍历到的标识为当前标识,由于本发明是对后台应用程序进行控制,因此,可以首先确定当前标识对应的应用程序是否是后台应用程序。
当当前标识对应的应用程序为后台应用程序时,在步骤S14中,确定预设的白名单中是否保存当前标识、以及程序列表中对应的应用程序为后台应用程序的标识的个数是否超过预设阈值。
当当前标识对应的应用程序不为后台应用程序时,执行步骤S12。
白名单中保存的是用户指定的后台应用程序的标识,即用户不希望关闭的后台应用程序的标识,例如,用户指定的后台应用程序为QQ、微信、飞信、百度地图等等,白名单中可以保存QQ、微信、飞信、百度地图等等应用程序的标识。
预设阈值可以根据终端设备的硬件配置和实际需要进行设定,例如可以设置为10个、20个、25个等等。
当白名单中保存当前标识且所述个数超过预设阈值时,在步骤S15中,从程序列表中选取对应的应用程序为后台应用程序的一个标识,关闭选取的标识对应的应用程序。
若白名单中保存当前标识且程序列表中对应的应用程序为后台应用程序的标识的个数超过预设阈值,为了保证操作系统的正常运行和用户体验,可以选取一个后台应用程序,并关闭选取的后台应用程序。
当白名单中未保存当前标识且所述个数超过预设阈值时,在步骤S16中,关闭当前标识对应的应用程序。
若白名单中未保存当前标识且程序列表中对应的应用程序为后台应用程序的标识的个数超过预设阈值,可以直接关闭当前标识对应的应用程序,由于白名单中未保存当前标识,也就是说当前标识对应的应用程序不是用户指定的后台应用程序,因此可以直接关闭,从而节省内存资源,提升用户体验。
当白名单中保存当前标识且所述个数未超过预设阈值时,以及当白名单中未保存当前标识且所述个数未超过预设阈值时,执行步骤S12。
该方案中,终端设备在确定要关闭的后台应用程序时,不仅考虑后台应用程序的数量是否超过预设阈值,还需要考虑该后台应用程序的标识是否保存在预设的白名单中,白名单中保存的是用户指定的后台应用程序的标识,也就是说这些白名单中的标识对应的后台应用程序是用户不希望关闭的,对于遍历到的当前标识,当白名单中保存当前标识且后台应用程序的个数超过预设阈值时,选取一个后台应用程序并关闭;当白名单中未保存当前标识且后台应用程序的个数超过预设阈值时,关闭当前标识对应的应用程序,由于不会轻易关闭用户指定的后台应用程序,相对于相关技术中结束占用内存最大且可能是用户指定的后台应用程序 的方法,能够更好地控制后台应用程序,提升用户体验。
可选的,在S11中根据操作系统中正在运行的应用程序建立程序列表的步骤包括:
计算操作系统中正在运行的每个应用程序的运行状态优先级;
按照应用程序的运行状态优先级由高到低的顺序排列应用程序的标识,得到程序列表。
通常应用程序的运行状态优先级由高到低排序为前台、可见、可感知、后台,因此终端设备可以计算操作系统中正在运行的每个应用程序的运行状态优先级,然后按照应用程序的运行状态优先级由高到低的顺序排列应用程序的标识,从而得到程序列表。
这里仅仅是列举了一种程序列表的建立方法,还有其它多种方法建立程序列表,例如还可以按照应用程序的运行状态优先级由低到高的顺序排列应用程序的标识,从而得到程序列表,其它建立程序列表的方法这里不再一一说明。
由于操作系统中正在运行的应用程序在短时间内变化比较小,因此,为了节省资源,终端设备可以设定周期计算操作系统中正在运行的每个应用程序的运行状态优先级,设定周期可以根据实际需要进行设定,例如,设置为30秒、45秒、60秒等等。
可选的,在S13中确定当前标识对应的应用程序是否为后台应用程序的步骤包括:
获取当前标识对应的应用程序的运行状态优先级;
当当前标识对应的应用程序的运行状态优先级为后台时,确定当前标识对应的应用程序为后台应用程序。
由于终端设备可以计算操作系统中正在运行的应用程序的运行状态优先级,因此可以根据当前标识对应的应用程序的运行状态优先级来确定后台应用程序,即将运行状态优先级为后台的应用程序确定为后台应用程序。
可选的,在S15中从程序列表中选取对应的应用程序为后台应用程序的一个标识的步骤包括:
在程序列表中查找位于当前标识之前且白名单中未保存的标识;
当查找到至少一个位于当前标识之前且白名单中未保存的标识时,选取查找到的任一标识或者选取查找到的距离当前标识最近的标识;
当未查找到位于当前标识之前且白名单中未保存的标识时,选取当前标识。
在程序列表中选取对应的应用程序为后台应用程序的一个标识时,可以首先在程序列表中查找位于当前标识之前且白名单中未保存的标识,也就是首先查找一个用户未指定的后台应用程序,若查找到至少一个标识,就可以选取查找到的任一标识或者选取查找到的距离当前标识最近的标识;若未查找,即当前标识之前的标识对应的后台应用程序都是用户指定的后台应用程序,则选取当前标识。
可选的,所述方法还包括:
当白名单中保存当前标识且所述个数未超过预设阈值时,获取当前标识对应的应用程序的不活跃时长;
确定不活跃时长是否超过第一预设时长;
当不活跃时长超过第一预设时长时,关闭当前标识对应的应用程序。
为了避免内存资源的浪费,对于白名单中保存当前标识且所述个数未超过预设阈值的情况,还可以获取当前标识对应的应用程序的不活跃时长,如果该不活跃时长超过第一预设时长,就可以直接关闭当前标识对应的应用程序,也就是说,即使白名单中保存当前标识且所述个数未超过预设阈值,在当前标识对应的应用程序长时间不活跃的情况下,也可以关闭。第一预设时长可以根据实际需要进行设定,例如可以设定为3分钟、5分钟、10分钟等等。
例如,对于QQ,用户在使用完之后转为后台运行状态,若不活跃时长超过10分钟,虽然白名单中保存了QQ的标识,但是仍可以关闭QQ,以节省内存资源。
可选的,所述方法还包括:
当不活跃时长未超过第一预设时长时,检测不活跃时长是否超过第二预设时长;
当不活跃时长超过第二预设时长时,释放当前标识对应的应用程序中的用户界面所占用的内存,第二预设时长小于第一预设时长。
继续沿用上例,当不活跃时长未超过第一预设时长时,还可以继续检测不活跃时长是否超过第二预设时长,第二预设时长要小于第一预设时长,若超过,释放当前标识对应的应用程序中的用户界面所占用的内存;若未超过,可以遍历程序列表中的下一个标识。第二预设时长可以根据实际需要进行设定,例如可以设定为3分钟、5分钟、10分钟等等。
例如,例如,对于QQ,用户在使用完之后转为后台运行状态,若不活跃时长超过5分钟,虽然白名单中保存了QQ的标识,但是仍可以释放QQ的用户界面占用的内存,以节省内存资源。
应用程序一般包括两部分:逻辑代码和用户界面(User Interface,UI),UI通常包括图片、动画等元素,正常情况下这两部分都会存储在内存中。在安卓系统,UI主要是应用组件(Activities),Activities是用于存放应用程序的UI的容器。由于逻辑代码占用内存较小,因此在本发明中不销毁应用程序的逻辑代码,而是释放不活跃时长超过第二预设时长的应用程序的UI占用的内存,从而可以节省大量内存,当该应用程序的运行状态变为前台时,由于保存了应用程序的逻辑代码,可以自动重建UI,不影响用户使用。
可选的,所述方法还包括:
当白名单中未保存当前标识且所述个数未超过预设阈值时,获取当前标识对应的应用程序的不活跃时长;
确定不活跃时长是否超过第三预设时长;
当不活跃时长超过第三预设时长时,释放当前标识对应的应用程序中的用户界面所占用的内存。
相应地,为了节省内存资源,对于白名单中未保存当前标识且所述个数未超过预设阈值的情况,还可以获取当前标识对应的应用程序的不活跃时长,如果该不活跃时长超过第三预设时长,就可以释放当前标识对应的应用程序中的用户界面所占用的内存。
第三预设时长可以根据实际需要进行设定,例如可以设定为3分钟、5分钟、10分钟等等。
例如,对于计算器,用户在使用完之后转为后台运行状态,若不活跃时长超过5分钟,由于白名单中未保存计算器的标识,可以释放计算器的用户界面所占用的内存,以节省内存资源。
可选的,上述获取当前标识对应的应用程序的不活跃时长的步骤包括:
统计当前标识对应的应用程序的进程未与操作系统中其他进程交互的时长;
将统计的时长确定为当前标识对应的应用程序的不活跃时长。
应用程序的不活跃状态是指应用程序的进程未与操作系统中其他进程交互的状态,交互可以包括发送数据请求、响应其他进程发送的数据请求、通信请求等。可以通过统计当前标识对应的应用程序的进程未与操作系统中其他进程交互的时长,得到当前标识对应的应用程序的不活跃时长。
图2是根据一示例性实施例示出的另一种后台应用程序的控制方法的流程图,如图2所示,该方法用于终端设备中,包括以下步骤。
在步骤S21中,计算操作系统中正在运行的每个应用程序的运行状态优先级。
通常应用程序的运行状态优先级由高到低排序为前台、可见、可感知、后台。不同的操作系统计算应用程序的运行状态优先级的方法可能不同,以安卓系统为例,可以通过组件管理服务(Activity Manager Service)计算应用程序的运行状态优先级。
在步骤S22中,按照应用程序的运行状态优先级由高到低的顺序排列应用程序的标识,得到程序列表。
这里仅仅是列举了一种程序列表的建立方法,还有其它多种方法建立程序列表,例如还可以按照应用程序的运行状态优先级由低到高的顺序排列应用程序的标识,从而得到程序列表,其它建立程序列表的方法这里不再一一说明。
应用程序的标识可以但不限于是应用程序的名称、图标等等信息。
在步骤S23中,遍历程序列表中的标识。
每次遍历到标识时进行后台应用程序的控制过程是相同的,下面以遍历到的一个标识为例进行说明。
在步骤S24中,遍历到的标识为当前标识,获取当前标识对应的应用程序的运行状态优先级。
当当前标识对应的应用程序的运行状态优先级为后台时,在步骤S25中,当前标识对应的应用程序为后台应用程序,执行S26。
当当前标识对应的应用程序的运行状态优先级不为后台时,执行S40。
在步骤S26中,确定预设的白名单中是否保存当前标识。
白名单中保存的是用户指定的后台应用程序的标识,即用户不希望关闭的后台应用程序的标识,例如,用户指定的后台应用程序为QQ、微信、飞信、百度地图等等,白名单中可以保存QQ、微信、飞信、百度地图等等应用程序的标识。
当白名单中保存当前标识时,在步骤S27中,确定程序列表中对应的应用程序为后台应用程序的标识的个数是否超过预设阈值。
预设阈值可以根据终端设备的硬件配置和实际需要进行设定,例如可以设置为10个、20个、25个等等。
当所述个数超过预设阈值时,在步骤S28中,在程序列表中查找位于当前标识之前且白名单中未保存的标识。
当查找到至少一个时,在步骤S29中,选取查找到的任一标识或者选取查找到的距离当前标识最近的标识,执行S31。
当未查找时,在步骤S30中,选取当前标识,执行S31。
在步骤S31中,关闭选取的标识对应的应用程序,执行S40。
当所述个数未超过预设阈值时,在步骤S32中,获取当前标识对应的应用程序的不活跃时长,确定不活跃时长是否超过第一预设时长。
当不活跃时长超过第一预设时长时,在步骤S33中,关闭当前标识对应的应用程序,执行S40。
为了避免内存资源的浪费,对于白名单中保存当前标识且所述个数未超过预设阈值的情况,还可以获取当前标识对应的应用程序的不活跃时长,如果该不活跃时长超过第一预设时长,就可以直接关闭当前标识对应的应用程序,也就是说,即使白名单中保存当前标识且所述个数未超过预设阈值,在当前标识对应的应用程序长时间不活跃的情况下,也可以关闭。第一预设时长可以根据实际需要进行设定,例如可以设定为3分钟、5分钟、10分钟等等。
例如,对于QQ,用户在使用完之后转为后台运行状态,若不活跃时长超过10分钟,虽然白名单中保存了QQ的标识,但是仍可以关闭QQ,以节省内存资源。
当不活跃时长未超过第一预设时长时,在步骤S34中,检测不活跃时长是否超过第二预设时长。
当不活跃时长超过第二预设时长时,在步骤S35中,释放当前标识对应的应用程序中的用户界面所占用的内存,执行S40。
当不活跃时长不超过第二预设时长时,执行S40。
继续沿用上例,当不活跃时长未超过第一预设时长时,还可以继续检测不活跃时长是否超过第二预设时长,第二预设时长要小于第一预设时长,若超过,释放当前标识对应的应用程序中的用户界面所占用的内存;若未超过,可以遍历程序列表中的下一个标识。第二预设时长可以根据实际需要进行设定,例如可以设定为3分钟、5分钟、10分钟等等。
例如,例如,对于QQ,用户在使用完之后转为后台运行状态,若不活跃时长超过5分钟,虽然白名单中保存了QQ的标识,但是仍可以释放QQ的用户界面占用的内存,以节省内存资源。
由于释放不活跃时长超过第二预设时长的应用程序的UI占用的内存,从而可以节省大量内存,当该应用程序的运行状态变为前台时,可以自动重建UI,不影响用户使用。
当白名单中未保存当前标识时,在步骤S36中,确定程序列表中对应的应用程序为后台应用程序的标识的个数是否超过预设阈值。
当所述个数超过预设阈值时,在步骤S37中,关闭当前标识对应的应用程序,执行S40。
若白名单中未保存当前标识且程序列表中对应的应用程序为后台应用程序的标识的个数超过预设阈值,可以直接关闭当前标识对应的应用程序,由于白名单中未保存当前标识,也就是说当前标识对应的应用程序不是用户指定的后台应用程序,因此可以直接关闭,从而节省内存资源,提升用户体验。
当所述个数未超过预设阈值时,在步骤S38中,获取当前标识对应的应用程序的不活跃时长,确定不活跃时长是否超过第三预设时长。
当不活跃时长超过第三预设时长时,在步骤S39中,释放当前标识对应的应用程序中的用户界面所占用的内存,执行S40。
当不活跃时长不超过第三预设时长时,执行S40。
相应地,为了节省内存资源,对于白名单中未保存当前标识且所述个数未超过预设阈值的情况,还可以获取当前标识对应的应用程序的不活跃时长,如果该不活跃时长超过第三预设时长,就可以释放当前标识对应的应用程序中的用户界面所占用的内存。
第三预设时长可以根据实际需要进行设定,例如可以设定为3分钟、5分钟、10分钟等等。
例如,对于计算器,用户在使用完之后转为后台运行状态,若不活跃时长超过5分钟,由于白名单中未保存计算器的标识,可以释放计算器的用户界面所占用的内存,以节省内存资源。
在步骤S40中,结束。
图3是根据一示例性实施例示出的一种后台应用程序的控制装置框图。参照图3,该装置包括建立单元31,遍历单元32,第一确定单元33,第二确定单元34和第一关闭单元35。
该建立单元31被配置为,根据操作系统中正在运行的应用程序建立程序列表,程序列表中至少保存有操作系统中正在运行的应用程序的标识。
该遍历单元32被配置为,遍历程序列表中的标识。
该第一确定单元33被配置为,遍历到的标识为当前标识,确定当前标识对应的应用程序是否为后台应用程序。
该第二确定单元34被配置为,当当前标识对应的应用程序为后台应用程序时,确定预设的白名单中是否保存当前标识、以及程序列表中对应的应用程序为后台应用程序的标识的个数是否超过预设阈值,白名单中保存的是用户指定的后台应用程序的标识。
该第一关闭单元35被配置为,当白名单中保存当前标识且所述个数超过预设阈值时,从程序列表中选取对应的应用程序为后台应用程序的一个标识,关闭选取的标识对应的应用程序;当白名单中未保存当前标识且所述个数超过预设阈值时,关闭当前标识对应的应用程序。
该方案中,终端设备在确定要关闭的后台应用程序时,不仅考虑后台应用程序的数量是否超过预设阈值,还需要考虑该后台应用程序的标识是否保存在预设的白名单中,白名单中保存的是用户指定的后台应用程序的标识,也就是说这些白名单中的标识对应的后台应用程序是用户不希望关闭的,对于遍历到的当前标识,当白名单中保存当前标识且后台应用程序的个数超过预设阈值时,选取一个后台应用程序并关闭;当白名单中未保存当前标识且后台应用程序的个数超过预设阈值时,关闭当前标识对应的应用程序,由于不会轻易关闭用户指定的后台应用程序,相对于相关技术中结束占用内存最大且可能是用户指定的后台应用程序的方法,能够更好地控制后台应用程序,提升用户体验。
可选的,建立单元31包括计算子单元和排序子单元。
该计算子单元被配置为,计算操作系统中正在运行的每个应用程序的运行状态优先级,运行状态优先级由高到低排序为前台、可见、可感知、后台。
该排序子单元被配置为,按照应用程序的运行状态优先级由高到低的顺序排列应用程序的标识,得到程序列表。
可选的,第一确定单元33包括获取子单元和第一确定子单元。
该获取子单元被配置为,获取当前标识对应的应用程序的运行状态优先级。
该第一确定子单元被配置为,当当前标识对应的应用程序的运行状态优先级为后台时,确定当前标识对应的应用程序为后台应用程序。
可选的,第一关闭单元35包括查找子单元和选取子单元。
该查找子单元被配置为,在程序列表中查找位于当前标识之前且白名单中未保存的标识。
该选取子单元被配置为,当查找到至少一个位于当前标识之前且白名单中未保存的标识时,选取查找到的任一标识或者选取查找到的距离当前标识最近的标识;当未查找到位于当前标识之前且白名单中未保存的标识时,选取当前标识。
可选的,所述装置还包括第一获取单元,第三确定单元和第二关闭单元。
该第一获取单元被配置为,当白名单中保存当前标识且所述个数未超过预设阈值时,获取当前标识对应的应用程序的不活跃时长。
该第三确定单元被配置为,确定不活跃时长是否超过第一预设时长。
该第二关闭单元被配置为,当不活跃时长超过第一预设时长时,关闭当前标识对应的应用程序。
可选的,所述装置还包括检测单元和第一释放单元。
该检测单元被配置为,当不活跃时长未超过第一预设时长时,检测不活跃时长是否超过第二预设时长。
该第一释放单元被配置为,当不活跃时长超过第二预设时长时,释放当前标识对应的应用程序中的用户界面所占用的内存,第二预设时长小于第一预设时长。
可选的,所述装置还包括第二获取单元,第四确定单元和第二释放单元。
该第二获取单元被配置为,当白名单中未保存当前标识且所述个数未超过预设阈值时,获取当前标识对应的应用程序的不活跃时长。
该第四确定单元被配置为,确定不活跃时长是否超过第三预设时长。
该第二释放单元被配置为,当不活跃时长超过第三预设时长时,释放当前标识对应的应用程序中的用户界面所占用的内存。
可选的,第一获取单元和第二获取单元包括统计子单元和第二确定子单元。
该统计子单元被配置为,统计当前标识对应的应用程序的进程未与操作系统中其他进程交互的时长。
该第二确定子单元被配置为,将统计的时长确定为当前标识对应的应用程序的不活跃时长。
关于上述实施例中的装置,其中各个模块执行操作的具体方式已经在有关该方法的实施例中进行了详细描述,此处将不做详细阐述说明。
图4是根据一示例性实施例示出的一种用于后台应用程序的控制装置800的框图。例如,装置800可以是移动电话,计算机,数字广播终端,消息收发设备,游戏控制台,平板设备, 医疗设备,健身设备,个人数字助理等。
参照图4,装置800可以包括以下一个或多个组件:处理组件802,存储器804,电源组件806,多媒体组件808,音频组件810,输入/输出(I/O)的接口812,传感器组件814,以及通信组件816。
处理组件802通常控制装置800的整体操作,诸如与显示,电话呼叫,数据通信,相机操作和记录操作相关联的操作。处理组件802可以包括一个或多个处理器820来执行指令,以完成上述的方法的全部或部分步骤。此外,处理组件802可以包括一个或多个模块,便于处理组件802和其他组件之间的交互。例如,处理组件802可以包括多媒体模块,以方便多媒体组件808和处理组件802之间的交互。
存储器804被配置为存储各种类型的数据以支持在装置800的操作。这些数据的示例包括用于在装置800上操作的任何应用程序或方法的指令,联系人数据,电话簿数据,消息,图片,视频等。存储器804可以由任何类型的易失性或非易失性存储设备或者它们的组合实现,如静态随机存取存储器(SRAM),电可擦除可编程只读存储器(EEPROM),可擦除可编程只读存储器(EPROM),可编程只读存储器(PROM),只读存储器(ROM),磁存储器,快闪存储器,磁盘或光盘。
电源组件806为装置800的各种组件提供电力。电源组件806可以包括电源控制系统,一个或多个电源,及其他与为装置800生成、控制和分配电力相关联的组件。
多媒体组件808包括在所述装置800和用户之间的提供一个输出接口的屏幕。在一些实施例中,屏幕可以包括液晶显示器(LCD)和触摸面板(TP)。如果屏幕包括触摸面板,屏幕可以被实现为触摸屏,以接收来自用户的输入信号。触摸面板包括一个或多个触摸传感器以感测触摸、滑动和触摸面板上的手势。所述触摸传感器可以不仅感测触摸或滑动动作的边界,而且还检测与所述触摸或滑动操作相关的持续时间和压力。在一些实施例中,多媒体组件808包括一个前置摄像头和/或后置摄像头。当装置800处于操作模式,如拍摄模式或视频模式时,前置摄像头和/或后置摄像头可以接收外部的多媒体数据。每个前置摄像头和后置摄像头可以是一个固定的光学透镜系统或具有焦距和光学变焦能力。
音频组件810被配置为输出和/或输入音频信号。例如,音频组件810包括一个麦克风(MIC),当装置800处于操作模式,如呼叫模式、记录模式和语音识别模式时,麦克风被配置为接收外部音频信号。所接收的音频信号可以被进一步存储在存储器804或经由通信组件816发送。在一些实施例中,音频组件810还包括一个扬声器,用于输出音频信号。
I/O接口812为处理组件802和外围接口模块之间提供接口,上述外围接口模块可以是键盘,点击轮,按钮等。这些按钮可包括但不限于:主页按钮、音量按钮、启动按钮和锁定按钮。
传感器组件814包括一个或多个传感器,用于为装置800提供各个方面的状态评估。例如,传感器组件814可以检测到装置800的打开/结束状态,组件的相对定位,例如所述组件为装置800的显示器和小键盘,传感器组件814还可以检测装置800或装置800一个组件的位置改变,用户与装置800接触的存在或不存在,装置800方位或加速/减速和装置800的温度变化。传感器组件814可以包括接近传感器,被配置用来在没有任何的物理接触时检测附近物体的存在。传感器组件814还可以包括光传感器,如CMOS或CCD图像传感器,用于在成像应用中使用。在一些实施例中,该传感器组件814还可以包括加速度传感器,陀螺仪传感器,磁传感器,压力传感器或温度传感器。
通信组件816被配置为便于装置800和其他设备之间有线或无线方式的通信。装置800可以接入基于通信标准的无线网络,如WiFi,2G或3G,或它们的组合。在一个示例性实施例中,通信组件816经由广播信道接收来自外部广播控制系统的广播信号或广播相关信息。在一个示例性实施例中,所述通信组件816还包括近场通信(NFC)模块,以促进短程通信。例如,在NFC模块可基于射频识别(RFID)技术,红外数据协会(IrDA)技术,超宽带(UWB)技术,蓝牙(BT)技术和其他技术来实现。
在示例性实施例中,装置800可以被一个或多个应用专用集成电路(ASIC)、数字信号处理器(DSP)、数字信号处理设备(DSPD)、可编程逻辑器件(PLD)、现场可编程门阵列(FPGA)、控制器、微控制器、微处理器或其他电子元件实现,用于执行上述方法。
在示例性实施例中,还提供了一种包括指令的非临时性计算机可读存储介质,例如包括指令的存储器804,上述指令可由装置800的处理器820执行以完成上述方法。例如,所述非临时性计算机可读存储介质可以是ROM、随机存取存储器(RAM)、CD-ROM、磁带、软盘和光数据存储设备等。
一种非临时性计算机可读存储介质,当所述存储介质中的指令由终端设备的处理器执行时,使得终端设备能够执行一种后台应用程序的控制方法,所述方法包括:
根据操作系统中正在运行的应用程序建立程序列表,所述程序列表中至少保存有所述操作系统中正在运行的应用程序的标识;
遍历所述程序列表中的标识;
遍历到的标识为当前标识,确定所述当前标识对应的应用程序是否为后台应用程序;
当所述当前标识对应的应用程序为后台应用程序时,确定预设的白名单中是否保存所述当前标识、以及所述程序列表中对应的应用程序为后台应用程序的标识的个数是否超过预设阈值,所述白名单中保存的是用户指定的后台应用程序的标识;
当所述白名单中保存所述当前标识且所述个数超过所述预设阈值时,从所述程序列表中选取对应的应用程序为后台应用程序的一个标识,关闭选取的标识对应的应用程序;
当所述白名单中未保存所述当前标识且所述个数超过所述预设阈值时,关闭所述当前标识对应的应用程序。
本领域技术人员在考虑说明书及实践这里公开的发明后,将容易想到本发明的其它实施方案。本申请旨在涵盖本发明的任何变型、用途或者适应性变化,这些变型、用途或者适应性变化遵循本发明的一般性原理并包括本公开未公开的本技术领域中的公知常识或惯用技术手段。说明书和实施例仅被视为示例性的,本发明的真正范围和精神由下面的权利要求指出。
应当理解的是,本发明并不局限于上面已经描述并在附图中示出的精确结构,并且可以在不脱离其范围进行各种修改和改变。本发明的范围仅由所附的权利要求来限制。

Claims (17)

  1. 一种后台应用程序的控制方法,其特征在于,包括:
    根据操作系统中正在运行的应用程序建立程序列表,所述程序列表中至少保存有所述操作系统中正在运行的应用程序的标识;
    遍历所述程序列表中的标识;
    遍历到的标识为当前标识,确定所述当前标识对应的应用程序是否为后台应用程序;
    当所述当前标识对应的应用程序为后台应用程序时,确定预设的白名单中是否保存所述当前标识、以及所述程序列表中对应的应用程序为后台应用程序的标识的个数是否超过预设阈值,所述白名单中保存的是用户指定的后台应用程序的标识;
    当所述白名单中保存所述当前标识且所述个数超过所述预设阈值时,从所述程序列表中选取对应的应用程序为后台应用程序的一个标识,关闭选取的标识对应的应用程序;
    当所述白名单中未保存所述当前标识且所述个数超过所述预设阈值时,关闭所述当前标识对应的应用程序。
  2. 根据权利要求1所述的方法,其特征在于,所述根据操作系统中正在运行的应用程序建立程序列表的步骤包括:
    计算操作系统中正在运行的每个应用程序的运行状态优先级,所述运行状态优先级由高到低排序为前台、可见、可感知、后台;
    按照应用程序的运行状态优先级由高到低的顺序排列应用程序的标识,得到程序列表。
  3. 根据权利要求2所述的方法,其特征在于,所述确定所述当前标识对应的应用程序是否为后台应用程序的步骤包括:
    获取所述当前标识对应的应用程序的运行状态优先级;
    当所述当前标识对应的应用程序的运行状态优先级为后台时,确定所述当前标识对应的应用程序为后台应用程序。
  4. 根据权利要求2或3所述的方法,其特征在于,所述从所述程序列表中选取对应的应用程序为后台应用程序的一个标识的步骤包括:
    在所述程序列表中查找位于所述当前标识之前且所述白名单中未保存的标识;
    当查找到至少一个位于所述当前标识之前且所述白名单中未保存的标识时,选取查找到的任一标识或者选取查找到的距离所述当前标识最近的标识;
    当未查找到位于所述当前标识之前且所述白名单中未保存的标识时,选取所述当前标识。
  5. 根据权利要求1所述的方法,其特征在于,所述方法还包括:
    当所述白名单中保存所述当前标识且所述个数未超过所述预设阈值时,获取所述当前标识对应的应用程序的不活跃时长;
    确定所述不活跃时长是否超过第一预设时长;
    当所述不活跃时长超过所述第一预设时长时,关闭所述当前标识对应的应用程序。
  6. 根据权利要求5所述的方法,其特征在于,所述方法还包括:
    当所述不活跃时长未超过所述第一预设时长时,检测所述不活跃时长是否超过第二预设时长;
    当所述不活跃时长超过所述第二预设时长时,释放所述当前标识对应的应用程序中的用户界面所占用的内存,所述第二预设时长小于所述第一预设时长。
  7. 根据权利要求1所述的方法,其特征在于,所述方法还包括:
    当所述白名单中未保存所述当前标识且所述个数未超过所述预设阈值时,获取所述当前标识对应的应用程序的不活跃时长;
    确定所述不活跃时长是否超过第三预设时长;
    当所述不活跃时长超过所述第三预设时长时,释放所述当前标识对应的应用程序中的用户界面所占用的内存。
  8. 根据权利要求5-7任一权利要求所述的方法,其特征在于,所述获取所述当前标识对应的应用程序的不活跃时长的步骤包括:
    统计所述当前标识对应的应用程序的进程未与所述操作系统中其他进程交互的时长;
    将统计的时长确定为所述当前标识对应的应用程序的不活跃时长。
  9. 一种后台应用程序的控制装置,其特征在于,包括:
    建立单元,用于根据操作系统中正在运行的应用程序建立程序列表,所述程序列表中至少保存有所述操作系统中正在运行的应用程序的标识;
    遍历单元,用于遍历所述程序列表中的标识;
    第一确定单元,用于遍历到的标识为当前标识,确定所述当前标识对应的应用程序是否为后台应用程序;
    第二确定单元,用于当所述当前标识对应的应用程序为后台应用程序时,确定预设的白名单中是否保存所述当前标识、以及所述程序列表中对应的应用程序为后台应用程序的标识的个数是否超过预设阈值,所述白名单中保存的是用户指定的后台应用程序的标识;
    第一关闭单元,用于当所述白名单中保存所述当前标识且所述个数超过所述预设阈值时,从所述程序列表中选取对应的应用程序为后台应用程序的一个标识,关闭选取的标识对应的应用程序;当所述白名单中未保存所述当前标识且所述个数超过所述预设阈值时,关闭所述当前标识对应的应用程序。
  10. 根据权利要求9所述的装置,其特征在于,所述建立单元包括:
    计算子单元,用于计算操作系统中正在运行的每个应用程序的运行状态优先级,所述运行状态优先级由高到低排序为前台、可见、可感知、后台;
    排序子单元,用于按照应用程序的运行状态优先级由高到低的顺序排列应用程序的标识,得到程序列表。
  11. 根据权利要求10所述的装置,其特征在于,所述第一确定单元包括:
    获取子单元,用于获取所述当前标识对应的应用程序的运行状态优先级;
    第一确定子单元,用于当所述当前标识对应的应用程序的运行状态优先级为后台时,确定所述当前标识对应的应用程序为后台应用程序。
  12. 根据权利要求10或11所述的装置,其特征在于,所述第一关闭单元包括:
    查找子单元,用于在所述程序列表中查找位于所述当前标识之前且所述白名单中未保存的标识;
    选取子单元,用于当查找到至少一个位于所述当前标识之前且所述白名单中未保存的标识时,选取查找到的任一标识或者选取查找到的距离所述当前标识最近的标识;当未查找到位于所述当前标识之前且所述白名单中未保存的标识时,选取所述当前标识。
  13. 根据权利要求9所述的装置,其特征在于,所述装置还包括:
    第一获取单元,用于当所述白名单中保存所述当前标识且所述个数未超过所述预设阈值时,获取所述当前标识对应的应用程序的不活跃时长;
    第三确定单元,用于确定所述不活跃时长是否超过第一预设时长;
    第二关闭单元,用于当所述不活跃时长超过所述第一预设时长时,关闭所述当前标识对应的应用程序。
  14. 根据权利要求13所述的装置,其特征在于,所述装置还包括:
    检测单元,用于当所述不活跃时长未超过所述第一预设时长时,检测所述不活跃时长是否超过第二预设时长;
    第一释放单元,用于当所述不活跃时长超过所述第二预设时长时,释放所述当前标识对应的应用程序中的用户界面所占用的内存,所述第二预设时长小于所述第一预设时长。
  15. 根据权利要求9所述的装置,其特征在于,所述装置还包括:
    第二获取单元,用于当所述白名单中未保存所述当前标识且所述个数未超过所述预设阈值时,获取所述当前标识对应的应用程序的不活跃时长;
    第四确定单元,用于确定所述不活跃时长是否超过第三预设时长;
    第二释放单元,用于当所述不活跃时长超过所述第三预设时长时,释放所述当前标识对应的应用程序中的用户界面所占用的内存。
  16. 根据权利要求13-15任一权利要求所述的装置,其特征在于,所述第一获取单元和所述第二获取单元包括:
    统计子单元,用于统计所述当前标识对应的应用程序的进程未与所述操作系统中其他进程交互的时长;
    第二确定子单元,用于将统计的时长确定为所述当前标识对应的应用程序的不活跃时长。
  17. 一种终端设备,其特征在于,包括:
    处理器;
    用于存储处理器可执行指令的存储器:
    其中,所述处理器被配置为:
    根据操作系统中正在运行的应用程序建立程序列表,所述程序列表中至少保存有所述操作系统中正在运行的应用程序的标识;
    遍历所述程序列表中的标识;
    遍历到的标识为当前标识,确定所述当前标识对应的应用程序是否为后台应用程序;
    当所述当前标识对应的应用程序为后台应用程序时,确定预设的白名单中是否保存所述当前标识、以及所述程序列表中对应的应用程序为后台应用程序的标识的个数是否超过预设阈值,所述白名单中保存的是用户指定的后台应用程序的标识;
    当所述白名单中保存所述当前标识且所述个数超过所述预设阈值时,从所述程序列表中选取对应的应用程序为后台应用程序的一个标识,关闭选取的标识对应的应用程序;
    当所述白名单中未保存所述当前标识且所述个数超过所述预设阈值时,关闭所述当前标识对应的应用程序。
PCT/CN2015/071367 2014-08-29 2015-01-22 后台应用程序的控制方法、装置及终端设备 WO2016029642A1 (zh)

Priority Applications (6)

Application Number Priority Date Filing Date Title
MX2015003748A MX356378B (es) 2014-08-29 2015-01-22 Método y dispositivo para controlar una aplicación en segundo plano y un dispositivo de terminal.
RU2015113734A RU2637474C2 (ru) 2014-08-29 2015-01-22 Способ и устройство для управления фоновым приложением и терминальным устройством
KR1020157009919A KR101706359B1 (ko) 2014-08-29 2015-01-22 백그라운드 애플리케이션을 제어하기 위한 방법 및 장치
BR112015008641A BR112015008641A2 (pt) 2014-08-29 2015-01-22 método e dispositivo para controlar um aplicativo em segundo plano, e, dispositivo de terminal
JP2016544717A JP6134074B2 (ja) 2014-08-29 2015-01-22 バックグラウンドアプリケーションを制御する方法および装置ならびに端末装置
US14/696,486 US9588805B2 (en) 2014-08-29 2015-04-27 Method and terminal device for controlling background application

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
CN201410436455.8 2014-08-29
CN201410436455.8A CN104239094B (zh) 2014-08-29 2014-08-29 后台应用程序的控制方法、装置及终端设备

Related Child Applications (1)

Application Number Title Priority Date Filing Date
US14/696,486 Continuation US9588805B2 (en) 2014-08-29 2015-04-27 Method and terminal device for controlling background application

Publications (1)

Publication Number Publication Date
WO2016029642A1 true WO2016029642A1 (zh) 2016-03-03

Family

ID=52227229

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2015/071367 WO2016029642A1 (zh) 2014-08-29 2015-01-22 后台应用程序的控制方法、装置及终端设备

Country Status (9)

Country Link
US (1) US9588805B2 (zh)
EP (1) EP2993584B1 (zh)
JP (1) JP6134074B2 (zh)
KR (1) KR101706359B1 (zh)
CN (1) CN104239094B (zh)
BR (1) BR112015008641A2 (zh)
MX (1) MX356378B (zh)
RU (1) RU2637474C2 (zh)
WO (1) WO2016029642A1 (zh)

Families Citing this family (43)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP2015095219A (ja) * 2013-11-14 2015-05-18 ソニー株式会社 情報処理装置、情報処理方法および記憶媒体
CN105373419A (zh) * 2014-08-26 2016-03-02 阿里巴巴集团控股有限公司 一种后台应用的操作方法及装置
CN104239094B (zh) * 2014-08-29 2017-12-08 小米科技有限责任公司 后台应用程序的控制方法、装置及终端设备
CN104461725B (zh) * 2014-12-30 2018-05-08 小米科技有限责任公司 控制应用进程启动的方法及装置
CN105828408B (zh) * 2015-01-08 2020-12-22 中兴通讯股份有限公司 一种控制上网时间的方法和装置
CN104636144A (zh) * 2015-02-26 2015-05-20 北京数字天域科技有限责任公司 一种移动终端后台程序管理方法及装置
CN104793846A (zh) * 2015-04-27 2015-07-22 小米科技有限责任公司 应用程序的界面展示方法及装置
CN106371913A (zh) * 2015-07-21 2017-02-01 赤子城网络技术(北京)有限公司 内存清理方法及装置
CN105373405B (zh) * 2015-11-26 2019-05-10 努比亚技术有限公司 动态加载应用程序的装置及方法
CN105430726B (zh) * 2015-11-28 2018-05-29 广东欧珀移动通信有限公司 一种通信终端的载波聚合功能控制方法及通信终端
CN106855826B (zh) * 2015-12-08 2021-02-23 斑马智行网络(香港)有限公司 一种后台应用程序的控制方法及装置
CN106909407B (zh) * 2015-12-23 2020-07-03 北京金山安全软件有限公司 一种后台应用程序的关闭方法、装置及终端
CN106909447B (zh) * 2015-12-23 2019-11-15 北京金山安全软件有限公司 一种后台应用程序的处理方法、装置及终端
CN105653323B (zh) * 2015-12-28 2019-07-02 小米科技有限责任公司 应用程序管理方法及装置
CN105786520A (zh) * 2016-03-17 2016-07-20 北京百纳威尔科技有限公司 电子设备应用程序的管理方法和装置
CN105893146B (zh) * 2016-03-28 2020-01-10 北京小米移动软件有限公司 内存处理方法及装置
CN106537344A (zh) * 2016-03-30 2017-03-22 北京小米移动软件有限公司 一种应用程序调用管理的方法和装置
CN112882804A (zh) 2016-08-17 2021-06-01 华为技术有限公司 一种启动应用的方法及装置
CN106293402B (zh) * 2016-08-22 2019-11-29 珠海市魅族科技有限公司 应用程序控制方法及其装置
CN107783833B (zh) * 2016-08-25 2020-04-28 华为技术有限公司 一种终端后台应用程序的管理方法及装置
CN106650430A (zh) * 2016-12-01 2017-05-10 惠州Tcl移动通信有限公司 一种基于移动终端的应用程序状态锁定控制方法及系统
CN107066288B (zh) * 2017-01-17 2020-06-26 北京光年无限科技有限公司 一种用于智能机器人的多模态交互方法及装置
CN107045443A (zh) * 2017-04-14 2017-08-15 北京安云世纪科技有限公司 后台进程控制方法、装置及智能终端
JP6470344B2 (ja) * 2017-04-28 2019-02-13 Kddi株式会社 制御装置、制御方法、及びコンピュータプログラム
CN107894917A (zh) * 2017-11-10 2018-04-10 深圳天珑无线科技有限公司 终端及其关闭后台应用程序的方法、存储装置
CN107911831B (zh) * 2017-11-16 2022-03-01 北京小米移动软件有限公司 提醒用户更换路由器的方法、装置、设备和存储介质
CN108304525B (zh) * 2018-01-25 2022-02-11 创新先进技术有限公司 一种条件数据的确定方法及装置
CN108363591A (zh) * 2018-01-25 2018-08-03 维沃移动通信有限公司 一种推送消息控制的方法及装置
CN110489171A (zh) * 2018-05-11 2019-11-22 珠海市魅族科技有限公司 移动终端控制方法、移动终端及存储介质
KR102532696B1 (ko) * 2018-07-11 2023-05-12 주식회사 케이티 어플리케이션의 포그라운드 서비스 실행시 보안을 제공하기 위한 통신 단말 및 방법
CN109117256A (zh) * 2018-07-12 2019-01-01 维沃移动通信有限公司 一种后台应用程序的管理方法及终端
CN109688618A (zh) * 2018-11-27 2019-04-26 Oppo广东移动通信有限公司 视频处理方法、装置、电子设备及存储介质
CN109725702A (zh) 2018-12-28 2019-05-07 三星电子(中国)研发中心 一种基于ai预测的智能终端节能方法和设备
CN109862184A (zh) * 2019-01-28 2019-06-07 努比亚技术有限公司 终端及其资源管控方法、计算机可读存储介质
CN110069328B (zh) * 2019-03-25 2021-11-09 维沃移动通信有限公司 应用关闭方法及终端设备
CN110716799A (zh) * 2019-09-30 2020-01-21 深圳市九洲电器有限公司 一种应用程序管理方法及智能终端
US11561587B2 (en) 2019-10-01 2023-01-24 Microsoft Technology Licensing, Llc Camera and flashlight operation in hinged device
US11201962B2 (en) 2019-10-01 2021-12-14 Microsoft Technology Licensing, Llc Calling on a multi-display device
US11416130B2 (en) * 2019-10-01 2022-08-16 Microsoft Technology Licensing, Llc Moving applications on multi-screen computing device
KR20220038987A (ko) * 2020-09-21 2022-03-29 삼성전자주식회사 전자장치 및 그 제어방법
CN112162783B (zh) * 2020-09-27 2021-09-14 珠海格力电器股份有限公司 音乐播放应用保活处理方法、系统、存储介质及电子设备
CN115665311B (zh) * 2022-10-25 2024-02-06 北京鸿途信达科技股份有限公司 一种手机定时优化后台进程的系统优化方法
CN117667364B (zh) * 2024-02-02 2024-04-09 广东信聚丰科技股份有限公司 应用程序的管控方法及用户设备

Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN103164268A (zh) * 2013-04-02 2013-06-19 北京奇虎科技有限公司 系统优化方法及装置
CN103902335A (zh) * 2014-03-12 2014-07-02 上海天奕达电子科技有限公司 一种后台程序清理的方法及其系统
CN103914342A (zh) * 2013-01-06 2014-07-09 联想(北京)有限公司 一种电子设备程序控制方法、系统及电子设备
CN104239094A (zh) * 2014-08-29 2014-12-24 小米科技有限责任公司 后台应用程序的控制方法、装置及终端设备

Family Cites Families (13)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US8954045B2 (en) * 2006-09-29 2015-02-10 Qualcomm Incorporated Method and apparatus for managing resources at a wireless device
CN101859261B (zh) * 2010-06-09 2015-05-13 中兴通讯股份有限公司 一种释放内存的控制方法及控制设备
US8635630B2 (en) * 2010-10-25 2014-01-21 Microsoft Corporation Application lifetime management
WO2012127596A1 (ja) * 2011-03-19 2012-09-27 富士通株式会社 端末装置、プロセス管理方法、およびプロセス管理プログラム
US8886976B2 (en) * 2011-04-11 2014-11-11 Microsoft Corporation Management of background tasks
AU2012347871B2 (en) * 2011-12-06 2017-11-23 Domain Surgical Inc. System and method of controlling power delivery to a surgical instrument
US9319246B2 (en) * 2012-06-25 2016-04-19 Microsoft Technology Licensing, Llc Voice-over-internet protocol (VOIP) application platform
US20140007106A1 (en) * 2012-07-02 2014-01-02 Arnold S. Weksler Display and Terminate Running Applications
US8813177B2 (en) * 2012-07-12 2014-08-19 Microsoft Corporation Background application management
US9274832B2 (en) * 2013-02-07 2016-03-01 Htc Corporation Method and electronic device for thread scheduling
CN103164229A (zh) * 2013-04-08 2013-06-19 北京奇虎科技有限公司 一种清理移动终端进程的方法及装置
CN103220427A (zh) * 2013-04-16 2013-07-24 广东欧珀移动通信有限公司 手机后台程序清理方法及手机
US9690685B2 (en) * 2014-05-30 2017-06-27 Apple Inc. Performance management based on resource consumption

Patent Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN103914342A (zh) * 2013-01-06 2014-07-09 联想(北京)有限公司 一种电子设备程序控制方法、系统及电子设备
CN103164268A (zh) * 2013-04-02 2013-06-19 北京奇虎科技有限公司 系统优化方法及装置
CN103902335A (zh) * 2014-03-12 2014-07-02 上海天奕达电子科技有限公司 一种后台程序清理的方法及其系统
CN104239094A (zh) * 2014-08-29 2014-12-24 小米科技有限责任公司 后台应用程序的控制方法、装置及终端设备

Also Published As

Publication number Publication date
KR20160042398A (ko) 2016-04-19
CN104239094A (zh) 2014-12-24
MX356378B (es) 2018-05-25
RU2015113734A (ru) 2016-11-10
JP6134074B2 (ja) 2017-05-24
RU2637474C2 (ru) 2017-12-04
CN104239094B (zh) 2017-12-08
EP2993584B1 (en) 2018-03-21
EP2993584A1 (en) 2016-03-09
JP2016538663A (ja) 2016-12-08
KR101706359B1 (ko) 2017-02-13
BR112015008641A2 (pt) 2017-07-04
US9588805B2 (en) 2017-03-07
MX2015003748A (es) 2017-03-20
US20160062792A1 (en) 2016-03-03

Similar Documents

Publication Publication Date Title
WO2016029642A1 (zh) 后台应用程序的控制方法、装置及终端设备
US10282561B2 (en) Method and apparatus for managing application
JP6072362B2 (ja) アプリケーションプログラムの処理方法、装置、プログラム及び記憶媒体
US9860844B2 (en) Method and apparatus of temperature control
EP3136793B1 (en) Method and apparatus for awakening electronic device
WO2017071068A1 (zh) 应用程序切换方法、装置及设备
KR101722522B1 (ko) 디스플레이 모드를 전환하기 위한 방법 및 장치
JP6355735B2 (ja) 省エネルギーモードを開始するための方法及び装置
EP3151117A1 (en) Method and device for delaying information broadcasting
US10216248B2 (en) Method and device for controlling power consumption
US20190235745A1 (en) Method and device for displaying descriptive information
US20170300211A1 (en) Method and apparatus for displaying status information of application
CN110262692B (zh) 一种触摸屏扫描方法、装置及介质
CN105227426B (zh) 一种应用界面切换方法、装置及终端设备
EP2985697A1 (en) Method and device for controlling router plug-in
US20170220401A1 (en) Method, device, and computer-readable storage medium for calling a process
CN105553772B (zh) 流量监控方法及装置
US9740524B2 (en) Method and terminal device for executing application chain
US9703662B2 (en) Method for controlling plug-in by a router and the router thereof
CN107027110B (zh) 流量控制方法及装置

Legal Events

Date Code Title Description
WWE Wipo information: entry into national phase

Ref document number: MX/A/2015/003748

Country of ref document: MX

ENP Entry into the national phase

Ref document number: 2015113734

Country of ref document: RU

Kind code of ref document: A

ENP Entry into the national phase

Ref document number: 20157009919

Country of ref document: KR

Kind code of ref document: A

ENP Entry into the national phase

Ref document number: 2016544717

Country of ref document: JP

Kind code of ref document: A

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

Ref document number: 15835124

Country of ref document: EP

Kind code of ref document: A1

REG Reference to national code

Ref country code: BR

Ref legal event code: B01A

Ref document number: 112015008641

Country of ref document: BR

NENP Non-entry into the national phase

Ref country code: DE

ENP Entry into the national phase

Ref document number: 112015008641

Country of ref document: BR

Kind code of ref document: A2

Effective date: 20150416

122 Ep: pct application non-entry in european phase

Ref document number: 15835124

Country of ref document: EP

Kind code of ref document: A1