US12536033B2 - Application keepalive method and apparatus, and electronic device - Google Patents
Application keepalive method and apparatus, and electronic deviceInfo
- Publication number
- US12536033B2 US12536033B2 US17/918,360 US202117918360A US12536033B2 US 12536033 B2 US12536033 B2 US 12536033B2 US 202117918360 A US202117918360 A US 202117918360A US 12536033 B2 US12536033 B2 US 12536033B2
- Authority
- US
- United States
- Prior art keywords
- application
- foreground
- priority
- electronic device
- callback
- Prior art date
- Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
- Active, expires
Links
Images
Classifications
-
- G—PHYSICS
- G06—COMPUTING OR CALCULATING; COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F9/00—Arrangements for program control, e.g. control units
- G06F9/06—Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
- G06F9/46—Multiprogramming arrangements
- G06F9/48—Program initiating; Program switching, e.g. by interrupt
- G06F9/4806—Task transfer initiation or dispatching
- G06F9/4843—Task transfer initiation or dispatching by program, e.g. task dispatcher, supervisor, operating system
- G06F9/485—Task life-cycle, e.g. stopping, restarting, resuming execution
-
- G—PHYSICS
- G06—COMPUTING OR CALCULATING; COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F9/00—Arrangements for program control, e.g. control units
- G06F9/06—Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
- G06F9/44—Arrangements for executing specific programs
- G06F9/445—Program loading or initiating
- G06F9/44594—Unloading
-
- G—PHYSICS
- G06—COMPUTING OR CALCULATING; COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F9/00—Arrangements for program control, e.g. control units
- G06F9/06—Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
- G06F9/44—Arrangements for executing specific programs
- G06F9/451—Execution arrangements for user interfaces
-
- G—PHYSICS
- G06—COMPUTING OR CALCULATING; COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F9/00—Arrangements for program control, e.g. control units
- G06F9/06—Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
- G06F9/46—Multiprogramming arrangements
- G06F9/50—Allocation of resources, e.g. of the central processing unit [CPU]
- G06F9/5005—Allocation of resources, e.g. of the central processing unit [CPU] to service a request
- G06F9/5011—Allocation 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/5022—Mechanisms to release resources
-
- G—PHYSICS
- G06—COMPUTING OR CALCULATING; COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F9/00—Arrangements for program control, e.g. control units
- G06F9/06—Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
- G06F9/46—Multiprogramming arrangements
- G06F9/50—Allocation of resources, e.g. of the central processing unit [CPU]
- G06F9/5005—Allocation of resources, e.g. of the central processing unit [CPU] to service a request
- G06F9/5027—Allocation of resources, e.g. of the central processing unit [CPU] to service a request the resource being a machine, e.g. CPUs, Servers, Terminals
- G06F9/5038—Allocation of resources, e.g. of the central processing unit [CPU] to service a request the resource being a machine, e.g. CPUs, Servers, Terminals considering the execution order of a plurality of tasks, e.g. taking priority or time dependency constraints into consideration
-
- G—PHYSICS
- G06—COMPUTING OR CALCULATING; COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F2209/00—Indexing scheme relating to G06F9/00
- G06F2209/48—Indexing scheme relating to G06F9/48
- G06F2209/482—Application
Definitions
- This application relates to the field of computer technologies, and in particular, to an application keepalive method and apparatus, and an electronic device.
- a user When using an electronic device such as an artificial intelligence (artificial intelligence, AI) terminal, a smartphone, a tablet computer, a smartwatch, and a smart band, a user often switches between two applications.
- an electronic device such as an artificial intelligence (artificial intelligence, AI) terminal, a smartphone, a tablet computer, a smartwatch, and a smart band
- AI artificial intelligence
- a smartphone When using an electronic device such as an artificial intelligence (artificial intelligence, AI) terminal, a smartphone, a tablet computer, a smartwatch, and a smart band, a user often switches between two applications.
- AI artificial intelligence
- the electronic device When an application runs in the background, the electronic device sets a relatively low keepalive priority for the application. When system resources are insufficient, to avoid interface freezing and slow response of the foreground application, the electronic device clears a background application in ascending order of keepalive priorities, for example, ends a process of the background application, to release system resources.
- This application provides an application keepalive method and apparatus, and an electronic device, to optimize a background application scanning and killing mechanism of an electronic device system, and improve use experience when a user performs an application switching operation.
- this application provides an application keepalive method.
- the method includes: when a foreground application is switched from a first application to a second application, obtaining a callback probability of the second application relative to the first application, where the callback probability of the second application relative to the first application is a probability that the foreground application is switched from the second application back to the first application within first preset duration after the foreground application is switched from the first application to the second application; and when the callback probability of the second application relative to the first application is greater than a preset threshold, increasing a keepalive priority of the first application when the first application is used as a background application.
- system resources are insufficient, an electronic device ends a process of at least one background application in ascending order of keepalive priorities, to release system resources.
- the method before obtaining the callback probability from the second application to the first application when the foreground application is switched from the first application to the second application, the method further includes: generating a foreground running record for each application that has run in the foreground.
- Each foreground running record includes an application name of one application and duration for which the application is used as a foreground application once.
- the electronic device may calculate the callback probability from the second application to the first application based on the foreground running record.
- the method before obtaining the callback probability from the second application to the first application when the foreground application is switched from the first application to the second application, the method further includes: obtaining, based on the plurality of foreground running records, switching times of switching the foreground application from the first application to the second application. For a foreground running record N and a foreground running record N+1 that are generated adjacently, where N is a natural number, when the foreground running record N corresponds to the first application and the foreground running record N+1 corresponds to the second application, the switching times of switching the foreground application from the first application to the second application is increased by 1.
- the method before obtaining the callback probability from the second application to the first application when the foreground application is switched from the first application to the second application, the method further includes: obtaining callback times of the second application relative to the first application based on the plurality of foreground running records. For the foreground running record N, the foreground running record N+1, and a foreground running record N+2 that are generated adjacently, where N is a natural number, when the foreground running record N and the foreground running record N+2 correspond to the first application, and the foreground running record N+1 corresponds to the second application, whether duration recorded in the foreground running record N+1 is less than or equal to the first preset duration is determined. When the duration recorded in the foreground running record N+1 is less than or equal to the first preset duration, the callback times of the second application relative to the first application is increased by 1.
- the method before obtaining the callback probability from the second application to the first application when the foreground application is switched from the first application to the second application, the method further includes: calculating the callback probability of the second application relative to the first application.
- the callback probability of the second application relative to the first application is equal to a ratio of the callback times of the second application relative to the first application to the switching times of switching the foreground application from the first application to the second application.
- the increasing a keepalive priority of the first application when the first application is used as a background application includes: increasing the keepalive priority of the first application from a default priority to a first priority, so that the first application is not killed when running in the background.
- the method further includes: when duration for which the second application is currently used as the foreground application is greater than the first preset duration, decreasing the keepalive priority of the first application from the first priority to the default priority. It should be understood that, when the duration for which the second application is currently used as the foreground application is greater than the first preset duration, there is no callback association between the first application and the second application in the current switching operation, which means that the user may need to use the second application as the foreground application for long time. In this case, the electronic device does not perform special protection on the first application.
- the method further includes: when the foreground application is switched from the second application to a transition application, determining whether duration for which the transition application runs in the foreground is greater than second preset duration; and when the duration for which the transition application runs in the foreground is greater than the second preset duration, decreasing the keepalive priority of the first application from the first priority to the default priority.
- the transition application includes at least a home screen application, a multitask window application, and a notification bar application. It should be understood that, if the duration for which the transition application runs in the foreground is greater than the second preset duration, it means that the user does not want to switch back to the first application. In this case, the electronic device does not perform special protection on the first application.
- the method further includes: when the foreground application is switched from the second application to a third application, decreasing the keepalive priority of the first application from the first priority to the default priority, where the third application is not a transition application. It should be understood that, when the foreground application is switched from the second application to the third application, it indicates that there is no callback association between the first application and the second application in the current switching operation. In this case, the electronic device does not perform special protection on the first application.
- the foreground application when the foreground application is switched from the first application to the second application, if the callback probability is not obtained, determining whether the second application directly jumps from the first application to the foreground for running; and when the second application directly jumps from the first application to the foreground for running, increasing the keepalive priority of the first application from a default priority to a first priority. It should be understood that if the second application directly jumps from the first application to the foreground for running, it indicates that there is a relatively high probability that the first application and the second application have a callback association. In this case, the electronic device increases the keepalive priority of the first application, so that the first application is not killed when running in the background.
- that the system resources of the electronic device are insufficient includes: available memory RAM of the electronic device is lower than a preset memory threshold, and/or processor usage of the electronic device is higher than a preset usage threshold, and/or power consumption of the electronic device is higher than a preset power consumption threshold.
- this application further provides an application keepalive apparatus.
- the application keepalive apparatus has a function of implementing behavior of the foregoing electronic device.
- the function may be implemented by hardware, or may be implemented by hardware executing corresponding software.
- the hardware or software includes one or more units or modules corresponding to the foregoing function.
- the application keepalive apparatus includes: a callback probability obtaining unit, configured to: when a foreground application is switched from a first application to a second application, obtain a callback probability of the second application relative to the first application, Where the callback probability of the second application relative to the first application is a probability that the foreground application is switched from the second application back to the first application within first preset duration after the foreground application is switched from the first application to the second application; and a keepalive priority adjustment unit, configured to: when the callback probability of the second application relative to the first application is greater than a preset threshold, increase a keepalive priority of the first application when the first application is used as a background application.
- a callback probability obtaining unit configured to: when a foreground application is switched from a first application to a second application, obtain a callback probability of the second application relative to the first application, Where the callback probability of the second application relative to the first application is a probability that the foreground application is switched from the second application back to the
- this application provides an electronic device.
- the electronic device includes a display, a memory, and one or more processors, the display and the memory are coupled to the processor, the memory is configured to store computer program code, the computer program code includes computer instructions, and when the processor executes the computer instructions, the electronic device is enabled to perform the method according to any one of the first aspect and the implementations of the first aspect.
- this application provides a chip system.
- the chip system includes a processor and a memory.
- the memory is coupled to the processor.
- the memory stores computer instructions.
- an electronic device is enabled to perform the method according to any one of the first aspect and the implementations of the first aspect.
- this application provides a computer storage medium.
- the computer storage medium includes computer instructions.
- the computer instructions When the computer instructions are run on an electronic device, the electronic device is enabled to perform the method according to any one of the first aspect and the implementations of the first aspect.
- this application provides a computer program product.
- the computer program product runs on a computer, the computer is enabled to perform the method according to any one of the first aspect and the implementations of the first aspect.
- beneficial effects that can be achieved by the apparatus in the second aspect, the electronic device in the third aspect, the chip system in the fourth aspect, the computer storage medium in the fifth aspect, and the computer program product in the sixth aspect that are provided above, refer to beneficial effects in the first aspect and any implementation of the first aspect. Details are not described herein again.
- FIG. 1 shows an application switching behavior of a user when the user uses an electronic device
- FIG. 2 shows an application switching scenario
- FIG. 3 shows another application switching scenario
- FIG. 4 shows still another application switching scenario
- FIG. 5 is a schematic diagram of a scenario in which an electronic device kills a background application
- FIG. 6 is a schematic diagram of a structure of an electronic device according to an embodiment of this application.
- FIG. 7 is a flowchart of an application keepalive method according to an embodiment of this application.
- FIG. 8 is a schematic diagram of a callback association concept according to an embodiment of this application.
- FIG. 9 is another flowchart of an application keepalive method according to an embodiment of this application.
- FIG. 10 is still another flowchart of an application keepalive method according to an embodiment of this application.
- FIG. 11 is yet another flowchart of an application keepalive method according to an embodiment of this application.
- FIG. 12 is a flowchart of obtaining a callback probability of an application relative to another application according to an embodiment of this application;
- FIG. 13 is a schematic diagram in which an electronic device collects statistics on foreground running records of applications in a historical time period
- FIG. 14 is a schematic diagram of a foreground running record when an application runs in the foreground for two consecutive times;
- FIG. 15 is a schematic diagram in which an electronic device collects statistics on switching times and callback times between applications
- FIG. 16 is a schematic diagram of storing switching statistics data by an electronic device
- FIG. 17 is a schematic diagram of an application keepalive apparatus according to an embodiment of this application.
- FIG. 18 is a schematic diagram of a chip system according to an embodiment of this application.
- first and second mentioned below are merely intended for a purpose of description, and shall not be understood as an indication or implication of relative importance or implicit indication of a quantity of indicated technical features. Therefore, a feature limited by “first” or “second” may explicitly or implicitly include one or more features. In the descriptions of embodiments, unless otherwise specified, “a plurality of” means two or more.
- a possible switching behavior includes: before a moment t 0 , the first application displays an interface on a screen of an electronic device. In this case, the first application is used as a foreground application. At the moment t 0 , the electronic device switches the foreground application from the first application to the second application in response to a user operation. In this case, the second application is used as the foreground application, and the first application changes from the foreground application to a background application.
- AI artificial intelligence
- the electronic device switches the foreground application from the second application back to the first application in response to another user operation.
- the first application is used as the foreground application again, and the second application changes from the foreground application to the background application.
- the “user operation” may be a gesture operation, a tap operation, or the like performed by a user on the screen of the electronic device.
- the switching behavior shown in FIG. 1 may occur, for example, in the following scenarios:
- a friend list is displayed, and the user may share the game score to a friend by performing an operation such as selecting on the friend list ⁇ circle around (2) ⁇ . Then, when the user taps “Back to the first application” in the second application ⁇ circle around (3) ⁇ , the second application immediately switches to the background, and the first application simultaneously wakes up and switches to the foreground (that is, the foreground application switches from the second application back to the first application), so that the user can continue playing the game.
- Example scenario 2 As shown in FIG. 3 , a first application is a shopping application, and a second application is a payment application.
- a foreground application is the first application
- the first application wakes up the second application and the second application switches to the foreground (that is, the foreground application switches from the first application to the second application) ⁇ circle around (4) ⁇ .
- the second application When the user completes a payment operation in the second application and taps “Back to merchant” ⁇ circle around (5) ⁇ , the second application immediately switches to the background, and simultaneously the first application wakes up and switches to the foreground (that is, the foreground application switches from the second application to the first application), so that the user can view the order or continue shopping.
- Example scenario 3 As shown in FIG. 4 , a first application is a bank application that needs to be logged in to by using an SMS verification code, and a second application is a Messages application.
- a user enters a mobile phone number on a login interface of the first application and taps “Get a verification code” ⁇ circle around (6) ⁇
- an electronic device pops up a message on a navigation bar at the top of a display.
- the electronic device switches a foreground application from the first application to the second application.
- the user may tap a home screen button (or perform a gesture operation) on the display to back to the home screen ⁇ circle around (8) ⁇ . Then, the user taps an icon of the first application on the home screen to back to the first application ⁇ circle around (9) ⁇ .
- the user may tap a multitask button (or perform a gesture operation) on the display to enter a multitask list, and then taps an icon of the first application in the multitask list to back to the first application.
- the switching behavior shown in FIG. 1 may alternatively occur in another scenario.
- a user logs in to a non-instant messaging IM application by using an IM account, invokes a Phone application to make a call to a merchant in an application such as a take-out application or a group buying application, views a route map in a map application, shares a route with a friend in a social application, or the like.
- an application such as a take-out application or a group buying application
- views a route map in a map application shares a route with a friend in a social application, or the like.
- Another scenario is not specifically described herein in embodiments of this application. It should be understood that, in a process in which the user uses the electronic device, any scenario in which applications are switched to a foreground application according to “first application ⁇ second application ⁇ first application” falls within the discussion scope of embodiments of this application.
- first application and the second application may be switched in a direct switching manner, or may be switched in an indirect switching manner.
- the direct switching means directly switching from the first application to the second application, or directly switching from the second application to the first application without using any transition application.
- the indirect switching means first switching from the first application to a transition application, and then switching from the transition application to the second application, or first switching from the second application to the transition application, and then switching from the transition application to the first application.
- the transition application may include, for example, a home screen (desktop) application, a multitask window application, and a notification bar application.
- system resources of the electronic device for example, a processor resource and a random access memory (random access memory, RAM) resource.
- RAM random access memory
- a background application competes for system resources with a foreground processor more severely, and the foreground application is more likely to freeze and respond slowly, Therefore, to ensure smooth running of the foreground application, when available system resources are insufficient, the electronic device clears the background application by using some mechanisms, for example, ending a system process of the background application to release system resources, or freezing the background application to prevent an activity behavior of the background application from occupying system resources.
- that the system resources of the electronic device are insufficient may include: available memory RAM of the electronic device is insufficient, for example, lower than a preset memory threshold; and/or processor usage of the electronic device is excessively high, for example, higher than a preset usage threshold; and/or power consumption of the electronic device is excessively high, for example, higher than a preset power consumption threshold; and the like.
- the following uses an example in which an electronic device runs an Android system to describe a mechanism for clearing a background application by the electronic device.
- this embodiment of this application may also be applied to an electronic device running another operating system, for example, an iOS system, an iPad OS system, a Windows mobile system, a Linux system, a Windows system, or a Harmony OS (Harmony OS) system.
- an iOS system for example, an iPad OS system, a Windows mobile system, a Linux system, a Windows system, or a Harmony OS (Harmony OS) system.
- a low memory killer (low memory killer, LMK) mechanism of the Android system configures different keepalive priorities (adjustments, ADJ) for applications based on different applications and application states.
- ADJ keepalive priorities
- the system scans and kills background applications in ascending order of keepalive priorities, that is, ends application processes, until sufficient system resources are released for the foreground application to run.
- Table 1 shows a solution for configuring keepalive priorities for different applications and application states.
- a keepalive priority may be represented by a priority value of the keepalive priority, and a priority value of each keepalive priority may be predefined.
- a smaller priority value indicates a higher keepalive priority
- a larger priority value indicates a lower keepalive priority.
- a keepalive priority configured by the system for the foreground application is FOREGROUND_APP_ADJ.
- the keepalive priority configured by the system for the foreground application is PREVIOUS_APP_ADJ, which is lower than FOREGROUND_APP_ADJ.
- the system may adjust the keepalive priority of the first application to a lowest CACHED_APP_MIN_ADJ or CACHED_APP_MAX_ADJ, which is referred to as CACHED below.
- CACHED the keepalive priority of the first application running in the background
- the keepalive priority of the first application running in the background is CACHED or PREVIOUS_APP_ADJ, because the priority is very low, the first application is likely to be scanned and killed by the LMK mechanism when system resources are insufficient.
- the foreground application is switched from the second application to the first application, the first application needs to be restarted and load resources, and a previous progress is lost, which severely reduces user experience.
- the foregoing example scenario 1 is used as an example.
- the user wakes up social software B in a game A, and a keepalive priority of the game A is adjusted to PREVIOUS_APP_ADJ. After that, if the user opens some transition applications, the keepalive priority of the game A further decreases to CACHED.
- the LMK mechanism may kill the game A.
- the foregoing example scenario 3 is used as an example. If the bank application is killed by the LMK mechanism in the background, when the foreground application is switched from the Messages application back to the bank application, the bank application needs to be restarted, so that the previously received SMS verification code becomes invalid. As a result, the user cannot complete a login process.
- an embodiment of this application provides an application keepalive method.
- the method may be applied to various electronic devices, for example, an artificial intelligence AI terminal, a smartphone, a tablet computer, a smartwatch, and a smart band.
- the artificial intelligence AI terminal may be, for example, an AI sound box, an AI robot, and an electrical appliance, an industrial device, a vehicle, an airplane, or a ship that has an AI function.
- FIG. 6 is a schematic diagram of a structure of an electronic device 100 according to an embodiment of this application.
- the electronic device 100 may include a processor 110 , an external memory interface 120 , an internal memory 121 , a universal serial bus (universal serial bus, USB) interface 130 , a charging management module 140 , a power management module 141 , a battery 142 , an antenna 1 , an antenna 2 , a mobile communication module 150 , a wireless communication module 160 , an audio module 170 , a speaker 170 A, a receiver 170 B, a microphone 170 C, a headset jack 170 D, a sensor module 180 , a button 190 , a motor 191 , an indicator 192 , a camera 193 , a display 194 , a subscriber identification module (subscriber identification module, SIM) card interface 195 , and the like.
- SIM subscriber identification module
- the sensor module 180 may include a pressure sensor 180 A, a gyroscope sensor 180 B, a barometric pressure sensor 180 C, a magnetic sensor 180 D, an acceleration sensor 180 E, a distance sensor 180 F, an optical proximity sensor 180 G, a fingerprint sensor 180 H, a temperature sensor 180 J, a touch sensor 180 K, an ambient light sensor 180 L, a bone conduction sensor 180 M, and the like.
- the structure shown in this embodiment does not constitute a specific limitation on the electronic device 100 .
- the electronic device 100 may include more or fewer components than those shown in the figure, or some components may be combined, or some components may be split, or different component arrangements may be used.
- the components shown in the figure may be implemented by hardware, software, or a combination of software and hardware.
- the processor 110 may include one or more processing units.
- the processor 110 may include an application processor (application processor, AP), a modem processor, a GPU, an image signal processor (image signal processor, ISP), a controller, a memory, a video codec, a digital signal processor (digital signal processor, DSP), a baseband processor, and/or a neural-network processing unit (neural-network processing unit, NPU).
- application processor application processor, AP
- modem processor image signal processor
- ISP image signal processor
- controller a memory
- video codec digital signal processor
- DSP digital signal processor
- baseband processor baseband processor
- neural-network processing unit neural-network processing unit
- the controller may be a nerve center and a command center of the electronic device 100 .
- the controller may generate an operation control signal based on an instruction operation code and a time sequence signal, to complete control of instruction reading and instruction execution.
- a memory may be further disposed in the processor 110 , and is configured to store instructions and data.
- the memory in the processor 110 is a cache memory.
- the memory may store instructions or data just used or cyclically used by the processor 110 , If the processor 110 needs to use the instructions or the data again, the processor may directly invoke the instructions or the data from the memory. This avoids repeated access, reduces waiting time of the processor 110 , and improves system efficiency.
- the processor 110 may include one or more interfaces.
- the interface may include an inter-integrated circuit (inter-integrated circuit, I2C) interface, an inter-integrated circuit sound (inter-integrated circuit sound, I2S) interface, a pulse code modulation (pulse code modulation, PCM) interface, a universal asynchronous receiver/transmitter (universal asynchronous receiver/transmitter, UART) interface, a mobile industry processor interface (mobile industry processor interface, MIPI), a general-purpose input/output (general-purpose input/output, GPIO) interface, a subscriber identity module (subscriber identity module, SIM) interface, a universal serial bus (universal serial bus, USB) interface, and/or the like.
- I2C inter-integrated circuit
- I2S inter-integrated circuit sound
- PCM pulse code modulation
- PCM pulse code modulation
- UART universal asynchronous receiver/transmitter
- MIPI mobile industry processor interface
- GPIO general-purpose input/output
- an interface connection relationship between the modules shown in this embodiment is merely used as an example for description, and does not constitute a limitation on a structure of the electronic device 100 .
- the electronic device 100 may alternatively use an interface connection manner different from an interface connection manner in the foregoing embodiment, or use a combination of a plurality of interface connection manners.
- the charging management module 140 is configured to receive a charging input from the charger.
- the charging management module 140 supplies power to the electronic device through the power management module 141 while charging the battery 142 .
- the power management module 141 is configured to connect to the battery 142 , the charging management module 140 , and the processor 110 .
- the power management module 141 receives an input of the battery 142 and/or the charging management module 140 , to supply power to the processor 110 , the internal memory 121 , an external memory, the display 194 , the camera 193 , the wireless communication module 160 , and the like.
- the power management module 141 may alternatively be disposed in the processor 110 .
- the power management module 141 and the charging management module 140 may alternatively be disposed in a same component.
- a wireless communication function of the electronic device 100 may be implemented through the antenna 1 , the antenna 2 , the mobile communication module 150 , the wireless communication module 160 , the modem processor, the baseband processor, and the like.
- the antenna 1 and the antenna 2 are configured to transmit and receive an electromagnetic wave signal.
- Each antenna in the electronic device 100 may be configured to cover one or more communication frequency bands. Different antennas may be further multiplexed, to improve antenna utilization.
- the antenna 1 may be multiplexed as a diversity antenna of a wireless local area network.
- the mobile communication module 150 may provide a wireless communication solution that includes 2G/3G/4G/5G or the like and that is applied to the electronic device 100 .
- the mobile communication module 150 may include at least one filter, a switch, a power amplifier, a low noise amplifier (low noise amplifier, LNA), and the like.
- the mobile communication module 150 may receive an electromagnetic wave through the antenna 1 , perform processing such as filtering or amplification on the received electromagnetic wave, and transmit the electromagnetic wave to the modem processor for demodulation.
- the mobile communication module 150 may further amplify a signal modulated by the modem processor, and convert the signal into an electromagnetic wave for radiation through the antenna 1 .
- the modem processor may include a modulator and a demodulator.
- the modulator is configured to modulate a to-be-sent low-frequency baseband signal into a medium-high frequency signal.
- the demodulator is configured to demodulate a received electromagnetic wave signal into a low-frequency baseband signal. Then, the demodulator transmits the low-frequency baseband signal obtained through demodulation to the baseband processor for processing.
- the low-frequency baseband signal is processed by the baseband processor and then transmitted to the application processor.
- the application processor outputs a sound signal by using an audio device (which is not limited to the speaker 170 A, the receiver 170 B, or the like), or displays an image or a video by using the display 194 .
- the wireless communication module 160 may provide a solution, applied to the electronic device 100 , to wireless communication including a wireless local area network (wireless local area network, WLAN) (for example, a wireless fidelity (wireless fidelity, network).
- WLAN wireless local area network
- Bluetooth Bluetooth
- BT global navigation satellite system
- GNSS global navigation satellite system
- FM frequency modulation
- NFC near field communication
- NFC near field communication
- IR infrared
- the wireless communication module 160 may be one or more components integrating at least one communication processor module.
- the wireless communication module 160 receives an electromagnetic wave through the antenna 2 , performs frequency modulation and filtering processing on an electromagnetic wave signal, and sends a processed signal to the processor 110 .
- the wireless communication module 160 may further receive a to-be-sent signal from the processor 110 , perform frequency modulation and amplification on the signal, and convert the signal into an electromagnetic wave for radiation through the antenna 2 .
- the antenna 1 and the mobile communication module 150 are coupled, and the antenna 2 and the wireless communication module 160 are coupled, so that the electronic device 100 can communicate with a network and another device by using a wireless communication technology.
- the wireless communication technology may include a global system for mobile communications (global system for mobile communications, GSM), a general packet radio service (general packet radio service, GPRS), code division multiple access (code division multiple access, CDMA), wideband code division multiple access (wideband code division multiple access, WCDMA), time-division code division multiple access (time-division code division multiple access, TD-SCDMA), long term evolution (long term evolution, LTE), BT, a GNSS, a WLAN, NFC, FM, an IR technology, and/or the like.
- GSM global system for mobile communications
- GPRS general packet radio service
- code division multiple access code division multiple access
- CDMA wideband code division multiple access
- WCDMA wideband code division multiple access
- time-division code division multiple access time-division code
- the GNSS may include a global positioning system (global positioning system, GPS), a global navigation satellite system (global navigation satellite system, GLONASS), a BeiDou navigation satellite system (BeiDou navigation satellite system, BDS), a quasi-zenith satellite system (quasi-zenith satellite system, QZSS), and/or a satellite based augmentation system (satellite based augmentation system, SBAS).
- GPS global positioning system
- GLONASS global navigation satellite system
- BeiDou navigation satellite system BeiDou navigation satellite system
- BDS BeiDou navigation satellite system
- QZSS quasi-zenith satellite system
- SBAS satellite based augmentation system
- the electronic device 100 may implement a display function through the GPU, the display 194 , the application processor, and the like.
- the GPU is a microprocessor for image processing, and is connected to the display 194 and the application processor.
- the GPU is configured to: perform mathematical and geometric computation, and render an image.
- the processor 110 may include one or more GPUs, which execute program instructions to generate or change display information.
- the display 194 is configured to display an image, a video, and the like.
- the display 194 includes a display panel.
- the display panel may be a liquid crystal display (liquid crystal display, LCD), an organic light-emitting diode (organic light-emitting diode, OLED), an active-matrix organic light emitting diode (active-matrix organic light emitting diode, AMOLED), a flexible light-emitting diode (flexible light-emitting diode, FLED), a mini-LED, a micro-LED, a micro-OLED, a quantum dot light emitting diode (quantum dot light emitting diode, QLED), or the like.
- the display 194 in this embodiment of this application may be a touchscreen.
- the touch sensor 180 K is integrated in the display 194 .
- the touch sensor 180 K may also be referred to as a “touch panel”.
- the display 194 may include a display panel and a touch panel.
- the touch sensor 180 K and the display 194 form a touchscreen, which is also referred to as a “touch screen”.
- the touch sensor 180 K is configured to detect a touch operation performed on or near the touch sensor. After the touch sensor 180 K detects the touch operation, a driver (for example, a TP driver) at a kernel layer may transfer the touch operation to an upper layer, to determine a touch event type.
- a visual output related to the touch operation may be provided through the display 194 .
- the touch sensor 180 K may also be disposed on a surface of the electronic device 100 at a location different from that of the display 194 .
- the electronic device 100 may implement an image shooting function by using the ISP, the camera 193 , the video codec, the GPU, the display 194 , the application processor, and the like.
- the ISP is configured to process data fed back by the camera 193 .
- the camera 193 is configured to capture a static image or a video.
- the digital signal processor is configured to process a digital signal, and may process another digital signal in addition to the digital image signal.
- the video codec is configured to compress or decompress a digital video.
- the electronic device 100 may support one or more video codecs. In this way, the electronic device 100 may play or record videos in a plurality of coding formats, for example, moving picture experts group (moving picture experts group, MPEG)-1, MPEG-2, MPEG-3, and MPEG-4.
- MPEG moving picture experts group
- the NPU is a neural-network (neural-network, NN) computing processor.
- the NPU quickly processes input information with reference to a structure of a biological neural network, for example, a transfer mode between human brain neurons, and may further continuously perform self-learning.
- Applications such as intelligent cognition of the electronic device 100 may be implemented through the NPU, for example, image recognition, facial recognition, speech recognition, and text understanding.
- the external memory interface 120 may be used to connect to an external storage card, for example, a micro SD card, to extend a storage capability of the electronic device 100 .
- the external storage card communicates with the processor 110 through the external memory interface 120 , to implement a data storage function. For example, files such as music and videos are stored in the external storage card.
- the internal memory 121 may be configured to store computer-executable program code.
- the executable program code includes instructions.
- the processor 110 runs the instructions stored in the internal memory 121 , to perform various function applications of the electronic device 100 and data processing. For example, in this embodiment of this application, the processor 110 may execute the instructions stored in the internal memory 121 , and the internal memory 121 may include a program storage area and a data storage area.
- the program storage area may store an operating system, an application required by at least one function (for example, a sound playing function or an image playing function), and the like.
- the data storage area may store data (for example, audio data and a phone book) and the like created during use of the electronic device 100 .
- the internal memory 121 may include a high-speed random access memory, or may include a nonvolatile memory such as at least one disk storage device, a flash memory, or a universal flash storage (universal flash storage, UFS).
- the electronic device 100 may implement an audio function, for example, music playing and recording, through the audio module 170 , the speaker 170 A, the receiver 170 B, the microphone 170 C, the headset jack 170 D, the application processor, and the like.
- an audio function for example, music playing and recording
- the audio module 170 is configured to convert digital audio information into an analog audio signal for output, and is also configured to convert an analog audio input into a digital audio signal.
- the audio module 170 may be further configured to code and decode an audio signal.
- the speaker 170 A also referred to as a “loudspeaker”, is configured to convert an audio electrical signal into a sound signal.
- the receiver 170 B also referred to as an “earpiece”, is configured to convert an electrical audio signal into a sound signal.
- the microphone 170 C also referred to as a “mike” or a “mic”, is configured to convert a sound signal into an electrical signal.
- the headset jack 170 D is configured to connect to a wired headset.
- the pressure sensor 180 A is configured to sense a pressure signal, and can convert the pressure signal into an electrical signal.
- the pressure sensor 180 A may be disposed on the display 194 .
- the capacitive pressure sensor may include at least two parallel plates made of conductive materials.
- the electronic device 100 may also calculate a touch location based on a detection signal of the pressure sensor 180 A.
- touch operations that are performed in a same touch position but have different touch operation intensity may correspond to different operation instructions.
- the electronic device 100 may obtain pressure of the touch operation of the user by using the pressure sensor 180 A.
- the button 190 includes a power button, a volume button, and the like.
- the button 190 may be a mechanical button, or may be a touch button.
- the electronic device 100 may receive a button input, and generate a button signal input related to a user setting and function control of the electronic device 100 .
- the motor 191 may generate a vibration prompt.
- the motor 191 may be configured to provide an incoming call vibration prompt and a touch vibration feedback.
- the indicator 192 may be an indicator light, and may be configured to indicate a charging status and a power change, or may be configured to indicate a message, a missed call, a notification, and the like.
- the SIM card interface 195 is configured to connect to a SIM card.
- the SIM card may be inserted into the SIM card interface 195 or removed from the SIM card interface 195 , to implement contact with or separation from the electronic device 100 .
- the electronic device 100 may support one or N SIM card interfaces, where N is a positive integer greater than 1.
- the SIM card interface 195 may support a nano-SIM card, a micro-SIM card, a SIM card, and the like.
- FIG. 7 is a flowchart of an application keepalive method according to an embodiment of this application.
- the method may be implemented by the electronic device 100 having the foregoing hardware structure. As shown in FIG. 7 , the method may include the following steps.
- Step S 201 When a foreground application is switched from a first application to a second application, obtain a callback probability of the second application relative to the first application.
- a sequence in which foreground applications are switched and how long each application runs in the foreground are determined based on a user's intent. For example:
- duration of running the second application in the foreground may reflect an intent of the user. If the intent of the user is different, the duration of running the second application in the foreground is also different. Therefore, in this embodiment of this application, what is defined is that a concept of “callback association” exists in a process of switching between the first application and the second application. Specifically, as shown in FIG. 8 , if the foreground application is switched back from the second application to the first application within first preset duration after the foreground application is switched from the first application to the second application, it is considered that one callback association occurs between the first application and the second application.
- the first preset duration may be an empirical value, for example, 3 min (minutes) or 5 min.
- callback association if a callback association occurs between the first application and the second application, it may reflect that the user has the intent (2) or if no callback association occurs between the first application and the second application, it may reflect that the user has the intent (1). Therefore, in this embodiment of this application, the intent of the user is associated with the method in this embodiment of this application by using the concept of “callback association”.
- this application defines a callback probability of an application relative to another application.
- a callback probability of the second application relative to the first application is a probability that the foreground application is switched from the second application back to the first application within the first preset duration after the foreground application is switched from the first application to the second application.
- the electronic device may collect statistics on switching times of switching the foreground application from the first application to the second application in a historical time period, and collect statistics on callback times of the second application relative to the first application in the historical time period.
- a ratio of the callback times of the second application relative to the first application to the switching times num_total of switching the foreground application from the first application to the second application is used as the callback probability of the second application relative to the first application, that is:
- callback_rate ⁇ ( A , B ) num_callback ⁇ ( A , B ) num_total ⁇ ( A , B ) 1
- A represents the first application
- B represents the second application
- callback_rate(A, B) represents the callback probability of the second application relative to the first application
- num_callback(A, B) represents the callback times of the second application relative to the first application in the historical time period
- num_total(A, B) represents the switching times of the foreground application from the first application to the second application in the historical time period.
- Step S 202 When the callback probability of the second application relative to the first application is greater than a preset threshold, increase a keepalive priority of the first application when the first application is used as a background application.
- a higher callback probability of the second application relative to the first application indicates a higher probability that the foreground application is switched from the second application back to the first application within the first preset duration after the foreground application is switched from the first application to the second application
- a lower callback probability of the second application relative to the first application indicates a lower probability that the foreground application is switched from the second application back to the first application within the first preset duration after the foreground application is switched from the first application to the second application.
- a threshold is preset for the callback probability.
- the threshold may be an empirical value, for example, 30%, or 40%.
- the electronic device increases the keepalive priority of the first application, so that the first application is not likely to be scanned and killed by the LMK mechanism in the background. Therefore, when the user switches the foreground application from the second application back to the first application, the first application can continue to run in the foreground in a state before being switched to the background for running. In this way, operations of the user on the first application can be seamlessly connected, and user experience is improved.
- the electronic device does not specially adjust the keepalive priority of the first application.
- the first application may be scanned and killed by the LMK mechanism, to release system resources, prevent system freezing, and improve user experience.
- a new keepalive priority for example, CALLBACK_APP_ADJ
- the new keepalive priority may be interpreted as a callback process, and corresponds to the first priority in the claims.
- CALLBACK_APP_ADJ is higher than PREVIOUS_APP_ADJ and lower than FOREGROUND_APP_ADJ.
- Table 2 shows a configuration solution including a keepalive priority of CALLBACK_APP_ADJ.
- the priority value of CALLBACK_APP_ADJ is set to, for example, 290, which is higher than that of BACKUP_APP_ADJ, HEAVY_WEIGHT_APP_ADJ, SERVICE_ADJ, HOME_APP_ADJ, PREVIOUS_APP_ADJ, and the like.
- the system sets the keepalive priority of the first application to PREVIOUS_APP_ADJ by default, which corresponds to the default priority in the claims.
- the priority value of PREVIOUS_APP_ADJ is only 700, and is only slightly higher than that of SERVICE_B_ADJ and CACHED.
- the electronic device may directly increase the keepalive priority of the first application used as the background application from the default PREVIOUS_APP_ADJ to CALLBACK_APP_ADJ.
- the priority value of CALLBACK_APP_ADJ may be, for example, 290, and is higher than priorities of many processes.
- the LMK mechanism scans and kills, in ascending order of keepalive priority, processes whose keepalive priorities are CACHED_APP_MAX_ADJ, CACHED_APP_MIN_ADJ, SERVICE_B_ADJ, PREVIOUS_APP_ADJ, and the like, until sufficient system resources are released. It can be learned that because a keepalive priority of the second application is higher than that of many other processes such as the backup process, the service process, and the home screen process, the second application is not likely to be killed by the LMK mechanism.
- the electronic device when the user switches the foreground application of the electronic device from the first application to the second application, the electronic device obtains the callback probability of the second application relative to the first application.
- the callback probability of the second application relative to the first application is greater than the preset threshold, the electronic device increases the keepalive priority of the first application when the first application is used as the background application, so that the second application is not killed by the LMK mechanism in the background. Therefore, when the user switches the foreground application from the second application back to the first application, the first application can continue to run in the foreground in a state before being switched to the background for running. In this way, operations of the user on the first application can be seamlessly connected. This meets a user's intent to continue using the first application, and improves user experience.
- the application keepalive method provided in this embodiment of this application may further include the following step:
- Step S 203 When duration for which the second application is currently used as the foreground application is greater than the first preset duration, decrease the keepalive priority of the first application from the first priority to the default priority.
- the electronic device may decrease the keepalive priority of the first application from CALLBACK_APP_ADJ to the default PREVIOUS_APP_ADJ, so that when the system resources are insufficient, the first application is likely to be scanned and killed by the LMK mechanism, to release the system resources.
- the application keepalive method provided in this embodiment of this application may further include the following steps.
- Step S 204 When the foreground application is switched from the second application to a transition application, determine whether duration for which the transition application runs in the foreground is greater than second preset duration.
- Step S 205 When the duration for which the transition application runs in the foreground is greater than the second preset duration, decrease the keepalive priority of the first application from the first priority to the default priority.
- the transition application may include, for example, a home screen application (a system desktop), a multitask window application, and a notification bar application.
- the foregoing transition application generally belongs to a launcher process and a systemUI process (including a systemUI_navThread subprocess, a system_UI_statusBar subprocess, and the like) of the system.
- a first operation manner may be as follows: The user directly returns the first application from the second application to the foreground by using an application programming interface API provided by the system of the electronic device.
- a second operation manner may be as follows: The user first switches the foreground application from the second application to the transition application, and then switches the foreground application from the transition application to the first application.
- the user may first tap a home screen button (home button) on the display of the electronic device to switch the foreground application from the social application to the home screen application, and then tap an icon of the game application (the first application) on the home screen to switch the foreground application from the home screen application to the game application.
- a home screen button home button
- the foreground application when the user switches the foreground application from the second application to a transition application, if a real intent of the user is to switch the first application back to the foreground by using the transition application for continuous use, the user stays in the transition application for very short time. Therefore, in this embodiment of this application, when the foreground application is switched from the second application to a transition application, it is determined whether duration for which the transition application runs in the foreground is greater than the second preset duration. If the duration for which the transition application runs in the foreground is greater than the second preset duration, it means that the user does not want to switch back to the first application.
- the electronic device may decrease the keepalive priority of the first application from CALLBACK_APP_ADJ to the default PREVIOUS_APP_ADJ, so that when the system resources are insufficient, the first application is more likely to be scanned and killed by the LMK mechanism, to release the system resources.
- the application keepalive method provided in this embodiment of this application may further include the following step:
- Step S 206 When the foreground application is switched from the second application to a third application, decrease the keepalive priority of the first application from the first priority to the default priority, where the third application is not a transition application.
- the electronic device may decrease the keepalive priority of the first application from CALLBACK_APP_ADJ to the default PREVIOUS_APP_ADJ so that when the system resources are insufficient, the first application is more likely to be scanned and killed by the LMK mechanism, to release the system resources.
- the switching of the foreground application from the second application to the third application may be implemented in a direct switching manner, or may be implemented in an indirect switching manner.
- the application keepalive method provided in this embodiment of this application may further include the following steps.
- Step S 207 When the foreground application is switched from the first application to the second application, if the callback probability is not obtained, determine whether the second application directly jumps from the first application to the foreground for running.
- the electronic device may not collect statistics on the callback probability of the second application relative to the first application. In this case, the electronic device determines whether the second application directly jumps from the first application to the foreground for running.
- the direct jumping means that no transition application is used in a process of switching the foreground application from the first application to the second application.
- Step S 208 When the second application directly jumps from the first application to the foreground for running, increase the keepalive priority of the first application from a default priority to a first priority.
- the electronic device may directly increase the keepalive priority of the first application from the default PREVIOUS_APP_ADJ to CALLBACK_APP_ADJ, to prevent the first application from being scanned and killed by the LMK mechanism in the background.
- An embodiment of this application further provides a method for obtaining a callback probability of an application relative to another application. As shown in FIG. 12 , the method may specifically include the following steps.
- Step S 301 Generate a foreground running record for each application that has run in the foreground, where each foreground running record includes duration for which one application is used as a foreground application once.
- an electronic device may collect, within a historical time period, statistics on duration of each application running in the foreground each time, and then generate, based on statistics data, a foreground running record for each application that has run in the foreground. Each time the application runs in the foreground, the electronic device correspondingly generates a foreground running record.
- Each foreground running record may include an application name of an application and duration in which the application is used as a foreground application once, for example, (appname, time), where appname is the application name, and time is the duration.
- the plurality of foreground running records are sorted according to a time sequence of running applications corresponding to the plurality of foreground running records in the foreground, for example, ⁇ (appname 1, time 1), (appname 2, time 2), . . . , (appname n, time n) ⁇ .
- the electronic device may start to generate the foreground running record after an operating system of the electronic device is activated, so that in a process in which a user uses the electronic device, the electronic device continuously generates a new foreground running record over time, to track a usage habit of the user.
- the electronic device may further actively delete some foreground running records generated long time ago, so as to track only a recent usage habit of the user, for example, delete a foreground running record generated one month ago, or delete a foreground running record generated three months ago.
- the electronic device ignores behavior of running transition applications such as the home screen application, the multitask window application, and the notification bar application in the foreground, and does not generate foreground running records of the transition applications such as the home screen application, the multitask window application, and the notification bar application, to avoid interference to calculation of a quantity of callback times between applications, and reduce a quantity of foreground running records.
- a previous foreground application and a current foreground application are a same application, that is, an application continuously runs in the foreground twice
- time of running the application in the foreground twice is accumulated, to generate a foreground running record. For example, if the user switches the foreground application from a social application back to the home screen application, and then immediately returns the social application from the home screen application, it may be considered that the social application continuously runs in the foreground twice.
- the application name appname may be a package name of the application, and a unit of the time (time) may be second (s).
- An Android system is used as an example.
- a package name of the Huawei application store is com.huawei.appmarket. In this case, if the Huawei application store runs in the foreground for 20 seconds at a time, the foreground running record generated by the electronic device for the Huawei application store may be (com.huawei.appmarket, 20).
- Step S 302 Obtain switching times of a second application relative to a first application based on the plurality of foreground running records.
- A represents the first application
- B represents the second application
- num_total(A, B) represents switching times of switching the foreground application from the first application A to the second application B
- an initial value of num_total(A, B) is 0.
- num_callback(A, B) represents the callback times of the second application B relative to the first application A, and an initial value of num_callback(A, B) is 0.
- callback_rate ⁇ ( A , B ) num_callback ⁇ ( A , B ) num_total ⁇ ( A , B ) 1
- the electronic device includes a corresponding hardware structure and/or software module for performing each of the functions.
- the electronic device includes a corresponding hardware structure and/or software module for performing each of the functions.
- a person skilled in the art should easily be aware that, in combination with units and algorithm steps of the examples described in embodiments disclosed in this specification, this application may be implemented by hardware or a combination of hardware and computer software. Whether a function is performed by hardware or hardware driven by computer software depends on particular applications and design constraints of the technical solutions. A person skilled in the art may use different methods to implement the described functions for each particular application, but it should not be considered that the implementation goes beyond the scope of this application.
- an application keepalive apparatus configured to implement the function of the behavior of the electronic device includes: a callback probability obtaining unit 401 , configured to: when a foreground application is switched from a first application to a second application, obtain a callback probability of the second application relative to the first application, where the callback probability of the second application relative to the first application is a probability that the foreground application is switched from the second application back to the first application within first preset duration after the foreground application is switched from the first application to the second application; and a keepalive priority adjustment unit 402 , configured to: when the callback probability of the second application relative to the first application is greater than a preset threshold, increase a keepalive priority of the first application when the first application is used as a background application.
- a callback probability obtaining unit 401 configured to: when a foreground application is switched from a first application to a second application, obtain a callback probability of the second application relative to the first application, where the callback probability of the second application relative to the first
- the application keepalive apparatus further includes: a foreground running record generation unit 403 , configured to generate a foreground running record for each application that has run in the foreground.
- Each foreground running record includes duration for which one application is used as a foreground application once.
- the electronic device may calculate the callback probability from the second application to the first application based on the foreground running record.
- the application keepalive apparatus further includes: a switching times calculation unit 404 , configured to obtain, based on the plurality of foreground running records, switching times of switching the foreground application from the first application to the second application.
- a switching times calculation unit 404 configured to obtain, based on the plurality of foreground running records, switching times of switching the foreground application from the first application to the second application. For a foreground running record N and a foreground running record N+1 that are generated adjacently, where N is a natural number, when the foreground running record N corresponds to the first application and the foreground running record N+1 corresponds to the second application, the switching times of switching the foreground application from the first application to the second application is increased by 1.
- the application keepalive apparatus further includes: a callback times calculation unit 405 , configured to obtain callback times of the second application relative to the first application based on the plurality of foreground running records.
- a callback times calculation unit 405 configured to obtain callback times of the second application relative to the first application based on the plurality of foreground running records.
- N is a natural number
- the callback times of the second application relative to the first application is increased by 1.
- the keepalive priority adjustment unit 402 is specifically configured to: when the callback probability of the second application relative to the first application is greater than a preset threshold, increase the keepalive priority of the first application from a default priority to a first priority, so that the first application is not scanned and killed when running in the background.
- the keepalive priority adjustment unit 402 is further configured to: when duration for which the second application is currently used as the foreground application is greater than the first preset duration, decrease the keepalive priority of the first application from the first priority to the default priority. It should be understood that, when the duration for which the second application is currently used as the foreground application is greater than the first preset duration, there is no callback association between the first application and the second application, which means that the user may need to use the second application as the foreground application for long time. In this case, the electronic device does not perform special protection on the first application.
- that the system resources of the electronic device are insufficient includes: available memory RAM of the electronic device is lower than a preset memory threshold, and/or processor usage of the electronic device is higher than a preset usage threshold, and/or power consumption of the electronic device is higher than a preset power consumption threshold.
- the foregoing electronic device implements a corresponding function by using a hardware module.
- the electronic device may include, for example, a display 194 , a memory 121 , and a processor 110 .
- the display 194 and the memory 121 are coupled to the processor 110 .
- the memory 121 is configured to store computer program code, where the computer program code includes computer instructions.
- the processor 110 executes the computer instructions, the electronic device may perform functions or steps in the foregoing method embodiment.
- the chip system includes a processor 501 and a memory 502 .
- the memory 502 stores computer instructions 503 .
- an electronic device may perform the steps in the foregoing embodiments.
- the chip system may further include another discrete device. This is not specifically limited in this embodiment of this application.
- An embodiment of this application further provides a computer storage medium.
- the computer storage medium includes computer instructions, and when the computer instructions are run on the foregoing electronic device, the electronic device is enabled to perform functions or steps performed by the electronic device in the foregoing method embodiment.
- An embodiment of this application further provides a computer program product.
- the computer program product runs on a computer, the computer is enabled to perform the functions or steps performed by the electronic device in the foregoing method embodiments.
- the disclosed device and method may be implemented in other manners.
- the described device embodiment is merely an example.
- the module or unit division is merely logical function division and may be other division in actual implementation.
- a plurality of units or components may be combined or integrated into another apparatus, or some features may be ignored or not performed.
- the displayed or discussed mutual couplings or direct couplings or communication connections may be implemented through some interfaces.
- the indirect couplings or communication connections between the devices or units may be implemented in electronic, mechanical, or other forms.
- the units described as separate parts may or may not be physically separate, and parts displayed as units may be one or more physical units, may be located in one place, or may be distributed on different places. Some or all of the units may be selected based on actual requirements to achieve the objectives of the solutions of embodiments.
- function units in embodiments of this application may be integrated into one processing unit, or each of the units may exist alone physically, or two or more units are integrated into one unit.
- the integrated unit may be implemented in a form of hardware, or may be implemented in a form of a software function unit.
- the integrated unit When the integrated unit is implemented in a form of a software function unit and sold or used as an independent product, the integrated unit may be stored in a readable storage medium.
- the software product is stored in a storage medium and includes several instructions for instructing a device (which may be a single-chip microcomputer, a chip, or the like) or a processor (processor) to perform all or some of the steps of the methods described in embodiments of this application.
- the foregoing storage medium includes any medium that can store program code, such as a USB flash drive, a removable hard disk, a read-only memory (read-only memory, ROM), a random access memory (random access memory, RAM), a magnetic disk, or an optical disc.
- program code such as a USB flash drive, a removable hard disk, a read-only memory (read-only memory, ROM), a random access memory (random access memory, RAM), a magnetic disk, or an optical disc.
Landscapes
- Engineering & Computer Science (AREA)
- Software Systems (AREA)
- Theoretical Computer Science (AREA)
- Physics & Mathematics (AREA)
- General Engineering & Computer Science (AREA)
- General Physics & Mathematics (AREA)
- Human Computer Interaction (AREA)
- Telephone Function (AREA)
- Stored Programmes (AREA)
Applications Claiming Priority (3)
| Application Number | Priority Date | Filing Date | Title |
|---|---|---|---|
| CN202010284992.0 | 2020-04-13 | ||
| CN202010284992.0A CN113535250B (zh) | 2020-04-13 | 2020-04-13 | 一种应用保活方法、装置和电子设备 |
| PCT/CN2021/079030 WO2021208626A1 (fr) | 2020-04-13 | 2021-03-04 | Procédé et appareil pour garder une application active, et dispositif électronique |
Publications (2)
| Publication Number | Publication Date |
|---|---|
| US20230147061A1 US20230147061A1 (en) | 2023-05-11 |
| US12536033B2 true US12536033B2 (en) | 2026-01-27 |
Family
ID=78084087
Family Applications (1)
| Application Number | Title | Priority Date | Filing Date |
|---|---|---|---|
| US17/918,360 Active 2043-03-17 US12536033B2 (en) | 2020-04-13 | 2021-03-04 | Application keepalive method and apparatus, and electronic device |
Country Status (4)
| Country | Link |
|---|---|
| US (1) | US12536033B2 (fr) |
| EP (1) | EP4123445B1 (fr) |
| CN (1) | CN113535250B (fr) |
| WO (1) | WO2021208626A1 (fr) |
Families Citing this family (6)
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| CN113741994B (zh) * | 2021-06-26 | 2022-07-12 | 荣耀终端有限公司 | 一种视频应用的保活方法以及电子设备 |
| CN116055793B (zh) * | 2022-06-07 | 2024-04-05 | 荣耀终端有限公司 | 投屏进程的管理方法、设备及存储介质 |
| CN117632393B (zh) * | 2022-08-12 | 2025-09-02 | 华为技术有限公司 | 资源管控方法、电子设备、存储介质及程序产品 |
| CN116027942A (zh) * | 2022-09-16 | 2023-04-28 | Oppo广东移动通信有限公司 | 应用管理方法和终端设备 |
| CN116366922B (zh) * | 2022-12-12 | 2025-11-14 | 深圳创维-Rgb电子有限公司 | 目标应用保护方法、系统、计算机设备及可读存储介质 |
| CN117453104B (zh) * | 2023-11-30 | 2024-05-24 | 荣耀终端有限公司 | 图像获取方法及电子设备 |
Citations (10)
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| US20120324481A1 (en) | 2011-06-16 | 2012-12-20 | Samsung Electronics Co. Ltd. | Adaptive termination and pre-launching policy for improving application startup time |
| US20150347181A1 (en) | 2014-05-30 | 2015-12-03 | Apple Inc. | Resource management with dynamic resource policies |
| US9250958B2 (en) | 2012-11-19 | 2016-02-02 | Qualcomm Innovation Center, Inc. | System, method, and apparatus for improving application-launch latencies |
| CN105843650A (zh) | 2016-03-31 | 2016-08-10 | 青岛海信移动通信技术股份有限公司 | 一种智能终端中的应用程序管理方法和装置 |
| CN107463403A (zh) | 2017-07-31 | 2017-12-12 | 广东欧珀移动通信有限公司 | 进程控制方法、装置、存储介质以及电子设备 |
| US20180307600A1 (en) * | 2015-12-31 | 2018-10-25 | Huawei Technologies Co., Ltd. | Memory reclaim method and apparatus |
| CN110489215A (zh) | 2019-06-29 | 2019-11-22 | 华为技术有限公司 | 一种应用程序中等待场景的处理方法和装置 |
| US20200226433A1 (en) * | 2017-09-30 | 2020-07-16 | Guangdong Oppo Mobile Telecommunications Corp., Ltd. | Method and Device for Controlling Application, Storage Medium, and Electronic Device |
| US20200241917A1 (en) * | 2017-10-13 | 2020-07-30 | Huawei Technologies Co., Ltd. | Resource management method and terminal device |
| US20210149689A1 (en) * | 2019-11-18 | 2021-05-20 | Samsung Electronics Co., Ltd. | Method for preloading application and electronic device supporting same |
Family Cites Families (8)
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| US7140022B2 (en) * | 2000-06-02 | 2006-11-21 | Honeywell International Inc. | Method and apparatus for slack stealing with dynamic threads |
| US10289260B2 (en) * | 2014-08-27 | 2019-05-14 | Honda Motor Co., Ltd. | Systems and techniques for application multi-tasking |
| CN106201686A (zh) * | 2016-06-30 | 2016-12-07 | 北京小米移动软件有限公司 | 应用的管理方法、装置及终端 |
| CN107220076B (zh) * | 2016-09-27 | 2018-10-30 | 华为技术有限公司 | 一种内存回收方法及装置 |
| US10639550B2 (en) * | 2017-04-18 | 2020-05-05 | Bullguard Ltd | System and method for dynamically allocating resources to a game process |
| CN108874109A (zh) * | 2017-05-16 | 2018-11-23 | 复旦大学 | 后台应用的清理方法及装置 |
| CN110046031B (zh) * | 2018-01-12 | 2021-11-09 | Oppo广东移动通信有限公司 | 应用处理方法和装置、电子设备、计算机可读存储介质 |
| CN109739634A (zh) * | 2019-01-16 | 2019-05-10 | 中国银联股份有限公司 | 一种原子任务执行方法及装置 |
-
2020
- 2020-04-13 CN CN202010284992.0A patent/CN113535250B/zh active Active
-
2021
- 2021-03-04 WO PCT/CN2021/079030 patent/WO2021208626A1/fr not_active Ceased
- 2021-03-04 EP EP21787837.0A patent/EP4123445B1/fr active Active
- 2021-03-04 US US17/918,360 patent/US12536033B2/en active Active
Patent Citations (10)
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| US20120324481A1 (en) | 2011-06-16 | 2012-12-20 | Samsung Electronics Co. Ltd. | Adaptive termination and pre-launching policy for improving application startup time |
| US9250958B2 (en) | 2012-11-19 | 2016-02-02 | Qualcomm Innovation Center, Inc. | System, method, and apparatus for improving application-launch latencies |
| US20150347181A1 (en) | 2014-05-30 | 2015-12-03 | Apple Inc. | Resource management with dynamic resource policies |
| US20180307600A1 (en) * | 2015-12-31 | 2018-10-25 | Huawei Technologies Co., Ltd. | Memory reclaim method and apparatus |
| CN105843650A (zh) | 2016-03-31 | 2016-08-10 | 青岛海信移动通信技术股份有限公司 | 一种智能终端中的应用程序管理方法和装置 |
| CN107463403A (zh) | 2017-07-31 | 2017-12-12 | 广东欧珀移动通信有限公司 | 进程控制方法、装置、存储介质以及电子设备 |
| US20200226433A1 (en) * | 2017-09-30 | 2020-07-16 | Guangdong Oppo Mobile Telecommunications Corp., Ltd. | Method and Device for Controlling Application, Storage Medium, and Electronic Device |
| US20200241917A1 (en) * | 2017-10-13 | 2020-07-30 | Huawei Technologies Co., Ltd. | Resource management method and terminal device |
| CN110489215A (zh) | 2019-06-29 | 2019-11-22 | 华为技术有限公司 | 一种应用程序中等待场景的处理方法和装置 |
| US20210149689A1 (en) * | 2019-11-18 | 2021-05-20 | Samsung Electronics Co., Ltd. | Method for preloading application and electronic device supporting same |
Non-Patent Citations (2)
| Title |
|---|
| Li Cong et al:"Optimizing low memory killers for mobile devices using reinforcement learning", 2017 13th International Wireless Communications and Mobile Computing Conference(IWCMC), IEEE, Jun. 26, 2017, XP033125611, 6 pages. |
| LI CONG; BAO JIA; WANG HAITAO: "Optimizing low memory killers for mobile devices using reinforcement learning", 2017 13TH INTERNATIONAL WIRELESS COMMUNICATIONS AND MOBILE COMPUTING CONFERENCE (IWCMC), IEEE, 26 June 2017 (2017-06-26), pages 2169 - 2174, XP033125611, DOI: 10.1109/IWCMC.2017.7986619 |
Also Published As
| Publication number | Publication date |
|---|---|
| EP4123445B1 (fr) | 2025-02-26 |
| EP4123445A1 (fr) | 2023-01-25 |
| EP4123445A4 (fr) | 2023-09-13 |
| CN113535250B (zh) | 2024-06-04 |
| EP4123445C0 (fr) | 2025-02-26 |
| CN113535250A (zh) | 2021-10-22 |
| US20230147061A1 (en) | 2023-05-11 |
| WO2021208626A1 (fr) | 2021-10-21 |
Similar Documents
| Publication | Publication Date | Title |
|---|---|---|
| US12536033B2 (en) | Application keepalive method and apparatus, and electronic device | |
| US11921977B2 (en) | Processing method for waiting scenario in application and apparatus | |
| EP3989526B1 (fr) | Procédé d'affichage d'informations concernant la mise en route d'un écran d'application, et dispositif électronique | |
| US12361914B2 (en) | Vertical synchronization signal-based control method and electronic device | |
| US20220343317A1 (en) | Near field communication method and electronic device | |
| US12493377B2 (en) | Method for adjusting touch panel sampling rate and electronic device | |
| US11823603B2 (en) | Always-on-display method and electronic device | |
| US20220317873A1 (en) | Operation method for electronic device and electronic device | |
| US20220188131A1 (en) | Card Processing Method and Device | |
| CN113535340A (zh) | 一种任务调度方法、装置及电子设备 | |
| CN112445276A (zh) | 一种折叠屏显示应用方法及电子设备 | |
| WO2021180089A1 (fr) | Procédé et appareil de commutation d'interface et dispositif électronique | |
| WO2021190314A1 (fr) | Procédé et appareil de commande de réponse au glissement d'un écran tactile, et dispositif électronique | |
| WO2021036898A1 (fr) | Procédé d'activation d'applications pour appareil à écran pliable et dispositif associé | |
| WO2021052170A1 (fr) | Procédé de commande de vibration de moteur et dispositif électronique | |
| CN113127188A (zh) | 一种性能优化方法与电子设备 | |
| EP4113276B1 (fr) | Procédé et dispositif de lecture de son | |
| CN115904686A (zh) | 内存管理方法、电子设备、计算机存储介质和程序产品 | |
| CN118426888B (zh) | 一种显示控制方法及电子设备 | |
| US20250224971A1 (en) | Service invoking method and system, and electronic device | |
| CN121764387A (zh) | 触摸信息的传输方法、电子设备、芯片系统及存储介质 | |
| CN121367750A (zh) | 电子设备运行状态的调整方法、电子设备和计算机可读存储介质 |
Legal Events
| Date | Code | Title | Description |
|---|---|---|---|
| FEPP | Fee payment procedure |
Free format text: ENTITY STATUS SET TO UNDISCOUNTED (ORIGINAL EVENT CODE: BIG.); ENTITY STATUS OF PATENT OWNER: LARGE ENTITY |
|
| STPP | Information on status: patent application and granting procedure in general |
Free format text: DOCKETED NEW CASE - READY FOR EXAMINATION |
|
| STPP | Information on status: patent application and granting procedure in general |
Free format text: ALLOWED -- NOTICE OF ALLOWANCE NOT YET MAILED Free format text: NOTICE OF ALLOWANCE MAILED -- APPLICATION RECEIVED IN OFFICE OF PUBLICATIONS |
|
| AS | Assignment |
Owner name: HUAWEI TECHNOLOGIES CO., LTD., CHINA Free format text: ASSIGNMENT OF ASSIGNORS INTEREST;ASSIGNOR:XI AN HUAWEI TECHNOLOGIES CO., LTD.;REEL/FRAME:072325/0298 Effective date: 20241201 Owner name: HUAWEI TECHNOLOGIES CO., LTD., CHINA Free format text: EMPLOYMENT AGREEMENT;ASSIGNOR:YI, PENGXIANG;REEL/FRAME:072925/0190 Effective date: 20180930 Owner name: XIAN HUAWEI TECHNOLOGIES CO., LTD., CHINA Free format text: EMPLOYMENT AGREEMENT;ASSIGNOR:DOU, ZEFEI;REEL/FRAME:072925/0123 Effective date: 20170731 Owner name: XIAN HUAWEI TECHNOLOGIES CO., LTD., CHINA Free format text: EMPLOYMENT AGREEMENT;ASSIGNOR:YUAN, XIAOFENG;REEL/FRAME:072925/0116 Effective date: 20180430 |
|
| STPP | Information on status: patent application and granting procedure in general |
Free format text: PUBLICATIONS -- ISSUE FEE PAYMENT RECEIVED |
|
| STPP | Information on status: patent application and granting procedure in general |
Free format text: PUBLICATIONS -- ISSUE FEE PAYMENT VERIFIED |
|
| STCF | Information on status: patent grant |
Free format text: PATENTED CASE |