Image drawing method and electronic equipment

CN119731627APending Publication Date: 2025-03-28HONOR DEVICE CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202380060885.1
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Priority Date
2022-11-04
Filing Date
2023-08-14
Publication Date
2025-03-28

AI Technical Summary

Technical Problem

In electronic devices such as mobile phones, applications running in the background continue to apply for drawing interfaces or animations, resulting in a waste of system resources and increased power consumption.

Method used

By reducing the frequency of the display synthesis system sending vertical synchronization signals to the application's choreographer, the application's corresponding image drawing operation frequency is reduced, especially when all windows are switched to the background, the second frequency is used to perform image drawing operations. The second frequency is smaller than the first frequency.

Benefits of technology

It effectively avoids the waste of system resources of electronic equipment, reduces CPU resource consumption, thereby reducing power consumption and improving the operating efficiency of the equipment.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119731627A_ABST
    Figure CN119731627A_ABST
Patent Text Reader

Abstract

The embodiment of the invention discloses an image drawing method and electronic equipment, relates to the field of electronic equipment, and is used for reducing the power consumption of the electronic equipment when an application program is in the background of the electronic equipment. According to the specific scheme, the electronic equipment receives starting operation of a user; in response to the starting operation, the electronic equipment starts the first application program; under the condition that at least one window of the first application program runs in the foreground of the electronic equipment, the electronic equipment executes an image drawing operation corresponding to the first application program based on the first frequency; under the condition that all windows of the first application program are switched to the background to run, the electronic equipment executes image drawing operation corresponding to the first application program based on second frequency, and the second frequency is smaller than the first frequency.
Need to check novelty before this filing date? Find Prior Art

Description

Image drawing method and electronic device

[0001] This application claims priority to the Chinese patent application filed with the State Intellectual Property Office on November 4, 2022, with application number 202211379191.8 and invention name “A method for image drawing and electronic device”, the entire contents of which are incorporated by reference into this application. Technical Field

[0002] The present application relates to the field of electronic devices, and in particular to an image drawing method and electronic device. Background Art

[0003] With the popularity of electronic devices such as mobile phones, users often open multiple applications when using their phones. When using a mobile phone, the screen usually displays the interface of an application, that is, the application is running in the foreground of the phone, and the applications that are not displayed are running in the background of the phone.

[0004] When the application is running in the foreground of the mobile phone, the mobile phone will draw the interface corresponding to the application in the foreground. When the application is running in the background of the mobile phone, the mobile phone does not need to draw the interface corresponding to the application in the background.

[0005] However, for some applications, when the application is in the background of the mobile phone, the application will still request the mobile phone to draw the interface corresponding to the application, which will cause a waste of system resources of the mobile phone and further lead to higher power consumption of the mobile phone.

[0006] Summary of the Invention

[0007] The embodiments of the present application provide an image drawing method and an electronic device for reducing the power consumption of an electronic device such as a mobile phone when an application is in the background of the electronic device such as a mobile phone.

[0008] To achieve the above objectives, the present invention adopts the following technical solutions:

[0009] In a first aspect, an embodiment of the present application provides a method for image drawing operations, which is applied to an electronic device. The image drawing method may include: the electronic device receives a startup operation from a user; in response to the startup operation, the electronic device starts a first application; when at least one window of the first application is running in the foreground of the electronic device, the electronic device performs an image drawing operation corresponding to the first application based on a first frequency; when all windows of the first application are switched to the background, the electronic device performs an image drawing operation corresponding to the first application based on a second frequency, wherein the second frequency is less than the first frequency.

[0010] Based on the method described in the first aspect, when all windows of the electronic device's application are background windows, the electronic device can reduce the frequency of drawing the corresponding background application, thereby avoiding waste of system resources of the electronic device, such as avoiding waste of resources of the electronic device's CPU, and thereby reducing the power consumption of the electronic device.

[0011] In combination with the first aspect, in another possible implementation, the electronic device executes the image drawing operation corresponding to the first application based on the first frequency, which may include: the display synthesis system of the electronic device generates a first vertical synchronization signal, and the frequency of the first vertical synchronization signal is the first frequency; the choreographer corresponding to the first application executes the image drawing operation corresponding to the first application according to the received first vertical synchronization signal; the electronic device executes the image drawing operation corresponding to the first application based on the second frequency, which may include: the display synthesis system of the electronic device generates a first vertical synchronization signal, and the frequency of the first vertical synchronization signal is the second frequency; the choreographer corresponding to the first application executes the image drawing operation corresponding to the first application according to the received first vertical synchronization signal.

[0012] Based on this possible implementation method, when all windows of an application are background windows, the frequency with which the display synthesis system sends vertical synchronization signals to the choreographer corresponding to the application can be reduced, thereby reducing the frequency with which the choreographer corresponding to the application receives vertical synchronization signals, and further reducing the frequency with which the choreographer corresponding to the application performs drawing operations based on the received vertical synchronization signals.

[0013] In combination with the first aspect, in another possible implementation, before the display synthesis system of the electronic device generates the second vertical synchronization signal, the image drawing method may also include: the first application sends an image drawing request to the choreographer corresponding to the application; the choreographer corresponding to the application responds to the image drawing request and sends vertical synchronization signal request information to the display synthesis system of the electronic device at a first frequency; the display synthesis system of the electronic device receives the vertical synchronization signal request information and sends the vertical synchronization signal request information to the hardware of the electronic device at the first frequency; the hardware of the electronic device responds to the received vertical synchronization signal request information and sends a vertical synchronization signal to the display synthesis system of the electronic device; the display synthesis system of the electronic device receives the vertical synchronization signal sent by the hardware of the electronic device.

[0014] Based on this possible implementation method, when all windows of an application are background windows, the vertical synchronization signal is applied for at a lower frequency through the display synthesis system, but the vertical synchronization signal is sent to the choreographer corresponding to the application at the reduced frequency, so that the frequency at which the choreographer corresponding to the application receives the vertical synchronization signal is reduced, and then the frequency at which the choreographer corresponding to the application performs drawing operations according to the received vertical synchronization signal is reduced, thereby reducing the frequency of drawing the background application, thereby avoiding waste of system resources of the electronic device.

[0015] In combination with the first aspect, in another possible implementation, before the display synthesis system of the electronic device generates the first vertical synchronization signal, the image drawing method may also include: the first application sends an image drawing request to the choreographer corresponding to the application; the choreographer corresponding to the application responds to the image drawing request and sends vertical synchronization signal request information to the display synthesis system of the electronic device at a first frequency; the display synthesis system of the electronic device receives the vertical synchronization signal request information and sends the vertical synchronization signal request information to the hardware of the electronic device at the first frequency; the hardware of the electronic device responds to the received vertical synchronization signal request information and sends a vertical synchronization signal to the display synthesis system of the electronic device; the display synthesis system of the electronic device receives the vertical synchronization signal sent by the hardware of the electronic device.

[0016] Based on this possible implementation method, when there is a foreground window in the application's window, the display synthesis system applies for a vertical synchronization signal at a reduced frequency before, and sends a vertical synchronization signal to the choreographer corresponding to the application at the reduced frequency before, so that the frequency at which the choreographer corresponding to the application receives the vertical synchronization signal will not be reduced, thereby not affecting the display corresponding to the application.

[0017] In combination with the first aspect, in another possible implementation, the above-mentioned electronic device performs an image drawing operation corresponding to the first application based on the second frequency, which may include: the display synthesis system of the electronic device sends a first vertical synchronization signal to the choreographer corresponding to the first application at the first frequency; the choreographer corresponding to the first application receives a portion of the vertical synchronization signal in the first vertical synchronization signal; the choreographer corresponding to the first application performs the image drawing operation corresponding to the first application based on the portion of the vertical synchronization signal in the first vertical synchronization signal, and the time interval between any two vertical synchronization signals in the portion of the vertical synchronization signal is the inverse of the second frequency.

[0018] Based on this possible implementation method, when all windows of an application are background windows, the display synthesis system can send a vertical synchronization signal to the choreographer corresponding to the application at a reduced frequency. After the choreographer corresponding to the application receives the frequency of the vertical synchronization signal, it performs drawing operations according to the reduced frequency, thereby reducing the frequency of the drawing operations performed by the choreographer corresponding to the application.

[0019] In combination with the first aspect, in another possible implementation, the above-mentioned image drawing method may also include: a choreographer corresponding to the first application sends vertical synchronization signal request information to a display synthesis system of the electronic device, and the time interval between any two vertical synchronization signal request information in the vertical synchronization signal request information is greater than a first threshold, and the first threshold is determined based on the second frequency.

[0020] Based on this possible implementation method, when all windows of an application are background windows, the choreographer corresponding to the application can send vertical synchronization signal request information to the display synthesis system of the electronic device at a reduced frequency, thereby reducing the frequency at which the display synthesis system sends vertical synchronization signals to the choreographer corresponding to the application. After the choreographer corresponding to the application receives the frequency of the vertical synchronization signal, it can perform drawing operations according to the reduced frequency, thereby reducing the frequency at which the choreographer corresponding to the application performs drawing operations.

[0021] In combination with the first aspect, in another possible implementation, the first threshold may be the reciprocal of the second frequency.

[0022] Based on this possible implementation method, by setting the first threshold value to the inverse of the second frequency, it is possible to determine the time interval for the choreographer corresponding to the application to send vertical synchronization signal request information to the display synthesis system of the electronic device, thereby enabling the choreographer corresponding to the application to send vertical synchronization signal request information to the display synthesis system of the electronic device at a reduced frequency.

[0023] In combination with the first aspect, in another possible implementation, the above-mentioned electronic device performs the image drawing operation corresponding to the first application based on the second frequency, which may include: the display synthesis system of the electronic device sends a first vertical synchronization signal to the choreographer corresponding to the first application at the first frequency; the choreographer corresponding to the first application receives the first vertical synchronization signal; when the choreographer corresponding to the first application determines that the time interval between the moment of receiving the first vertical synchronization signal and the moment of the last execution of the image drawing operation corresponding to the first application is greater than a second threshold, the choreographer corresponding to the first application performs the image drawing operation corresponding to the first application, and the second threshold is determined based on the second frequency.

[0024] Based on this possible implementation method, when all windows of an application are background windows, the choreographer corresponding to the application can execute the image drawing operation corresponding to the application when the time interval between the moment of receiving the vertical synchronization signal and the moment of the last execution of the image drawing operation corresponding to the application is greater than a second threshold, thereby reducing the frequency of the choreographer corresponding to the application executing the drawing operation.

[0025] In combination with the first aspect, in another possible implementation, after all windows of the first application are switched to background operation, the image drawing method may further include: when at least one window of the first application is switched from the background of the electronic device to the foreground of the electronic device, the electronic device executes the image drawing operation corresponding to the first application based on the first frequency.

[0026] Based on this possible implementation, when all windows of an application are background windows, if at least one window of the application is switched to the foreground, the frequency of executing drawing operations is restored to the previous frequency, thereby not affecting the corresponding display of the application.

[0027] In combination with the first aspect, in another possible implementation, the first application may include a music player application or a video player application.

[0028] Based on this possible implementation method, when a music player application or a video player application is being used, the electronic device can reduce the frequency of drawing the corresponding music player application or video player application, thereby avoiding waste of system resources of the electronic device and further reducing the power consumption of the electronic device.

[0029] In combination with the first aspect, in another possible implementation, the window of the first application may include at least one of an activity-type window, a view-type window, and a wallpaper-type window.

[0030] Based on this possible implementation, it can be determined whether the application is switched to background operation through the activity-type window, view-type window, and wallpaper-type window included in the application.

[0031] In combination with the first aspect, in another possible implementation, when all windows of the first application are switched to background operation, the image drawing method may further include: refreshing the display image on the screen of the electronic device at a first frequency.

[0032] Based on this possible implementation, when an application is switched to background operation, the frequency of drawing operations corresponding to the application is reduced without reducing the frequency of refreshing the display image on the electronic device's screen, thereby not affecting the electronic device's display of other applications.

[0033] In combination with the first aspect, in another possible implementation, when at least one window among all windows of the first application is switched to the foreground of the electronic device, the above-mentioned image drawing method may also include: the screen of the electronic device refreshes the displayed image at a first frequency.

[0034] Based on this possible implementation, when the application is switched to the foreground, the screen of the electronic device refreshes the displayed image at a reduced frequency, thereby not affecting the display of the application by the electronic device.

[0035] In a second aspect, embodiments of the present application provide an image rendering device that can be used in an electronic device to implement the method described in the first aspect. The functions of the image rendering device can be implemented in hardware or by hardware executing corresponding software. The hardware or software includes one or more modules corresponding to the aforementioned functions, such as a receiving module, a starting module, and a rendering module.

[0036] The receiving module can be used to receive the user's startup operation.

[0037] The startup module can be configured to start the first application in response to a startup operation.

[0038] The drawing module can be used to execute an image drawing operation corresponding to the first application based on a first frequency when at least one window of the first application is running in the foreground of the electronic device.

[0039] The drawing module can also be used for the electronic device to perform an image drawing operation corresponding to the first application based on a second frequency when all windows of the first application are switched to background operation, wherein the second frequency is lower than the first frequency.

[0040] In a third aspect, an image rendering device is provided, which has the function of implementing the method described in the first aspect. The function can be implemented by hardware or by hardware executing corresponding software. The hardware or software includes one or more modules corresponding to the above-mentioned functions.

[0041] In a fourth aspect, an image drawing device is provided, comprising: a processor and a memory; the memory is used to store computer-executable instructions, and when the image drawing device is running, the processor executes the computer-executable instructions stored in the memory to enable the image drawing device to perform the image drawing method as described in any one of the above-mentioned first aspects.

[0042] In a fifth aspect, an image drawing device is provided, comprising: a processor; the processor is configured to be coupled to a memory, and after reading instructions in the memory, execute the image drawing method as described in any one of the first aspects above according to the instructions.

[0043] In a sixth aspect, embodiments of the present application provide a computer-readable storage medium having computer program instructions stored thereon. When the computer program instructions are executed by an electronic device, the electronic device implements the image drawing method as described in the first aspect or any possible implementation of the first aspect.

[0044] In a seventh aspect, an embodiment of the present application provides a computer program product, comprising a computer-readable code, which, when executed in an electronic device, enables the electronic device to implement an image drawing method as described in any one of the first aspect or possible implementations of the first aspect.

[0045] In an eighth aspect, a device (for example, a chip system) is provided, which includes a processor for supporting an electronic device in implementing the functions described in the first aspect. In one possible design, the device also includes a memory for storing program instructions and data necessary for the electronic device. When the device is a chip system, it can be composed of a chip or include a chip and other discrete devices.

[0046] It should be understood that the beneficial effects of the second to eighth aspects can be found in the relevant description of the first aspect, and will not be repeated here. BRIEF DESCRIPTION OF THE DRAWINGS

[0047] FIG1 is a schematic diagram of a process of image drawing provided by an embodiment of the present application;

[0048] FIG2 is a schematic diagram of the hardware structure of an electronic device provided in an embodiment of the present application;

[0049] FIG3 is a schematic diagram of a software structure of an electronic device provided in an embodiment of the present application;

[0050] FIG4 is a flowchart of an image drawing method according to an embodiment of the present application;

[0051] FIG5 is a second flow chart of an image drawing method provided in an embodiment of the present application;

[0052] FIG6 is a schematic diagram of a process of switching an application window to the foreground according to an embodiment of the present application;

[0053] FIG7 is a third flow chart of an image drawing method provided in an embodiment of the present application;

[0054] FIG8 is a schematic structural diagram of an image drawing device provided in an embodiment of the present application. DETAILED DESCRIPTION

[0055] The following will be combined with the drawings in the embodiments of this application to clearly and completely describe the technical solutions in the embodiments of this application. Obviously, the embodiments described are only part of the embodiments of this application, not all of the embodiments. Based on the embodiments in this application, all other embodiments obtained by ordinary technicians in this field without making creative efforts are within the scope of protection of this application.

[0056] The terms "first" and "second" are used for descriptive purposes only and should not be construed as indicating or implying relative importance or implicitly specifying the number of the technical features being referred to. Thus, a feature specified as "first" or "second" may explicitly or implicitly include one or more of such features. Throughout this application, unless otherwise specified, "plurality" means two or more.

[0057] With the popularity of mobile phones and other electronic devices, users are downloading more and more applications on their phones. When using a mobile phone, users often open multiple applications. When a user uses a mobile phone, the screen usually displays the interface or animation of an application, that is, the application is running in the foreground of the phone. The application running in the foreground of the phone can be called the foreground application. For an application that the user has opened on the phone but the screen does not display the interface or animation, the application is running in the background of the phone. That is, the application running in the background of the phone can be called the foreground application.

[0058] That is to say, the foreground application runs in the foreground of the mobile phone and can interact directly with the user, while the background application runs in the background of the mobile phone and cannot interact directly with the user.

[0059] When an application is running in the foreground of the phone, the phone will draw the corresponding interface or animation of the foreground application (i.e., refresh the drawing) to meet the user's usage needs. When an application is running in the background of the phone, the phone screen does not display the corresponding interface or animation of the background application, so the phone does not need to draw the corresponding interface or animation of the background application.

[0060] However, due to irregular development practices, some apps, such as music apps, will still request to draw their corresponding interface or animations even when the app is in the background. Consequently, the phone will draw the interface or animations for the app. However, the phone does not need to draw the interface or animations for the background app, and the phone will not display them. This results in a waste of system resources and, in turn, higher power consumption.

[0061] The following describes the process of a background application (i.e., a background application) requesting the mobile phone to draw a corresponding interface or animation, as shown in Figure 1. As shown in Figure 1, the process of a background application requesting the mobile phone to draw a corresponding interface or animation may include the following steps.

[0062] A background application, also known as a background app, first sends a drawing request for its interface or animation to the choreographer in the phone's operating system, requesting the phone to draw the corresponding interface or animation. The background application can request the choreographer to draw the corresponding interface or animation by calling the Choreographer postCallBack API.

[0063] After receiving a drawing request from the background application, the choreographer, or Choreographer, sends a request for vertical synchronization (Vsync) to the display compositing system in the phone's operating system. The display compositing system then reports the request to the phone's hardware. The choreographer can call the scheduleVsync API to register the choreographer with the display compositing system.

[0064] The display synthesis system, that is, the Surface module (also called SurfaceFlinger) in the mobile phone's operating system, will report the request for vertical synchronization signal to the mobile phone's hardware (such as the hardware composer in the mobile phone) after receiving the request for vertical synchronization signal sent by the choreographer. The display synthesis system will report the request for vertical synchronization signal to the mobile phone's hardware at a certain frequency based on the reporting mechanism of the vertical synchronization signal. For background applications and foreground applications, the display synthesis system reports the request for vertical synchronization signal to the mobile phone's hardware at the same frequency. Because

[0065] After the hardware of the mobile phone generates a vertical synchronization signal, the vertical synchronization signal can be sent to the display synthesis system, that is, the display synthesis system can receive the vertical synchronization signal.

[0066] After the display composition system receives the vertical synchronization signal, it returns the vertical synchronization signal to the choreographer corresponding to the background application. The choreographer then performs the corresponding drawing according to the received vertical synchronization signal. The display composition system returns the vertical synchronization signal to the choreographer corresponding to the background application. The display composition system can call the onVsync interface to send the vertical synchronization signal to the choreographer.

[0067] After the choreographer performs the corresponding drawing according to the received vertical synchronization signal, the choreographer corresponding to the background application will return the drawing to the background application, so that the background application can continue to request drawing from the choreographer. The choreographer corresponding to the background application will return the drawing to the background application, which may be by calling doCallback to return the drawing to the background application. Since the display synthesis system reports the vertical synchronization signal request frequency for the background application and the foreground application at the same time, the choreographer corresponding to the background application receives the same vertical synchronization signal frequency for the background application and the foreground application, and the choreographer performs the corresponding drawing at the same frequency (i.e., the drawing frame rate) for the background application and the foreground application.

[0068] For background applications, the phone does not need to draw the interface or animation corresponding to the background application, and the phone will not display the interface or animation corresponding to the background application. The display synthesis system reports the vertical synchronization signal application frequency for the background application and the foreground application at the same frequency, and the choreographer corresponding to the background application performs the corresponding drawing at the same frequency (i.e., drawing frame rate) for the background application and the foreground application. This will lead to a waste of the phone's system resources, such as the phone's CPU resources, which in turn leads to higher power consumption of the phone.

[0069] In response to the above problems, an embodiment of the present application provides an image drawing method, which is applied to an electronic device. When the application of the electronic device is in the background of the electronic device, the electronic device can reduce the drawing frame rate of the interface or animation corresponding to the background application (also referred to as the image corresponding to the application), that is, reduce the frequency of the image drawing operation corresponding to the background application, thereby avoiding waste of system resources of the electronic device, such as avoiding waste of resources of the CPU of the electronic device, and thereby reducing the power consumption of the electronic device.

[0070] For example, when an application of an electronic device is in the background of the electronic device, the electronic device can reduce the frequency at which the display synthesis system sends vertical synchronization signals to the choreographer corresponding to the application, thereby reducing the frame rate at which the choreographer corresponding to the background application of the electronic device draws the interface or animation corresponding to the background application, thereby avoiding waste of system resources of the electronic device, such as avoiding waste of resources of the CPU of the electronic device, and thereby reducing the power consumption of the electronic device.

[0071] For another example, when an application of an electronic device is in the background of the electronic device, the electronic device can reduce the frame rate at which the choreographer corresponding to the background application draws the interface or animation corresponding to the background application, thereby avoiding waste of system resources of the electronic device, such as avoiding waste of resources of the CPU of the electronic device, and thereby reducing the power consumption of the electronic device.

[0072] The following describes the image drawing method provided in the embodiment of the present application.

[0073] The image rendering method provided in the embodiments of the present application can be applied to electronic devices. In some embodiments, the electronic devices can be mobile phones, tablet computers, handheld computers, personal computers (PCs), cellular phones, personal digital assistants (PDAs), wearable devices, and other electronic devices with application programs. The embodiments of the present application do not limit the specific form of the electronic devices.

[0074] For example, taking the electronic device as a mobile phone as an example, FIG2 shows a structural diagram of an electronic device provided in an embodiment of the present application.

[0075] As shown in Figure 2, the electronic device may include a processor 210, an external memory interface 220, an internal memory 221, a universal serial bus (USB) interface 230, a charging management module 240, a power management module 241, a battery 242, an antenna 1, an antenna 2, a mobile communication module 250, a wireless communication module 260, an audio module 270, a speaker 270A, a receiver 270B, a microphone 270C, an earphone interface 270D, a sensor module 280, a button 290, a motor 291, an indicator 292, a camera 293, a display screen 294, and a subscriber identification module (SIM) card interface 295, etc. Among them, the sensor module 280 can include a pressure sensor 280A, a gyroscope sensor 280B, an air pressure sensor 280C, a magnetic sensor 280D, an acceleration sensor 280E, a distance sensor 280F, a proximity light sensor 280G, a fingerprint sensor 280H, a temperature sensor 280J, a touch sensor 280K, an ambient light sensor 280L, a bone conduction sensor 280M, etc.

[0076] It should be understood that the structure illustrated in this embodiment does not constitute a specific limitation on the electronic device. In other embodiments, the electronic device may include more or fewer components than shown, or may combine or separate certain components, or have different component arrangements. The illustrated components may be implemented in hardware, software, or a combination of software and hardware.

[0077] The processor 210 may include one or more processing units. For example, the processor 210 may include an application processor (AP), a modem processor, a graphics processing unit (GPU), an image signal processor (ISP), a controller, a memory, a video codec, a digital signal processor (DSP), a baseband processor, and / or a neural-network processing unit (NPU). Different processing units may be independent devices or integrated into one or more processors.

[0078] The controller can be the nerve center and command center of the electronic device. The controller can generate operation control signals based on the instruction opcode and timing signals to complete the control of instruction fetching and execution.

[0079] Processor 210 may also include a memory for storing instructions and data. In some embodiments, the memory in processor 210 is a cache memory. This memory can store instructions or data that have just been used or are being recycled by processor 210. If processor 210 needs to use the same instruction or data again, it can directly access the memory. This avoids duplicate accesses, reduces processor 210 latency, and thus improves system efficiency.

[0080] In some embodiments, the processor 210 may include one or more interfaces. The interfaces may include an inter-integrated circuit (I2C) interface, an inter-integrated circuit sound (I2S) interface, a pulse code modulation (PCM) interface, a universal asynchronous receiver / transmitter (UART) interface, a mobile industry processor interface (MIPI), a general-purpose input / output (GPIO) interface, a subscriber identity module (SIM) interface, and / or a universal serial bus (USB) interface.

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

[0082] Antenna 1 and Antenna 2 are used to transmit and receive electromagnetic wave signals. Each antenna in an electronic device can be used to cover a single or multiple communication frequency bands. Different antennas can also be reused to improve antenna utilization. For example, antenna 1 can be reused as a diversity antenna for a wireless local area network. In other embodiments, the antennas can be used in conjunction with a tuning switch.

[0083] The mobile communication module 250 can provide solutions for wireless communications including 2G / 3G / 4G / 5G applied to electronic devices. The mobile communication module 250 may include at least one filter, a switch, a power amplifier, a low noise amplifier (LNA), etc. The mobile communication module 250 can receive electromagnetic waves from the antenna 1, and filter, amplify, and process the received electromagnetic waves, and transmit them to the modulation and demodulation processor for demodulation. The mobile communication module 250 can also amplify the signal modulated by the modulation and demodulation processor, and convert it into electromagnetic waves for radiation through the antenna 1. In some embodiments, at least some of the functional modules of the mobile communication module 250 can be set in the processor 210. In some embodiments, at least some of the functional modules of the mobile communication module 250 can be set in the same device as at least some of the modules of the processor 210.

[0084] The wireless communication module 260 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), near field communication (NFC), infrared (IR), etc. The wireless communication module 260 can be one or more devices that integrate at least one communication processing module. The wireless communication module 260 receives electromagnetic waves via the antenna 2, frequency modulates and filters the electromagnetic wave signals, and sends the processed signals to the processor 210. The wireless communication module 260 can also receive the signal to be sent from the processor 210, frequency modulate it, amplify it, and convert it into electromagnetic waves for radiation through the antenna 2.

[0085] In some embodiments, antenna 1 of the electronic device is coupled to mobile communication module 250, and antenna 2 is coupled to wireless communication module 260, so that the electronic device can communicate with a network and other devices via wireless communication technologies. The wireless communication technologies may include global system for mobile communications (GSM), general packet radio service (GPRS), code division multiple access (CDMA), wideband code division multiple access (WCDMA), time-division code division multiple access (TD-SCDMA), long term evolution (LTE), BT, GNSS, WLAN, NFC, FM, and / or IR technology.

[0086] The electronic device implements display functionality through a GPU, display screen 294, and an application processor. A GPU is a microprocessor for image processing that connects display screen 294 and the application processor. The GPU is used to perform mathematical and geometric calculations for graphics rendering. Processor 210 may include one or more GPUs that execute program instructions to generate or modify display information.

[0087] Display screen 294 is used to display images, videos, and the like. Display screen 294 includes a display panel. The display panel can be a liquid crystal display (LCD), an organic light-emitting diode (OLED), an active-matrix organic light-emitting diode (AMOLED), a flexible light-emitting diode (FLED), a MiniLED, a MicroLED, a Micro-oLed, or a quantum dot light-emitting diode (QLED). In some embodiments, the electronic device can include one or N display screens 294, where N is a positive integer greater than one.

[0088] The electronic device can implement the shooting function through the ISP, camera 293, video codec, GPU, display 294 and application processor, etc. In some embodiments, the electronic device can include 1 or N cameras 293, where N is a positive integer greater than 1.

[0089] The internal memory 221 can be used to store computer executable program codes, which include instructions. The processor 210 executes various functional applications and data processing of the electronic device by running the instructions stored in the internal memory 221. The internal memory 221 may include a program storage area and a data storage area. Among them, the program storage area can store an operating system, an application required for at least one function (such as a sound playback function, an image playback function, etc.), etc. The data storage area can store data established during the use of the electronic device (such as audio data, a phone book, etc.), etc. In addition, the internal memory 221 may include a high-speed random access memory, and may also include a non-volatile memory, such as at least one disk storage device, a flash memory device, a universal flash storage (UFS), etc.

[0090] The acceleration sensor 280E can periodically collect acceleration data of the electronic device at a certain frequency. For example, it can collect the acceleration magnitude of the electronic device in various directions (generally the XYZ three-axis directions).

[0091] Of course, it is understood that FIG2 is merely an example of an electronic device in the form of a mobile phone. If the electronic device is a tablet computer, handheld computer, PC, PDA, wearable device (such as a smart watch, smart bracelet), or other device form factors, the structure of the electronic device may include fewer or more structures than shown in FIG2, and this is not limited here.

[0092] It is understandable that, generally speaking, the realization of electronic device functions requires not only hardware support but also software cooperation.

[0093] 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. The embodiment of the present application takes the Android system of the layered architecture as an example to illustrate the software structure of the electronic device.

[0094] FIG3 is a block diagram of the software structure of the electronic device provided in an embodiment of the present application.

[0095] A layered architecture divides software into several layers, each with distinct roles and responsibilities. Layers communicate with each other through software interfaces. In some embodiments, the Android system is divided into four layers: from top to bottom: the application layer, the application framework layer, the Android runtime and system libraries (also called the native layer), and the kernel layer.

[0096] The application layer can include a series of application packages. As shown in Figure 3, the application packages may include applications such as camera, gallery, calendar, phone, map, navigation, WLAN, Bluetooth, music, video, and short messaging. In some examples, the applications included in the application layer can be foreground applications (i.e., running in the foreground of the electronic device and capable of direct user interaction) or background applications (i.e., running in the background of the electronic device and unable to directly interact with the user).

[0097] The application framework layer provides an application programming interface (API) and programming framework for applications in the application layer. The application framework layer includes some predefined functions.

[0098] As shown in FIG3 , the application framework layer may include a window manager, a content provider, a view system, a telephony manager, a resource manager, a notification manager, and the like.

[0099] The window manager is used to manage window programs. The window manager can obtain the display size, determine whether there is a status bar, lock the screen, take screenshots, etc.

[0100] Content providers are used to store and retrieve data and make it accessible to applications. The data may include videos, images, audio, calls made and received, browsing history and bookmarks, phone books, etc.

[0101] The view system includes visual controls, such as those for displaying text and images. The view system is used to build applications. A display interface can consist of one or more views. For example, a display interface containing a text notification icon might include a view for displaying text and a view for displaying images.

[0102] The phone manager is used to provide communication functions for electronic devices, such as call status management (including answering, hanging up, etc.).

[0103] The resource manager provides various resources for applications, such as localized strings, icons, images, layout files, video files, and so on.

[0104] The Notification Manager allows applications to display notifications in the status bar. These messages can be displayed briefly and then disappear automatically without user interaction. For example, the Notification Manager is used to notify users of completed downloads and message reminders. The Notification Manager can also display notifications in the top status bar of the system as icons or scrolling text, such as notifications from background applications, or as dialog windows on the screen. Examples include text messages in the status bar, beeps, vibrations on electronic devices, and flashing indicator lights.

[0105] As shown in Figure 3, in order to implement the image drawing method provided by the embodiment of the present application, the application framework layer may also include a window management module, an application state management module, an application window module corresponding to the application, a choreographer corresponding to the application, etc.

[0106] The window management module can be the system window system of the native Android system, which is a core service of the native Android system. The window management module can be used to monitor the switching of application windows to the background of the electronic device. After the window module monitors the switching of application windows to the background, the window management module can send a notification of the application window switching to the background to the application state management module.

[0107] The window management module can also be used to monitor the application window switching to the foreground of the electronic device. After the window module monitors the application window switching to the foreground, the window management module can send a notification of the application window switching to the foreground to the application state management module.

[0108] The application state management module can be used to receive the window switching to the background notification sent by the window management module. After the application state management module receives the window switching to the background notification sent by the window management module, the application state management module can determine whether all the windows of the application are background windows. When the application state management module determines that all the windows of the application are background windows, the application state management module can send the application switching to the background application notification to the display synthesis system (i.e., the Surface module) included in the system library of the electronic device, so that the display synthesis system can reduce the frequency of sending vertical synchronization signals to the choreographer corresponding to the application.

[0109] The application state management module may also be configured to receive a window switching to the foreground notification sent by the window management module. After receiving the window switching to the foreground notification, the application state management module may send a notification indicating that the application has switched to the foreground application to a display composition system included in a system library of the electronic device, thereby enabling the display composition system to resume the frequency of sending vertical synchronization signals to the choreographer corresponding to the application.

[0110] The choreographer corresponding to the application can receive the vertical synchronization signal sent by the display composition system, and thus perform drawing according to the vertical synchronization signal sent by the display composition system.

[0111] The application window module corresponding to the application can be used to monitor whether the application window is switched to the background of the electronic device. When the application window module monitors that the application window is switched to the background of the electronic device, the application window module can notify the window management module that the application window is switched to the background.

[0112] The window management module may also be configured to receive a notification from the application window module indicating that the application's windows have been switched to the background. Upon receiving the notification, the window management module may determine whether all windows of the application are background windows. If the window management module determines that all windows of the application are background windows, the window management module may send a notification to the application window module indicating that the application has been switched to the background.

[0113] When the application window module receives the notification that the application is switched to a background application sent by the window module, the application window module may send a notification that the application is switched to a background application to the choreographer.

[0114] The choreographer corresponding to the application can also be used to receive a notification from the application window module that the application has been switched to a background application. When the choreographer receives the notification from the application window module that the application has been switched to a background application, the choreographer corresponding to the application can reduce the frame rate of drawing the interface or animation corresponding to the background application.

[0115] The application window module corresponding to the application can also be used to monitor whether the application window has been switched to the foreground of the electronic device. When the application window module monitors that the application window has been switched to the foreground of the electronic device, the application window module can send a notification to the choreographer corresponding to the application that the application window has been switched to the foreground, so that the choreographer corresponding to the application can restore the frame rate of drawing the interface or animation corresponding to the background application.

[0116] The Android runtime includes core libraries and a virtual machine. The Android runtime is responsible for scheduling and management of the Android system.

[0117] The core library consists of two parts: one is the function that the Java language needs to call, and the other is The core library.

[0118] The application layer and application framework layer run in a virtual machine. The virtual machine executes Java files in the application layer and application framework layer as binary files. The virtual machine manages object lifecycles, stack management, thread management, security and exception management, and garbage collection.

[0119] The system library can include multiple functional modules, such as surface manager, media library, 3D graphics processing library (such as OpenGL ES), 2D graphics engine (such as SGL), etc.

[0120] The surface manager is used to manage the display subsystem and provide the fusion of two-dimensional and three-dimensional layers for multiple applications.

[0121] The media library supports playback and recording of a variety of common audio and video formats, as well as static image files. The media library can support multiple audio and video encoding formats.

[0122] The 3D graphics processing library is used to implement 3D graphics drawing, image rendering, compositing, and layer processing.

[0123] A 2D graphics engine is a drawing engine for 2D drawings.

[0124] As shown in FIG3 , the system library may further include a display composition system (ie, a Surface module).

[0125] The display composition system can be used to send a vertical synchronization signal request to the hardware of the electronic device, that is, the display composition system can report the request for the vertical synchronization signal to the hardware of the electronic device. In other words, the display composition system can be used to receive a request from the choreographer corresponding to the application and distribute the vertical synchronization signal to the application in response to the request. The vertical synchronization signal can be generated by software simulation or by the hardware of the electronic device. For example, the vertical synchronization signal can be generated by a hardware composer (HWC). The display composition system can report the request for the vertical synchronization signal to the hardware of the electronic device (i.e., the hardware composer). After the HWC generates the vertical synchronization signal, it can send the vertical synchronization signal to the display composition system through a callback method, so that the display composition system can forward the vertical synchronization signal to the choreographer corresponding to the application. After receiving the vertical synchronization signal sent by the display composition system, the choreographer corresponding to the application can begin to perform the corresponding drawing operation.

[0126] The display composition system can be configured to receive a notification from the application state management module indicating that an application has been switched to a background application. Upon receiving the notification from the application state management module, the display composition system can reduce the frequency of vertical synchronization signals sent to the choreographer corresponding to the application.

[0127] The display composition system is used to receive requests from choreographers of different applications and distribute vertical synchronization signals to the applications in response to the requests. The generation of the vertical synchronization signal can be generated by software simulation or by the hardware of the electronic device. For example, the vertical synchronization signal can be generated by a hardware composer (HWC). After the HWC generates the vertical synchronization signal, it can send the vertical synchronization signal to SurfaceFlinger through a callback method, so SurfaceFlinger can forward the vertical synchronization signal to the choreographer corresponding to the application. After receiving the vertical synchronization signal sent by SurfaceFlinger, the choreographer corresponding to the application will start to perform the drawing operation.

[0128] The display composition system may also be configured to receive a notification from the application state management module indicating that the application has been switched to the foreground application. Upon receiving the notification, the display composition system may resume the frequency of sending vertical synchronization signals to the choreographer corresponding to the application.

[0129] The display composition system can also be used to receive a vertical synchronization signal sent by the hardware of the electronic device, and send the received vertical synchronization signal to the choreographer corresponding to the application.

[0130] The kernel layer is the layer between hardware and software. The kernel layer includes at least display driver, camera driver, audio driver, and sensor driver.

[0131] The methods in the following embodiments can all be implemented in an electronic device having the above hardware structure or software structure.

[0132] In some examples, when an application of an electronic device is in the background of the electronic device, the electronic device can reduce the frequency at which the display synthesis system sends vertical synchronization signals to the choreographer corresponding to the background application, thereby reducing the frame rate at which the choreographer corresponding to the background application draws the interface or animation corresponding to the background application, that is, reducing the frequency at which the choreographer corresponding to the background application performs image drawing operations corresponding to the background application.

[0133] The following describes in detail an image drawing method provided by an embodiment of the present application in conjunction with Figure 4. Figure 4 is a flow chart of an image drawing method provided by an embodiment of the present application. As shown in Figure 4, the image drawing method may include the following steps S401-S423.

[0134] S401: A window management module of an electronic device monitors that a first window corresponding to a first application program is switched to a background of the electronic device.

[0135] An electronic device may include multiple applications, such as a music application, a video application, and the like. After the electronic device runs a first application, the electronic device may run the first application in the foreground, that is, the electronic device may display a window corresponding to the first application, so that the foreground application can interact directly with the user. The electronic device may also run the first application in the background, that is, the electronic device does not display a window corresponding to the first application, so that the foreground application cannot interact directly with the user. It should be noted that the electronic device may switch the first application running in the foreground to the background of the electronic device, and the electronic device may also switch the first application running in the background to the foreground of the electronic device.

[0136] In some examples, the first application may be any one of multiple applications included in the electronic device, or may be multiple applications among multiple applications included in the electronic device, which is not limited in the embodiments of the present application.

[0137] After the electronic device runs the first application, the first application may include one or more windows, so that the electronic device can display the window corresponding to the first application and directly interact with the user through the window corresponding to the first application.

[0138] In some examples, the window corresponding to the first application may include different types of windows. For example, the window corresponding to the first application may include an activity type window (i.e., an Activity type window), a view type window (i.e., a View type window), and a wallpaper type window.

[0139] It should be noted that when the first application runs in the foreground of the electronic device, that is, the first application is the foreground application, the electronic device can display the window corresponding to the first application. The window corresponding to the first application can be an Activity type, a View type window or a wallpaper type window. There can also be multiple types of windows corresponding to the first application at the same time.

[0140] When the first application runs in the background of the electronic device, that is, the first application is a background application, the electronic device does not display the window corresponding to the first application. At this time, the electronic device can switch the first application from the background to the foreground. When the electronic device switches the first application from the background to the foreground, it can be to switch the Activity type window corresponding to the first application to the foreground (that is, to pull up the Activity type window), or it can be to switch the View type window or wallpaper type window corresponding to the first application to the foreground. In other words, whether the first application is in the foreground of the electronic device can be determined by whether the window corresponding to the first application is in the foreground of the electronic device. That is, when all the windows corresponding to the first application are in the background of the electronic device, it can be determined that the first application is in the background of the electronic device. When one or more windows corresponding to the first application are in the foreground of the electronic device, it can be determined that the first application is in the foreground of the electronic device.

[0141] The window management module of the electronic device can manage the window corresponding to the first application, such as managing the life cycle of different types of windows, so that the window management module of the electronic device can monitor different types of windows, whether the monitoring window is in the foreground of the electronic device or the background of the electronic device, and whether the window is switched from the foreground of the electronic device to the background of the electronic device.

[0142] For example, the life cycle of an Activity type window may include start (i.e., start) scheduling, pause (i.e., pause) scheduling, stop (i.e., stop) scheduling, destroy (i.e., destroy) scheduling, and its corresponding window object creation, window object destruction, layer application, and layer drawing refresh. The life cycle of a View type window may include corresponding window object creation, window object destruction, layer application, and layer drawing refresh, and wallpaper type window creation, destruction, visibility, and invisibility. The window management module of an electronic device can manage the life cycle of an Activity type window or the life cycle of a View type window, so that the window management module can monitor the Activity type window or the View type window, and monitor whether the window is switched from the foreground of the electronic device to the background of the electronic device. For example, when the window management module of the electronic device receives an Activity stop callback corresponding to the first application, the window management module of the electronic device can determine that the Activity type window corresponding to the first application is monitored to be switched to the background.

[0143] That is to say, after the electronic device runs the first application, the window management module of the electronic device can monitor the windows corresponding to the first application (i.e., different types of windows), thereby monitoring whether the window corresponding to the first application is in the foreground of the electronic device or the background of the electronic device, and whether the window is switched from the foreground of the electronic device to the background of the electronic device.

[0144] When the window management module of the electronic device monitors that the first window corresponding to the first application (also called the component corresponding to the first application) is switched to the background of the electronic device, the electronic device can continue to determine whether the first application is a background application, and thus when it is determined that the first application is a background application, the drawing frame rate of the interface or animation corresponding to the first application can be reduced, thereby avoiding the waste of system resources of the electronic device. That is, when the window management module of the electronic device monitors that the first window corresponding to the first application is switched to the background of the electronic device, the electronic device can continue to execute the following solution.

[0145] It should be noted that the first window may be one of the windows corresponding to the first application, or the first window may be multiple windows corresponding to the first application, which is not limited in the embodiments of the present application.

[0146] S402: The window management module of the electronic device sends a notification of switching the first window to the background to the application state management module.

[0147] When the window management module of the electronic device monitors that the first window corresponding to the first application is switched to the background of the electronic device, the window management module of the electronic device can send a first window switching to the background notification to the application status management module of the electronic device, so that the application status management module can determine whether the first application is a background application based on the first window switching to the background notification.

[0148] In some examples, the notification that the first window switches to the background may include an identifier of the first application, so that the application state management module can determine whether the first application is a background application based on the identifier of the first application.

[0149] S403: The application state management module of the electronic device receives a notification that the first window switches to the background.

[0150] S404: The application status management module of the electronic device determines whether the first application is a background application.

[0151] After the application state management module of the electronic device receives the notification that the first window switches to the background, the electronic device may determine whether the first application is a background application according to the notification that the first window switches to the background.

[0152] In some examples, the application state management module of the electronic device determines whether the first application is a background application, which may include: the application state management module of the electronic device determines whether all windows corresponding to the first application are background windows. A background window is a window located in the background of the electronic device, which is not displayed by the electronic device and cannot be used by the user to interact with the window. Correspondingly, a foreground window is a window located in the foreground of the electronic device, which is displayed by the electronic device and can be used by the user to interact with the window.

[0153] If the application state management module of the electronic device determines that all windows corresponding to the first application are background windows, the application state management module of the electronic device may determine that the first application is a background application. If the application state management module of the electronic device determines that there is a foreground window corresponding to the first application, the application state management module of the electronic device may determine that the first application is a foreground application.

[0154] In some examples, when the notification that the first window switches to the background includes an identifier of the first application, the application status management module of the electronic device can determine whether the first application is a background application based on the identifier of the first application, that is, the application status management module of the electronic device can determine whether all windows corresponding to the first application are background windows based on the identifier of the first application.

[0155] If the application state management module of the electronic device determines that the first application is a background application, the application state management module of the electronic device may send a notification to the display composition system that the first application is a background application, and the electronic device may continue to execute the following S405. If the application state management module of the electronic device determines that the first application is not a background application, the application state management module of the electronic device may not send a notification to the display composition system that the first application is a background application, and the electronic device may continue to monitor whether the first window corresponding to the first application is switched to the background of the electronic device, so that the electronic device can continue to execute the above S401-S405.

[0156] In some examples, when the application state management module of the electronic device determines that the first application is a background application, the application state management module of the electronic device may further record the identifier of the first application in a background application list, thereby enabling management of the background application through the background application list. The identifier of the first application may be the package name of the first application or the user identification (UID) of the first application, which is not limited in the embodiments of the present application.

[0157] The application status management module of the electronic device manages background applications through a background application list, which may include: when the window corresponding to the application is switched to the foreground of the electronic device, the application status management module of the electronic device may query whether the identifier of the application is in the background application list; if the identifier of the application is in the background application list, the application status management module of the electronic device may send a notification to the display synthesis system to restore the frequency of the vertical synchronization signal requested for reporting to the hardware of the electronic device.

[0158] In some examples, the application state management module can also delete the identifier of the background application in the background application list. For example, the application state management module can also add an interface for clearing the identifier of the background application in the background application list. When the background application collides (i.e., crashes) or the electronic device's system recycles the background application, the window management module can call this interface so that the application state management module can update the background application list to avoid the situation where the application has stopped running but the identifier of the background application still exists in the background application list. The application state management module frequently interacts with the display synthesis system based on the identifier of the background application.

[0159] In some examples, the application state management module of the electronic device determines whether the first application is a background application, which may include encapsulating a pair of interfaces in the application state management module for monitoring whether the first application has exited the background or switched to the foreground, that is, monitoring whether the window corresponding to the first application has exited the background or switched to the foreground through the interface. The calling point of this pair of interfaces can be located in the window system of the electronic device (i.e., the window management module), in the Activity or Window life cycle callback. For example, when the window corresponding to the first application exits the background (i.e., switches to the foreground), the calling point is in the Activity life cycle callback, which may be the calling point in the interface corresponding to the stop callback in the Activity life cycle. The calling point may also be located in the wallpaper (i.e., Window) application application invisible callback.

[0160] S405: The application state management module of the electronic device sends a notification to the display composition system that the first application is a background application.

[0161] When the application status management module of the electronic device determines that the first application is a background application, the application status management module of the electronic device can send a notification that the first application is a background application to the display synthesis system, so that the display synthesis system of the electronic device can determine the frequency of applying for the vertical synchronization signal.

[0162] S406: The display synthesis system of the electronic device receives a notification that the first application is a background application.

[0163] In some examples, the notification that the first application is a background application may include an identifier of the first application, that is, it may include the package name of the first application, and may also include the UID of the first application, which is not limited in the embodiments of the present application.

[0164] S407: The display synthesis system of the electronic device adjusts the frequency of sending the vertical synchronization signal to the second frequency according to the notification that the first application is a background application.

[0165] After the display composition system of the electronic device receives a notification that the first application is a background application, the display composition system of the electronic device may adjust the frequency of the vertical synchronization signal sent to the choreographer corresponding to the application to a second frequency based on the notification that the first application is a background application. The second frequency is the frequency of the vertical synchronization signal sent by the display composition system to the choreographer corresponding to the application when the first application is a background application.

[0166] The second frequency may be less than the first frequency, and the first frequency may be a preset frequency. For example, the first frequency may be the frequency of the vertical synchronization signal sent by the display synthesis system to the choreographer corresponding to the first application when the first application is the foreground application. Since the display synthesis system of the electronic device can send the vertical synchronization signal at the frequency of the choreographer corresponding to the application, that is, when the display synthesis system sends the vertical synchronization signal to the choreographer corresponding to the application at the first frequency, the frequency of the vertical synchronization signal requested by the display synthesis system from the hardware of the electronic device is also the first frequency.

[0167] In some examples, the second frequency can be a single frequency or multiple frequencies. When the second frequency is a single frequency, that is, when different applications are background applications, the display synthesis system of the electronic device determines that the frequencies of the vertical synchronization signals sent to the choreographers corresponding to the applications are all the same.

[0168] When the second frequency is a plurality of frequencies, that is, when different applications are background applications, the frequencies of the vertical synchronization signals sent to the choreographer corresponding to the applications determined by the display synthesis system of the electronic device can be different, that is, when different applications are background applications, they correspond to different second frequencies. The display synthesis system of the electronic device can pre-store the correspondence between the application identifier and the frequency of the vertical synchronization signal sent to the choreographer corresponding to the application, so that based on the correspondence between the application identifier and the frequency of the vertical synchronization signal sent to the choreographer corresponding to the application, the frequency of the vertical synchronization signal sent to the choreographer corresponding to the application corresponding to the application identifier can be determined. For example, when the first frequency is a plurality of frequencies, the display synthesis system of the electronic device determines the second frequency of the vertical synchronization signal sent to the choreographer corresponding to the first application according to the identifier of the first application included in the notification that the first application is a background application.

[0169] S408: The display synthesis system of the electronic device applies for a vertical synchronization signal from the hardware of the electronic device according to the first frequency.

[0170] After the display synthesis system of the electronic device adjusts the vertical synchronization signal sent to the choreographer corresponding to the application to the second frequency, the display synthesis system of the electronic device can apply for a vertical synchronization signal from the hardware of the electronic device according to the first frequency of the vertical synchronization signal.

[0171] For example, the display synthesis system of the electronic device can send a request for a vertical synchronization signal to the hardware writer HWC of the electronic device according to a preset first frequency. After the HWC generates the vertical synchronization signal, the HWC can send the vertical synchronization signal to the display synthesis system of the electronic device through a callback method. After the HWC generates the vertical synchronization signal, the frequency at which the HWC sends the vertical synchronization signal to the display synthesis system of the electronic device is the same as the frequency at which the display synthesis system sends the request for a vertical synchronization signal to the HWC, that is, the frequency of the vertical synchronization signal sent by the HWC to the display synthesis system of the electronic device is also the first frequency.

[0172] S409: The display synthesis system of the electronic device receives a vertical synchronization signal sent by the hardware.

[0173] S410: The display synthesis system of the electronic device sends a vertical synchronization signal to the choreographer at a second frequency.

[0174] After the display synthesis system of the electronic device receives the vertical synchronization signal sent by the hardware of the electronic device, the display synthesis system of the electronic device can send the vertical synchronization signal to the choreographer corresponding to the application of the electronic device (i.e., the choreographer corresponding to the first application) at a second frequency, so that the choreographer corresponding to the application of the electronic device can perform corresponding drawing operations according to the vertical synchronization signal.

[0175] S411. The choreographer of the electronic device receives a vertical synchronization signal.

[0176] S412: The choreographer of the electronic device performs a drawing operation according to the vertical synchronization signal.

[0177] After the choreographer corresponding to the application of the electronic device receives the vertical synchronization signal sent by the display synthesis system, the choreographer corresponding to the application of the electronic device can perform corresponding drawing operations according to the vertical synchronization signal, that is, the choreographer corresponding to the application can perform corresponding drawing operations, such as drawing the interface or animation corresponding to the first application.

[0178] Since the frequency at which the HWC sends the vertical synchronization signal to the display synthesis system of the electronic device is the same as the frequency at which the display synthesis system sends the vertical synchronization signal request to the HWC, that is, the frequency of the vertical synchronization signal sent by the HWC to the display synthesis system of the electronic device is also the first frequency, the frequency of the vertical synchronization signal received by the choreographer corresponding to the application of the electronic device is also the first frequency. Therefore, the choreographer corresponding to the application of the electronic device performs the drawing operation at the second frequency according to the vertical synchronization signal. Since the second frequency is less than the first frequency, that is, when the first application is a background application, the drawing frame rate corresponding to the first application is reduced.

[0179] S413: The window management module of the electronic device monitors that the second window corresponding to the first application program is switched to the foreground of the electronic device.

[0180] When the first application is a background application, that is, all windows corresponding to the first application are background windows, the window management module of the electronic device can continue to monitor whether the second window corresponding to the first application is switched to the foreground of the electronic device. The second window can be one or more windows corresponding to the first application. The second window can be the same as the first window or different from the first window, which is not limited in the embodiments of the present application.

[0181] When the electronic device window management module monitors that the second window corresponding to the first application is cut to the foreground of the electronic device, the electronic device can determine that the first application is the foreground application, so that the electronic device can restore the frequency of the vertical synchronization signal that the display synthesis system applies to the hardware of the electronic device to the first frequency, that is, when the first application is the foreground application, the display synthesis system applies to the hardware of the electronic device for the frequency of the vertical synchronization signal.

[0182] For a specific implementation of the embodiment of the present application, the window management module of the electronic device monitors that the second window corresponding to the first application is switched to the foreground of the electronic device, reference may be made to the above S401, which will not be described in detail in the embodiment of the present application.

[0183] S414: The window management module of the electronic device sends a notification to the application state management module that the second window has been switched to the foreground.

[0184] When the window management module of the electronic device monitors that the second window corresponding to the first application is switched to the foreground of the electronic device, the window management module of the electronic device can send a second window switching to the foreground notification to the application state management module of the electronic device.

[0185] In some examples, the notification that the second window switches to the foreground may include an identifier of the first application, so that the application state management module can determine whether the first application is a background application in the background application list based on the identifier of the first application.

[0186] S415: The application state management module of the electronic device receives a notification that the second window has been switched to the foreground.

[0187] S416: The application state management module of the electronic device sends a notification to the display composition system that the first application is a foreground application.

[0188] After the application status management module of the electronic device receives the notification that the second window has switched to the foreground, the application status management module of the electronic device can send a notification that the first application is the foreground application to the display synthesis system, so that the display synthesis system of the electronic device adjusts the vertical synchronization signal to the first frequency based on the notification that the first application is the foreground application.

[0189] In some examples, before the application state management module of the electronic device sends a notification to the display composition system that the first application is a foreground application, the application state management module can determine whether the first application is a background application in the background application list based on the identifier of the first application included in the notification that the second window switches to the background.

[0190] When the first application is a background application in the background application list, the electronic device can determine that the first application is switched from the background of the electronic device to the foreground of the electronic device. When the first application is a background application, the corresponding vertical synchronization signal applied is the second frequency, and when the first application is switched to the foreground application, the corresponding vertical synchronization signal applied needs to be adjusted to the first frequency. Therefore, when the first application is a background application in the background application list, the application state management module of the electronic device can send a notification that the first application is a foreground application to the display synthesis system, so that the display synthesis system of the electronic device adjusts the vertical synchronization signal applied to the first frequency according to the notification that the first application is a foreground application.

[0191] When the first application is not a background application in the background application list, the electronic device can determine that the first application is not switched from the background of the electronic device to the foreground of the electronic device. The first application may be a newly launched application. For the newly launched application, the corresponding vertical synchronization signal requested is the first frequency. Therefore, when the first application is not a background application in the background application list, the application status management module of the electronic device may not send a notification to the display synthesis system that the first application is a foreground application, so that the display synthesis system of the electronic device applies for the vertical synchronization signal according to the first frequency by default.

[0192] S417: The display composition system of the electronic device receives a notification that the first application is a foreground application.

[0193] S418. The display synthesis system of the electronic device adjusts the frequency of sending the vertical synchronization signal to the first frequency according to the notification that the first application is the foreground application.

[0194] After the display synthesis system of the electronic device receives the notification that the first application is the foreground application, the display synthesis system of the electronic device can adjust the frequency of sending the vertical synchronization signal to the choreographer corresponding to the application to the first frequency based on the notification that the first application is the foreground application.

[0195] In some examples, the first frequency may be one frequency or multiple frequencies. When the first frequency is one frequency, that is, when different applications are foreground applications, the display synthesis system of the electronic device determines that the frequency of sending the vertical synchronization signal to the choreographer corresponding to the application is the same.

[0196] When the first frequency is multiple, that is, when different applications are in the foreground, the frequencies of the vertical synchronization signals sent to the choreographers corresponding to the applications can be different, that is, when different applications are in the foreground, they correspond to different first frequencies. The display synthesis system of the electronic device can pre-store a correspondence between the application identifiers and the frequencies of the vertical synchronization signals sent to the choreographers corresponding to the applications, so that the frequency of the vertical synchronization signal sent to the choreographers corresponding to the application identifiers can be determined based on the correspondence between the application identifiers and the frequencies of the vertical synchronization signals sent to the choreographers corresponding to the applications.

[0197] For example, when the first frequency is a plurality of frequencies, the display synthesis system of the electronic device determines the first frequency corresponding to the first application for sending a vertical synchronization signal to the choreographer corresponding to the application based on the identifier of the first application included in the notification that the first application is the foreground application.

[0198] S419: The display synthesis system of the electronic device applies for a vertical synchronization signal from the hardware of the electronic device according to the first frequency.

[0199] After the display synthesis system of the electronic device adjusts the vertical synchronization signal sent to the choreographer corresponding to the application to the first frequency, the display synthesis system of the electronic device can apply for a vertical synchronization signal from the hardware of the electronic device according to the first frequency of sending the vertical synchronization signal to the choreographer corresponding to the application.

[0200] S420: The display synthesis system of the electronic device receives a vertical synchronization signal sent by hardware.

[0201] S421: The display synthesis system of the electronic device sends a vertical synchronization signal to the choreographer at a first frequency.

[0202] After the display synthesis system of the electronic device receives the vertical synchronization signal sent by the hardware of the electronic device, the display synthesis system of the electronic device can send the vertical synchronization signal to the choreographer corresponding to the application of the electronic device at a first frequency, so that the choreographer corresponding to the application of the electronic device can perform corresponding drawing operations according to the vertical synchronization signal.

[0203] S422. The choreographer of the electronic device receives a vertical synchronization signal.

[0204] S423: The choreographer of the electronic device performs a drawing operation according to the vertical synchronization signal.

[0205] After the choreographer corresponding to the application of the electronic device receives the vertical synchronization signal sent by the display synthesis system, the choreographer corresponding to the application of the electronic device can perform corresponding drawing operations according to the vertical synchronization signal, that is, the choreographer corresponding to the application can perform corresponding drawing operations, such as drawing the interface or animation corresponding to the first application.

[0206] Since the frequency at which the HWC sends the vertical synchronization signal to the display synthesis system of the electronic device is the same as the frequency at which the display synthesis system sends the vertical synchronization signal request to the HWC, that is, the frequency of the vertical synchronization signal sent by the HWC to the display synthesis system of the electronic device is also the first frequency, the frequency of the vertical synchronization signal received by the choreographer corresponding to the application of the electronic device is also the first frequency. Therefore, the frequency at which the choreographer corresponding to the application of the electronic device performs the drawing operation according to the vertical synchronization signal is also the first frequency, that is, when the first application is a background application, the drawing frame rate corresponding to the first application is the first frequency.

[0207] According to the solution of the present application, when the first window of the first application of the electronic device is cut to the background of the electronic device, the electronic device can determine whether all the windows of the first application are background windows. When it is determined that all the windows of the first application are background windows, it can be determined that the first application is a background application. When the first application is a background application, the electronic device can reduce the frequency of the vertical synchronization signal sent by the display synthesis system to the choreographer corresponding to the background application, thereby reducing the frequency of the vertical synchronization signal received by the choreographer corresponding to the background application of the electronic device, and reducing the frame rate of the background application drawing the corresponding interface or motion effect, thereby avoiding the waste of system resources of the electronic device, such as avoiding the waste of resources of the CPU of the electronic device, and thus reducing the power consumption of the electronic device.

[0208] When the second window of the first application is switched to the foreground of the electronic device, the electronic device can determine that the first application is the foreground application, and the electronic device can restore the frequency of the vertical synchronization signal sent by the display synthesis system to the choreographer corresponding to the application, and can restore the frequency of the vertical synchronization signal received by the choreographer corresponding to the application of the electronic device, and restore the drawing frame rate of the foreground application in drawing the corresponding interface or animation, so as not to affect the user experience of the first application.

[0209] In other embodiments, when an application of an electronic device is in the background of the electronic device, the electronic device can reduce the frame rate at which the choreographer corresponding to the background application draws the interface or animation corresponding to the background application, that is, reduce the frequency at which the choreographer corresponding to the background application performs the image drawing operation corresponding to the background application.

[0210] Another image drawing method provided by an embodiment of the present application is described in detail below with reference to FIG5 . FIG5 is a flow chart of another image drawing method provided by an embodiment of the present application . As shown in FIG5 , the image drawing method may include the following S501 - S523 .

[0211] S501: An application window module of an electronic device monitors that a first window corresponding to a first application program is switched to a background of the electronic device.

[0212] After the electronic device runs the first application, the application window module of the electronic device can monitor whether the first window corresponding to the first application is switched to the background of the electronic device. The first window can be a window corresponding to the first application.

[0213] The application window module of the electronic device may be a module corresponding to the first application, configured to monitor whether the window corresponding to the first application is switched to the background of the electronic device. The application window module of the electronic device may also be a module corresponding to multiple applications included in the electronic device, configured to monitor whether the windows corresponding to the multiple applications are switched to the background of the electronic device.

[0214] The application window module of the electronic device may be an application window module corresponding to the first application, that is, the application window module corresponding to the first application may monitor whether the first window corresponding to the first application is switched to the background of the electronic device.

[0215] When the application window module of the electronic device monitors that the first window corresponding to the first application has been switched to the background of the electronic device, the application window module of the electronic device sends a notification of the first window being switched to the background to the window management module. When the application window module of the electronic device does not monitor that the first window corresponding to the first application has been switched to the background of the electronic device, the application window module of the electronic device may continue to monitor the window of the first application.

[0216] S502: The application window module of the electronic device sends a notification of switching the first window to the background to the window management module.

[0217] When the application window module of the electronic device monitors that the first window corresponding to the first application is switched to the background of the electronic device, the application window module of the electronic device sends a first window switching to the background notification to the window management module, so that the window management module can determine whether the first application is a background application based on the first window switching to the background notification.

[0218] In some examples, the notification that the first window switches to the background may include an identifier of the first application, so that the application state management module can determine whether the first application is a background application based on the identifier of the first application.

[0219] S503: The window management module of the electronic device receives a notification that the first window switches to the background.

[0220] S504: The window management module of the electronic device determines whether the first application is a background application.

[0221] After the window management module of the electronic device receives the first window switching to background notification sent by the application window module, the window management module may determine whether the first application is a background application according to the first window switching to background notification.

[0222] If the window management module of the electronic device determines that the first application is a background application, the window management module of the electronic device may send a notification that the first application is a background application to the application window module, and the electronic device may continue to execute the following S505. If the window management module of the electronic device determines that the first application is not a background application, the window management module of the electronic device may send a notification that the first application is a foreground application to the application window module, so that the electronic device can continue to monitor whether the first window corresponding to the first application is switched to the background of the electronic device, and the electronic device may continue to execute the above S501-S504.

[0223] In some examples, the window management module determining whether the first application is a background application may include determining whether all windows corresponding to the first application are background windows. If the window management module of the electronic device determines that all windows corresponding to the first application are background windows, the window management module of the electronic device may determine that the first application is a background application. If the window management module of the electronic device determines that there is a foreground window corresponding to the window of the first application, the window management module of the electronic device may determine that the first application is a foreground application.

[0224] For example, the window management system can extend an interface to determine whether the current application (i.e., the first application) has a visible window or is in the background. This interface can be used to determine whether the window of the first application is a foreground window or a background window. The call point of this interface can be located in the handleAppVisibility interface or in the application's Activity stop callback.

[0225] In some examples, when the notification that the first window switches to the background includes an identifier of the first application, the window management module of the electronic device can determine whether the first application is a background application based on the identifier of the first application, that is, the window management module of the electronic device can determine whether all windows corresponding to the first application are background windows based on the identifier of the first application.

[0226] S505: The window management module of the electronic device sends a notification to the application window module that the first application is a background application.

[0227] After the window management module of the electronic device determines that the first application is a background application, the window management module of the electronic device can send a notification that the first application is a background application to the application window module, so that the application window module of the electronic device can send a notification that the first application is a background application to the choreographer corresponding to the application (i.e., the choreographer corresponding to the first application).

[0228] S506: The application window module of the electronic device receives a notification that the first application is a background application.

[0229] S507: The application window module of the electronic device sends a notification to the choreographer that the first application is a background application.

[0230] After the application window module of the electronic device receives the notification that the first application is a background application, the application window module of the electronic device can send the notification that the first application is a background application to the choreographer, so that the choreographer corresponding to the application can determine the frequency of performing drawing operations.

[0231] S508: The choreographer of the electronic device receives a notification that the first application is a background application.

[0232] S509: The choreographer of the electronic device records the first application as a background application according to the notification that the first application is a background application, and determines a minimum interval time.

[0233] After the choreographer corresponding to the application of the electronic device receives the notification that the first application is a background application, the electronic device can record the first application as a background application and determine a minimum interval time (also called a preset duration).

[0234] In some examples, the choreographer corresponding to the application of the electronic device is a singleton for an application (i.e., a process), so the choreographer corresponding to the application of the electronic device manages the drawing scheduling of all windows of an application. The choreographer corresponding to the application of the electronic device can extend the definition of three variables. The first variable is mIsHasVisibleWindow, which can indicate whether the application has a visible window, that is, the variable can be used to determine whether the application is a background application. The second variable is mLastRequestTime, which can indicate the time when the application last applied for drawing to the choreographer corresponding to the application, that is, the time when the application applied for postCallback registration to the choreographer corresponding to the application. The third variable can indicate the minimum interval time, that is, the interval time between the time when the application last applied for drawing to the choreographer corresponding to the application and the time when the choreographer corresponding to the application performs the drawing operation.

[0235] After the choreographer corresponding to the application receives the vertical synchronization signal sent by the display composition system, the choreographer corresponding to the application determines whether the application is a background application based on the value of the first variable, mIsHasVisibleWindow. For example, when the value of mIsHasVisibleWindow is false, the choreographer corresponding to the application can determine that the application is a background application, and when the value of mIsHasVisibleWindow is true, the choreographer corresponding to the application can determine that the application is a foreground application. When the application is a background application, the choreographer corresponding to the application performs the drawing operation based on the minimum interval time, when the interval time between the last time the application applied to the choreographer for drawing and the time when the choreographer corresponding to the application performed the drawing operation is greater than the minimum interval time, thereby achieving the purpose of reducing the drawing frame rate of the interface or animation corresponding to the background application by the choreographer corresponding to the application.

[0236] That is, after the choreographer corresponding to the application of the electronic device receives the notification that the first application is a background application, the electronic device records the first application as a background application and can set the value of the variable mIsHasVisibleWindow to true for the choreographer corresponding to the application of the electronic device.

[0237] In some examples, the minimum interval is a preset interval, which may be greater than the interval between the last time the application requested a drawing request from the choreographer corresponding to the application when the application was the foreground application and the time the choreographer corresponding to the application performed the drawing operation.

[0238] The minimum interval can be one interval or multiple intervals. When the minimum interval is one interval, that is, when different applications are background applications, the minimum intervals determined by the choreographer corresponding to the applications of the electronic device are all the same.

[0239] When the minimum interval time is multiple interval times, that is, different applications are background applications, the choreographer corresponding to the application of the electronic device may determine different minimum interval times, that is, when different applications are background applications, they correspond to different minimum interval times. The choreographer of the electronic device may pre-store the correspondence between the application identifier and the minimum interval time, so that the minimum interval time corresponding to the application identifier can be determined based on the correspondence between the application identifier and the minimum interval time. For example, when the minimum interval time is multiple interval times, the choreographer corresponding to the application of the electronic device may determine the minimum interval time corresponding to the first application based on the identifier of the first application included in the notification that the first application is a background application.

[0240] S510: A choreographer of the electronic device receives a drawing request sent by a first application.

[0241] After the choreographer corresponding to the application of the electronic device records the first application as a background application and determines the minimum interval time, the choreographer corresponding to the application of the electronic device can receive the drawing request sent by the first application, that is, the first application can request the choreographer corresponding to the application to perform the corresponding drawing operation.

[0242] S511 : The choreographer of the electronic device sends a vertical synchronization signal request to the display composition system.

[0243] After the choreographer corresponding to the application of the electronic device receives the drawing request sent by the first application, the choreographer corresponding to the application of the electronic device can send a vertical synchronization signal request to the display synthesis system, so that the choreographer corresponding to the application can receive the vertical synchronization signal request sent by the display synthesis system.

[0244] S512: The choreographer of the electronic device records the time when the drawing request is received.

[0245] When the choreographer corresponding to the application of the electronic device sends a vertical synchronization signal request to the display synthesis system, the choreographer of the electronic device may also record the time when the drawing request is received. Since the choreographer corresponding to the application receives the drawing request, that is, sends a vertical synchronization signal request to the display synthesis system, the time when the drawing request is received may also be referred to as the time when the vertical synchronization signal request information is sent. The time when the drawing request is received is the time when the application last applied for drawing to the choreographer corresponding to the application.

[0246] S513: The display synthesis system of the electronic device receives the vertical synchronization signal request and applies for the vertical synchronization signal from the hardware of the electronic device.

[0247] After the display composition system of the electronic device receives the vertical synchronization signal request sent by the choreographer corresponding to the application, the display composition system of the electronic device may apply for a vertical synchronization signal from the hardware of the electronic device.

[0248] It should be noted that, for the foreground application and the background application, the display composition system of the electronic device requests the same frequency of vertical synchronization signals from the hardware of the electronic device.

[0249] S514: The display synthesis system of the electronic device receives a vertical synchronization signal sent by the hardware.

[0250] S515: The display synthesis system of the electronic device sends a vertical synchronization signal to the choreographer.

[0251] After the display synthesis system of the electronic device receives the vertical synchronization signal sent by the hardware of the electronic device, the display synthesis system of the electronic device can send the vertical synchronization signal to the choreographer corresponding to the application of the electronic device, so that the choreographer corresponding to the application of the electronic device can perform corresponding drawing operations according to the vertical synchronization signal.

[0252] S516: The choreographer of the electronic device receives the vertical synchronization signal and records the time when the vertical synchronization signal is received.

[0253] After the choreographer corresponding to the application of the electronic device receives the vertical synchronization signal, the choreographer of the electronic device may record the time when the vertical synchronization signal was received. Since the choreographer corresponding to the application of the electronic device performs a drawing operation according to the vertical synchronization signal upon receiving the vertical synchronization signal, the time when the choreographer corresponding to the application receives the vertical synchronization signal is the time when the choreographer corresponding to the application performs the drawing operation.

[0254] S517: The choreographer of the electronic device determines whether the first interval time is greater than the minimum interval time.

[0255] After the choreographer corresponding to the application of the electronic device records the time when the vertical synchronization signal is received, the choreographer corresponding to the application of the electronic device can determine a first time interval based on the time when the drawing request is received and the time when the vertical synchronization signal is received (i.e., the time when the choreographer corresponding to the application performs the drawing operation). The first time interval is the time interval between the time when the drawing request is received and the time when the choreographer performs the drawing operation.

[0256] If the choreographer corresponding to the application program of the electronic device determines that the first interval is greater than the minimum interval, the choreographer corresponding to the application program of the electronic device may perform a drawing operation according to the vertical synchronization signal, i.e., the electronic device may continue to perform S518 described below. If the choreographer corresponding to the application program of the electronic device determines that the first interval is less than the minimum interval, the choreographer corresponding to the application program of the electronic device may perform a drawing operation according to the vertical synchronization signal after the first interval is greater than the minimum interval, i.e., the electronic device may continue to perform S519 described below.

[0257] S518: The choreographer of the electronic device performs a drawing operation according to the vertical synchronization signal.

[0258] When the choreographer corresponding to the application of the electronic device determines that the first interval time is greater than the minimum interval time, the choreographer corresponding to the application of the electronic device can perform corresponding drawing operations according to the vertical synchronization signal, that is, the choreographer corresponding to the application can draw the interface or animation corresponding to the first application.

[0259] S519: The choreographer of the electronic device performs a drawing operation according to the vertical synchronization signal after the first interval time is greater than the minimum interval time.

[0260] When the choreographer of the electronic device determines that the first interval time is less than the minimum interval time, the choreographer corresponding to the application of the electronic device can, after the first interval time is greater than the minimum interval time, increase the interval time between the application drawing request and the execution of the drawing operation according to the vertical synchronization signal, that is, the choreographer corresponding to the application, thereby reducing the drawing frame rate of the interface or animation corresponding to the background application by the choreographer corresponding to the application.

[0261] The minimum interval time can be the interval time corresponding to the above-mentioned second frequency, that is, when the display synthesis system of the above-mentioned electronic device sends a vertical synchronization signal to the choreographer corresponding to the application at the second frequency, the interval time between continuously sending two vertical synchronization signals can be the minimum interval time.

[0262] S520: The application window module of the electronic device monitors that the second window corresponding to the first application program is switched to the foreground of the electronic device.

[0263] When the first application is a background application, that is, all windows corresponding to the first application are background windows, the application window module of the electronic device can continue to monitor whether the second window corresponding to the first application is switched to the foreground of the electronic device. The second window can be one or more windows corresponding to the first application.

[0264] When the application window module of the electronic device monitors that the second window corresponding to the first application is cut to the foreground of the electronic device, the electronic device can determine that the first application is the foreground application, so that the choreographer corresponding to the application of the electronic device can record the first application as the foreground application.

[0265] S521. The application window module of the electronic device sends a notification to the choreographer that the second window is switched to the foreground.

[0266] When the application window module of the electronic device monitors that the second window corresponding to the first application has been switched to the foreground of the electronic device, the application window module of the electronic device can send a second window switching to the foreground notification to the application state management module of the electronic device. In some examples, the second window switching to the foreground notification can include an identifier of the first application.

[0267] S522. The choreographer of the electronic device receives a notification that the second window has been switched to the foreground.

[0268] S523: The choreographer of the electronic device records the first application as the foreground application.

[0269] After the choreographer corresponding to the application of the electronic device receives the notification that the second window has switched to the foreground, the choreographer of the electronic device can record the first application as the foreground application, so that when the choreographer corresponding to the application of the electronic device receives the vertical synchronization signal sent by the display synthesis system, the choreographer can directly perform the drawing operation according to the vertical synchronization signal, without having to perform the drawing operation according to the vertical synchronization signal when the first interval time is greater than the minimum interval time.

[0270] In some examples, the choreographer corresponding to the application of the electronic device records the first application as the foreground application, which may include the choreographer corresponding to the application of the electronic device setting the value of the variable mIsHasVisibleWindow to false.

[0271] For example, as shown in FIG6 , the application window module of the electronic device monitors that the second window corresponding to the first application is cut to the foreground of the electronic device. The second window can be an active type window or a view type window corresponding to the first application, or the second window can be a wallpaper type window corresponding to the first application. When the application window module of the electronic device monitors that the active type window or the view type window corresponding to the first application is cut to the foreground, that is, cut to the foreground of the electronic device, the application window module of the electronic device can send a cut-to-foreground notification to the choreographer corresponding to the application, so that the choreographer corresponding to the application of the electronic device receives the cut-to-foreground notification and records that the first application is the foreground application, such as the choreographer corresponding to the application sets the value of the corresponding variable mIsHasVisibleWindow to false.

[0272] When the application window module of the electronic device monitors that the wallpaper type window corresponding to the first application is cut to the foreground, that is, cut to the foreground of the electronic device, the application window module of the electronic device can send a cutting-to-foreground notification to the choreographer corresponding to the application, so that the choreographer corresponding to the application of the electronic device receives the cutting-to-foreground notification and records the first application as the foreground application, such as the choreographer corresponding to the application sets the value of the corresponding variable mIsHasVisibleWindow to false.

[0273] According to the solution of the present application, when the first window of the first application of the electronic device is cut to the background of the electronic device, the electronic device can determine whether all the windows of the first application are background windows. When it is determined that all the windows of the first application are background windows, it can be determined that the first application is a background application. When the first application is a background application, the electronic device can perform a drawing operation according to a vertical synchronization signal when the interval between the drawing application and the execution of the drawing operation is greater than the minimum interval, that is, the interval between the drawing application and the execution of the drawing operation is increased, thereby reducing the drawing frame rate of the choreographer corresponding to the application for the interface or motion effect corresponding to the background application, thereby avoiding waste of system resources of the electronic device, such as avoiding waste of resources of the CPU of the electronic device, and thus reducing the power consumption of the electronic device.

[0274] When the second window of the first application is switched to the foreground of the electronic device, the electronic device can determine that the first application is the foreground application, and the choreographer corresponding to the application of the electronic device can perform drawing operations according to the vertical synchronization signal without increasing the interval time between the drawing application and the execution of the drawing operation, thereby restoring the drawing frame rate of the choreographer corresponding to the application for the interface or animation corresponding to the background application, thereby not affecting the user experience of the first application.

[0275] At this time, the interval time between the drawing application and the execution of the drawing operation can be the interval time corresponding to the above-mentioned first frequency, that is, when the display synthesis system of the above-mentioned electronic device sends a vertical synchronization signal to the choreographer corresponding to the application at the first frequency, the interval time between the continuous sending of two vertical synchronization signals can be the interval time between the drawing application and the execution of the drawing operation.

[0276] For ease of understanding, the image drawing method provided by the embodiment of the present application is described below with reference to FIG7. As shown in FIG7, the image drawing method may include the following S701-S707.

[0277] S701: The electronic device receives a startup operation from a user.

[0278] When a user needs to start an application included in an electronic device, the electronic device can receive the user's start operation, so that the electronic device can start the corresponding application.

[0279] S702: In response to the start-up operation, the electronic device starts a first application.

[0280] When the electronic device receives the user's start operation, in response, the electronic device can start the first application. In some examples, the first application can be a music player application or a video player application. The specific type of the first application is not limited in the embodiment of the present application.

[0281] In some examples, the first application may be one application included in the electronic device, or may be multiple applications included in the electronic device.

[0282] It should be noted that when the electronic device starts the first application, the electronic device can run the application in the foreground of the electronic device, that is, the application can be a foreground application, which is an application that can directly interact with the user.

[0283] When the electronic device starts the first application, that is, when the first application is running, the first application may include one or more windows. The windows of the first application may include an activity-type window, a view-type window, or a wallpaper-type window.

[0284] When the first application is a foreground application, that is, the first application runs in the foreground of the electronic device and can interact directly with the user, at least one window of the first application runs in the foreground of the electronic device. The window running in the foreground of the electronic device can be called a foreground window.

[0285] When the first application is switched to a background application, that is, the first application runs in the background of the electronic device and cannot interact directly with the user, all windows of the first application run in the foreground of the electronic device. The window running in the background of the electronic device can be called a background window.

[0286] S703: The electronic device determines whether all windows of the first application are switched to background operation.

[0287] After the electronic device starts the first application, the electronic device may determine (also referred to as monitor) whether all windows of the first application are switched to the background operation of the electronic device.

[0288] If the electronic device determines that at least one window of the first application is running in the foreground of the electronic device (i.e., not all windows of the first application are switched to the background of the electronic device), the electronic device may perform the image drawing operation corresponding to the first application based on the frequency before the reduction (i.e., the first frequency), that is, the electronic device may continue to perform the following S704. If the electronic device determines that all windows of the first application are switched to the background of the electronic device, the electronic device may perform the image drawing operation corresponding to the first application based on the frequency after the reduction (i.e., the second frequency), that is, the electronic device may continue to perform the following S705.

[0289] In some examples, the electronic device determines whether all windows of the first application are switched to the background operation of the electronic device, which may include: when the electronic device monitors that at least one window included in the first application is switched to the background operation of the electronic device, the electronic device may determine whether all windows of the first application are switched to the background operation of the electronic device.

[0290] For example, the window management module of the electronic device may monitor whether at least one window of the first application is switched to the background operation of the electronic device. When the window management module of the electronic device monitors that at least one window of the first application (such as the first window) is switched to the background operation of the electronic device, the electronic device may continue to determine whether all windows of the first application are switched to the background operation of the electronic device.

[0291] The electronic device determines whether all windows of a first application are switched to the background operation of the electronic device, which may include: when the window management module of the electronic device monitors that the first window corresponding to the first application is switched to the background of the electronic device, the window management module of the electronic device may send a first window switching to the background notification to the application state management module, and the application state management module of the electronic device receives the first window switching to the background notification. The application state management module of the electronic device may continue to determine whether all windows of the first application are switched to the background operation (i.e., determine whether the first application is a background application).

[0292] Specifically, the specific implementation method of the electronic device in the above example determining whether all windows of the first application are switched to the background operation of the electronic device can refer to the specific implementation methods in the above S401-S404, which will not be repeated in the embodiments of this application.

[0293] For another example, the application window management module of the electronic device can monitor whether at least one window of the first application is switched to the background operation of the electronic device. If the application window management module of the electronic device monitors that at least one window of the first application (such as the first window) is switched to the background operation of the electronic device, the electronic device can continue to determine whether all windows of the first application are switched to the background operation of the electronic device.

[0294] The electronic device determines whether all windows of a first application are switched to the background of the electronic device, which may include: when the application window management module of the electronic device monitors that the first window corresponding to the first application is switched to the background of the electronic device, the application window management module of the electronic device may send a first window switching to the background notification to the window management module, and the window management module of the electronic device receives the first window switching to the background notification. The window management module of the electronic device may continue to determine whether all windows of the first application are switched to the background (i.e., determine whether the first application is a background application).

[0295] Specifically, the specific implementation method of the electronic device in the above example determining whether all windows of the first application are switched to the background operation of the electronic device can refer to the specific implementation methods in S501-S504 above, which will not be repeated in the embodiments of this application.

[0296] S704: The electronic device executes an image drawing operation corresponding to the first application based on the first frequency.

[0297] When the electronic device determines that at least one window of the first application is running in the foreground of the electronic device, that is, the first application is the foreground application, the electronic device can perform image drawing operations corresponding to the first application based on the first frequency, such as the electronic device can perform drawing operations of the interface or animation corresponding to the first application based on the first frequency.

[0298] In some examples, the first frequency may be a preset frequency. For example, the first frequency may be a frequency at which a display screen of the electronic device refreshes a displayed image. That is, after the electronic device executes a drawing operation of an interface or animation corresponding to the first application based on the first frequency, the screen of the electronic device may refresh the displayed image at the first frequency, that is, the screen of the electronic device may refresh and display the interface or animation corresponding to the first application at the first frequency.

[0299] In some examples, the electronic device performing an image drawing operation corresponding to a first application based on a first frequency may include: a display composition system of the electronic device may generate a first vertical synchronization signal, where the frequency of the first vertical synchronization signal may be the first frequency; and a choreographer corresponding to the first application may perform the image drawing operation corresponding to the first application based on the received first vertical synchronization signal.

[0300] Before the display composition system of the electronic device generates a first vertical synchronization signal, the first application may send an image drawing request to the choreographer corresponding to the first application. The choreographer corresponding to the first application may, in response to the image drawing request, send vertical synchronization signal request information to the display composition system of the electronic device at a first frequency. The display composition system of the electronic device may receive the vertical synchronization signal request information and send the vertical synchronization signal request information to the hardware of the electronic device at the first frequency. The hardware of the electronic device may, in response to the received vertical synchronization signal request information, send a vertical synchronization signal to the display composition system of the electronic device. The display composition system of the electronic device may receive the vertical synchronization signal sent by the hardware of the electronic device.

[0301] After the display composition system of the electronic device receives the vertical synchronization signal, the display composition system of the electronic device may generate a first vertical synchronization signal having a first frequency, and send the first vertical synchronization signal to the choreographer corresponding to the first application. The choreographer corresponding to the first application may then receive the first vertical synchronization signal having the first frequency. In other words, the choreographer corresponding to the first application may execute an image drawing operation corresponding to the first application at the first frequency based on the received first vertical synchronization signal.

[0302] S705: The electronic device executes an image drawing operation corresponding to the first application based on the second frequency.

[0303] When the electronic device determines that all windows of the first application are switched to run in the background of the electronic device, that is, the first application is a background application, the electronic device can perform image drawing operations corresponding to the first application based on the second frequency, such as the electronic device can perform drawing operations of the interface or animation corresponding to the first application based on the second frequency.

[0304] The second frequency can be lower than the first frequency, that is, the second frequency can be any frequency lower than the first frequency, so that the electronic device can reduce the frequency corresponding to drawing the background application (that is, the first application), thereby avoiding waste of system resources of the electronic device, such as avoiding waste of resources of the CPU of the electronic device, and thus reducing the power consumption of the electronic device.

[0305] In some examples, the second frequency may be a pre-set frequency that is lower than the first frequency, or a frequency determined according to an actual rendering scene of the electronic device that is lower than the first frequency.

[0306] It should be noted that the second frequency may be a fixed frequency, or an average frequency within a preset time period, such as the average frequency of the image drawing operation corresponding to the application performed by the electronic device within the preset time period.

[0307] In some examples, when the electronic device performs an image drawing operation corresponding to the first application based on the second frequency, the screen of the electronic device refreshes the displayed image at the first frequency, such as displaying the interface or animation corresponding to other foreground applications. That is, when the electronic device performs an image drawing operation corresponding to the interface or animation corresponding to the first application based on the second frequency, the screen of the electronic device can refresh the displayed image at the first frequency, that is, the screen of the electronic device can refresh and display the interface or animation corresponding to other foreground applications at the first frequency. In other words, when the first application is switched to the foreground and background running, the screen of the electronic device can refresh the displayed image at a reduced frequency, so as not to affect the display of other applications by the electronic device.

[0308] In some examples, the electronic device performing an image drawing operation corresponding to the first application based on the second frequency may include: a display composition system of the electronic device may generate a second vertical synchronization signal having a frequency of the second vertical synchronization signal. A choreographer corresponding to the first application may perform the image drawing operation corresponding to the first application based on the received second vertical synchronization signal.

[0309] Before the display composition system of the electronic device generates the second vertical synchronization signal, the first application may send an image drawing request to the choreographer corresponding to the first application. The choreographer corresponding to the first application may send vertical synchronization signal request information to the display composition system of the electronic device at a first frequency in response to the image drawing request. The display composition system of the electronic device may receive the vertical synchronization signal request information and send the vertical synchronization signal request information to the hardware of the electronic device at the first frequency. The hardware of the electronic device may send a second vertical synchronization signal to the display composition system of the electronic device in response to the received vertical synchronization signal request information. The display composition system of the electronic device may receive the vertical synchronization signal sent by the hardware of the electronic device.

[0310] After the display composition system of the electronic device receives the vertical synchronization signal, the display composition system of the electronic device may generate a second vertical synchronization signal having a second frequency, and transmit the second vertical synchronization signal to the choreographer corresponding to the first application. The choreographer corresponding to the first application may then receive the second vertical synchronization signal having the second frequency. In other words, the choreographer corresponding to the first application may execute the image drawing operation corresponding to the first application at the second frequency based on the received second vertical synchronization signal.

[0311] Specifically, the specific implementation of the electronic device in the above example performing the image drawing operation corresponding to the first application based on the second frequency can refer to the specific implementation in S405-S412 above, which will not be repeated in the embodiments of the present application.

[0312] In other examples, an electronic device performing an image drawing operation corresponding to a first application based on a second frequency may include: a display composition system of the electronic device may send a first vertical synchronization signal at the first frequency to a choreographer corresponding to the first application. The choreographer corresponding to the first application may receive a portion of the first vertical synchronization signal. The choreographer corresponding to the first application may perform the image drawing operation corresponding to the first application based on the portion of the first vertical synchronization signal, where the time interval between any two vertical synchronization signals in the portion of the first vertical synchronization signal is the inverse of the second frequency.

[0313] That is, when all windows of the first application are background windows, the display synthesis system can send multiple vertical synchronization signals at a reduced frequency to the choreographer corresponding to the first application. The choreographer corresponding to the first application receives some of the multiple vertical synchronization signals and performs a drawing operation corresponding to the first application based on the some of the vertical synchronization signals. Because the time interval between any two of the some of the vertical synchronization signals is the inverse of the second frequency, that is, the frequency corresponding to the some of the vertical synchronization signals is the reduced frequency (i.e., the second frequency), the electronic device can perform the drawing operation based on the reduced frequency.

[0314] In other examples, a choreographer corresponding to a first application sends vertical synchronization signal request information to a display composition system of an electronic device, wherein a time interval between any two vertical synchronization signal request information in the vertical synchronization signal request information is greater than a first threshold, where the first threshold is determined based on a second frequency. For example, the first threshold is the inverse of the second frequency, i.e., the time interval between any two vertical synchronization signal request information in the vertical synchronization signal request information is greater than the time interval corresponding to the second frequency.

[0315] The display synthesis system of the electronic device can send a vertical synchronization signal to the choreographer corresponding to the first application based on the received vertical synchronization signal request information, so that the choreographer corresponding to the first application can perform the drawing operation corresponding to the first application based on the received vertical synchronization signal.

[0316] That is, when all windows of the first application are background windows, the choreographer corresponding to the first application can send vertical synchronization signal request information to the display synthesis system of the electronic device at a time interval corresponding to the reduced frequency (i.e., the second frequency), that is, the frequency of the choreographer corresponding to the first application sending vertical synchronization signal request information to the display synthesis system of the electronic device is reduced, thereby reducing the frequency of the display synthesis system sending vertical synchronization signals to the choreographer corresponding to the application, and then after the choreographer corresponding to the application receives the frequency of the vertical synchronization signal, it can perform drawing operations according to the reduced frequency, thereby reducing the frequency of the choreographer corresponding to the application performing drawing operations.

[0317] In other examples, the electronic device performing an image drawing operation corresponding to a first application based on a second frequency may include: a display composition system of the electronic device may transmit a first vertical synchronization signal at a first frequency to a choreographer corresponding to the first application. The choreographer corresponding to the first application may receive the first vertical synchronization signal transmitted by the display composition system of the electronic device.

[0318] After the choreographer corresponding to the first application receives the first vertical synchronization signal, the choreographer corresponding to the first application may determine whether the time interval between the moment of receiving the first vertical synchronization signal and the moment of the last execution of the image drawing operation corresponding to the first application is greater than a second threshold, and the second threshold may be determined based on the second frequency.

[0319] If the choreographer corresponding to the first application determines that the time interval between the moment of receiving the first vertical synchronization signal and the moment of the last execution of the image drawing operation corresponding to the first application is greater than the second threshold, the choreographer corresponding to the first application can execute the image drawing operation corresponding to the first application. If the choreographer corresponding to the first application determines that the time interval between the moment of receiving the first vertical synchronization signal and the moment of the last execution of the image drawing operation corresponding to the first application is not greater than the second threshold, the choreographer corresponding to the first application can execute the image drawing operation corresponding to the first application after the time interval between the moment of receiving the first vertical synchronization signal and the moment of the last execution of the image drawing operation corresponding to the first application is greater than the second threshold.

[0320] That is, when all windows of an application are background windows, the choreographer corresponding to the application can execute the image drawing operation corresponding to the application when the time interval between the moment of receiving the vertical synchronization signal and the moment of the last execution of the image drawing operation corresponding to the application is greater than the second threshold, thereby reducing the frequency of the choreographer corresponding to the application executing the drawing operation.

[0321] Specifically, the specific implementation of the electronic device in the above example performing the image drawing operation corresponding to the first application based on the second frequency can refer to the specific implementation in S505-S519 above, which will not be repeated in the embodiments of the present application.

[0322] S706: The electronic device determines whether at least one window of the first application is switched from the background to the foreground.

[0323] After all windows of the first application are switched to the background operation of the electronic device, the electronic device can continue to determine whether at least one window of the first application is switched from the background operation of the electronic device to the foreground operation of the electronic device, that is, determine whether the first application is switched to the foreground application.

[0324] When the electronic device determines that at least one window of the first application is switched from the background of the electronic device to the foreground of the electronic device, that is, it is determined that the first application is switched to the foreground application, the electronic device can perform the image drawing operation corresponding to the first application based on the frequency before reduction (that is, the first frequency), that is, the electronic device can continue to perform the following S707. When the electronic device determines that all windows of the first application are running in the background of the electronic device, that is, it is determined that the first application is still a background application, the electronic device can perform the image drawing operation corresponding to the first application based on the frequency after reduction (that is, the second frequency), that is, the electronic device can continue to perform the above S705.

[0325] In some examples, an electronic device determines whether at least one window of a first application is switched from the background of the electronic device to the foreground of the electronic device, which may include: a window management module of the electronic device can determine whether at least one window of the first application (i.e., the second window) is switched from the background of the electronic device to the foreground of the electronic device.

[0326] Specifically, the specific implementation method of the electronic device in the above example determining whether at least one window of the first application is switched from the background of the electronic device to the foreground of the electronic device can refer to the specific implementation method in the above S413, which will not be repeated in the embodiments of the present application.

[0327] In other examples, an electronic device determines whether at least one window of a first application is switched from the background of the electronic device to the foreground of the electronic device, which may include: an application window module of the electronic device determines whether at least one window of the first application (i.e., the second window) is switched to the foreground of the electronic device.

[0328] Specifically, the specific implementation method of the electronic device in the above example determining whether at least one window of the first application is switched from the background of the electronic device to the foreground of the electronic device can refer to the specific implementation method in the above S520, which will not be repeated in the embodiments of the present application.

[0329] S707: The electronic device executes an image drawing operation corresponding to the first application based on the first frequency.

[0330] When the electronic device determines that at least one window of the first application is switched from the background of the electronic device to the foreground of the electronic device, the electronic device can perform an image drawing operation corresponding to the first application based on the frequency before reduction (ie, the first frequency).

[0331] In some examples, upon an electronic device determining that at least one window of a first application has switched from the background of the electronic device to the foreground, the electronic device may perform an image drawing operation corresponding to the first application based on a first frequency. This may include: upon a window management module of the electronic device determining that at least one window of the first application has switched from the background of the electronic device to the foreground of the electronic device, the window management module of the electronic device may send a second window switching to the foreground notification to the application state management module. After receiving the second window switching to the foreground notification, the application state management module of the electronic device may send a notification to the display composition system that the first application is the foreground application. After receiving the notification that the first application is the foreground application, the display composition system of the electronic device may adjust the frequency of sending vertical synchronization signals to the first frequency. The display composition system of the electronic device requests a vertical synchronization signal from the hardware of the electronic device based on the first frequency. The display composition system of the electronic device receives the vertical synchronization signal sent by the hardware and sends the vertical synchronization signal at the first frequency to a choreographer corresponding to the first application. The choreographer corresponding to the first application receives the vertical synchronization signal and performs a drawing operation based on the vertical synchronization signal.

[0332] Specifically, the specific implementation of the electronic device in the above example performing the image drawing operation corresponding to the first application based on the first frequency can refer to the specific implementation in S414-S423 above, which will not be repeated in the embodiments of the present application.

[0333] In other examples, when the electronic device determines that at least one window of a first application has switched from the background of the electronic device to the foreground of the electronic device, the electronic device performs an image drawing operation corresponding to the first application based on a first frequency, which may include: when the application window module of the electronic device monitors that the second window corresponding to the first application has switched to the foreground of the electronic device, the application window module of the electronic device may send a second window switching to the foreground notification to the choreographer corresponding to the first application. After the choreographer corresponding to the first application receives the second window switching to the foreground notification, the choreographer corresponding to the first application may set the first application as the foreground application, thereby adjusting the frequency of the image drawing operation corresponding to the first application to the first frequency.

[0334] Specifically, the specific implementation of the electronic device in the above example performing the image drawing operation corresponding to the first application based on the first frequency can refer to the specific implementation in S521-S523 above, which will not be repeated in the embodiments of the present application.

[0335] According to the solution of the present application, when an application is switched to the foreground, the screen of the electronic device refreshes the displayed image at a reduced frequency, thereby not affecting the display of the application by the electronic device.

[0336] Corresponding to the methods in the aforementioned embodiments, embodiments of the present application further provide an image rendering device. This image rendering device can be applied to an electronic device to implement the methods in the aforementioned embodiments. The functions of this image rendering device can be implemented in hardware or by hardware executing corresponding software. The hardware or software includes one or more modules corresponding to the aforementioned functions.

[0337] For example, FIG8 shows a schematic structural diagram of an image drawing apparatus 800 . As shown in FIG8 , the image drawing apparatus 800 may include: a receiving module 801 , a starting module 802 , a drawing module 803 , and the like.

[0338] The receiving module 801 may be configured to receive a start-up operation from a user.

[0339] The starting module 802 may be configured to start a first application in response to a starting operation.

[0340] The drawing module 803 may be configured to execute an image drawing operation corresponding to the first application based on a first frequency when at least one window of the first application is running in the foreground of the electronic device.

[0341] The drawing module 803 may also be configured to, when all windows of the first application are switched to background operation, enable the electronic device to execute an image drawing operation corresponding to the first application based on a second frequency, where the second frequency is lower than the first frequency.

[0342] In another possible implementation, the image drawing module 800 may further include a generating module 804 .

[0343] The generating module 804 may be configured to generate a first vertical synchronization signal, where the frequency of the first vertical synchronization signal is a first frequency.

[0344] The drawing module 803 may also be configured to execute an image drawing operation corresponding to the first application program according to the received first vertical synchronization signal.

[0345] The generating module 804 may also be configured to generate a second vertical synchronization signal, where the frequency of the second vertical synchronization signal is a second frequency.

[0346] The drawing module 803 may also be configured to execute an image drawing operation corresponding to the first application program according to the received second vertical synchronization signal.

[0347] In another possible implementation, the image drawing module 800 may further include a sending module 805 .

[0348] The sending module 805 may be configured to send an image drawing request to the choreographer corresponding to the first application.

[0349] The sending module 805 may also be configured to send vertical synchronization signal request information to the display composition system of the electronic device at a first frequency in response to an image drawing request.

[0350] The receiving module 801 may also be configured to receive vertical synchronization signal request information.

[0351] The sending module 805 may also be configured to send vertical synchronization signal request information to the hardware of the electronic device at the first frequency.

[0352] The sending module 805 may also be configured to send a second vertical synchronization signal to the display synthesis system of the electronic device in response to the received vertical synchronization signal request information.

[0353] The receiving module 801 may also be configured to receive a second vertical synchronization signal sent by hardware of the electronic device.

[0354] In another possible implementation, the sending module 805 may also be configured to send a first vertical synchronization signal to the choreographer corresponding to the first application at a first frequency.

[0355] The receiving module 801 may also be configured to receive a portion of the vertical synchronization signal in the first vertical synchronization signal.

[0356] The drawing module 803 can also be used to perform image drawing operations corresponding to the first application based on part of the first vertical synchronization signal, where the time interval between any two vertical synchronization signals in the part of the first vertical synchronization signal is the inverse of the second frequency.

[0357] In another possible implementation, the sending module 805 can also be used to send vertical synchronization signal request information to the display synthesis system of the electronic device, where the time interval between any two vertical synchronization signal request information in the vertical synchronization signal request information is greater than a first threshold, and the first threshold is determined based on the second frequency.

[0358] In another possible implementation, the first threshold is the reciprocal of the second frequency.

[0359] In another possible implementation, the sending module 805 may also be configured to send a first vertical synchronization signal to the choreographer corresponding to the first application at a first frequency.

[0360] The receiving module 801 may also be configured to receive a first vertical synchronization signal.

[0361] The drawing module 803 may also be configured to execute the image drawing operation corresponding to the first application when the choreographer corresponding to the first application determines that the time interval between the moment of receiving the first vertical synchronization signal and the moment of the last execution of the image drawing operation corresponding to the first application is greater than a second threshold, where the second threshold is determined based on the second frequency.

[0362] In another possible implementation, the drawing module 803 may also be configured to execute an image drawing operation corresponding to the first application based on the first frequency when at least one window of the first application is switched from the background of the electronic device to the foreground of the electronic device.

[0363] In another possible implementation, the first application includes a music player application or a video player application.

[0364] In another possible implementation, the window of the first application includes at least one of an activity-type window, a view-type window, and a wallpaper-type window.

[0365] In another possible implementation, the image drawing module 800 may further include a display module 806 .

[0366] The display module 806 may be configured to refresh a displayed image at a first frequency.

[0367] It should be understood that the division of units or modules (hereinafter referred to as units) in the above devices is merely a division of logical functions. In actual implementation, they may be fully or partially integrated into a single physical entity, or physically separated. Furthermore, the units in the device may be implemented entirely in the form of software called through processing elements; entirely in the form of hardware; or partially in the form of software called through processing elements, and partially in the form of hardware.

[0368] For example, each unit can be a separately established processing element, or it can be integrated into a certain chip of the device for implementation. In addition, it can also be stored in a memory in the form of a program, and called by a certain processing element of the device to execute the function of the unit. In addition, all or part of these units can be integrated together, or they can be implemented independently. The processing element described here can also be called a processor, which can be an integrated circuit with signal processing capabilities. In the implementation process, each step of the above method or each of the above units can be implemented by the integrated logic circuit of the hardware in the processor element or in the form of software called by the processing element.

[0369] In one example, the units in the above apparatus may be one or more integrated circuits configured to implement the above method, such as one or more ASICs, or one or more DSPs, or one or more FPGAs, or a combination of at least two of these integrated circuit forms.

[0370] For another example, when the units in the device can be implemented in the form of a processing element scheduling program, the processing element can be a general-purpose processor, such as a CPU or other processor that can call programs. For another example, these units can be integrated together and implemented in the form of a system on a chip (SOC).

[0371] In one implementation, the units implementing the corresponding steps of the above methods in the apparatus described above may be implemented in the form of a processing element scheduling program. For example, the apparatus may include a processing element and a storage element, with the processing element invoking a program stored in the storage element to execute the method described in the above method embodiments. The storage element may be a storage element on the same chip as the processing element, i.e., an on-chip storage element.

[0372] In another implementation, the program for executing the above method may be stored in a memory element on a different chip from the processing element, i.e., an off-chip memory element. In this case, the processing element calls or loads the program from the off-chip memory element onto the on-chip memory element to call and execute the method described in the above method embodiment.

[0373] For example, embodiments of the present application may also provide an apparatus, such as an electronic device, which may include a processor and a memory for storing instructions executable by the processor. When the processor is configured to execute the instructions, the electronic device implements the image rendering method described in the aforementioned embodiments. The memory may be located within or outside the electronic device. The processor may include one or more processors.

[0374] In another implementation, the unit of the apparatus implementing each step of the above method may be configured as one or more processing elements, which may be provided on the corresponding electronic device. The processing elements may be integrated circuits, such as one or more ASICs, one or more DSPs, one or more FPGAs, or a combination of these integrated circuits. These integrated circuits may be integrated together to form a chip.

[0375] For example, embodiments of the present application further provide a chip that can be used in the aforementioned electronic device. The chip includes one or more interface circuits and one or more processors; the interface circuits and processors are interconnected via circuits; the processors receive and execute computer instructions from the electronic device's memory via the interface circuits to implement the methods described in the aforementioned method embodiments.

[0376] An embodiment of the present application also provides a computer program product, including computer instructions executed by the above-mentioned electronic device.

[0377] Through the description of the above implementation methods, technical personnel in the relevant field can clearly understand that for the convenience and simplicity of description, only the division of the above-mentioned functional modules is used as an example. In actual applications, the above-mentioned functions can be assigned to different functional modules as needed, that is, the internal structure of the device can be divided into different functional modules to complete all or part of the functions described above.

[0378] In the several embodiments provided in this application, it should be understood that the disclosed devices and methods can be implemented in other ways. For example, the device embodiments described above are merely schematic. For example, the division of the modules or units is merely a logical function division. In actual implementation, there may be other division methods, such as multiple units or components can be combined or integrated into another device, or some features can be ignored or not executed. Another point is that the mutual coupling or direct coupling or communication connection shown or discussed can be through some interfaces, indirect coupling or communication connection of devices or units, which can be electrical, mechanical or other forms.

[0379] The units described as separate components may or may not be physically separate, and the components shown as units may be one physical unit or multiple physical units, that is, they may be located in one place or distributed in multiple places. Some or all of the units may be selected according to actual needs to achieve the purpose of the solution of this embodiment.

[0380] In addition, the functional units in the various embodiments of the present application may be integrated into a single processing unit, or each unit may exist physically separately, or two or more units may be integrated into a single unit. The aforementioned integrated units may be implemented in the form of hardware or software functional units.

[0381] If the integrated unit is implemented in the form of a software functional unit and sold or used as an independent product, it can be stored in a readable storage medium. Based on this understanding, the technical solution of the embodiment of the present application is essentially or the part that contributes to the prior art or all or part of the technical solution can be embodied in the form of a software product, such as a program. The software product is stored in a program product, such as a computer-readable storage medium, and includes a number of instructions to enable a device (which can be a single-chip microcomputer, chip, etc.) or a processor (processor) to execute all or part of the steps of the method described in each embodiment of the present application. The aforementioned storage medium includes various media that can store program codes, such as a USB flash drive, a mobile hard disk, a ROM, a RAM, a magnetic disk, or an optical disk.

[0382] For example, embodiments of the present application may further provide a computer-readable storage medium having computer program instructions stored thereon. When the computer program instructions are executed by an electronic device, the electronic device implements the image drawing method described in the aforementioned method embodiment.

[0383] The above is only a specific embodiment of the present application, but the scope of protection of this application is not limited to this. Any changes or substitutions within the technical scope disclosed in this application should be included in the scope of protection of this application. Therefore, the scope of protection of this application should be based on the scope of protection of the claims.

Claims

1. An image rendering method, characterized in that: Applied to electronic equipment, the method includes: The electronic device receives a start-up operation from a user; In response to the startup operation, the electronic device starts a first application; When at least one window of the first application is running in the foreground of the electronic device, the electronic device performs an image drawing operation corresponding to the first application based on a first frequency; When all windows of the first application are switched to background operation, the electronic device performs an image drawing operation corresponding to the first application based on a second frequency, wherein the second frequency is lower than the first frequency.

2. The method according to claim 1, characterized in that The electronic device performs an image drawing operation corresponding to the first application based on the first frequency, including: The display synthesis system of the electronic device generates a first vertical synchronization signal, wherein the frequency of the first vertical synchronization signal is the first frequency; The choreographer corresponding to the first application executes an image drawing operation corresponding to the first application according to the received first vertical synchronization signal; The electronic device performs an image drawing operation corresponding to the first application based on the second frequency, including: The display synthesis system of the electronic device generates a second vertical synchronization signal, the frequency of the second vertical synchronization signal being the second frequency; The choreographer corresponding to the first application executes the image drawing operation corresponding to the first application according to the received second vertical synchronization signal.

3. The method according to claim 2, characterized in that Before the display composition system of the electronic device generates the second vertical synchronization signal, the method further includes: The first application sends an image drawing request to a choreographer corresponding to the first application; The choreographer corresponding to the first application sends vertical synchronization signal request information to the display composition system of the electronic device at the first frequency in response to the image drawing request; The display composition system of the electronic device receives the vertical synchronization signal request information and sends the vertical synchronization signal request information to the hardware of the electronic device at the first frequency; The hardware of the electronic device sends a vertical synchronization signal to a display composition system of the electronic device in response to the received vertical synchronization signal request information; The display composition system of the electronic device receives a vertical synchronization signal sent by hardware of the electronic device.

4. The method according to claim 1, wherein The electronic device performs an image drawing operation corresponding to the first application based on the second frequency, including: The display synthesis system of the electronic device sends a first vertical synchronization signal to the choreographer corresponding to the first application at the first frequency; The choreographer corresponding to the first application receives a portion of the first vertical synchronization signal; The choreographer corresponding to the first application performs an image drawing operation corresponding to the first application based on a portion of the first vertical synchronization signal, and the time interval between any two vertical synchronization signals in the portion of the vertical synchronization signal is the inverse of the second frequency.

5. The method according to claim 4, characterized in that The method further comprises: The choreographer corresponding to the first application sends vertical synchronization signal request information to the display synthesis system of the electronic device, and the time interval between any two vertical synchronization signal request information in the vertical synchronization signal request information is greater than a first threshold, and the first threshold is determined based on the second frequency.

6. The method according to claim 5, characterized in that The first threshold is the reciprocal of the second frequency.

7. The method according to claim 1, characterized in that The electronic device performs an image drawing operation corresponding to the first application based on the second frequency, including: The display synthesis system of the electronic device sends a first vertical synchronization signal to the choreographer corresponding to the first application at the first frequency; The choreographer corresponding to the first application receives the first vertical synchronization signal; When the choreographer corresponding to the first application determines that the time interval between the moment of receiving the first vertical synchronization signal and the moment of last performing the image drawing operation corresponding to the first application is greater than a second threshold, the choreographer corresponding to the first application performs the image drawing operation corresponding to the first application, and the second threshold is determined based on the second frequency.

8. The method according to any one of claims 1 to 7, characterized in that After all windows of the first application are switched to background operation, the method further includes: When at least one window of the first application is switched from the background of the electronic device to the foreground of the electronic device, the electronic device executes an image drawing operation corresponding to the first application based on the first frequency.

9. The method according to any one of claims 1 to 7, characterized in that The first application includes a music player application or a video player application.

10. The method according to any one of claims 1 to 7, characterized in that The window of the first application includes at least one of an activity type window, a view type window, and a wallpaper type window.

11. The method according to any one of claims 1 to 7, characterized in that When all windows of the first application are switched to background operation, the method further includes: The screen of the electronic device refreshes the displayed image at the first frequency.

12. The method according to claim 11, characterized in that In a case where at least one window among all windows of the first application is switched to the foreground of the electronic device, the method further includes: The screen of the electronic device refreshes the displayed image at the first frequency.

13. An electronic device, characterized in that: The electronic device comprises a processor and a memory for storing instructions executable by the processor; when the processor is configured to execute the instructions, the electronic device implements the method according to any one of claims 1 to 12.

14. A computer-readable storage medium having computer program instructions stored thereon; characterized in that: When the computer program instructions are executed by an electronic device, the electronic device is caused to implement the method according to any one of claims 1 to 12.