Method and device for reducing power consumption

By detecting that there is no visible window in the front desk in electronic devices, the power consumption waste caused by the background application continuous application of vsync signals is solved, and the effective reduction of power consumption and normal operation of the application is achieved.

CN119759199APending Publication Date: 2025-04-04HONOR DEVICE CO LTD
View PDF 0 Cites 2 Cited by

Patent Information

Application Number
CN202311290211.9
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2023-09-28
Publication Date
2025-04-04

AI Technical Summary

Technical Problem

More running applications in electronic devices will cause excessive power consumption of the device, especially when the application still applies for vertical synchronous signals for image frame drawing after entering the background.

Method used

When detecting that there is no visible window in the foreground, the frame rate of the application is reduced, and the power consumption waste is alleviated by setting the frame rate of the first application to the second frame rate. The specific method includes setting the frame rate to the second frame rate when the first application is switched from the foreground to the background, and performing frame reduction processing on the application that allows the application to apply for a vsync signal in the background by configuring the first list.

Benefits of technology

It effectively reduces the power consumption of background applications, reduces resource waste caused by high frame rate image drawing, and ensures the normal operation of front-end applications.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119759199A_ABST
    Figure CN119759199A_ABST
Patent Text Reader

Abstract

The embodiment of the invention provides a power consumption reduction method and device, and relates to the technical field of terminals, an electronic device displays a first interface of a first application, and the first application is at a first frame rate; in response to the first operation, the electronic equipment displays a second interface, and the second interface does not comprise any window of the first application; wherein the first application sends out a drawing application to draw in the first window, the electronic equipment sets the frame rate of the first application as a second frame rate, the second frame rate is smaller than the first frame rate, and the first window is invisible. Thus, when the first application is switched from the foreground to the background, the electronic equipment can reduce the frame rate of the first application, and the power consumption waste caused by the fact that the first application still applies for the vsync signal to draw the image frame after entering the background is relieved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of terminal technology, and in particular to a power consumption reduction device. Background Art

[0002] With the popularization and development of the Internet, people's functional requirements for electronic devices are becoming more and more diverse. For example, in order to improve users' demand for electronic devices, electronic devices can support the download of various types of applications, which can be system applications or third-party applications.

[0003] However, running more applications in an electronic device will result in excessive power consumption of the device. For example, an application running on an electronic device may request a vertical synchronization (vsync) signal to draw an image, thereby triggering the drawing and rendering process of the image frame. These actions require a certain amount of power consumption. Summary of the invention

[0004] The embodiment of the present application provides a power consumption reduction device, so that the electronic device can reduce the frame rate when it detects that there is no visible window in the foreground, thereby alleviating the power consumption waste caused by some applications still applying for vsync signals to draw image frames after entering the background.

[0005] In a first aspect, an embodiment of the present application provides a method for reducing power consumption, the method comprising: an electronic device displays a first interface of a first application, wherein the first application is at a first frame rate; in response to a first operation, the electronic device displays a second interface, and the second interface does not include any window of the first application; wherein the first application issues a drawing request to draw in the first window, the electronic device sets the frame rate of the first application to a second frame rate, the second frame rate is less than the first frame rate, and the first window is invisible.

[0006] The first interface may be an interface displayed when the first application is in the foreground, and the first operation is an operation of switching the first application from the foreground to the background. The second interface may display the desktop or the interface of other applications.

[0007] In this way, when the first application switches from the foreground to the background, the electronic device can reduce the frame rate of the first application to alleviate the power consumption waste caused by the first application still applying for the vsync signal to draw the image frame after entering the background.

[0008] In one possible implementation, the electronic device sets the frame rate of the first application to the second frame rate, including: when the first application is in a first list, the electronic device sets the frame rate of the first application to the second frame rate, and the first list includes applications that are allowed to apply for vertical synchronization vsync signals in the background.

[0009] In this way, the electronic device can configure the first list to perform frame reduction processing on applications that are allowed to apply for vsync signals in the background when switching to the background, thereby reducing power consumption waste caused by image drawing at a high frame rate.

[0010] Among them, the first list can be the first control list described in the embodiment of the present application.

[0011] In one possible implementation, the method also includes: the electronic device displays a third interface of a second application, wherein the second application is at a first frame rate; in response to a second operation, the electronic device displays a fourth interface, and the fourth interface does not include any window of the second application; wherein the second application issues a drawing request to draw in the second window, and the electronic device maintains the second application at the first frame rate, wherein the second window is not visible, and the second application does not belong to the first list.

[0012] The third interface may be an interface displayed when the second application is in the foreground, and the second operation is an operation of switching the first application from the foreground to the background. The fourth interface may display the desktop or the interface of other applications.

[0013] In this way, when the second application switches from the foreground to the background, since the second application does not belong to the first list, the second application will not apply for a vsync signal in the background, and the electronic device does not need to perform frame reduction processing for the second application, and the second application can maintain the first frame rate.

[0014] In one possible implementation, after the electronic device sets the frame rate of the first application to a second frame rate, the method further includes: the electronic device adds the first application to a second list to obtain a third list, the second list includes: applications with a frame rate of the second frame rate, and the third list includes the first application.

[0015] The second list and the third list can both be the second control list described in the embodiments of the present application.

[0016] In this way, the electronic device can perform real-time control over the frame-reducing application through the setting of the second control list.

[0017] In one possible implementation, a first thread is run in an electronic device, and when the electronic device receives a first vsync signal request sent by a first application at a first moment, the first vsync signal is distributed to the first application at a second moment through the first thread; when the electronic device receives a second vsync signal request sent by the first application at a third moment, the second vsync signal is distributed to the first application at a fourth moment through the first thread, the second vsync signal request is the next vsync signal request of the first vsync signal request, and the time interval between the fourth moment and the second moment is determined by the electronic device based on the second frame rate.

[0018] In this way, the electronic device can delay the distribution of the vsync signal requested by the background application through the first thread, thereby reducing the power consumption waste caused by the background application drawing the screen.

[0019] In one possible implementation, when the electronic device receives a second vsync signal request sent by the first application at a third moment, the second vsync signal is distributed to the first application through the first thread at a fourth moment, including: when the electronic device receives a second vsync signal request sent by the first application through the second thread at the third moment, and when it is determined that the first application is in the third list, the first thread is woken up, wherein the first thread starts a timer, and the timer notifies the first thread to distribute the second vsync signal to the first application at the fourth moment.

[0020] In this way, the electronic switching device can wake up the first thread, and the first thread can implement delayed distribution of the vsync signal, thereby reducing power consumption waste caused by background applications drawing pictures.

[0021] In one possible implementation, the electronic device runs a third application in the foreground, and a second thread is also running in the electronic device. When the electronic device receives a third vsync signal request sent by the third application, the electronic device distributes the third vsync signal to the third application through the second thread, and the electronic device distributes the first vsync signal to the first application at the second moment through the first thread.

[0022] In this way, the electronic device can control the distribution of different vsync signals through two threads, and ensure the delayed distribution of vsync signals of background applications without affecting the foreground application's application for vsync signals for screen drawing, thereby maintaining the normal operation of foreground and background applications.

[0023] In one possible implementation, a fourth application is also running in the electronic device, the fourth application belongs to the first list, and the fourth application belongs to the third list. Between the third moment and the fourth moment, the electronic device receives a fourth vsync signal request sent by the fourth application. The method also includes: the electronic device distributes the second vsync signal to the first application at the fourth moment through the first thread, and distributes the fourth vsync signal to the fourth application at the fourth moment.

[0024] In this way, when the fourth application also belongs to the third list, the electronic device can control the distribution of the vaync signals of the two applications through one thread, ensuring that the applications in the background can all draw the screen at the first frame rate.

[0025] In a possible implementation, a display synthesis system is configured in the electronic device, and an event thread event thread runs in the display synthesis system, the second thread is a main thread in the event thread, and the first thread is a delay thread in the event thread.

[0026] In one possible implementation, the method further includes: in response to an operation of closing the first application, when the first application is in the first list, the electronic device sets the frame rate of the first application to the first frame rate; and the electronic device removes the first application from the third list.

[0027] In this way, when the first application is closed, the electronic device can restore the frame rate of the first application to the first frame rate, so that when the first application is subsequently started, the electronic device can continue to use the first frame rate to draw the screen of the first application.

[0028] In one possible implementation, an electronic device is configured with: an active task manager service and a display synthesis system, and the electronic device sets the frame rate of a first application to a second frame rate, including: the task manager service sends a first message to the display synthesis system, the first message including: the package name of the first application, information indicating that a frame reduction feature is enabled, and information indicating that the first application is in the background; the display synthesis system obtains the second frame rate based on the information indicating that the frame reduction feature is enabled; and the display synthesis system sets the frame rate of the first application to the second frame rate.

[0029] In this way, the task manager can initiate a frame reduction process by sending a first message to the display synthesis system, so that the display synthesis system can delay the distribution of the vsync signal requested by the first application based on the second frame rate, thereby alleviating the power consumption waste caused by the first application still applying for the vsync signal to draw the image frame after entering the background.

[0030] In a possible implementation manner, the first message also includes: a user identifier UID of the first application.

[0031] In this way, since some applications in electronic devices can support the application clone function and the application package name cannot distinguish between the two applications in the clone, the electronic device can use the package name of the first application and the UID of the first application to distinguish the specific application running in the application clone scenario to improve the accuracy of the power consumption reduction method.

[0032] In one possible implementation, the method also includes: after the electronic device adds the first application to the second list and obtains the third list, the method also includes: in response to the third operation, the electronic device applies for the window of the first application to be visible; when the first application belongs to the first list, the electronic device sets the frame rate of the first application to the first frame rate; the electronic device removes the first application from the third list.

[0033] In this way, when the electronic device detects that the first application switches from the background to the foreground, it can restore the first frame rate of the first application, so that the first application can maintain the first frame rate in the foreground to draw the screen, avoiding screen freeze in the first application.

[0034] The third operation may be an operation of switching the first application from the background to the foreground.

[0035] In one possible implementation, before the electronic device sets the frame rate of the first application to the first frame rate, the method also includes: when the electronic device receives the first frame data from the first application and the electronic device determines that the first application belongs to the third list, the electronic device sets the frame rate of the first application to the first frame rate, and the frame data is data obtained by layer rendering when the first application receives a vsync signal; the electronic device removes the first application from the third list.

[0036] In this way, in order to prevent the display synthesis system from not receiving the first frame rate in the second message when the first application receives the frame data for the first time, resulting in frame rate abnormalities in the foreground application and page freezes, the display synthesis system can restore to the first frame rate in advance when it detects that the first application is in the foreground and receives the first frame data.

[0037] In one possible implementation, an electronic device is configured with: a window manager, an active task manager service, and a display synthesis system, and the electronic device applies for the window of a first application to be visible, including: the window manager applies for the window of the first application to be visible; the window manager sends a second message to the active task manager service, and the second message is used to instruct the first application to return to the foreground; when the first application belongs to a first list, the electronic device sets the frame rate of the first application to the first frame rate, including: in response to the second message, when the active task manager service determines that the first application belongs to the first list, the active task manager service sends a third message to the display synthesis system, and the third message includes: the package name of the first application, information used to indicate that the frame reduction feature is turned off, and information used to indicate that the first application is in the foreground; the display synthesis system obtains the first frame rate based on the information used to indicate that the frame reduction feature is turned off; the display synthesis system sets the frame rate of the first application to the first frame rate.

[0038] In this way, the task manager can initiate a frame rate recovery process by sending a second message to the display composition system, so that the display composition system can normally distribute the vsync signal requested by the first application in the foreground based on the first frame rate, thereby ensuring the normal operation of the foreground application.

[0039] In a possible implementation manner, the second message also includes: a user identifier UID of the first application.

[0040] In this way, since some applications in electronic devices can support the application clone function and the application package name cannot distinguish between the two applications in the clone, the electronic device can use the package name of the first application and the UID of the first application to distinguish the specific application running in the application clone scenario to improve the accuracy of the power consumption reduction method.

[0041] In a third aspect, an embodiment of the present application provides a display device, which includes a display unit and a processing unit. The display unit is used to process the steps of displaying data in the display device, and the processing unit is used to process the steps of processing data in the display device.

[0042] In a possible implementation, the display device may further include a storage unit, which may include one or more memories, and the memory may be a device in one or more devices or circuits for storing programs or data.

[0043] In a second aspect, an embodiment of the present application provides an electronic device, including a processor and a memory, the memory being used to store code instructions; the processor being used to run the code instructions so that the electronic device executes the method described in the first aspect or any one of the implementations of the first aspect.

[0044] In a third aspect, an embodiment of the present application provides a computer-readable storage medium, which stores instructions. When the instructions are executed, the computer executes the method described in the first aspect or any implementation of the first aspect.

[0045] According to a fourth aspect, a computer program product includes a computer program. When the computer program is executed, the computer executes the method described in the first aspect or any one of the implementations of the first aspect.

[0046] It should be understood that the second to fourth aspects of the present application correspond to the technical solutions of the first aspect of the present application, and the beneficial effects achieved by each aspect and the corresponding feasible implementation methods are similar and will not be repeated here. BRIEF DESCRIPTION OF THE DRAWINGS

[0047] Figure 1 A schematic diagram of the hardware structure of an electronic device provided in an embodiment of the present application;

[0048] Figure 2 A schematic diagram of the software structure of an electronic device provided in an embodiment of the present application;

[0049] Figure 3 A schematic diagram of a flow chart of a method for reducing power consumption provided in an embodiment of the present application;

[0050] Figure 4 A flowchart of another method for reducing power consumption provided in an embodiment of the present application;

[0051] Figure 5 A schematic diagram of a process for restoring a frame rate provided in an embodiment of the present application;

[0052] Figure 6 A schematic diagram of an application state switching interface provided in an embodiment of the present application;

[0053] Figure 7 A schematic diagram of a vsync signal distribution process provided by an embodiment of the present application;

[0054] Figure 8 A schematic diagram of a vsync signal distribution process provided by an embodiment of the present application;

[0055] Fig. 9 A schematic diagram of a process for obtaining a first control list provided in an embodiment of the present application;

[0056] Fig.10 A schematic diagram of another process for obtaining a first control list provided in an embodiment of the present application;

[0057] Fig.11 A schematic diagram of the structure of a device for reducing power consumption provided in an embodiment of the present application;

[0058] Fig.12 A schematic diagram of the hardware structure of another electronic device provided in an embodiment of the present application. DETAILED DESCRIPTION

[0059] In order to facilitate the clear description of the technical solutions of the embodiments of the present application, in the embodiments of the present application, words such as "first" and "second" are used to distinguish between identical or similar items with substantially the same functions and effects. For example, the first value and the second value are only used to distinguish different values, and their order is not limited. Those skilled in the art can understand that words such as "first" and "second" do not limit the quantity and execution order, and words such as "first" and "second" do not necessarily limit them to be different.

[0060] It should be noted that, in this application, words such as "exemplary" or "for example" are used to indicate examples, illustrations or descriptions. Any embodiment or design described as "exemplary" or "for example" in this application should not be interpreted as being more preferred or more advantageous than other embodiments or designs. Specifically, the use of words such as "exemplary" or "for example" is intended to present related concepts in a specific way.

[0061] In the present application, "at least one" means one or more, and "plurality" means two or more. "And / or" describes the association relationship of associated objects, indicating that three relationships may exist. For example, A and / or B can mean: A exists alone, A and B exist at the same time, and B exists alone, where A and B can be singular or plural. The character " / " generally indicates that the objects associated before and after are in an "or" relationship. "At least one of the following" or similar expressions refers to any combination of these items, including any combination of single or plural items. For example, at least one of a, b, or c can mean: a, b, c, a and b, a and c, b and c, or a, b and c, where a, b, c can be single or multiple.

[0062] Normally, an application running in the foreground of an electronic device can request a vsync signal to trigger the drawing and rendering process of an image frame, while an application running in the background of an electronic device does not need to request a vsync signal. However, there are some applications that are not developed in a standardized manner, and they still request a vsync signal to draw image frames after the application enters the background. The application running in the background may even request a vsync signal repeatedly indefinitely, wasting central processing unit (CPU) resources and device power consumption.

[0063] In view of this, an embodiment of the present application provides a method for reducing power consumption, so that an electronic device can reduce the frame rate when it detects that there is no visible window in the foreground, thereby alleviating the power consumption waste caused by some applications still applying for vsync signals to draw image frames after entering the background.

[0064] It is understandable that the above electronic devices may also be referred to as terminals, user equipment (UE), mobile stations (MS), mobile terminals (MT), etc. The electronic devices may be mobile phones with touch screens, smart TVs, wearable devices, tablet computers (Pad), computers with wireless transceiver functions, virtual reality (VR) electronic devices, augmented reality (AR) electronic devices, wireless terminals in industrial control, wireless terminals in self-driving, wireless terminals in remote medical surgery, wireless terminals in smart grids, wireless terminals in transportation safety, wireless terminals in smart cities, wireless terminals in smart homes, etc. The embodiments of the present application do not limit the specific technologies and specific device forms used by the electronic devices.

[0065] Therefore, in order to better understand the embodiments of the present application, the structure of the electronic device of the embodiments of the present application is introduced below. Figure 1 A schematic diagram of the structure of an electronic device provided in an embodiment of the present application.

[0066] The electronic device may include a processor 110, an external memory interface 120, an internal memory 121, a universal serial bus (USB) interface 130, a charging management module 140, a power management module 141, an antenna 1, an antenna 2, a mobile communication module 150, a wireless communication module 160, an audio module 170, a speaker 170A, a receiver 170B, a microphone 170C, an earphone interface 170D, a sensor module 180, a button 190, an indicator 192, a camera 193, and a display screen 194, etc.

[0067] Among them, the sensor module 180 may include one or more of the following: pressure sensor, gyroscope sensor, air pressure sensor, magnetic sensor, acceleration sensor, distance sensor, proximity light sensor, fingerprint sensor, temperature sensor, touch sensor, ambient light sensor, or bone conduction sensor, etc., which is not specifically limited in the embodiments of the present application.

[0068] It is to be understood that the structure illustrated in the embodiments of the present application does not constitute a specific limitation on the electronic device. In other embodiments of the present application, the electronic device may include more or fewer components than shown in the figure, or combine certain components, or split certain components, or arrange the components differently. The components shown in the figure may be implemented in hardware, software, or a combination of software and hardware.

[0069] The processor 110 may include one or more processing units. Different processing units may be independent devices or integrated into one or more processors. The processor 110 may also be provided with a memory for storing instructions and data.

[0070] The USB interface 130 is an interface that complies with the USB standard specification, and specifically can be a Mini USB interface, a Micro USB interface, a USB Type C interface, etc. The USB interface 130 can be used to connect a charger to charge an electronic device, and can also be used to transfer data between an electronic device and a peripheral device. It can also be used to connect headphones to play audio through the headphones. The interface can also be used to connect other electronic devices, such as AR devices, etc.

[0071] The charging management module 140 is used to receive charging input from a charger, which may be a wireless charger or a wired charger. The power management module 141 is used to connect the charging management module 140 to the processor 110 .

[0072] The wireless communication function of the electronic device can be implemented through antenna 1, antenna 2, mobile communication module 150, wireless communication module 160, modem processor and baseband processor.

[0073] Antenna 1 and antenna 2 are used to transmit and receive electromagnetic wave signals. Antennas in electronic devices can be used to cover single or multiple communication frequency bands. Different antennas can also be reused to improve the utilization of antennas.

[0074] The mobile communication module 150 can provide solutions for wireless communications including 2G / 3G / 4G / 5G, etc., applied to electronic devices. The mobile communication module 150 may include at least one filter, a switch, a power amplifier, a low noise amplifier (LNA), etc. The mobile communication module 150 can receive electromagnetic waves from the antenna 1, and filter, amplify, etc. the received electromagnetic waves, and transmit them to the modulation and demodulation processor for demodulation.

[0075] The wireless communication module 160 can provide wireless communication solutions for electronic devices, including wireless local area networks (WLAN) (such as wireless fidelity (Wi-Fi) networks), Bluetooth (BT), global navigation satellite system (GNSS), frequency modulation (FM), etc.

[0076] The electronic device realizes the display function through the GPU, the display screen 194, and the application processor. The GPU is a microprocessor for image processing, connecting the display screen 194 and the application processor. The GPU is used to perform mathematical and geometric calculations for graphics rendering.

[0077] The display screen 194 is used to display images, videos, etc. The display screen 194 includes a display panel. In some embodiments, the electronic device may include 1 or N display screens 194, where N is a positive integer greater than 1.

[0078] The electronic device can realize the shooting function through ISP, camera 193, video codec, GPU, display screen 194 and application processor.

[0079] The camera 193 is used to capture still images or videos. In some embodiments, the electronic device may include 1 or N cameras 193, where N is a positive integer greater than 1.

[0080] The external memory interface 120 can be used to connect an external memory card, such as a Micro SD card, to expand the storage capacity of the electronic device. The external memory 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 can be stored in the external memory card.

[0081] The internal memory 121 can be used to store computer executable program codes, and the executable program codes include instructions. The internal memory 121 can include a program storage area and a data storage area.

[0082] The electronic device can implement audio functions such as music playing and recording through the audio module 170, the speaker 170A, the receiver 170B, the microphone 170C, the headphone jack 170D, and the application processor.

[0083] The audio module 170 is used to convert digital audio information into analog audio signal output, and is also used to convert analog audio input into digital audio signals. Speaker 170A, also known as "speaker", is used to convert audio electrical signals into sound signals. The electronic device can listen to music or listen to hands-free calls through speaker 170A. Receiver 170B, also known as "earpiece", is used to convert audio electrical signals into sound signals. When the electronic device answers a call or voice message, the voice can be answered by placing receiver 170B close to the human ear. Headphone interface 170D is used to connect wired headphones. Microphone 170C, also known as "microphone" or "microphone", is used to convert sound signals into electrical signals. In an embodiment of the present application, the electronic device may have a microphone 170C.

[0084] The pressure sensor is used to sense the pressure signal and can convert the pressure signal into an electrical signal. In some embodiments, the pressure sensor can be set on the display screen 194. The gyroscope sensor can be used to determine the movement posture of the electronic device. The air pressure sensor is used to measure the air pressure. The magnetic sensor includes a Hall sensor. The acceleration sensor can detect the magnitude of the acceleration of the electronic device in all directions (generally three axes). Distance sensor, used to measure the distance. The proximity light sensor can include, for example, a light emitting diode (LED) and a light detector, such as a photodiode. The ambient light sensor is used to sense the brightness of the ambient light. The fingerprint sensor is used to collect fingerprints. The temperature sensor is used to detect the temperature. The touch sensor, also known as a "touch device". The bone conduction sensor can obtain vibration signals.

[0085] The touch sensor may be provided on the display screen 194, and the touch sensor and the display screen 194 form a touch screen, or a "touch screen". In the embodiment of the present application, a capacitive sensing node grid (hereinafter referred to as a capacitive sensor) may be provided in the touch screen. When the electronic device determines that the value of the capacitance in at least one grid received by the capacitive sensor exceeds the capacitance threshold, it may be determined that a touch operation has occurred; further, the electronic device may determine the touch area corresponding to the touch operation based on the area occupied by at least one grid exceeding the capacitance threshold.

[0086] The key 190 includes a power key, a volume key, etc. The key 190 may be a mechanical key. It may also be a touch key. The electronic device may receive key input and generate key signal input related to user settings and function control of the electronic device. The indicator 192 may be an indicator light, which may be used to indicate charging status, power changes, messages, missed calls, notifications, etc.

[0087] The software system of the electronic device can adopt a layered architecture, an event-driven architecture, a micro-kernel architecture, a microservice architecture, or a cloud architecture, etc., which will not be elaborated here.

[0088] For example, Figure 2 The software structure diagram of an electronic device provided in an embodiment of the present application is shown in FIG. Figure 2 As shown, the layered architecture divides the software into several layers, each with clear roles and division of labor. The layers communicate with each other through software interfaces. In some embodiments, the Android system is divided into multiple layers, from top to bottom, including the application (APP) layer, the application framework (framework) layer, the hardware abstraction layer (HAL), and the kernel layer (kernel), etc., which is not limited in the embodiments of the present application.

[0089] The application layer may include a series of application packages. The application layer may include one or more of the following: settings, Bluetooth, calendar, health, or phone, etc., which are not limited in the embodiments of the present application.

[0090] The application framework layer provides application programming interface (API) and programming framework for the application programs in the application layer. The application framework layer includes some predefined interfaces. The application framework layer may include one or more of the following: activity task manager service (ATMS), window manager (WMS), display composition system (surfaceflinger), window manager, content provider, resource manager, view system, or notification manager, etc.

[0091] The Active Task Manager service is used to determine whether to reduce the application's frame rate based on the frequency reduction optimization switch and whether there is a visible foreground window.

[0092] The window manager is used to manage window programs. For example, the window manager can be used to apply for the foreground window, obtain the display screen size, determine whether there is a status bar, lock the screen, touch the screen, drag the screen, capture the screen, etc.

[0093] The display synthesis system is used to switch frame rates and synthesize layers.

[0094] Content providers are used to store and retrieve data and make it accessible to applications. Data can include video, images, audio, calls made and received, browsing history and bookmarks, phone books, etc. The view system includes visual controls, such as controls for displaying text, controls for displaying pictures, etc. The view system can be used to build applications. The display interface can be composed of one or more views. For example, a display interface including a text notification icon can include a view for displaying text and a view for displaying pictures. The resource manager provides various resources for applications, such as localized strings, icons, pictures, layout files, video files, and so on.

[0095] The purpose of the hardware abstraction layer is to abstract the hardware, and to provide a unified interface for querying hardware devices for upper-layer applications, or to provide data storage services for upper-layer applications. The hardware abstraction layer may include modules such as the hardware composer (HWC).

[0096] The kernel layer is the layer between hardware and software. The kernel layer is used to drive the hardware to make it work. The kernel layer may include one or more of the following: display driver, camera driver, or sensor driver, etc.

[0097] In the embodiments of the present application, no specific limitation is imposed on the software layers involved in the software architecture, the modules contained in the layers, and the functions of the modules.

[0098] The following specific embodiments are used to describe in detail the technical solution of the present application and how the technical solution of the present application solves the above technical problems. The following specific embodiments can be implemented independently or in combination with each other, and the same or similar concepts or processes may not be described in detail in some embodiments.

[0099] For example, Figure 3 A flowchart of a method for reducing power consumption provided in an embodiment of the present application is provided. Figure 3 In a corresponding embodiment, the electronic device may include: an activity task manager service, a display synthesis system and other modules.

[0100] like Figure 3 As shown, the method for reducing power consumption may include the following steps:

[0101] S301: When the activity task manager service determines that the first application exits the foreground, the activity task manager service determines whether a preset switch is turned on.

[0102] The preset switch can be understood as a switch for implementing the power consumption reduction method provided in the embodiment of the present application. The preset switch may also be referred to as a background application frequency reduction optimization switch, etc. The preset switch may be pre-set in the electronic device. For example, the preset switch may be set before the electronic device leaves the factory, or the preset switch may be set after the electronic device is upgraded. Alternatively, the preset switch may also be turned on or off based on user operation, which is not limited in the embodiment of the present application.

[0103] When the active task manager service determines that the preset switch is turned on, the active task manager service may execute the step shown in S302; or, when the active task manager service determines that the preset switch is turned off, the active task manager service may not process the frame rate of the first application.

[0104] For example, Figure 6 A schematic diagram of an application state switching interface provided in an embodiment of the present application. Figure 6 In the corresponding embodiment, an example is given in which the electronic device is a mobile phone and the first application is a video application. This example does not constitute a limitation on the embodiments of the present application.

[0105] Electronic devices display Figure 6 The interface shown in a in , which may be an interface displayed by a video application, may display the video content being played, etc.

[0106] exist Figure 6 In the interface shown in a of FIG. 1 , in response to the user sliding upward along the bottom of the display screen, the activity task manager service can detect the interface state of the first application, that is, when it is detected that the activity of the first application is in a paused state, it is determined that the first application exits the foreground, and at this time the electronic device can display the following Figure 6 The interface shown in b or Figure 6 The interface shown in c.

[0107] Figure 6 The interface shown in b in FIG. 1 can display the content on the desktop, for example, at least one application icon.

[0108] In a possible implementation, in response to the first application exiting the foreground, the electronic device may also display Figure 6 The interface shown in c in the figure may include: a floating window 600 corresponding to the video application. Alternatively, in response to the operation of the first application exiting the foreground, the electronic device may also display the interface of other applications in the foreground, which is not limited in the embodiment of the present application.

[0109] In a possible implementation, the electronic device may also turn on the preset switch by default or not set the preset switch (or be understood as supporting the power consumption reduction method provided by the embodiment of the present application by default). In this scenario, the electronic device may not determine whether the preset switch is turned on, that is, when the activity task manager service determines that the first application exits the foreground, the step shown in S302 is executed.

[0110] In a possible implementation, when the electronic device determines that the first application exits the foreground, when the electronic device detects that the first application in the background requests a vsync signal, the electronic device can also determine whether to set the frame rate of the first application to the second frame rate based on S301-S307.

[0111] S302: The activity task manager service determines whether there is a visible window of the first application.

[0112] A visible window can be understood as an application window with a window attribute of visible, or can also be understood as an application window displayed in the foreground of an electronic device. The visible window can be displayed in the foreground full screen, or can also be displayed in the foreground floating window. Among them, the window displayed in the foreground floating window can include: an interactive floating window and a non-interactive floating window. The non-interactive floating window can also be called a mini window.

[0113] For example, see Figure 6 In a corresponding embodiment, when the first application is a video application and the video is in a playing state, in response to the operation of the video application exiting the foreground, the electronic device can display a floating window of the video application in the foreground, in which the video content can continue to be played, avoiding interruption of the video playback in the video application. Figure 6 The floating window 600 in the interface shown in c.

[0114] It is understandable that in the scenario where the visible window is still displayed in the foreground after the first application enters the background, in order to avoid triggering the electronic device to perform frame reduction processing after the first application enters the background, so that the low frame rate affects the normal operation of the visible window in the foreground, the electronic device can detect the visible window of the first application and perform subsequent frame reduction processing while ensuring that there is no visible window in the foreground.

[0115] When the active task manager service determines that there is no visible window for the first application, the step shown in S303 is executed, or when the active task manager service determines that there is a visible window for the first application, the frame rate of the first application is not processed.

[0116] Exemplarily, the activity task manager service can determine whether there is a visible window of the first application by using the user identifier (UID) of the first application. For example, the activity task manager service queries the visible window corresponding to the UID of the first application, that is, the activity task manager service queries the visible window by calling the method visiblewindow(getUID()).

[0117] The active task manager service can locally call an interface to query visible windows. For example, when the window manager detects a window change, it can set the window state in the application visible window map (appvisiblewindowMAP), and then the active task manager service can query the visible windows in the first application from the appvisiblewindowMAP by calling a method.

[0118] Alternatively, the active task manager service may also determine whether there is a visible window of the first application by exchanging information with the window manager. For example, the active task manager service may send a message to the window manager for querying the visible windows in the first application, and the window manager may query the visible windows in the first application from appvisiblewindowMAP and return the message to the active task manager service.

[0119] Optionally, S303, the active task manager service determines whether the method call satisfies the system call.

[0120] Exemplarily, the active task manager service obtains the UID of the caller by calling getCallingUid(). The caller may be the UID of the active task manager service, ie, the system UID (system_UID), to determine whether the method call satisfies the system call.

[0121] When the active task manager service determines that the method call satisfies the system call, the step shown in S304 is executed; or when the active task manager service determines that the method call does not satisfy the system call, the frame rate of the first application is not processed.

[0122] It is understandable that the active task manager service can prevent illegal calls of services and improve the security of the system by determining whether the current call is a system call.

[0123] Optionally, S304: The activity task manager service determines whether the package name of the first application passes parameter validity verification.

[0124] Exemplarily, the activity task manager service determines whether the package name of the first application is legal by calling the parameter legality verification method TextUtils.isEmpty(packageName), and the packageName in the parameter legality verification method may be the package name of the first application.

[0125] When the activity task manager service determines that the package name of the first application passes the parameter validity check, the step shown in S305 is executed; or when the activity task manager service determines that the package name of the first application does not pass the parameter validity check, the frame rate of the first application is not processed.

[0126] It can be understood that both S303 and S304 are steps for improving system security, and the electronic device may also use other steps to verify the system security, which is not limited in the embodiments of the present application.

[0127] S305: The activity task manager service determines whether the first application is in the first control list.

[0128] The first control list is used to store the package names of applications that are allowed to apply for vsync signals in the background. The first control list is set in the memory for easy query at any time.

[0129] The first control list may be obtained by loading a configuration file when the electronic device is restarted, or the first control list may be obtained by loading an updated configuration file after the electronic device performs a software update. For specific acquisition methods, see Figure 7 The corresponding embodiments are not limited to this in the embodiments of the present application.

[0130] When the active task manager service determines that the package name of the first application is included in the first control list, the step shown in S306 is executed; or, when the active task manager service determines that the package name of the first application is not in the first control list, the frame rate of the first application is not processed.

[0131] It is understandable that the sequence of any step in S301-S305 is not specifically limited in the embodiment of the present application.

[0132] S306: The activity task manager service sends a first message to the display composition system.

[0133] The first message is used to instruct to reduce the frame rate of the first application, and the first message may include: the package name of the first application, information used to indicate that the frame rate reduction feature is enabled, and information used to indicate that the first application is in the background. For example, the first message may include: package name (packagename), true (true), and background type (type_background), and true indicates that the frame rate reduction feature is enabled.

[0134] When the display composition system determines that the frame reduction feature is enabled based on the first message, the display composition system may call an interface to determine from the active task manager service that the frame rate when the frame reduction feature is enabled is the second frame rate.

[0135] The first frame rate is greater than the second frame rate. The first frame rate may be a value such as 120 Hz (or 90 Hz), and the second frame rate may be a value such as 15 Hz (or 30 Hz).

[0136] In a possible implementation, the first message may include: the package name of the first application, the UID of the first application, information indicating that the frame reduction feature is enabled, and information indicating that the first application is in the background.

[0137] It is understandable that since some applications in electronic devices can support the application clone function and the application package name cannot distinguish between the two applications in the clone, the electronic device can use the package name of the first application and the UID of the first application to distinguish the specific application running in the application clone scenario to improve the accuracy of the power consumption reduction method.

[0138] S307: The display synthesis system sets the frame rate of the first application to the second frame rate, and then adds the first application to the second control list.

[0139] The second control list may include: the package name of the application, or the package name of the application + the UID of the application.

[0140] Furthermore, after the electronic device adds the application to the second control list, the electronic device can use the second control list to control the application that has been downgraded. The specific steps of the second control list can be referred to the steps shown in S506-S507, which will not be repeated here.

[0141] Exemplarily, when the display synthesis system determines from the first message that the first application is in the background, the package name of the first application (or the package name of the first application + the UID of the first application) is added to the second control list, and the frame rate of the first application is set to the second frame rate.

[0142] After the display composition system sets the frame rate to the second frame rate, the display composition system may subsequently receive a vsync signal requested by the first application and, when it is determined that the first application is in the second control list, process the distribution of the vsync signal based on the second frame rate.

[0143] Based on this, when the electronic device detects that the first application exits the foreground and there is no visible window currently, it can reduce the frame rate and reduce the number of times the first application applies for vsync signals in the background, thereby alleviating the waste of resources caused by the first application applying for vsync signals in the background.

[0144] In a possible implementation, after S307, when the first application is in the background and in the first control list, in response to the user closing the first application, the electronic device can perform the steps of restoring the first frame rate of the first application, thereby removing the first application from the second control list. In this scenario, when the first application is started again, since the first application has been restored to the first frame rate, the first application can display the interface in the first application based on the first frame rate after applying for a visible window.

[0145] Alternatively, after S307, in response to the user closing the first application, the electronic device may not perform the step of setting the first application to the first frame rate, thereby removing the first application from the second control list. In this scenario, when the first application is started again, the electronic device may perform the step of setting the first application to the first frame rate, thereby removing the first application from the second control list when the application window is visible, so that the interface of the first application can be displayed normally in the foreground based on the first frame rate.

[0146] exist Figure 3 On the basis of the corresponding embodiment, the electronic device may also restore to the first frame rate when detecting that the first application returns to the foreground from the background, and the first application is not closed during the process of returning to the foreground from the background. It is understandable that Figure 4 The first application described in the description may be an application determined to be at the second frame rate through the judgment between S301-S307, and the first application is an application in the second control list.

[0147] For example, Figure 4 A flowchart of another method for reducing power consumption provided in an embodiment of the present application. Figure 4 In a corresponding embodiment, the electronic device may include: a window manager, an activity task manager service, and a display composition system.

[0148] like Figure 4 As shown, the method for reducing power consumption may include the following steps:

[0149] S401: When the window manager determines that the first application returns to the foreground, the window manager applies for the application window to be visible.

[0150] The window application makes the application window visible, that is, the window manager can set the property of the application window to visible, and the application window can be displayed in the foreground.

[0151] Exemplarily, the window manager may detect the interface state of the first application and, in response to the user Figure 6 In the interface shown in b, by sliding upward along the bottom, the electronic device can display the background multitasking interface ( Figure 6), the background multitasking interface may include a thumbnail of the first application. In response to a click operation on the thumbnail of the first application, the window manager may determine that the first application is back to the foreground when detecting that the activity of the first application is in a resume state. At this time, the electronic device may display the following Figure 6 The interface shown in a in FIG. The first application may be returned to the foreground by a cold start or a hot start.

[0152] S402: The window manager sends a message to the active task manager service for instructing the first application to exit the foreground.

[0153] Suitably, the active task manager service may execute the step shown in S403 when determining that the first application exits the foreground.

[0154] The window manager may execute the step shown in S402 when detecting that any application requests a visible window.

[0155] S403: The activity task manager service determines whether the preset switch is turned on.

[0156] The meaning of the preset switch and the method for obtaining the preset switch can refer to the step shown in S301, which will not be repeated here.

[0157] When the active task manager service determines that the preset switch is turned on, the step shown in S404 is executed; or when the active task manager service determines that the preset switch is turned off, the frame rate of the first application is not processed.

[0158] Optionally, S404, the active task manager service determines whether the method call satisfies the system call.

[0159] The way in which the active task manager service determines whether the method call satisfies the system call can be seen in the step shown in S303, which will not be repeated here.

[0160] When the active task manager service determines that the method call satisfies the system call, the step shown in S405 is executed; or when the active task manager service determines that the method call does not satisfy the system call, the frame rate of the first application is not processed.

[0161] Optionally, S405 , the activity task manager service determines whether the package name of the first application passes parameter validity verification.

[0162] The way in which the activity task manager service determines whether the package name of the first application passes the parameter validity check can be referred to the step shown in S304, which will not be repeated here.

[0163] When the activity task manager service determines that the package name of the first application passes the parameter validity check, the step shown in S406 is executed; or when the activity task manager service determines that the package name of the first application does not pass the parameter validity check, the step shown in S407 is executed.

[0164] S406: The activity task manager service determines whether the first application is in the first control list.

[0165] The meaning and usage of the first control list can be found in the steps shown in S305 and will not be repeated here.

[0166] When the active task manager service determines that the package name of the first application is included in the first control list, the step shown in S407 is executed; or, when the active task manager service determines that the package name of the first application is not in the first control list, the frame rate of the first application is not processed.

[0167] In a possible implementation, the active task manager can determine whether to restore the frame rate of all applications restored from the background to the foreground based on the steps shown in S403-S406. Alternatively, the active task manager can also determine whether the first application is in the second control list based on the package name of the first application. For example, when the task manager determines that the first application is in the second control list, the steps shown in S407-S408 are executed.

[0168] S407: The activity task manager service sends a second message to the display composition system.

[0169] The second message is used to restore the frame rate of the first application, and the second message may include: the package name of the first application, information indicating that the frame reduction feature is turned off, and a message indicating that the first application is in the foreground. For example, the second message may include: packagename, false, and foreground type (type_foreground), where false indicates that the frame reduction feature is turned off.

[0170] When the display composition system determines that the frame reduction feature is turned off based on the first message, the display composition system can call an interface to determine from the active task manager service that the frame rate when the frame reduction feature is turned off is the first frame rate.

[0171] In a possible implementation, the second message may further include: the UID of the first application.

[0172] S408: The display synthesis system sets the frame rate of the first application to the first frame rate, and then removes the first application from the second control list.

[0173] The meaning of the second control list can be found in the step shown in S307 above, and will not be repeated here.

[0174] For example, when the display synthesis system determines from the second message that the first application is in the foreground, it can set the frame rate to the first frame rate, and then remove the package name of the first application (or the package name of the first application + the UID of the first application) from the second control list.

[0175] Based on this, the electronic device can restore to the first frame rate when detecting that the first application returns to the foreground, so as to avoid affecting the normal operation of the first application in the foreground when the frame rate drops to the second frame rate.

[0176] exist Figure 4 Based on the corresponding embodiments, the embodiments of the present application can provide a guarantee mechanism for detecting that the frame rate has not been restored when the first frame is displayed. For example, when the electronic device receives the first frame data of the first application after S401 and before S408, the electronic device can Figure 5 The corresponding embodiment restores the first frame rate to avoid the situation where the display synthesis system has not received the first frame rate in the second message when the first application receives frame data for the first time, resulting in an abnormal foreground frame rate of the first application.

[0177] In a possible implementation, when the electronic device receives the first frame data of the first application after S408, the electronic device may process the first frame data based on the first frame rate, and at this time, the first application will not have an abnormal frame rate.

[0178] For example, Figure 5 A schematic diagram of a process for restoring frame rate provided in an embodiment of the present application.

[0179] like Figure 5 As shown, the method comprises the following steps:

[0180] S501: A first application requests a first vsync signal from a display composition system.

[0181] The first application described in S501 may be based on Figure 3 The corresponding embodiment determines the application for frame reduction, and the first application belongs to the second control list.

[0182] Exemplarily, the first application may send a message for obtaining a first vsync signal to the display composition system.

[0183] The vsync signal can be a periodic signal, and the vsync signal period can be set according to the frame rate. When the frame rate is 120 Hz, the vsync signal period can be approximately 8.4 ms, and when the frame rate is 15 Hz, the vsync signal period can be approximately 66.6 ms.

[0184] S502: The display composition system returns a first vsync signal to the first application.

[0185] S503: When receiving the first vsync signal, the first application performs layer drawing and rendering to generate a first frame of data.

[0186] S504: The first application sends a first frame of data to the display composition system.

[0187] The first frame data may carry layer information, the layer information may include a layer name, and the layer name includes the package name of the first application.

[0188] In the step shown in S504, the first frame data may be the first frame layer data received by the display synthesis system. For example, after S401, the first frame data generated by the first application may be physically displayed after layer synthesis by the display synthesis system. Therefore, it can be understood that when the display synthesis system detects that the first application has layer data (i.e., the first frame data) that needs to be synthesized for the first time based on the layer information, it indicates that the application needs to restore the foreground visibility and display the first frame, and then the display synthesis system can execute the steps shown in S505-S507 to restore the frame rate of the first application to avoid affecting the display of the first application in the foreground.

[0189] S505: The display synthesis system determines whether the preset switch is turned on.

[0190] The meaning of the preset switch and the method for obtaining the preset switch can refer to the step shown in S301, which will not be repeated here.

[0191] When the display composition system determines that the preset switch is turned on, the step shown in S506 is executed; or when the display composition system determines that the preset switch is turned off, the frame rate of the first application is not processed.

[0192] S506: The display synthesis system determines whether the first application is in the second control list.

[0193] When the display composition system determines that the second control list includes the package name of the first application, the step shown in S507 is executed; or, when the display composition system determines that the second control list does not include the package name of the first application, the frame rate of the first application is not processed.

[0194] S507: The display synthesis system sets the frame rate of the first application to the first frame rate, and then removes the first application from the second control list.

[0195] Exemplarily, after the display composition system recovers to the first frame rate and then removes the first application from the second control list, the display composition system can distribute a vsync signal to the first application at the first frame rate.

[0196] Based on this, in order to prevent the display synthesis system from not receiving the first frame rate in the second message when the first application receives the frame data for the first time, resulting in frame rate abnormalities in the foreground application and page freezes, the display synthesis system can restore to the first frame rate in advance when it detects that the first application is in the foreground and receives the first frame data.

[0197] Combination Figure 4 as well as Figure 5 In a corresponding embodiment, when the display synthesis system is first based on Figure 5 After the corresponding embodiment restores the first frame rate of the first application in advance, the display synthesis system receives the second message in S407. Suitably, the display synthesis system can execute the step shown in S408 when receiving the second message. Since the first application is no longer in the second control list at this time, the result after the display synthesis system executes S408 is that the frame rate of the first application is not processed; or, the display synthesis system can also determine whether the first application is in the second control list when receiving the second message, and when it is determined that the first application is not in the second control list, the step shown in S408 is not executed.

[0198] exist Figure 3-Figure 5 On the basis of the corresponding embodiment, the electronic device can also provide a mechanism for delaying the issuance of the vsync signal in the method of reducing power consumption.

[0199] For example, Figure 7 A schematic diagram of a vsync signal distribution process provided by an embodiment of the present application.

[0200] exist Figure 7 In the corresponding embodiment, the electronic device may run: APP1, APP2, APP3, a main thread in an event thread (or simply referred to as the main thread), a delay thread in the event thread (or simply referred to as the delay thread), and SF composit.

[0201] The main thread is used to detect the vsync signal requested by the application and to implement the distribution of the vsync signal; the delay thread is used to implement the delayed distribution of the vsync signal by setting a timer.

[0202] The event thread may be a sub-thread in the display composition system. The SF composition may also be a sub-thread in the display composition system, and the SF composition is used to implement composition processing for layers.

[0203] like Figure 7As shown, the electronic device can be in a first frame rate, and when the electronic device determines to downgrade the first application, the frame rate of the first application can be switched from the first frame rate to the second frame rate, and then when the electronic device determines to restore the frame rate of the first application, the frame rate of the first application can be switched from the second frame rate to the first frame rate.

[0204] When the first frame rate is 120 Hz, the vsync signal period may be approximately 8.3 ms, that is Figure 7 The time interval between adjacent frames in the video frame may be approximately 8.3 ms. The embodiment of the present application takes a screen refresh rate of 120 Hz as an example for illustration; when the second frame rate is 15 Hz, the vsync signal period may be approximately 66.7 ms.

[0205] In frame 1, the electronic device can run APP1, APP1, APP2 and APP3 in the foreground at the same time. For example, the electronic device can display APP1 and APP2 in split screen, and display APP3 in the form of a floating window. In the embodiment of the present application, there is no limitation on the form in which APP1, APP1, APP2 and APP3 are running in the foreground. Furthermore, APP1, APP2 and APP3 all request a vsync signal from the display synthesis system.

[0206] When the main thread determines that APP1, APP2, and APP3 all request vsync signals, the main thread determines whether APP1, APP2, and APP3 are all in the second control list. When the main thread determines that APP1, APP2, and APP3 are not in the second control list, the main thread can generate a vsync signal and distribute it to APP1, APP2, and APP3.

[0207] Before the main thread of frame 2 distributes the vsync signal, in response to APP3 exiting the foreground (or understood as APP3 returning to the background), the electronic device can Figure 3 In a corresponding embodiment, after determining that APP3 satisfies the steps shown in S301-S305, the electronic device can set the frame rate of APP3 to 15 Hz, and then add APP3 to the second control list. In this scenario, APP1 and APP2 can continue to run in the foreground of the electronic device.

[0208] In frame 2, the electronic device runs APP1 and APP2 in the foreground, and the electronic device runs APP3 in the background. Further, APP1, APP2 and APP3 all request a vsync signal.

[0209] When the main thread determines that APP1, APP2, and APP3 all request vsync signals, it determines whether APP1, APP2, and APP3 are all in the second control list. When the main thread determines that APP1 and APP2 are not in the second control list, the main thread generates a vsync signal and distributes the vsync signal to APP1 and APP2.

[0210] When the main thread determines that APP3 is in the second control list, the main thread can add APP3 to the third control list. The third control list is used to store applications that have not yet distributed vsync signals. The subsequent delay thread can realize the vsync signal distribution for objects in the third control list.

[0211] Exemplarily, when the main thread determines that APP3 is an object in the third control list, the main thread can wake up the delay thread. The delay thread sets a first timer, the trigger time of the first timer is the first distribution time, and the delay thread sets a task of distributing a vsync signal to APP3 when the first timer initiates a notification. When the first timer determines that the first distribution time has arrived, the first timer can notify the delay thread through a SIGALRM signal, and the delay thread can perform the task of distributing a vsync signal to APP3. After the task is completed, the display synthesis system clears the objects in the third control list and records the first distribution time of distributing the vsync signal to APP3.

[0212] The main thread and the delayed thread may be created by the display composition system at the same time. For example, the display composition system may create the main thread, delayed thread and other threads in the display composition system after detecting that the device is turned on.

[0213] Among them, the first distribution time can be 1ms or 2ms after the delay thread sets the first timer. It can be understood that the delay thread can almost achieve immediate distribution of the vsync signal of frame 2.

[0214] In frame 3, the electronic device runs APP1 and APP2 in the foreground, and the electronic device keeps running APP3 in the background. Further, APP1, APP2 and APP3 all request a vsync signal.

[0215] When the main thread determines that APP1, APP2, and APP3 all request vsync signals, it determines whether APP1, APP2, and APP3 are all in the second control list. When the main thread determines that APP1 and APP2 are not in the second control list, the main thread distributes the vsync signal to APP1 and APP2.

[0216] When the main thread determines that APP3 is in the second control list, the main thread can add APP3 to the third control list, the main thread can wake up the delay thread, the delay thread sets a second timer, the trigger event of the second timer is the second distribution time, and the delay thread sets the task of distributing the vsync signal to APP3 when the second timer initiates the notification. When the second timer determines that the second distribution time has arrived, the second timer can notify the delay thread through the SIGALRM signal, and the delay thread can perform the task of distributing the vsync signal to APP3. After the task is completed, the display synthesis system clears the objects in the third control list and records the second distribution time for distributing the vsync signal to APP3.

[0217] The second distribution time may be the time after the first distribution time is added with 66.6ms, for example, the second distribution time may be at frame 10. Or it may be understood that the duration between the first distribution time and the time when the delay thread sets the second timer is the first duration, the duration between the time when the delay thread sets the second timer and the second distribution time is the second duration, and the sum of the first duration and the second duration is 66.6ms, so that the time interval between the distribution of the vsync signal to APP3 after frame 2 and the distribution of the vsync signal to APP3 by frame 10 is 66.6ms, that is, the frame rate of APP3 is satisfied to be 15Hz.

[0218] In a possible implementation, APP4 may also be running in the electronic device. When APP3 enters the background and APP4 also enters the background from the foreground, the display synthesis system may add the package name of APP4 to the second control list. Furthermore, the display synthesis system may control the signal distribution of APP3 and APP4 through a delay thread, or the display synthesis system may control the signal distribution of APP3 and APP4 through two delay threads respectively.

[0219] In one implementation, when the main thread confirms that APP4 requests a vsync signal and the package name of APP4 is in the second control list, the main thread can also add APP4 to the third control list. Since the third control list contains APP3 and APP4 at this time, the delay thread can uniformly distribute vsync signals to APP3 and APP4 in the third control list when it is determined that the second distribution time has arrived.

[0220] For example, Figure 8 A schematic diagram of another process of distributing vsync signals provided by an embodiment of the present application. Figure 8 As shown, the vsync signal distribution process of APP3 and APP4 in the background is illustrated by way of example.

[0221] After APP3 returns to the background, APP4 can return to the background at any time between frame 3 and frame 9, for example, APP4 can return to the background at frame 4. When frame 4 returns to the background, the display synthesis system can reduce the frame rate of APP4 to 15Hz, and then add APP4 to the second control list.

[0222] Further, APP4 requests a vsync signal. When the main thread determines that APP4 is in the second control list, the main thread can add APP4 to the third control list. At this time, the third control list includes APP3 and APP4. When the second timer determines that the second distribution time has arrived, the second timer can notify the delay thread through the SIGALRM signal, and the delay thread implements the vsync signal distribution for APP3 in the third control list and the vsync signal distribution for APP4.

[0223] In another implementation, when the main thread confirms that APP4 requests a vsync signal and APP4 is in the second control list, the main thread can add APP4 to the fourth control list and wake up another delay thread. The other delay thread can be used to control the delayed distribution of APP4. For example, a third timer can be set in the other delay thread according to the vsync signal distribution cycle of APP4, and the triggering event of the third timer can be the third distribution time. The delay thread is set to distribute the vsync signal to APP4 at the third distribution time. For example, when the frame rate of APP4 is 30Hz, the vsync signal distribution cycle of APP4 can be 33.3ms. It can be understood that the electronic device can control the vsync signal distribution of different applications at different frame rates through two delay threads. Among them, the vsync signal distribution process at different frame rates can refer to the process of delaying the distribution of APP3 using the delay thread, which will not be repeated here.

[0224] Between frames 4 and 9, the electronic device can run APP2 in the foreground and APP3 in the background. In this scenario, APP1 stops drawing and rendering (APP1 can stop running at this time), APP3 is in the background and has not yet requested a vsync signal, and APP2 can request a vsync signal in each frame between frames 4 and 9.

[0225] Taking frame 4 as an example, the vsync signal distribution process between frames 5 to 9 can refer to frame 4, which will not be repeated later.

[0226] In frame 4, when the main thread determines that APP2 requests a vsync signal, it determines whether APP2 is in the second control list. When the main thread determines that APP2 is not in the second control list, the main thread distributes the vsync signal to APP2. Moreover, since the second distribution time indicated in the second timer has not been reached at this time, the main thread does not distribute the vsync signal requested by APP3.

[0227] In frame 10, the electronic device may run APP2 in the foreground and APP3 in the background. APP2 requests a vsync signal, but APP3 does not request a vsync signal.

[0228] The main thread can determine whether APP2 is in the second control list when APP2 requests the vsync signal. When the main thread determines that APP2 is not in the second control list, the main thread distributes the vsync signal to APP2.

[0229] When the second timer determines that the second distribution time has arrived, the second timer can notify the delay thread through the SIGALRM signal, and the delay thread can distribute the vsync signal requested by APP3 in frame 3 to APP3, thereby realizing delayed distribution of the vsync signal requested by the background application.

[0230] In frame 11, the electronic device may run APP2 in the foreground and APP3 in the background. APP2 requests a vsync signal, but APP3 does not request a vsync signal.

[0231] The main thread can determine whether APP2 is in the second control list when APP2 requests the vsync signal. When the main thread determines that APP2 is not in the second control list, the main thread distributes the vsync signal to APP2.

[0232] Before the main thread distributes the vsync signal in frame 12, APP3 returns to the foreground, and the display synthesis system can remove APP3 from the second control list, and the display synthesis system can switch the frame rate of APP3 to 120Hz.

[0233] In frame 12, the electronic device can run APP2 and APP3 in the foreground. Both APP2 and APP3 request a vsync signal.

[0234] After frame 12, the main thread can determine whether APP2 and APP3 are in the second control list when APP2 and APP3 request vsync signals. When the main thread determines that neither APP2 nor APP3 is in the second control list, the main thread distributes the vsync signal to APP2 and APP3.

[0235] It is understandable that the electronic device can delay the distribution of the vsync signal initiated by the background application by setting a delay thread to alleviate the power consumption waste caused by the background application applying for the vsync signal to draw the image frame.

[0236] exist Figure 4-Figure 8 In the corresponding embodiment, the content in the first control list can be flexibly added or deleted in the cloud, and the cloud can push the first control list to the electronic device of the execution model through the configuration file. Suitably, the electronic device can receive the configuration file pushed by the cloud by registering the parameter upgrade broadcast in AndroidManfest or setting the parameter upgrade broadcast receiver.

[0237] The first control list may be obtained by loading a configuration file when the electronic device is restarted, or the first control list may be obtained by loading an updated configuration file after the electronic device performs a software update.

[0238] In one implementation, Fig. 9 A schematic diagram of a process for obtaining a first control list provided in an embodiment of the present application. Fig. 9 As shown, the method for obtaining the first control list may include the following steps:

[0239] S901: The electronic device receives an operation of a user opening a software update interface.

[0240] The operation for the user to open the software update interface may be that the user enters the software update interface by following the path of Settings->System and Updates->Software Update.

[0241] S902: In response to the user opening the software update interface, the electronic device determines whether there is a configuration file that needs to be updated.

[0242] When the electronic device detects that there is an updated configuration file, it may display a configuration update button in the software update interface and then execute the step shown in S903; or, when the electronic device determines that there is no updated configuration file, it may execute the step shown in S908.

[0243] S903: The electronic device receives an operation by the user on a configuration update button.

[0244] S904: In response to the user's operation on the configuration update button, the electronic device notifies the system side that there is a configuration update.

[0245] S905: The electronic device determines whether a preset switch is turned on.

[0246] The electronic device executes the step shown in S906 when determining that the preset switch is turned on, or executes the step shown in S908 when determining that the preset switch is turned off. The meaning of the preset switch can refer to the step shown in S301, which will not be repeated here.

[0247] S906: The electronic device loads the updated configuration file.

[0248] S907. The electronic device parses the first control list in the configuration file and saves the first control list.

[0249] S908. The electronic device ends updating.

[0250] In another implementation, Fig.10 Another flow chart of obtaining the first control list provided in the embodiment of the present application. Fig.10 As shown, the method for obtaining the first control list may include the following steps:

[0251] S1001: The electronic device receives an operation from a user to restart the device.

[0252] S1002. The electronic device determines whether there is a configuration file in the product path.

[0253] The product path may store files containing product characteristics of the electronic device. When the electronic device finds the configuration file in the product path, the step shown in S1004 is executed, or when the electronic device does not find the configuration file in the product path, the step shown in S1003 is executed.

[0254] S1003: The electronic device determines whether there is a configuration file in the preset path.

[0255] The preset path may be a default path for storing configuration files of the electronic device, and the preset path does not distinguish the version of the device. When the electronic device finds the configuration file from the preset path, the step shown in S1004 is executed, or when the electronic device does not find the configuration file from the preset path, the step shown in S1006 is executed.

[0256] It is understandable that both the product path and the preset path are paths that can store configuration files. In order to adapt to more device scenarios, the electronic device can search for configuration files from the product path and the preset path respectively.

[0257] S1004: The electronic device loads the updated configuration file.

[0258] S1005. The electronic device parses the first control list in the configuration file and saves the first control list.

[0259] S1006. End updating.

[0260] It is understandable that the first control list is not fixed, but can be increased or decreased according to needs, and pushed to the electronic device through the configuration file to ensure the accuracy of the first control list described in the embodiment of the present application.

[0261] In a possible implementation, a second application is also running in the electronic device, and the second application may be an application that does not allow frame drops. Figure 6 In the interface shown in a of FIG. 1 , in response to the operation of returning the first application to the background, the electronic device may also Figure 6 The interface of the second application is displayed in the interface shown in b in FIG. The operation of returning the first application to the background can be a sliding operation of the user to the left or right along the bottom of the display screen.

[0262] In response to the first application returning to the foreground, the electronic device can resume displaying Figure 6 In the interface shown in a, the second application is in the background.

[0263] In a scenario where the second application is switched from the background to the foreground or from the foreground to the background, the frame rate of the second application may remain unchanged.

[0264] Combined with the above Figure 4-Figure 10 , the method provided in the embodiment of the present application is described, and the device for executing the above method provided in the embodiment of the present application is described below. Fig.11 As shown, Fig.11 A schematic diagram of the structure of a power consumption reduction device provided in an embodiment of the present application. The power consumption reduction device may be an electronic device in an embodiment of the present application, or a chip or chip system in an electronic device.

[0265] like Fig.11 As shown, the apparatus 1100 for reducing power consumption can be used in a communication device, a circuit, a hardware component or a chip, and the apparatus 1100 for reducing power consumption includes: a display unit 1101 and a processing unit 1102. The display unit 1101 is used to support the display step of the method for reducing power consumption; the processing unit 1102 is used to support the apparatus 1100 for reducing power consumption to perform information processing steps.

[0266] In a possible implementation, the apparatus 1100 for reducing power consumption may further include a communication unit 1103, and the communication unit 1103 is used to support the apparatus 1100 for reducing power consumption to perform steps such as receiving or sending a message.

[0267] The power consumption reduction devices described in the embodiments of the present application may include Fig.11 The units described in the corresponding embodiments.

[0268] Specifically, the processing unit 1102 and the display unit 1101 may be integrated together, and the processing unit 1102 and the display unit 1101 may communicate with each other.

[0269] In a possible implementation, the power consumption reduction apparatus 1100 may further include: a storage unit 1104. The storage unit 1104 may include one or more memories, and the memory may be a device in one or more devices or circuits for storing programs or data.

[0270] The storage unit 1104 may exist independently and be connected to the processing unit 1102 via a communication bus. The storage unit 1104 may also be integrated with the processing unit 1102.

[0271] Taking the power consumption reduction device 1100 as an example, which can be a chip or chip system of an electronic device in an embodiment of the present application, the storage unit 1104 can store computer execution instructions of the method of the electronic device, so that the processing unit 1102 executes the method of the electronic device in the above embodiment. The storage unit 1104 can be a register, a cache, or a random access memory (RAM), etc. The storage unit 1104 can be integrated with the processing unit 1102. The storage unit 1104 can be a read-only memory (ROM) or other types of static storage devices that can store static information and instructions, and the storage unit 1104 can be independent of the processing unit 1102.

[0272] In a possible implementation, the apparatus 1100 for reducing power consumption may further include: a communication unit 1103. The communication unit 1103 is used to support the apparatus 1100 for reducing power consumption to interact with other devices. Exemplarily, when the apparatus 1100 for reducing power consumption is an electronic device, the communication unit 1103 may be a communication interface or an interface circuit. When the apparatus 1100 for reducing power consumption is a chip or a chip system in an electronic device, the communication unit 1103 may be a communication interface. For example, the communication interface may be an input / output interface, a pin or a circuit, etc.

[0273] The device of this embodiment can be used to execute the steps executed in the above method embodiment. Its implementation principle and technical effects are similar and will not be described in detail here.

[0274] Fig.12 A schematic diagram of the hardware structure of another electronic device provided in an embodiment of the present application.

[0275] The electronic device includes a processor 1201, a communication circuit 1204 and at least one communication interface ( Fig.12 The communication interface 1203 is used as an example for explanation).

[0276] The processor 1201 may be a general-purpose central processing unit (CPU), a microprocessor, an application-specific integrated circuit (ASIC), or one or more integrated circuits for controlling the execution of the program of the present application.

[0277] Communications link 1204 may include circuitry to transmit information between the above-described components.

[0278] The communication interface 1203 uses any transceiver or other device for communicating with other devices or communication networks, such as Ethernet, wireless local area networks (WLAN), etc.

[0279] Possibly, the electronic device may further include a memory 1202 .

[0280] The memory 1202 may be a read-only memory (ROM) or other types of static storage devices that can store static information and instructions, a random access memory (RAM) or other types of dynamic storage devices that can store information and instructions, or an electrically erasable programmable read-only memory (EEPROM), a compact disc read-only memory (CD-ROM) or other optical disc storage, optical disc storage (including compressed optical disc, laser disc, optical disc, digital versatile disc, Blu-ray disc, etc.), a magnetic disk storage medium or other magnetic storage device, or any other medium that can be used to carry or store the desired program code in the form of instructions or data structures and can be accessed by a computer, but is not limited thereto. The memory may exist independently and be connected to the processor via a communication line 1204. The memory may also be integrated with the processor.

[0281] The memory 1202 is used to store computer-executable instructions for executing the solution of the present application, and the execution is controlled by the processor 1201. The processor 1201 is used to execute the computer-executable instructions stored in the memory 1202, thereby implementing the method provided by the embodiment of the present application.

[0282] Possibly, the computer-executable instructions in the embodiments of the present application may also be referred to as application code, and the embodiments of the present application do not specifically limit this.

[0283] In a specific implementation, as an embodiment, the processor 1201 may include one or more CPUs, such as Fig.12 CPU0 and CPU1 in.

[0284] In a specific implementation, as an embodiment, the electronic device may include multiple processors, such as Fig.12 1 and 1205. Each of these processors may be a single-CPU processor or a multi-CPU processor. A processor herein may refer to one or more devices, circuits, and / or processing cores for processing data (e.g., computer program instructions).

[0285] In the above embodiments, the instructions stored in the memory for execution by the processor may be implemented in the form of a computer program product, wherein the computer program product may be pre-written in the memory, or may be downloaded and installed in the memory in the form of software.

[0286] The computer program product includes one or more computer instructions. When the computer program instructions are loaded and executed on the computer, the process or function according to the embodiment of the present application is generated in whole or in part. The computer can be a general-purpose computer, a special-purpose computer, a computer network or other programmable device. The computer instructions can be stored in a computer-readable storage medium, or transmitted from one computer-readable storage medium to another computer-readable storage medium. For example, the computer instructions can be transmitted from one website site, computer, server or data center to another website site, computer, server or data center by wired (e.g., coaxial cable, optical fiber, digital subscriber line (digital subscriber line, DSL) or wireless (e.g., infrared, wireless, microwave, etc.) mode. The computer-readable storage medium can be any available medium that a computer can store or a data storage device such as a server or data center that includes one or more available media integrated. For example, the available medium can include a magnetic medium (e.g., a floppy disk, a hard disk or a tape), an optical medium (e.g., a digital versatile disc (digital versatiledisc, DVD)), or a semiconductor medium (e.g., a solid state drive (solid state disk, SSD)), etc.

[0287] The embodiments of the present application also provide a computer-readable storage medium. The methods described in the above embodiments can be implemented in whole or in part by software, hardware, firmware, or any combination thereof. Computer-readable media may include computer storage media and communication media, and may also include any medium that can transfer a computer program from one place to another. The storage medium may be any target medium that can be accessed by a computer.

[0288] As a possible design, the computer readable medium may include a compact disc read-only memory (CD-ROM), RAM, ROM, EEPROM or other optical disc storage; the computer readable medium may include a magnetic disk storage or other magnetic disk storage device. Moreover, any connection line may also be appropriately referred to as a computer readable medium. For example, if the software is transmitted from a website, server or other remote source using a coaxial cable, fiber optic cable, twisted pair, DSL or wireless technology (such as infrared, radio and microwave), the coaxial cable, fiber optic cable, twisted pair, DSL or wireless technology such as infrared, radio and microwave are included in the definition of medium. Disk and disc as used herein include compact disc (CD), laser disc, optical disc, digital versatile disc (DVD), floppy disk and Blu-ray disc, where disks usually reproduce data magnetically, while optical discs reproduce data optically using lasers.

[0289] The above combinations should also be included in the scope of computer-readable media. The above are only specific embodiments of the present invention, but the protection scope of the present invention is not limited thereto. Any technician familiar with the technical field can easily think of changes or substitutions within the technical scope disclosed by the present invention, which should be included in the protection scope of the present invention. Therefore, the protection scope of the present invention shall be based on the protection scope of the claims.

[0290] It should be noted that the user information (including but not limited to user device information, user personal information, etc.) and data (including but not limited to data used for analysis, stored data, displayed data, etc.) involved in this application are all information and data authorized by the user or fully authorized by all parties, and the collection, use and processing of relevant data must comply with relevant laws, regulations and standards, and provide corresponding operation entrances for users to choose to authorize or refuse.

Claims

1. A method for reducing power consumption, characterized in that: The method comprises: The electronic device displays a first interface of a first application, wherein the first application is at a first frame rate; In response to the first operation, the electronic device displays a second interface, where the second interface does not include any window of the first application; The first application issues a drawing request to draw in the first window, the electronic device sets a frame rate of the first application to a second frame rate, the second frame rate is less than the first frame rate, and the first window is invisible.

2. The method according to claim 1, characterized in that The electronic device sets the frame rate of the first application to a second frame rate, including: When the first application belongs to a first list, the electronic device sets the frame rate of the first application to a second frame rate, and the first list includes applications that are allowed to apply for a vertical synchronization vsync signal in the background.

3. The method according to claim 2, characterized in that The method further comprises: The electronic device displays a third interface of a second application, wherein the second application is at a first frame rate; In response to the second operation, the electronic device displays a fourth interface, where the fourth interface does not include any window of the second application; The second application issues a drawing request to draw in the second window, and the electronic device maintains the second application at the first frame rate, wherein the second window is not visible and the second application does not belong to the first list.

4. The method according to claim 2, characterized in that: After the electronic device sets the frame rate of the first application to a second frame rate, the method further includes: The electronic device adds the first application to a second list to obtain a third list, wherein the second list includes applications having a frame rate of the second frame rate, and the third list includes the first application.

5. The method according to claim 4, characterized in that The electronic device runs a first thread, and after the electronic device adds the first application to a second list, the method further includes: When the electronic device receives a first vsync signal request sent by the first application at a first moment, distributing the first vsync signal to the first application at a second moment through the first thread; When the electronic device receives a second vsync signal request sent by the first application at a third moment, the second vsync signal is distributed to the first application through the first thread at a fourth moment, the second vsync signal request is the next vsync signal request of the first vsync signal request, and the time interval between the fourth moment and the second moment is determined by the electronic device based on the second frame rate.

6. The method according to claim 5, characterized in that When the electronic device receives a second vsync signal request sent by the first application at a third time, distributing the second vsync signal to the first application at a fourth time through the first thread includes: When the electronic device receives a second vsync signal request sent by the first application through the second thread at a third moment and wakes up the first thread when it is determined that the first application is in the third list, wherein the first thread starts a timer, and the timer notifies the first thread to distribute the second vsync signal to the first application at the fourth moment.

7. The method according to claim 6, characterized in that The electronic device runs a third application in the foreground, and the method further includes: When the electronic device receives a third vsync signal request sent by a third application, the electronic device distributes the third vsync signal to the third application through the second thread, and the electronic device distributes the first vsync signal to the first application at a second moment through the first thread.

8. The method according to claim 5, characterized in that The electronic device further runs a fourth application, the fourth application belongs to the first list and the fourth application belongs to the third list, and the electronic device receives a fourth vsync signal request sent by the fourth application between the third moment and the fourth moment, and the method further includes: The electronic device distributes the second vsync signal to the first application at the fourth moment through the first thread, and distributes the fourth vsync signal to the fourth application at the fourth moment.

9. The method according to any one of claims 6 to 8, characterized in that: The electronic device is provided with a display synthesis system, in which an event thread event thread is run, the second thread is a main thread main thread in the event thread, and the first thread is a delay thread delay thread in the event thread.

10. The method according to claim 4, characterized in that The method further comprises: In response to the operation of closing the first application, when the first application belongs to the first list, the electronic device sets the frame rate of the first application to the first frame rate; The electronic device removes the first application from the third list.

11. The method according to claim 1, characterized in that: The electronic device is configured with: an activity task manager service and a display synthesis system, and the electronic device sets the frame rate of the first application to a second frame rate, including: The task manager service sends a first message to the display composition system, wherein the first message includes: a package name of the first application, information indicating that a frame reduction feature is enabled, and information indicating that the first application is in the background; The display composition system acquires the second frame rate based on the information indicating that the frame reduction feature is enabled; The display composition system sets the frame rate of the first application to the second frame rate.

12. The method according to claim 11, characterized in that The first message also includes: a user identifier UID of the first application.

13. The method according to claim 4, characterized in that After the electronic device adds the first application to the second list to obtain a third list, the method further includes: In response to a third operation, the electronic device applies for the window of the first application to be visible; In a case where the first application belongs to the first list, the electronic device sets the frame rate of the first application to the first frame rate; The electronic device removes the first application from the third list.

14. The method according to claim 13, characterized in that Before the electronic device sets the frame rate of the first application to the first frame rate, the method further includes: When the electronic device receives the first frame data from the first application and the electronic device determines that the first application belongs to the third list, the electronic device sets the frame rate of the first application to the first frame rate, and the frame data is data obtained by layer rendering when the first application receives a vsync signal; The electronic device removes the first application from the third list.

15. The method according to claim 13, characterized in that The electronic device is configured with: a window manager, an activity task manager service and a display synthesis system. The window for the electronic device to apply for the first application is visible, including: The window manager applies for the window of the first application to be visible; The window manager sends a second message to the active task manager service, where the second message is used to instruct the first application to return to the foreground; In a case where the first application belongs to the first list, the electronic device sets the frame rate of the first application to the first frame rate, including: In response to the second message, when the active task manager service determines that the first application belongs to the first list, the active task manager service sends a third message to the display composition system, wherein the third message includes: a package name of the first application, information indicating that the frame drop feature is turned off, and information indicating that the first application is in the foreground; The display composition system acquires the first frame rate based on the information indicating that the frame reduction feature is turned off; The display composition system sets the frame rate of the first application to the first frame rate.

16. The method according to claim 15, characterized in that The second message also includes: a user identifier UID of the first application.

17. An electronic device comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein: When the processor executes the computer program, the electronic device executes the method according to any one of claims 1 to 16.

18. A computer-readable storage medium storing a computer program, characterized in that: When the computer program is executed by a processor, the computer is caused to perform the method according to any one of claims 1 to 16.

Citation Information

Cited By

  • Method and apparatus for reducing power consumption

    EP4675399A1

  • Method and apparatus for reducing power consumption

    WO2025066576A1