A management method and related device
By obtaining the application's application and rationally allocating terminal resources, the problem of applications occupying a large amount of memory in the background is solved, the performance and battery life of the terminal are improved, the abuse of resources by rogue software is avoided, and the user experience is improved.
Patent Information
- Application Number
- CN202011318382.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2020-11-20
- Publication Date
- 2025-09-19
- Estimated Expiration
- 2040-11-20
AI Technical Summary
When running in the background, applications occupy a large amount of memory, causing problems such as terminal lag, high power consumption, and heat generation, affecting the user experience.
By obtaining the application's application, determine whether it is allowed to continue using terminal resources in the background, set up whitelists and blacklists, reasonably configure terminal resources, and limit the resource usage of rogue software.
It effectively prevents applications from abusing resources without restriction in the background, improves the terminal's fluency and battery life, and enhances the user experience.
Smart Images

Figure CN114518954B_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of terminal technology, and in particular to a management method and related devices. Background Art
[0002] With the widespread use of mobile phones, tablets, and other terminals, the types of applications that can be installed on them are becoming increasingly diverse, including games, music players, social networking apps, and navigation software. After an application switches from the foreground to the background, it can continue to run and occupy a large amount of memory. For example, when games, audio, video, and navigation applications remain active in the background for a long time, the terminal may experience lag, high power consumption, and heat generation, affecting the smoothness and battery life of the terminal, resulting in a poor user experience. Summary of the Invention
[0003] The embodiments of the present application provide a management method and related devices that can reasonably configure terminal resources after the application switches to the background.
[0004] In the first aspect, an embodiment of the present application provides a management method, including the following steps: obtaining a first instruction, the first instruction instructing to switch a first application from the foreground to the background; obtaining a first application, the first application being submitted by the first application, requesting to continue using terminal resources after the first application is switched to the background; responding to the first application, determining whether the first application is allowed to continue using the terminal resources after switching to the background; after obtaining the first instruction, if the first application is not obtained, triggering the first application to suspend in the background.
[0005] By adopting the technical solution provided in the embodiment of the present application, the application can continue to use terminal resources after switching to the background only after the application makes an application and is allowed. This is conducive to the rational allocation of terminal resources and avoids unlimited abuse of resources by the application in the background.
[0006] Among them, the first application can determine whether to issue the first application based on the current task. In some possible implementations, the tasks corresponding to different scenarios of the first application can be classified, for example, they can be divided into: long-term tasks, short-term tasks and non-background tasks. For example, tasks such as navigation and music playback that are being executed can be set as long-term tasks; tasks such as file compression and file transfer can be set as short-term tasks; tasks such as browsing pictures, browsing documents, and browsing web pages can be set as non-background tasks. It should be noted that after the application is suspended in the background, the terminal resources it uses are released, and when the application is switched from the background to the foreground, the terminal resources it uses are restored.
[0007] In some possible embodiments, a blacklist can be set in advance, and applications in the blacklist are suspended after switching to the background, or are not allowed to issue the first application, or even after issuing the first application, applications in the blacklist are not allowed to continue using terminal resources after switching to the background.
[0008] In some possible embodiments, a whitelist can be pre-set, and only applications in the whitelist can submit the first application. This can prevent rogue software from submitting the first application, and applications not in the whitelist cannot continue to use terminal resources after switching to the background.
[0009] In some possible embodiments, the response to the first application determines whether the first application is allowed to continue using the terminal resources after switching to the background, including: when the task currently being executed by the first application is a preset first type task, allowing the first application to continue using the terminal resources after switching to the background; wherein, the first type task is a preset task that needs to remain in the background for a long time after switching to the background.
[0010] In some possible embodiments, the response to the first application determines whether the first application is allowed to continue using the terminal resources after switching to the background, including: when the task currently being executed by the first application is a preset second type task, the maximum cumulative duration for which the first application is allowed to continue using the terminal resources after switching to the background is a preset duration T1, and after the task currently being executed by the first application is completed, the first application is triggered to suspend in the background; wherein the second type task is a preset short-term task that needs to continue running for a period of time after switching to the background to be completed.
[0011] In some possible embodiments, the response to the first application determines whether the first application is allowed to continue using the terminal resources after switching to the background, including: when the task currently being executed by the first application is a preset third type task, after the first application is switched to the background, the first application is not allowed to continue using the terminal resources after a shorter preset time T2, triggering the first application to suspend in the background, and the third type task is a task that does not need to continue running after switching.
[0012] In some possible embodiments, if the task currently being executed by the first application is a preset second type task, the first application includes an application to continue using the terminal resources within a predetermined duration T3 after the first application switches to the background, wherein T3≤T1.
[0013] In some possible embodiments, the method further includes obtaining a second application, wherein the second application is used by the first application to apply to continue using the terminal resources for a subsequent time period of T4 after switching to the background to continue using the terminal resources for a time period of T3, wherein (T3+T4)≤T1.
[0014] In some possible embodiments, the method further includes obtaining a second instruction, where the second instruction instructs the first application to switch from the background to the foreground; and in response to the second instruction, allowing the first application to continue using the terminal resources.
[0015] In some possible embodiments, if it is detected that the power consumption of the first application exceeds a preset value while running in the background, the method further includes: obtaining a third application, wherein the third application is used by the first application to apply to continue using the terminal resources after switching to the background; in response to the third application, the first application is not allowed to continue using the terminal resources after switching to the background, or, the time period during which the first application is allowed to continue using the terminal resources after switching to the background is shortened.
[0016] In some possible embodiments, it also includes: while the first application is running in the background, it is only allowed to use designated terminal resources. If it is detected that the first application uses terminal resources that are not allowed to be used in the background, the first application is triggered to suspend in the background.
[0017] In the second aspect, an embodiment of the present application provides a management device, characterized in that it includes: a first acquisition unit, used to acquire a first instruction, the first instruction instructing to switch the first application from the foreground to the background; a second acquisition unit, used to acquire a first application, the first application is submitted by the first application, and the application is to continue to use the terminal resources after the first application is switched to the background; a first processing unit, used to respond to the first application, determine whether the first application is allowed to continue to use the terminal resources after switching to the background; and after the first acquisition unit acquires the first instruction, if the second acquisition unit does not acquire the first application, triggering the first application to suspend in the background.
[0018] In some possible embodiments, in response to the first application, in determining whether the first application is allowed to continue using the terminal resources after switching to the background, the first processing unit is specifically used to allow the first application to continue using the terminal resources after switching to the background when the task currently being executed by the first application is a preset first type of task; wherein, the first type of task is a preset task that needs to remain in the background for a long time after switching to the background.
[0019] In some possible embodiments, in response to the first application, determining whether the first application is allowed to continue using the terminal resources after switching to the background, the first processing unit is specifically used to, when the task currently being executed by the first application is a preset second type task, allow the first application to continue using the terminal resources after switching to the background for a maximum cumulative duration of a preset duration T1, and after the task currently being executed by the first application is completed, trigger the first application to suspend in the background; wherein, the second type task is a preset short-term task that needs to continue running for a period of time after switching to the background to be completed.
[0020] In some possible embodiments, in response to the first application, determining whether the first application is allowed to continue using the terminal resources after switching to the background, the first processing unit is specifically used to, when the first application is a preset third type of task, not allow the first application to continue using the terminal resources after a preset time T2 after the first application switches to the background, triggering the first application to suspend in the background, and the third type of task is an application that has no background task requirements after switching to the background.
[0021] In some possible embodiments, if the first application is a preset second type task, the first application includes an application to continue using the terminal resources within a predetermined duration T3 after the first application is switched to the background, wherein T3≤T1.
[0022] In some possible embodiments, the second acquisition unit is further used to obtain a second application, where the second application is used by the first application to apply to continue using the terminal resources for a subsequent time period of T4 after switching to the background to continue using the terminal resources for a time period of T3, wherein (T3+T4)≤T1.
[0023] In some possible embodiments, the first acquisition unit is further used to obtain a second instruction, where the second instruction instructs the first application to switch from the background to the foreground; the first processing unit is further used to respond to the second instruction and allow the first application to continue using the terminal resources.
[0024] In some possible embodiments, the second acquisition unit is further used to obtain a third application after obtaining the first application, and the third application is used for the first application to apply to continue using the terminal resources after switching to the background; the first processing unit is also used to detect the power consumption of the first application during background operation, and to respond to the third application. If it is detected that the power consumption of the first application exceeds a preset value during background operation, the first application is not allowed to continue using the terminal resources after switching to the background, or the first application is allowed to continue using the terminal resources for a preset time period after switching to the background.
[0025] In some possible embodiments, the first processing unit is further configured to allow the first application to only use designated terminal resources while the first application is running in the background, and trigger the first application to suspend in the background if it is detected that the first application uses terminal resources that are not allowed to be used in the background.
[0026] In a third aspect, an embodiment of the present application provides a computer storage medium comprising a computer program. When the computer program is executed, some or all of the steps of the method described in the first aspect or any possible embodiment of the first aspect are executed.
[0027] In a fourth aspect, an embodiment of the present application provides a computer program product, characterized in that when the computer program product runs on a computer, it enables the computer to execute part or all of the steps of the method described in the first aspect or any possible embodiment of the first aspect.
[0028] In a fifth aspect, an embodiment of the present application provides an electronic device, characterized in that it includes a processor and a memory; the processor is used to execute a computer program stored in the memory, and when the computer program is executed, some or all of the steps of the method described in the first aspect or any possible embodiment of the first aspect are executed.
[0029] By adopting the technical solution provided in the embodiment of the present application, the application can continue to use terminal resources after switching to the background only after the application makes an application and is allowed. This is conducive to the rational allocation of terminal resources and avoids unlimited abuse of resources by the application in the background. BRIEF DESCRIPTION OF THE DRAWINGS
[0030] The above and other features, advantages and aspects of the embodiments of the present application will become more apparent with reference to the following detailed description in conjunction with the accompanying drawings.
[0031] Figure 1 It is a flowchart of a management method provided by an embodiment of the present application.
[0032] Figure 2 It is a flowchart of a management method provided in another embodiment of the present application.
[0033] Figure 3 It is a flowchart of a management method provided in another embodiment of the present application.
[0034] Figure 4 It is a flowchart of a management method provided in another embodiment of the present application.
[0035] Figure 5 It is a flowchart of a management method provided in another embodiment of the present application.
[0036] Figure 6 It is a flowchart of a management method provided in another embodiment of the present application.
[0037] Figure 7 It is a flowchart of a management method provided in another embodiment of the present application.
[0038] Figure 8 It is a flowchart of a management method provided in another embodiment of the present application.
[0039] Figure 9 It is a structural diagram of a management device provided by an embodiment of the present application. DETAILED DESCRIPTION
[0040] The following describes embodiments of the present disclosure in more detail with reference to the accompanying drawings. Although certain embodiments of the present disclosure are shown in the accompanying drawings, it should be understood that the present disclosure can be implemented in various forms and should not be construed as limited to the embodiments described herein. Rather, these embodiments are provided to provide a more thorough and complete understanding of the present disclosure. It should be understood that the drawings and embodiments of the present disclosure are for illustrative purposes only and are not intended to limit the scope of protection of the present disclosure.
[0041] It should be understood that the various steps described in the method embodiments of the present disclosure may be performed in different orders and / or in parallel. In addition, the method embodiments may include additional steps and / or omit the steps shown. The scope of the present disclosure is not limited in this respect.
[0042] As used herein, the term "including" and its variations are open-ended, i.e., "including but not limited to." The term "based on" means "based, at least in part, on." The term "one embodiment" means "at least one embodiment," the term "another embodiment" means "at least one additional embodiment," and the term "some embodiments" means "at least some embodiments." Definitions of other terms are provided below.
[0043] It should be noted that the concepts of "first" and "second" mentioned in this application are only used to distinguish different devices, modules or units, and are not used to limit the order or interdependence of the functions performed by these devices, modules or units.
[0044] It should be noted that the modifications of "one" and "multiple" mentioned in the present disclosure are illustrative rather than restrictive, and those skilled in the art should understand that unless otherwise clearly indicated in the context, they should be understood as "one or more".
[0045] The names of the messages or information exchanged between multiple devices in the embodiments of the present application are only used for illustrative purposes and are not used to limit the scope of these messages or information.
[0046] Example 1
[0047] like Figure 1 As shown, it is a flow chart of the management method provided by one embodiment of the present application. In this embodiment, the terminal is taken as a mobile phone and the first application is described as a music player software. Figure 1 The management method shown may include the following steps:
[0048] 101. Obtain a first instruction, where the first instruction instructs to switch a first application from the foreground to the background.
[0049] For example, if the music player application software is playing music and the mobile phone receives an instruction to return to the main interface, the mobile phone will respond to the instruction by switching the first application program from the foreground to the background.
[0050] 102. Obtain a first application, where the first application is submitted by the first application and requests continued use of terminal resources after the first application switches to the background.
[0051] Taking the music playing software in step 101 as an example, since the music playing software is playing music, the music playing software makes a first application, requesting that the terminal can continue to use resources to play music after the music playing software switches to the background.
[0052] 103. Respond to the first application and determine whether to allow the first application to continue using the terminal resources after switching to the background.
[0053] Taking the first application made by the music player software in step 102 as an example, after the mobile phone obtains the first application, it responds to the first application and allows the music player software to continue using the terminal's resources for playing music after switching to the background.
[0054] In some possible implementations, for easy identification, if the first application is allowed to continue using terminal resources after being switched to the background, an identification icon of the first application may be displayed on the main interface of the mobile phone.
[0055] 104. After obtaining the first instruction, if the first application is not obtained, trigger the first application to suspend in the background.
[0056] It should be noted that if the music player software is opened but no music is played, the music player software will not submit the first application. If the mobile phone does not receive the first application, the music player software will be switched to the background and suspended.
[0057] By adopting the technical solution provided in the embodiment of the present application, the application can continue to use terminal resources after switching to the background only after the application makes an application and is allowed. This is conducive to the rational allocation of terminal resources and avoids unlimited abuse of resources by the application in the background.
[0058] In some possible embodiments, a whitelist may be pre-set, and only applications in the whitelist may submit the first application, or this may prevent rogue software from submitting the first application.
[0059] Example 2
[0060] In some possible embodiments, a blacklist of application software can be pre-set, and the applications in the blacklist will be suspended after switching to the background, or will not be allowed to issue the first application, or even after issuing the first application, the applications in the blacklist will not be allowed to continue using terminal resources after switching to the background.
[0061] like Figure 2 As shown, it is a flow chart of the management method provided by one embodiment of the present application. In this embodiment, the terminal is taken as a mobile phone and the first application is described as a shopping software A in the blacklist. Figure 2 The management method shown may include the following steps:
[0062] 201. A blacklist is set, wherein the application software in the blacklist is not allowed to continue to use the terminal resources after switching to the background even if a first application is made. The first application is made by the application, requesting to continue to use the terminal resources after the application is switched to the background.
[0063] For example, if the blacklist includes shopping software A, the mobile phone will not allow shopping software A to continue using terminal resources even if it applies to switch to the background.
[0064] 202. Obtain a first instruction, where the first instruction instructs to switch the shopping software A from the foreground to the background.
[0065] 203. Obtain a first application, which is submitted by shopping software A, requesting to continue using terminal resources after shopping software A switches to the background.
[0066] 204. In response to the first application, determine that the first application is not allowed to continue using the terminal resources after switching to the background.
[0067] Since the shopping software A is an application in the remaining blacklist, after the mobile phone obtains the first application, the shopping software A is not allowed to continue using terminal resources after switching to the background.
[0068] By setting up a blacklist, you can prevent applications on the blacklist from continuing to use terminal resources after switching to the background. This can prevent rogue software from continuing to use terminal resources in the background, affecting the user's normal operation and experience.
[0069] Example 3
[0070] In this embodiment, a whitelist can be pre-set, and only applications on the whitelist can submit the first application. This prevents rogue software and other applications from occupying resources required for the foreground, causing terminal performance degradation and increased power consumption. The key point of this embodiment is that applications must first be submitted before continuing to run in the background; applications that do not submit applications will be suspended after switching to the background. In this way, when an application that is not on the whitelist or blacklist switches to the background, it cannot submit an application and will be suspended after switching to the background.
[0071] like Figure 3 As shown, it is a flow chart of the management method provided by one embodiment of the present application. In this embodiment, the terminal is taken as a mobile phone, and the first application is described as a loan software B that is not in the white list or in the black list. Figure 3 The management method shown may include the following steps:
[0072] 301. Set a whitelist. Applications outside the whitelist cannot apply to continue using terminal resources after switching to the background.
[0073] For example, loan software B is not in the whitelist, so loan software B cannot apply to switch to the background and continue to use terminal resources.
[0074] 302. Obtain a first instruction, wherein the first instruction instructs to switch the loan software B from the foreground to the background.
[0075] 303. The application submitted by the loan software B to continue using the terminal resources after switching to the background is not obtained, which triggers the loan software B to suspend in the background.
[0076] By adopting the technical solution provided by this embodiment, when applications outside the whitelist are switched to the background, these applications cannot continue to use terminal resources after switching to the background. This can prevent rogue software from continuing to use terminal resources in the background and affecting the user's normal operation and experience.
[0077] Example 4
[0078] like Figure 4 As shown, it is a flow chart of the management method provided by one embodiment of the present application. In this embodiment, the terminal is described by taking a mobile phone as an example, and the first application is described by taking a navigation software as an example. The navigation task is determined as a long-term background task. After the long-term background task is switched to the background, the terminal resources can continue to be used, such as Figure 4 The management method shown may include the following steps:
[0079] 401. Obtain a first instruction, where the first instruction instructs to switch the navigation software from the foreground to the background.
[0080] For example, if the navigation software is navigating and the mobile phone receives an instruction to return to the main interface, the mobile phone will respond to the instruction and switch the navigation software from the foreground to the background.
[0081] 402. Obtain a first application, where the first application is submitted by the navigation software and requests that the navigation software continue to use terminal resources after switching to the background during navigation.
[0082] 403. Respond to the first application and allow the navigation software to continue using terminal resources after switching to the background.
[0083] It should be noted that if the navigation app is open but not performing navigation, it will not submit a first request. If the phone does not receive the first request, the navigation app will switch to the background and suspend. In other words, the navigation app determines whether to submit a first request based on its own operating scenario. If the navigation app is navigating, it will submit a first request. If the navigation app is not performing a navigation task, it will not request to switch to the background and continue to use terminal resources.
[0084] By adopting the technical solution provided in the embodiment of the present application, the application can continue to use terminal resources after switching to the background only after the application makes an application and is allowed. This is conducive to the rational allocation of terminal resources and avoids unlimited abuse of resources by the application in the background.
[0085] Example 5
[0086] like Figure 5As shown, it is a flow chart of the management method provided by one embodiment of the present application. In this embodiment, the terminal is described by taking a mobile phone as an example, and the first application is described by taking downloading software as an example. The download task is determined as a short-term task. A short-term task is a task that needs to continue running for a period of time to be completed after being switched to the background. After switching to the background, you can continue to use terminal resources, such as Figure 5 The management method shown may include the following steps:
[0087] 501. Obtain a first instruction, where the first instruction instructs to switch the download software from the foreground to the background.
[0088] For example, if the download software is downloading and the mobile phone receives an instruction to return to the main interface, the mobile phone will respond to the instruction and switch the download software from the foreground to the background.
[0089] 502. Obtain a first application, where the first application is submitted by the downloading software, and the application is made to continue using terminal resources after switching to the background when the downloading software is downloading.
[0090] 503. In response to the first application, the maximum cumulative duration for which the downloaded software is allowed to continue using terminal resources after switching to the background is the preset duration T1.
[0091] It should be noted that the download software can apply to switch to the background and continue to use the terminal resources within a predetermined time period T3, wherein T3≤T1. After the time is up, the download software is suspended in the background.
[0092] In some possible implementations, if the downloaded content is large and cannot be completely downloaded within the time period T3, the downloading software can further submit a second application. The second application is used for the downloading software to apply to continue using the terminal resources for T3 time after switching to the background, and to continue using the terminal resources in a subsequent time period T4, wherein (T3+T4)≤T1.
[0093] By adopting the technical solution provided in the embodiment of the present application, when an application executes a short-term task, if it receives an instruction to switch to the background, the application can apply to continue using terminal resources after switching to the background. This is conducive to the rational allocation of terminal resources and ensures that short-term tasks are processed in a timely manner.
[0094] Example 6
[0095] like Figure 6 As shown, it is a flow chart of the management method provided by one embodiment of the present application. In this embodiment, the terminal is described by taking a mobile phone as an example, the first application is described by taking a web browsing software as an example, and the third type of task is a task that does not need to continue running after switching to the background. After switching to the background, it is directly suspended or suspended after a predetermined period of time, such as 10 seconds. Figure 6The management method shown may include the following steps:
[0096] 601. Obtain a first instruction, where the first instruction instructs to switch a web browsing software from the foreground to the background.
[0097] 602. Obtain a first application, where the first application is submitted by the web browsing software and the application is to continue using terminal resources after switching to the background.
[0098] 603. In response to the first application, since the web browsing task is a non-background task, the web browsing software is not allowed to continue using terminal resources after switching to the background.
[0099] By adopting the technical solution provided in the embodiment of the present application, when an application is executing no background tasks, if it receives an instruction to switch to the background, even if the application applies to continue using terminal resources after switching to the background, it will not be allowed to continue using terminal resources in the background. This is conducive to the rational allocation of terminal resources and avoids the abuse of resources in the background by applications without background tasks.
[0100] Example 7
[0101] like Figure 7 As shown, it is a flow chart of the management method provided by one embodiment of the present application. In this embodiment, the terminal is taken as a mobile phone and the first application is described as a music player software. Figure 7 The management method shown may include the following steps:
[0102] 701. Obtain a first instruction, where the first instruction instructs to switch a first application from the foreground to the background.
[0103] For example, if the music player application software is playing music and the mobile phone receives an instruction to return to the main interface, the mobile phone will respond to the instruction by switching the first application program from the foreground to the background.
[0104] 702. Obtain a first application, where the first application is submitted by a first application program, requesting continued use of terminal resources after the first application program switches to the background.
[0105] Taking the music playing software in step 701 as an example, since the music playing software is playing music, the music playing software makes a first application, requesting that the terminal can continue to use resources to play music after the music playing software switches to the background.
[0106] 703. Respond to the first application and allow the first application to continue using terminal resources for a period of T after switching to the background.
[0107] 704 : Detect the power consumption G of the first application when it is running in the background. If the power consumption G exceeds a preset threshold M, the first application is not allowed to continue using terminal resources.
[0108] In some possible implementations, if it is detected that the power consumption of the first application when running in the background is G, if the power consumption G exceeds the preset threshold M, then if the first application subsequently applies to continue using terminal resources after switching to the background, the application will not be allowed.
[0109] In some possible implementations, if it is detected that the power consumption of the first application when running in the background is G, if the power consumption G exceeds the preset threshold M, the time for running the first application to switch to the background to continue using terminal resources is shortened, for example, the time allowed to be changed from T to T / 2, etc.
[0110] By adopting the technical solution provided in the embodiment of the present application, the application can continue to use terminal resources after switching to the background only after the application makes an application and is allowed. If the power consumption of the application using terminal resources in the background exceeds a preset threshold, the application can be restricted from continuing to use terminal resources in the background. This is conducive to the rational allocation of terminal resources and avoids the abuse of resources by the application in the background.
[0111] Example 8
[0112] like Figure 8 As shown, it is a flow chart of the management method provided by one embodiment of the present application. In this embodiment, the terminal is taken as a mobile phone and the first application is described as a music player software. In this embodiment, after the first application applies to switch to the background, it is allowed to use resources that match its current task. If other unallowed resources are used, the permission for the first application in the background is restricted. Figure 8 The management method shown may include the following steps:
[0113] 801. Obtain a first instruction, where the first instruction instructs to switch a first application from the foreground to the background.
[0114] For example, if the music player application software is playing music and the mobile phone receives an instruction to return to the main interface, the mobile phone will respond to the instruction by switching the first application program from the foreground to the background.
[0115] 802. Obtain a first application, where the first application is submitted by a first application program, requesting continued use of terminal resources after the first application program switches to the background.
[0116] Taking the music playing software in step 801 as an example, since the music playing software is playing music, the music playing software makes a first application, requesting that the terminal can continue to use resources to play music after the music playing software switches to the background.
[0117] 803. In response to the first application, the first application is allowed to continue using the voice playback resources in the terminal resources for a duration of T after switching to the background.
[0118] 804. Detect resource usage of the first application when it is running in the background. If it is detected that the first application uses terminal resources other than those permitted, such as positioning resources, the first application is not allowed to continue using terminal resources in the background.
[0119] In some possible implementations, the first application may be suspended in the background.
[0120] In some possible implementations, if it is detected that the first application uses terminal resources other than those permitted, then if the first application subsequently applies to continue using the terminal resources after switching to the background, the application will not be allowed.
[0121] In some possible implementations, if it is detected that the first application uses terminal resources other than those permitted, the time during which the first application is switched to the background to continue using terminal resources is shortened, for example, the permitted time is changed from T to T / 2.
[0122] By adopting the technical solution provided in the embodiment of the present application, the application can continue to use terminal resources after switching to the background only after the application makes an application and is allowed. If the application uses terminal resources other than those permitted in the background, the application can be restricted from continuing to use terminal resources in the background. This is conducive to the rational allocation of terminal resources and avoids the abuse of resources by the application in the background.
[0123] Example 9
[0124] like Figure 9 As shown in FIG. 1 , a schematic diagram of the structure of a management device provided by an embodiment of the present application is shown. The first application is described as a music player software. Figure 9 The management device 900 shown includes: a first acquisition unit 901, a second acquisition unit 902 and a first processing unit 903. Among them, the first acquisition unit 901 is used to obtain a first instruction, and the first instruction indicates that the first application is switched from the foreground to the background. The second acquisition unit 902 is used to obtain a first application, and the first application is submitted by the first application, and the application continues to use the terminal resources after the first application is switched to the background; the first processing unit 903 is used to respond to the first application and determine whether the first application is allowed to continue to use the terminal resources after switching to the background; and after the first acquisition unit obtains the first instruction, if the second acquisition unit does not obtain the first application, triggering the first application to suspend in the background. For simplicity, the specific functions and processing procedures of each unit can be found in the relevant description in the previous method embodiment, and will not be repeated here.
[0125] In some possible implementations, in response to the first application, determining whether the first application is allowed to continue using the terminal resources after switching to the background, the first processing unit is specifically used to allow the first application to continue using the terminal resources after switching to the background when the task currently being executed by the first application is a preset first type task; wherein the first type task is a preset task that needs to remain in the background for a long time after switching to the background.
[0126] In some possible implementations, in response to the first application, determining whether the first application is allowed to continue using the terminal resources after switching to the background, the first processing unit is specifically used to, when the task currently being executed by the first application is a preset second type task, allow the first application to continue using the terminal resources after switching to the background for a maximum cumulative duration of a preset duration T1, and after the task currently being executed by the first application is completed, trigger the first application to suspend in the background; wherein, the second type task is a preset short-term task that needs to continue running for a period of time after switching to the background to be completed.
[0127] In some possible implementations, in response to the first application, determining whether the first application is allowed to continue using terminal resources after switching to the background, the first processing unit is specifically used to, when the first application is a preset third type of task, not allow the first application to continue using terminal resources after a preset time T2 after the first application switches to the background, triggering the first application to suspend in the background, and the third type of task is an application that has no background task requirements after switching to the background.
[0128] In some possible implementations, if the first application is a preset second type task, the first application includes applying to continue using terminal resources within a predetermined duration T3 after the first application is switched to the background, where T3≤T1.
[0129] In some possible implementations, the second acquisition unit is also used to obtain a second application, where the second application is used by the first application to apply to continue using the terminal resources for a subsequent time period of T4 after switching to the background to continue using the terminal resources for a time period of T3, wherein (T3+T4)≤T1.
[0130] In some possible implementations, the first acquisition unit is further used to acquire a second instruction, where the second instruction instructs the first application to switch from the background to the foreground; the first processing unit is further used to respond to the second instruction and allow the first application to continue using terminal resources.
[0131] In some possible embodiments, the second acquisition unit is also used to obtain a third application after obtaining the first application, and the third application is used for the first application to apply to continue using terminal resources after switching to the background; the first processing unit is also used to detect the power consumption of the first application during background operation, and to respond to the third application. If it is detected that the power consumption of the first application exceeds a preset value during background operation, the first application is not allowed to continue using terminal resources after switching to the background, or the first application is allowed to continue using terminal resources after switching to the background for a preset period of time.
[0132] In some possible implementations, the first processing unit is further configured to allow the first application to use only designated terminal resources while running in the background, and trigger the first application to suspend in the background if it is detected that the first application uses terminal resources that are not allowed to be used in the background.
[0133] An embodiment of the present application further provides a computer storage medium including a computer program. When the computer program is executed, part or all of the steps of the management method described in any of the previous embodiments are executed.
[0134] An embodiment of the present application further provides a computer program product, which, when executed on a computer, enables the computer to execute some or all of the steps of the management method described in any of the preceding embodiments.
[0135] An embodiment of the present application also provides an electronic device, including a processor and a memory; the processor is used to execute a computer program stored in the memory, and when the computer program is executed, it executes some or all of the steps of the management method described in any of the previous embodiments.
[0136] The above-mentioned specific method embodiments and the explanations, descriptions, and expansions of various implementation forms of the technical features in the embodiments are also applicable to the execution of the method in the device, and will not be described in detail in the device embodiments.
[0137] It should be understood that the division of the modules in the above device is merely a division of logical functions. In actual implementation, they can be fully or partially integrated into one physical entity, or they can be physically separated. For example, the above modules can be independently established processing elements, or they can be integrated into a chip of the terminal for implementation. In addition, they can be stored in the storage element of the controller in the form of program code, and called and executed by a processing element of the processor for performing the functions of the above modules. In addition, the modules can be integrated together or implemented independently. The processing element described here can be an integrated circuit chip with signal processing capabilities. In the implementation process, the steps of the above method or the above modules can be completed by hardware integrated logic circuits in the processor element or instructions in the form of software. The processing element can be a general-purpose processor, such as a processor, or it can be one or more integrated circuits configured to implement the above method, such as one or more specific integrated circuits, or one or more microprocessors, or one or more field programmable gate arrays, etc.
[0138] It should be understood that the terms "first," "second," and the like in the description and claims of the present invention and the accompanying drawings are used to distinguish similar objects and are not necessarily used to describe a particular order or precedence. It should be understood that the terms used in this manner are interchangeable where appropriate so that the embodiments described herein can be implemented in an order other than that illustrated or described herein. In addition, the terms "including" and "having," as well as any variations thereof, are intended to cover non-exclusive inclusions. For example, a process, method, system, product, or apparatus comprising a series of steps or modules is not necessarily limited to those steps or modules explicitly listed, but may include other steps or modules that are not explicitly listed or that are inherent to such processes, methods, products, or apparatus.
[0139] The above disclosure is only a preferred embodiment of the present invention, and certainly cannot be used to limit the scope of the rights of the present invention. Ordinary technicians in this field can understand that all or part of the processes of the above embodiment and equivalent changes made in accordance with the claims of the present invention are still within the scope of the invention.
Claims
1. A management method, characterized in that: The steps include: Obtaining a first instruction, wherein the first instruction instructs switching a first application from a foreground to a background; Obtaining a first application, where the first application is submitted by the first application and requests continued use of terminal resources after the first application is switched to the background; In response to the first application, determining, based on the type of task currently being executed by the first application, whether to allow the first application to continue using the terminal resources after switching to the background; After obtaining the first instruction, if the first application is not obtained, the first application is triggered to suspend in the background.
2. The method according to claim 1, characterized in that The responding to the first application and determining, according to the type of the task currently being executed by the first application, whether to allow the first application to continue using the terminal resources after switching to the background, includes: When the task currently being executed by the first application is a preset first type task, the first application is allowed to continue using the terminal resources after switching to the background; wherein, the first type task is a preset task that needs to remain in the background after switching to the background.
3. The method according to claim 1 or 2, characterized in that The responding to the first application and determining, according to the type of the task currently being executed by the first application, whether to allow the first application to continue using the terminal resources after switching to the background, includes: When the task currently being executed by the first application is a preset second-type task, the maximum cumulative time that the first application is allowed to continue using the terminal resources after switching to the background is the preset time T1. After the task currently being executed by the first application is completed, the first application is triggered to suspend in the background; wherein, the second-type task is a short-term task that needs to continue running for a period of time after switching to the background.
4. The method according to any one of claims 1 to 3, characterized in that The responding to the first application and determining, according to the type of the task currently being executed by the first application, whether to allow the first application to continue using the terminal resources after switching to the background, includes: When the task currently being executed by the first application is a preset third type task, after the first application switches to the background, the first application is not allowed to continue using the terminal resources after a short preset time T2, triggering the first application to suspend in the background. The third type task is a task that does not need to continue running after switching.
5. The method according to claim 3, characterized in that If the task currently being executed by the first application is a preset second type task, The first application includes an application for continuing to use the terminal resources within a predetermined time period T3 after the first application is switched to the background, wherein T3≤T1.
6. The method according to claim 5, characterized in that The method further comprises, Obtain a second application, where the second application is used by the first application to apply to continue using the terminal resources for a subsequent time period of T4 after switching to the background to continue using the terminal resources for a time period of T3, wherein (T3+T4)≤T1.
7. The method according to any one of claims 1 to 6, characterized in that The method further comprises, Obtaining a second instruction, wherein the second instruction instructs the first application to switch from the background to the foreground; In response to the second instruction, the first application is allowed to continue using the terminal resources.
8. The method according to any one of claims 1 to 7, characterized in that If it is detected that the power consumption of the first application exceeds a preset value during background operation, the method further includes: Obtaining a third application, where the third application is used by the first application to apply for continued use of the terminal resources after switching to the background; In response to the third application, the first application is not allowed to continue using the terminal resources after switching to the background, or the time period for which the first application is allowed to continue using the terminal resources after switching to the background is shortened.
9. The method according to any one of claims 1 to 8, characterized in that Also includes: While the first application is running in the background, it is only allowed to use designated terminal resources. If it is detected that the first application uses terminal resources that are not allowed to be used in the background, the first application is triggered to suspend in the background.
10. A management device, characterized in that: include: A first acquiring unit is configured to acquire a first instruction, wherein the first instruction instructs to switch the first application from the foreground to the background; A second acquiring unit is configured to acquire a first application, where the first application is submitted by the first application and requests that the terminal resources continue to be used after the first application is switched to the background; a first processing unit, configured to respond to the first application and determine, based on a type of task currently being executed by the first application, whether to allow the first application to continue using the terminal resources after switching to the background; And it is used to trigger the first application to suspend in the background if the second acquisition unit does not acquire the first application after the first acquisition unit acquires the first instruction.
11. The device according to claim 10, characterized in that In response to the first application, determining whether to allow the first application to continue using the terminal resources after switching to the background according to the type of task currently being executed by the first application, The first processing unit is specifically used to allow the first application to continue using the terminal resources after switching to the background when the task currently being executed by the first application is a preset first type task; wherein, the first type task is a preset task that needs to remain in the background for a long time after switching to the background.
12. The device according to claim 10 or 11, characterized in that In response to the first application, determining whether to allow the first application to continue using the terminal resources after switching to the background according to the type of task currently being executed by the first application, The first processing unit is specifically used to, when the task currently being executed by the first application is a preset second type task, allow the first application to continue using the terminal resources for a maximum cumulative time of a preset time length T1 after switching to the background, and trigger the first application to suspend in the background after the task currently being executed by the first application is completed; wherein, the second type task is a preset short-term task that needs to continue running for a period of time after switching to the background.
13. The device according to any one of claims 10 to 12, characterized in that In response to the first application, determining whether to allow the first application to continue using the terminal resources after switching to the background according to the type of task currently being executed by the first application, The first processing unit is specifically used to, when the first application is a preset third type task, not allow the first application to continue to use the terminal resources after the preset time T2 after the first application switches to the background, triggering the first application to suspend in the background, and the third type task is an application that has no background task requirements after switching to the background.
14. The device according to claim 12, characterized in that If the first application is a preset second type task, The first application includes an application for continuing to use the terminal resources within a predetermined time period T3 after the first application is switched to the background, wherein T3≤T1.
15. The device according to claim 14, characterized in that The second acquisition unit is also used to obtain a second application, where the second application is used by the first application to apply for continuing to use the terminal resources for a subsequent time period of T4 after switching to the background to continue using the terminal resources for a time period of T3, wherein (T3+T4)≤T1.
16. The device according to any one of claims 10 to 15, characterized in that The first acquisition unit is further configured to acquire a second instruction, wherein the second instruction instructs the first application to switch from the background to the foreground; The first processing unit is further configured to, in response to the second instruction, allow the first application to continue using the terminal resources.
17. The device according to any one of claims 10 to 16, characterized in that The second acquiring unit is further configured to, after acquiring the first application, acquire a third application, wherein the third application is used by the first application to apply for continued use of the terminal resources after switching to the background; The first processing unit is also used to detect the power consumption of the first application while it is running in the background, and to respond to the third application. If it is detected that the power consumption of the first application exceeds a preset value while it is running in the background, the first application is not allowed to continue using the terminal resources after switching to the background, or the first application is allowed to continue using the terminal resources for a preset period of time after switching to the background.
18. The device according to any one of claims 10 to 17, characterized in that The first processing unit is further configured to allow the first application to only use designated terminal resources while the first application is running in the background, and trigger the first application to suspend in the background if it is detected that the first application uses terminal resources that are not allowed to be used in the background.
19. A computer storage medium, characterized in that The invention comprises a computer program, and when the computer program is executed, the method according to any one of claims 1 to 9 is performed.
20. A computer program product, characterized in that When the computer program product is run on a computer, the computer is caused to perform the method according to any one of claims 1 to 9.
21. An electronic device, characterized in that: The method comprises a processor and a memory; the processor is configured to execute a computer program stored in the memory, and when the computer program is executed, the method according to any one of claims 1 to 9 is executed.
Citation Information
Patent Citations
Method and apparatus for clearing background applications
CN105892613A
Method and device for terminating application programs
CN107025118A
Application processing method and apparatus, mobile terminal and storage medium
CN107526638A