Search

US-20260129117-A1 - Standby Method and Electronic Device

US20260129117A1US 20260129117 A1US20260129117 A1US 20260129117A1US-20260129117-A1

Abstract

A standby method includes: entering, by an electronic device, a first standby scenario, where the first standby scenario is a scenario in which a first wake lock, when the electronic device executes a first event through a first application; requesting a second wake lock for a second standby scenario based on a second event, where the second standby scenario is a scenario in which the electronic device in a standby state executes the second event through a second application; approving or rejecting a request for the second wake lock based on the first standby scenario, the second standby scenario, and a standby scenario relationship. The wake locks are managed and controlled based on the scenarios.

Inventors

  • Chunxin Zhang

Assignees

  • HUAWEI TECHNOLOGIES CO., LTD.

Dates

Publication Date
20260507
Application Date
20251229
Priority Date
20230707

Claims (20)

  1. 1 . A method, comprising: entering, by an electronic device, a first standby scenario when the electronic device executes a first event through a first application, wherein the first standby scenario comprises obtaining, through requesting, based on the first event, and in response to a screen-off operation of a user, a first wake lock; requesting, based on a second event, a second wake lock for a second standby scenario, wherein the second standby scenario comprises the electronic device executing, through a second application, the second event when the electronic device is in a standby state; approving or rejecting, based on the first standby scenario, the second standby scenario, and a standby scenario relationship, a first request for the second wake lock; and entering the standby state either after the first wake lock is released and a screen is off, or after both the first wake lock and the second wake lock are released and the screen is off.
  2. 2 . The method of claim 1 , wherein before requesting the second wake lock, the method further comprises receiving the second event.
  3. 3 . The method of claim 1 , wherein the first standby scenario further comprises an audio scenario, an exercise scenario, a navigation scenario, or a task scenario, and wherein the first application comprises a music application, an exercise application, a map application, or a browser application.
  4. 4 . The method of claim 1 , wherein the second standby scenario comprises a notification scenario, a call scenario, an audio scenario, an exercise scenario, a navigation scenario, or a task scenario, and wherein the second application comprises a messaging application, a phone application, a music application, an exercise application, a map application, or a browser application.
  5. 5 . The method of claim 1 , wherein the standby scenario relationship comprises mutual exclusion between a task scenario and a non-task scenario.
  6. 6 . The method of claim 5 , wherein the standby scenario relationship further comprises mutual exclusion between standby scenarios in which a sleep mode is entered with the screen off from a foreground.
  7. 7 . The method of claim 1 , wherein obtaining the first wake lock comprises: requesting, from a power service, through a system service corresponding to the first event, and in the first standby scenario, the first wake lock; and approving, through the power service and based on the first event, a second request for the first wake lock.
  8. 8 . The method of claim 1 , wherein after entering the standby state, the method further comprises: receiving a third event; entering, based on the third event, a third standby scenario, wherein the third standby scenario comprises the electronic device executing, in the standby state and through a third application, the third event; and entering the standby state after a third wake lock corresponding to the third standby scenario is released and the screen is off.
  9. 9 . The method of claim 8 , wherein entering the third standby scenario comprises: waking up, based on the third event and through hardware corresponding to the third event, a system; activating a system service corresponding to the third event; obtaining, through requesting from a power service and through the system service, the third wake lock; waking up, based on the third wake lock, the third application; and executing, through the third application, the third event.
  10. 10 . The method of claim 8 , wherein the third event is associated with a fourth event, wherein after entering the third standby scenario, the method further comprises entering, based on the fourth event, a fourth standby scenario, and wherein the fourth standby scenario comprises the electronic device executing, in the standby state and through the third application, the fourth event.
  11. 11 . The method of claim 10 , wherein entering the fourth standby scenario comprises: activating, based on the fourth event, a system service corresponding to the fourth event; obtaining, through requesting from a power service and through the system service, a fourth wake lock; and executing, through the third application and based on the fourth wake lock, the fourth event.
  12. 12 . The method of claim 11 , wherein entering the standby state comprises entering the standby state after both the third wake lock and the fourth wake lock are released and the screen is off.
  13. 13 . An electronic device, comprising: a memory configured to store instructions; and one or more processors coupled to the memory and configured to execute the instructions to cause the electronic device to: enter a first standby scenario when the electronic device executes a first event through a first application, wherein the first standby scenario comprises obtaining, through requesting, based on the first event, and in response to a screen-off operation of a user, a first wake lock; request, based on a second event, a second wake lock for a second standby scenario, wherein the second standby scenario comprises the electronic device executing, through a second application, the second event when the electronic device is in a standby state; approve or reject a request, based on the first standby scenario, the second standby scenario, and a standby scenario relationship, a first request for the second wake lock; and enter the standby state either after the first wake lock is released and a screen is off, or after both the first wake lock and the second wake lock are released and the screen is off.
  14. 14 . The electronic device of claim 13 , wherein before requesting the second wake lock, the one or more processors are further configured to execute the instructions to cause the electronic device to receive the second event.
  15. 15 . The electronic device of claim 13 , wherein the first standby scenario further comprises an audio scenario, an exercise scenario, a navigation scenario, or a task scenario, and wherein the first application comprises a music application, an exercise application, a map application, or a browser application.
  16. 16 . The electronic device of claim 13 , wherein the second standby scenario comprises a notification scenario, a call scenario, an audio scenario, an exercise scenario, a navigation scenario, or a task scenario, and wherein the second application comprises a messaging application, a phone application, a music application, an exercise application, a map application, or a browser application.
  17. 17 . The electronic device of claim 13 , wherein the standby scenario relationship comprises mutual exclusion between a task scenario and a non-task scenario.
  18. 18 . The electronic device of claim 13 , wherein after entering the standby state, the one or more processors are further configured to execute the instructions to cause the electronic device to: receive a third event; enter, based on the third event, a third standby scenario, wherein the third standby scenario comprises the electronic device executing, in the standby state and through a third application, the third event; and enter the standby state after a third wake lock corresponding to the third standby scenario is released and the screen is off.
  19. 19 . The electronic device of claim 13 , wherein the one or more processors are further configured to execute the instructions to cause the electronic device to obtain the first wake lock by: requesting, from a power service, through a system service corresponding to the first event, and in the first standby scenario, the first wake lock; and approving, through the power service and based on the first event, a second request for the first wake lock.
  20. 20 . A computer program product comprising instructions that are stored on a non-transitory computer-readable storage medium and that, when executed by one or more processors, cause an electronic device to: enter a first standby scenario when the electronic device executes a first event through a first application, wherein the first standby scenario comprises obtaining, through requesting, based on the first event, and in response to a screen-off operation of a user, a first wake lock; request, based on a second event, a second wake lock for a second standby scenario, wherein the second standby scenario comprises the electronic device executing, through a second application, the second event when the electronic device is in a standby state; approve or reject, based on the first standby scenario, the second standby scenario, and a standby scenario relationship, a request for the second wake lock; and enter the standby state either after the first wake lock is released and a screen is off, or after both the first wake lock and the second wake lock are released and the screen is off.

Description

CROSS-REFERENCE TO RELATED APPLICATIONS This is a continuation of International Patent Application No. PCT/CN2024/095653 filed on May 28, 2024, which claims priority to Chinese Patent Application No. 202310841845.2 field on Jul. 7, 2023. The disclosures of the aforementioned applications are hereby incorporated by reference in their entireties. TECHNICAL FIELD The present disclosure relates to the field of computer technologies, and in particular, to a standby method and an electronic device. BACKGROUND A feature of an electronic device reducing power consumption by entering a standby state to improve endurance is a power management technology of an operating system. How the electronic device enters the standby state is one of key technical points in the power management technology of the operating system. However, there is usually an uncontrollable or inflexible problem in a scenario in which the electronic device enters the standby state. SUMMARY In view of this, embodiments of the present disclosure provide a standby method and an electronic device. Wake locks are managed and controlled based on scenarios, so that the electronic device is controllable and flexible in a scenario of entering a standby state. According to a first aspect, an embodiment of the present disclosure provides a standby method. The method includes: entering, by an electronic device, a first standby scenario, where the first standby scenario is a scenario in which a first wake lock, when the electronic device executes a first event through a first application, is obtained through requesting based on the first event in response to a screen-off operation of a user; requesting a second wake lock for a second standby scenario based on a second event, where the second standby scenario is a scenario in which the electronic device in a standby state executes the second event through a second application; approving or rejecting a request for the second wake lock based on the first standby scenario, the second standby scenario, and a standby scenario relationship; and entering the standby state after the first wake lock is released and a screen is off, or after both the first wake lock and the second wake lock are released and a screen is off. The wake locks are managed and controlled based on the standby scenarios, so that the electronic device is controllable and flexible in a scenario of entering the standby state. With reference to the first aspect, in some implementations of the first aspect, before requesting the second wake lock for the second standby scenario based on the second event, the method further includes: receiving the second event. When the second event is from the outside, the electronic device needs to receive the second event, such as an incoming call event or a messaging event. With reference to the first aspect, in some implementations of the first aspect, the first standby scenario includes an audio scenario, an exercise scenario, a navigation scenario, or a task scenario, and the first application includes a music application, an exercise application, a map application, or a browser application. According to the standard of application classification in an application market, types of applications that perform task processing in a standby case are roughly five types: audio and video entertainment, social communication, utility tools, exercise and health, and travel navigation. In an embodiment of the present disclosure, the five types of applications are classified into six standby scenarios, respectively a notification scenario, a call scenario, an audio scenario, an exercise scenario, a navigation scenario, and a task scenario. In any standby scenario, what needs to be woken up is a part of a system and hardware of the electronic device, to ensure minimization of a wakeup range, so that unnecessary task execution can be effectively reduced, thereby reducing duration of entering a standby state, reducing power consumption, and improving endurance. Therefore, in an embodiment of the present disclosure, a wake lock is redesigned based on the six standby scenarios. Because the first standby a scenario in which, when the electronic device executes the first event through the first application, the first wake lock is obtained through requesting based on the first event in response to the screen-off operation of the user, and the first event continues to be executed through the first application based on the first wake lock, the audio scenario, the exercise scenario, the navigation scenario, or the task scenario in the foregoing six standby scenarios matches the first standby scenario. The first application corresponds to the first standby scenario. Therefore, the first application includes a music application, an exercise application, a map application, or a browser application. The first event corresponds to the first standby scenario. For example, if the first standby scenario is an audio scenario, the first event is a