Event processing method and device

By processing the touch screen input events that meet the conditions in advance in the electronic device, the problem of ACTION_MOVE event processing delay in the existing technology is solved, the response speed and sliding chirality of the sliding screen interaction are improved, and the frame rate is improved.

CN118567773APending Publication Date: 2024-08-30HUAWEI TECH CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202410742127.4
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2020-09-30
Publication Date
2024-08-30

AI Technical Summary

Technical Problem

When the existing technology handles the ACTION_MOVE event in touch screen interaction, it needs to wait for the vertical synchronization signal, resulting in a long delay and affecting the response time and sliding chirality of the sliding screen interaction.

Method used

After receiving the first target vertical synchronization signal, if the input event meets the preset conditions (for example, the time between the event arrival time and the next vertical synchronization signal is less than the minimum reporting period), the system will advance before the arrival of the second target vertical synchronization signal. Handle target input events, including drawing and processing associated layers.

Benefits of technology

It reduces the delay in electronic devices processing target input events, reduces the response time of sliding screen interaction, improves sliding chirality, reduces the possibility of timeout in the image drawing and rendering process, and improves the frame rate.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118567773A
    Figure CN118567773A
Patent Text Reader

Abstract

The embodiment of the invention provides an event processing method and device, relates to the technical field of terminals, and can process a collected target input event in advance when an electronic device determines that the received target input event meets a preset condition without processing the collected target input event after waiting for the arrival of a next target vertical synchronization signal. According to the specific scheme, after the electronic equipment receives a first target vertical synchronization signal, if an input event received by the electronic equipment is a target input event and meets a preset condition, the target input event is processed before a second target vertical synchronization signal arrives. Wherein the second target vertical synchronization signal is the next target vertical synchronization signal of the first target vertical synchronization signal. The embodiment of the invention is used for an event processing process.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The embodiments of the present application relate to the field of terminal technology, and in particular, to an event processing method and device. Background Art

[0002] Generally, an electronic device displays a picture on a screen of the electronic device through processes such as drawing, rendering, image frame synthesis, and image frame display. Figure 1A As shown, the drawing process can be divided into four steps, including: input processing 1, animation processing 2, traversal processing 3 and callback processing 4.

[0003] In the Android system, input events during touch screen interaction may include: touch screen action ACTION_DOWN event, sliding action ACTION_MOVE event, and hand raising action ACTION_UP event, etc. Among them, if the electronic device determines that the received input event is an ACTION_MOVE event, the input event is cached until the next target vertical synchronization signal (such as VSYNC_APP) arrives, and then one or more layers corresponding to the cached input event are drawn (that is, input processing, animation processing, traversal processing, callback processing are performed in sequence), and then the one or more layers are rendered, image frame synthesis, image frame display, etc. are performed.

[0004] When processing ACTION_MOVE events using the existing technology, it is necessary to wait for the vertical synchronization signal 1 to arrive, which may cause a delay when processing the ACTION_MOVE event (i.e., when starting to draw one or more layers corresponding to the ACTION_MOVE event), and the response time of the sliding screen interaction is longer. Summary of the invention

[0005] The embodiments of the present application provide an event processing method and device, by which an electronic device can process a target input event in advance without having to wait for the next target vertical synchronization signal to arrive before processing the target input event, thereby reducing the delay of the electronic device in processing the target input event and reducing the response time of the sliding screen interaction.

[0006] In order to achieve the above objectives, the embodiments of the present application adopt the following technical solutions:

[0007] In a first aspect, an embodiment of the present application provides an event processing method, which is applied to an electronic device. The method may include: after receiving a first target vertical synchronization signal, if the input event received by the electronic device is a target input event and meets a preset condition, the electronic device processes the target input event before a second target vertical synchronization signal arrives. The second target vertical synchronization signal is the next target vertical synchronization signal of the first target vertical synchronization signal.

[0008] In the method of the present application, the electronic device can process the target input event before the second target vertical synchronization signal arrives when the received target input event meets the preset conditions. In this way, the electronic device can process the collected target input events in advance without waiting for the second target vertical synchronization signal to arrive before processing the collected target input events, thereby reducing the delay of the electronic device, reducing the response time of the sliding screen interaction, and ensuring the sliding hand tracking.

[0009] In combination with the first aspect, in a possible design, the above-mentioned preset condition includes: the first time period corresponding to the target input event is less than the minimum reporting period of the input event. The first time period represents the time period between the moment when the target input event is received and the moment when the second target vertical synchronization signal arrives.

[0010] That is to say, the electronic device receiving the target input event that satisfies the preset condition means that the time difference between the moment when the electronic device receives the target input event and the moment when the second target vertical synchronization signal arrives is less than the minimum reporting period of the input event. In this way, before the second target vertical synchronization signal arrives, the electronic device will not receive the target input event again. Therefore, it can be ensured that the target input event that needs to be processed after the second target vertical synchronization signal arrives has been collected and the electronic device can process the target input event in advance.

[0011] In combination with the first aspect, in another possible design manner, processing the target input event includes: drawing one or more layers corresponding to the target input event.

[0012] In combination with the first aspect, in another possible design, processing the target input event further includes: processing other target input events received in the second event segment. The second time period represents the time period between the moment when the first target vertical synchronization signal is received and the moment when the target input event is received. That is, when the preset conditions are met, in addition to processing the target input event, the electronic device also processes other target input events received after receiving the first target vertical synchronization signal and before receiving the target input event.

[0013] In combination with the first aspect, in another possible design manner, processing the target input event does not include: calculating a first time period corresponding to the target input event.

[0014] In combination with the first aspect, in another possible design, the method further includes: if the input event received by the electronic device is a target input event and does not meet a preset condition, receiving a next input event.

[0015] In combination with the first aspect, in another possible design manner, the target input event may be a sliding action event.

[0016] In a second aspect, the present application provides an electronic device, which includes a touch screen, a memory and one or more processors; the touch screen, the memory and the processor are coupled; the memory is used to store computer program code, the computer program code includes computer instructions, and when the processor executes the computer instructions, the electronic device executes: after receiving a first target vertical synchronization signal, if the received input event is a target input event and meets a preset condition, then before a second target vertical synchronization signal arrives, process the target input event; wherein the second target vertical synchronization signal is the next target vertical synchronization signal of the first target vertical synchronization signal.

[0017] In combination with the second aspect, in a possible design method, the preset conditions include: the first time period corresponding to the target input event is less than the minimum reporting period of the input event; wherein the first time period represents the time period between the moment when the target input event is received and the moment when the second target vertical synchronization signal is received.

[0018] In combination with the second aspect, in another possible design manner, processing a target input event includes: drawing one or more layers corresponding to the target input event.

[0019] In combination with the second aspect, in another possible design method, processing a target input event also includes: processing other target input events received within a second time period; wherein the second time period represents a time period between the moment of the first target vertical synchronization signal and the moment of receiving the target input event.

[0020] In combination with the second aspect, in another possible design, the electronic device further performs: if the input event received by the electronic device is a target input event and does not meet the preset condition, receiving the next input event

[0021] In combination with the second aspect, in another possible design manner, the target input event is a sliding action event.

[0022] In a third aspect, the present application provides a chip system, which includes one or more interface circuits and one or more processors; the interface circuit and the processor are interconnected via lines; the interface circuit is used to receive a signal from a memory of the electronic device and send the signal to the processor, the signal including computer instructions stored in the memory; when the processor executes the computer instructions, the electronic device executes the method described in the first aspect and any possible design method thereof.

[0023] In a fourth aspect, the present application provides a computer storage medium, which includes computer instructions. When the computer instructions are executed on an electronic device, the electronic device executes the method described in the first aspect and any possible design thereof.

[0024] In a fifth aspect, the present application provides a computer program product, which, when executed on a computer, enables the computer to execute the method described in the first aspect and any possible design thereof.

[0025] It can be understood that the beneficial effects that can be achieved by the electronic device described in the second aspect, the chip system described in the third aspect, the computer storage medium described in the fourth aspect, and the computer program product described in the fifth aspect provided above can be referred to the beneficial effects in the first aspect and any possible design method thereof, and will not be repeated here. BRIEF DESCRIPTION OF THE DRAWINGS

[0026] Figure 1A A schematic diagram of the image processing process provided;

[0027] Figure 1B A schematic diagram of a software processing flow of a provided electronic device;

[0028] Figure 1C A schematic diagram showing the same signal period of a vertical synchronization signal;

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

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

[0031] Figure 4 A flow chart of an event processing method provided in an embodiment of the present application;

[0032] Figure 5 A schematic diagram of an interface for touch screen interaction provided in an embodiment of the present application;

[0033] Figure 6A schematic diagram of an event processing method provided in an embodiment of the present application;

[0034] Figure 7 Another flowchart of the event processing method provided in the embodiment of the present application;

[0035] Figure 8 Another flowchart of the event processing method provided in the embodiment of the present application;

[0036] Fig. 9 A schematic diagram of the structure of an electronic device provided in an embodiment of the present application. DETAILED DESCRIPTION

[0037] The technical solutions in the embodiments of the present application will be described below in conjunction with the drawings in the embodiments of the present application. In the description of the embodiments of the present application, unless otherwise specified, " / " means or, for example, A / B can mean A or B; "and / or" in this article is only a description of the association relationship of associated objects, indicating that there can be three relationships, for example, A and / or B can mean: A exists alone, A and B exist at the same time, and B exists alone. In addition, in the description of the embodiments of the present application, "multiple" means two or more than two.

[0038] In the following, the terms "first" and "second" are used for descriptive purposes only and are not to be understood as indicating or implying relative importance or implicitly indicating the number of the indicated technical features. Thus, a feature defined as "first" or "second" may explicitly or implicitly include one or more of the features. In the description of this embodiment, unless otherwise specified, "plurality" means two or more.

[0039] An embodiment of the present application provides an event processing method that can be applied to electronic devices. When the received input event is a target input event, such as a sliding action ACTION_MOVE event, it can determine whether the target input event can be processed in advance, that is, whether one or more layers corresponding to the target input event can be drawn immediately, based on the minimum reporting period of the input event and the screen refresh period. If the target input event can be processed in advance, the electronic device processes the target input event immediately without waiting for the vertical synchronization signal 1 to be received before processing the target input event. Thereby, the response delay of the electronic device can be reduced, and the response time of the sliding screen interaction can be reduced; and the problem of a long delay caused by waiting for the vertical synchronization signal 1 to be received before processing the target input event in the prior art, a long response time of the sliding screen interaction, and affecting the sliding hand-tracking property will not occur.

[0040] refer to Figure 1BThe electronic device may include: a touch panel (TP) / TP driver, an Input framework (i.e., Input Framework), a UI framework (i.e., UI Framework), a Display framework (i.e., DisplayFramework) and a hardware display module.

[0041] Among them, after the TP in the TP IC / TP driver collects the user's touch operation on the TP of the electronic device, the TP driver reports the corresponding touch event; the Input Reader thread of the Input framework can read the touch event, and then send the touch event to the Input Dispatcher thread; the Input Dispatcher thread sends and uploads the touch event to the UI thread (such as DoFrame) in the UI framework; the UI thread in the UI framework draws one or more layers corresponding to the touch event; the rendering thread performs layer rendering on one or more layers; the synthesis thread in the Display framework performs layer synthesis on the rendered one or more layers to obtain an image frame; the Liquid Crystal Display (LCD) driver of the hardware display module can receive the synthesized image frame, and the synthesized image frame is displayed by the LCD. After the LCD displays the image frame, the image displayed by the LCD can be perceived by the human eye.

[0042] Combination Figure 1A , an introduction is given to the vertical synchronization signal that appears when an electronic device responds to a user's touch operation on the touch screen and when the touch screen displays an image.

[0043] The vertical synchronization signal 1 (such as VSYNC_APP) can be used to trigger the drawing of one or more layers. In an embodiment of the present application, the vertical synchronization signal 1 can be used to trigger the drawing of one or more layers. Specifically, the vertical synchronization signal 1 can trigger the drawing of one or more layers and trigger the rendering of the one or more layers. In other words, the drawn one or more layers refer to one or more layers after rendering. It should be noted that if the drawing of one or more layers is not completed within a signal cycle of the vertical synchronization signal 1, that is, the drawing times out, then when the next vertical synchronization signal 1 arrives, the electronic device will still perform the above-mentioned unfinished drawing process. Figure 1A As shown, in this case, frame drops may occur due to drawing timeout.

[0044] The vertical synchronization signal 2 (such as VSYNC_SF) can be used to trigger the layer synthesis of one or more drawn layers to obtain an image frame. After the electronic device completes drawing one or more layers in response to the vertical synchronization signal 1, the electronic device can respond to the vertical synchronization signal 2 to perform layer synthesis on the one or more layers (the one or more layers after rendering).

[0045] The vertical synchronization signal 3 (such as HW_VSYNC) can be used to trigger hardware to refresh the display image frame. After the electronic device completes the image frame synthesis in response to the vertical synchronization signal 2, the electronic device can display the image frame in response to the vertical synchronization signal 3.

[0046] Combination Figure 1A and Figure 1B , in response to the user's touch operation, or the occurrence of a UI event in the electronic device, the UI framework can call the UI thread to draw one or more layers corresponding to the touch event (i.e., input event) when the vertical synchronization signal 1 arrives, and then call the rendering thread to render the one or more layers. Then, the synthesis thread in the Display framework can call the synthesis thread to perform layer synthesis on the drawn one or more layers (i.e., one or more layers after rendering) to obtain an image frame when the vertical synchronization signal 2 arrives; finally, the hardware display module can refresh and display the above image frame on the LCD (i.e., the display screen, LCD is taken as an example here) when the vertical synchronization signal 3 arrives. Among them, the above UI event can be triggered by the user's touch operation on the TP. Alternatively, the UI event can be automatically triggered by the electronic device. For example, when the foreground application of the electronic device automatically switches the screen, the above UI event can be triggered. The foreground application is the application corresponding to the interface currently displayed on the display screen of the electronic device.

[0047] It should be noted that the UI framework periodically draws and renders layers based on vertical synchronization signal 1; the Display framework periodically synthesizes layers based on vertical synchronization signal 2; and the hardware display module periodically refreshes image frame display based on vertical synchronization signal 3.

[0048] The vertical synchronization signal 3 is a hardware signal triggered by the display screen driver of the electronic device, and the signal period T3 of the vertical synchronization signal 3 is determined according to the screen refresh frequency of the display screen of the electronic device. That is, the signal period T3 of the vertical synchronization signal 3 is equal to the screen refresh period of the display screen of the electronic device. Specifically, the signal period T3 of the vertical synchronization signal 3 is the reciprocal of the screen refresh frequency of the display screen of the electronic device.

[0049] For example, the screen refresh rate of the display screen of the electronic device can be any value such as 60 Hz, 70 Hz, 75 Hz or 80 Hz. Taking the screen refresh rate of 60 Hz as an example, the signal period T3 of the vertical synchronization signal 3 is 1 / 60 = 0.01667 seconds (s) = 16.667 milliseconds (ms). It should be noted that, among them, the electronic device may support multiple different screen refresh rates. For example, suppose that the maximum screen refresh rate supported by the electronic device is 80 Hz. Then, the electronic device may support screen refresh rates of 80 Hz, 60 Hz or 40 Hz, etc. The screen refresh rate described in the embodiment of the present application is the screen refresh rate currently used by the electronic device. That is, the signal period T3 of the vertical synchronization signal 3 is the inverse of the screen refresh rate currently used by the electronic device.

[0050] The vertical synchronization signal 1 and the vertical synchronization signal 2 are generated based on the vertical synchronization signal 3. Usually, the vertical synchronization signal 1 and the vertical synchronization signal 2 are synchronized with the vertical synchronization signal 3. That is to say, the vertical synchronization signal 1 and the vertical synchronization signal 2 have the same signal period as the vertical synchronization signal 3, and the phase is consistent. It is understandable that in the actual implementation process, there may be a certain phase error between the vertical synchronization signal 1, the vertical synchronization signal 2, and the vertical synchronization signal 3 due to various factors (such as processing performance). It should be noted that when understanding the method of the embodiment of the present application, the above-mentioned phase error is ignored.

[0051] In the present application embodiment, Figure 1C As shown, the vertical synchronization signal 1, the vertical synchronization signal 2 and the vertical synchronization signal 3 are all periodic discrete signals, and the signal periods of the vertical synchronization signal 1, the vertical synchronization signal 2 and the vertical synchronization signal 3 can all be referred to as the synchronization period T Z That is, T1 = T2 = T3 = T Z .in, Figure 1A Frame1, Frame2, Frame3 and Frame4 shown are all the above-mentioned synchronization cycles.

[0052] Among them, TP is a touch panel, and TP can be integrated into a display screen. TP can periodically detect user touch operations. After TP detects a touch operation, it can wake up the above-mentioned vertical synchronization signal 1 and vertical synchronization signal 2 to trigger the UI framework to draw and render layers based on vertical synchronization signal 1, and the Display framework to synthesize layers based on vertical synchronization signal 2. The period in which TP periodically detects user touch operations can be called the reporting period of input events. In an embodiment of the present application, the minimum reporting period of input events refers to the minimum value of the reporting period of input events. Exemplarily, the minimum reporting period of input events is typically less than T Z fixed value.

[0053] The event processing method provided in the embodiments of the present application can be applied to electronic devices such as mobile phones, tablet computers, wearable devices, vehicle-mounted devices, augmented reality (AR) / virtual reality (VR) devices, laptop computers, ultra-mobile personal computers (UMPC), netbooks, personal digital assistants (PDA), etc. The embodiments of the present application do not impose any restrictions on the specific types of electronic devices.

[0054] For example, Figure 2 1 shows a schematic diagram of the structure of the electronic device 100. The electronic device 100 may include a processor 110, an external memory interface 120, an internal memory 121, a universal serial bus (USB) interface 130, a charging management module 140, a power management module 141, a battery 142, an antenna 1, an antenna 2, a mobile communication module 150, a wireless communication module 160, an audio module 170, a speaker 170A, a receiver 170B, a microphone 170C, an earphone interface 170D, a sensor module 180, a button 190, a motor 191, an indicator 192, a camera 193, a display screen 194, and a subscriber identification module (SIM) card interface 195. The sensor module 180 may include a pressure sensor 180A, a gyroscope sensor 180B, an air pressure sensor 180C, a magnetic sensor 180D, an acceleration sensor 180E, a distance sensor 180F, a proximity light sensor 180G, a fingerprint sensor 180H, a temperature sensor 180J, a touch sensor 180K, an ambient light sensor 180L, a bone conduction sensor 180M, etc.

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

[0056] The processor 110 may include one or more processing units, for example, the processor 110 may include an application processor (AP), a modem processor, a graphics processor (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), etc. Different processing units may be independent devices or integrated into one or more processors.

[0057] The controller may be the nerve center and command center of the electronic device 100. The controller may generate an operation control signal according to the instruction operation code and the timing signal to complete the control of fetching and executing instructions.

[0058] A memory may also be provided in the processor 110 for storing instructions and data. In some embodiments, the memory in the processor 110 is a cache memory. The memory may store instructions or data that the processor 110 has just used or circulated. If the processor 110 needs to use the instruction or data again, it may be directly called from the memory. Repeated access is avoided, and the waiting time of the processor 110 is reduced, thereby improving the efficiency of the system. In some embodiments, when the received target input event does not meet the conditions for advance processing, the electronic device 100 may cache the received target input event in the memory, and wait until the vertical synchronization VSYNC signal arrives or the preset conditions are met before processing the cached target input event.

[0059] In some embodiments, the processor 110 may include one or more interfaces. The interface 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, etc.

[0060] It is understandable that the interface connection relationship between the modules illustrated in the embodiment of the present application is only a schematic illustration and does not constitute a structural limitation on the electronic device 100. In other embodiments of the present application, the electronic device 100 may also adopt different interface connection methods in the above embodiments, or a combination of multiple interface connection methods.

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

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

[0063] The mobile communication module 150 can provide solutions for wireless communications including 2G / 3G / 4G / 5G, etc., applied to the electronic device 100. The mobile communication module 150 may include at least one filter, a switch, a power amplifier, a low noise amplifier (LNA), etc. The mobile communication module 150 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 150 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 150 can be set in the processor 110. In some embodiments, at least some of the functional modules of the mobile communication module 150 can be set in the same device as at least some of the modules of the processor 110.

[0064] The wireless communication module 160 can provide wireless communication solutions 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., which are applied to the electronic device 100. The wireless communication module 160 can be one or more devices integrating at least one communication processing module. The wireless communication module 160 receives electromagnetic waves via the antenna 2, modulates the frequency of the electromagnetic wave signal and performs filtering, and sends the processed signal to the processor 110. The wireless communication module 160 can also receive the signal to be sent from the processor 110, modulate the frequency of it, amplify it, and convert it into electromagnetic waves for radiation through the antenna 2.

[0065] In some embodiments, the antenna 1 of the electronic device 100 is coupled to the mobile communication module 150, and the antenna 2 is coupled to the wireless communication module 160, so that the electronic device 100 can communicate with the network and other devices through wireless communication technology. The wireless communication technology 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. The GNSS may include a global positioning system (GPS), a global navigation satellite system (GLONASS), a Beidou navigation satellite system (BDS), a quasi-zenith satellite system (QZSS) and / or a satellite based augmentation system (SBAS).

[0066] The electronic device 100 implements the display function through a GPU, a display screen 194, and an application processor. The GPU is a microprocessor for image processing, which connects the display screen 194 and the application processor. The GPU is used to perform mathematical and geometric calculations for graphics rendering. The processor 110 may include one or more GPUs that execute program instructions to generate or change display information.

[0067] The display screen 194 is used to display images, videos, etc. The display screen 194 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 or an active-matrix organic light-emitting diode (AMOLED), a flexible light-emitting diode (FLED), Miniled, MicroLed, Micro-oLed, a quantum dot light-emitting diode (QLED), etc. In some embodiments, the electronic device 100 may include 1 or N display screens 194, where N is a positive integer greater than 1.

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

[0069] ISP is used to process the data fed back by camera 193. For example, when taking a photo, the shutter is opened, and the light is transmitted to the camera photosensitive element through the lens. The light signal is converted into an electrical signal, and the camera photosensitive element transmits the electrical signal to ISP for processing and converts it into an image visible to the naked eye. ISP can also perform algorithm optimization on the noise, brightness, and skin color of the image. ISP can also optimize the exposure, color temperature and other parameters of the shooting scene. In some embodiments, ISP can be set in camera 193.

[0070] The digital signal processor is used to process digital signals, and can process not only digital image signals but also other digital signals. For example, when the electronic device 100 is selecting a frequency point, the digital signal processor is used to perform Fourier transform on the frequency point energy.

[0071] Video codecs are used to compress or decompress digital videos. The electronic device 100 may support one or more video codecs. Thus, the electronic device 100 may play or record videos in a variety of coding formats, such as Moving Picture Experts Group (MPEG) 1, MPEG2, MPEG3, MPEG4, etc.

[0072] NPU is a neural network (NN) computing processor. By drawing on the structure of biological neural networks, such as the transmission mode between neurons in the human brain, it can quickly process input information and can also continuously self-learn. Through NPU, applications such as intelligent cognition of electronic device 100 can be realized, such as image recognition, face recognition, voice recognition, text understanding, etc.

[0073] The external memory interface 120 can be used to connect an external memory card, such as a Micro SD card, to expand the storage capacity of the electronic device 100. The external memory card communicates with the processor 110 through the external memory interface 120 to implement a data storage function, such as storing music, video and other files in the external memory card.

[0074] The internal memory 121 can be used to store computer executable program codes, which include instructions. The processor 110 executes various functional applications and data processing of the electronic device 100 by running the instructions stored in the internal memory 121. The internal memory 121 may include a program storage area and a data storage area. Among them, the program storage area may 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 may store data created during the use of the electronic device 100 (such as audio data, a phone book, etc.), etc. In addition, the internal memory 121 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.

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

[0076] The pressure sensor 180A is used to sense the pressure signal and can convert the pressure signal into an electrical signal. In some embodiments, the pressure sensor 180A can be set on the display screen 194. There are many types of pressure sensors 180A, such as resistive pressure sensors, inductive pressure sensors, capacitive pressure sensors, etc. A capacitive pressure sensor can be a parallel plate including at least two conductive materials. When a force acts on the pressure sensor 180A, the capacitance between the electrodes changes. The electronic device 100 determines the intensity of the pressure based on the change in capacitance. When a touch operation acts on the display screen 194, the electronic device 100 detects the intensity of the touch operation according to the pressure sensor 180A. The electronic device 100 can also calculate the position of the touch based on the detection signal of the pressure sensor 180A. In some embodiments, touch operations acting on the same touch position but with different touch operation intensities can correspond to different operation instructions.

[0077] The fingerprint sensor 180H is used to collect fingerprints. The electronic device 100 can use the collected fingerprint characteristics to implement fingerprint unlocking, access application locks, fingerprint photography, fingerprint call answering, etc.

[0078] The touch sensor 180K is also called a "touch panel". The touch sensor 180K can be set on the display screen 194, and the touch sensor 180K and the display screen 194 form a touch screen, also called a "touch screen". The touch sensor 180K is used to detect touch operations acting on or near it. The touch sensor can pass the detected touch operation to the application processor to determine the type of input event corresponding to the touch operation. Visual output related to the touch operation can be provided through the display screen 194. In other embodiments, the touch sensor 180K can also be set on the surface of the electronic device 100, which is different from the position of the display screen 194.

[0079] In the embodiment of the present application, the touch sensor 180K can detect a touch operation on or near the display screen, such as a touch screen action ACTION_DOWN, a sliding action ACTION_MOVE, or a hand-raising action ACTION_UP, etc. The touch sensor 180K can transmit the detected touch operation to the application processor. If the input event corresponding to the touch operation is a target input event, such as an ACTION_MOVE event, the electronic device can immediately process the collected target input event and provide relevant visual output through the display screen 194 when it is determined that the target input event meets the preset conditions, without waiting until the vertical synchronization signal 1 is received before processing the target input event, thereby reducing the response delay and ensuring the sliding hand tracking.

[0080] Figure 3 is a software structure block diagram of the electronic device 100 of the embodiment of the present application. It should be noted that: Figure 3Only the architecture of the application layer and the application framework layer running in the virtual machine is shown. The electronic device 100 may also include an Android runtime and a system library, as well as a kernel layer, etc., which are not limited in this application. Each layer has a clear role and division of labor, and the layers communicate with each other through software interfaces.

[0081] The application layer may include a series of application packages. For example, an application package may include camera, gallery, calendar, call, map, navigation, WLAN, Bluetooth, music, video, short message and other applications. The application layer may also handle various input events, such as ACTION_DOWN event, ACTION_MOVE event or ACTION_UP event.

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

[0083] like Figure 3 As shown, the application framework layer may include a Framwork module, an iAware module, a core service module, and the like.

[0084] The iAware module may include a switch configuration module and a frame time synchronization module. The iAware module is used to configure the minimum reporting period T_input of input events and the screen refresh period T Z For example, the electronic device 100 can statically configure the minimum reporting period T_input of the input event by turning on the switch configuration module in the iAware module. For another example, the frame time synchronization module in the iAware module can obtain the screen refresh period T Z , that is, the period of the vertical synchronization signal 1. The frame time synchronization module can also calculate the time t_vsync of the next vertical synchronization signal 1 according to the screen refresh period.

[0085] The Framwork module may include a Choreographer module and an InputEventReceiver module. The Framwork module is used to determine the type of input event, and after determining that the input event is a target input event, such as an ACTION_MOVE event, determine whether the target input event can be processed in advance, that is, determine whether one or more layers corresponding to the target input event can be drawn immediately without waiting for the next vertical synchronization signal 1 to arrive before processing the target input event.

[0086] Exemplarily, the InputEventReceiver module in the Framwork module can obtain the minimum reporting period of the input event from the iAware module; the Choreographer module in the Framwork module can obtain the screen refresh period and the time of the next vertical synchronization signal 1 from the frame time synchronization module, and also send the screen refresh period and the time of the next vertical synchronization signal 1 to the InputEventReceiver module.

[0087] If the InputEventReceiver module determines that the current input event is a target input event, such as an ACTION_MOVE event, the InputEventReceiver module can determine whether to process the target input event in advance, that is, whether to immediately draw one or more layers corresponding to the target input event, based on the minimum reporting period of the input event, the time of the next vertical synchronization signal 1, and the timestamp t_input of the target input event. It can be understood that the timestamp of the target input event indicates the input moment of the target input event.

[0088] The core service module may include an inputflinger module and a surfaceflinger module. The core service module includes an internal service program of the electronic device 100. Among them, the inputflinger module is used to receive various input operations. For example, the inputflinger module can receive various touch screen operations (user touch operations or touch screen operations performed by a touch device), and then receive corresponding input events. The surfaceflinger module is used to provide corresponding visual outputs. For example, the surfaceflinger module can provide relevant visual outputs through a display screen based on input events.

[0089] In the examples of this application, see Figure 3 After the InputEventReceiver module of the application framework layer determines that the target input event can be processed in advance, it sends the determination result to the application layer, and the application layer calls the CPU or GPU to process the target input event. For example, one or more layers corresponding to the target input event are drawn, and then the one or more layers are layer-synthesized, and finally the image frame is displayed.

[0090] For ease of understanding, the following embodiments of the present application will take electronic devices as Figure 2 and Figure 3 As an example, the mobile phone with the structure shown in the figure is combined with the attached Figure 4 The event processing method provided in the embodiment of the present application is specifically described. Figure 4 As shown, the event handling method includes:

[0091] S401. The mobile phone receives an input event.

[0092] When the user interacts with the mobile phone through touch screen, the mobile phone can receive various touch screen operations input by the user through a touch object such as a finger or a stylus, such as a sliding action ACTION_MOVE, a touch screen action ACTION_DOWN, or a hand-raising action ACTION_UP, etc. In some embodiments, a complete touch screen interaction may include: one ACTION_DOWN, multiple ACTION_MOVEs, and one ACTION_UP.

[0093] According to different touch screen operations, the mobile phone can receive different input events. For example, the input event may include: ACTION_MOVE event, ACTION_DOWN event or ACTION_UP event.

[0094] For example, Figure 5 As shown, the user interacts with the phone through touch screen, causing the phone to display a drop-down notification bar. Among them, at position 1, the user's touch screen operation is ACTION_DOWN, and the phone can receive the ACTION_DOWN event accordingly; during the pull-down process, such as at position 2 and position 3, the user's touch screen operation is ACTION_MOVE, and the phone can receive the ACTION_MOVE event accordingly; at position 4, the user's touch screen operation is ACTION_UP, and the phone can receive the ACTION_UP event accordingly. Through the user's touch screen interaction with the phone, the phone displays a drop-down notification bar.

[0095] S402: The mobile phone determines whether the received input event is a target input event.

[0096] After receiving the input event, the mobile phone may determine the type of the input event to determine whether the received input event is a target input event.

[0097] The target input event refers to an input event that can be processed only after the next vertical synchronization signal 1 arrives in the prior art. For example, the target input event may be an ACTION_MOVE event.

[0098] If the mobile phone determines that the received input event is a target input event, it can determine whether the target input event meets the preset conditions. If the preset conditions are met, the mobile phone can process the target input event in advance. In other words, the mobile phone can process the target input event before the next vertical synchronization signal 1 arrives. For example, one or more layers corresponding to the target input event are drawn before the next vertical synchronization signal 1 arrives, without waiting for the next vertical synchronization signal 1 to arrive before processing the target input event. If the preset conditions are not met, the mobile phone can save the current target input event and continue to receive the next input event.

[0099] In some embodiments, the preset condition includes that the time difference between the timestamp of the target input event and the time when the next vertical synchronization signal 1 arrives is less than the minimum reporting period of the input event. In other words, the mobile phone can determine whether the target input event meets the preset condition through the timestamp of the target input event, the time when the next vertical synchronization signal 1 arrives, and the minimum reporting period of the input event.

[0100] In a possible implementation, the mobile phone may determine whether the target input event meets a preset condition by including the following steps:

[0101] S403: If the mobile phone determines that the received input event is a target input event, the mobile phone calculates the time when the next vertical synchronization signal 1 arrives.

[0102] If the mobile phone determines that the received input event is not a target input event, the mobile phone continues to receive the next input event.

[0103] The event of the next vertical synchronization signal 1 is the moment when the mobile phone receives the next vertical synchronization signal 1. The mobile phone can calculate the time when the next vertical synchronization signal 1 arrives according to the screen refresh cycle. Specifically, the time when the next vertical synchronization signal 1 arrives is equal to the time when the current vertical synchronization signal 1 arrives plus the screen refresh cycle T Z .

[0104] For example, Figure 6 As shown, if the time when the current vertical synchronization signal 1 arrives is t0, then the time when the next vertical synchronization signal 1 arrives is t_vsync=t0+T Z .

[0105] Among them, the screen refresh cycle T ZIndicates the switching display time of the screen display. For example, if the screen refresh cycle is 16.6ms, that is, the screen refresh frequency is 60Hz, it means that 60 pictures are switched and displayed in one second; if the screen refresh cycle is 8.33ms, that is, the screen refresh cycle is 120Hz, it means that 120 pictures are switched and displayed in one second. The embodiment of the present application does not limit the duration of the screen refresh cycle.

[0106] It can also be considered that the screen refresh period is the refresh period of the VSYNC signal, that is, the time difference between two VSYNC signals.

[0107] The screen refresh cycle can be set in advance in the mobile phone, or can be set by the user in the mobile phone according to needs. The embodiment of the present application does not limit the setting time and setting method of the screen refresh cycle.

[0108] In some embodiments, the mobile phone may obtain the screen refresh period T after determining that the received input event is a target input event. Z In some other embodiments, the mobile phone may also obtain the screen refresh cycle T before step S402. Z In the embodiment of the present application, the mobile phone obtains the screen refresh cycle T Z The timing is not limited, as long as the screen refresh period T is obtained before calculating the arrival time of the next vertical synchronization signal 1 Z That's it.

[0109] S404: The mobile phone calculates the time difference according to the timestamp of the target input event and the time when the next vertical synchronization signal 1 arrives.

[0110] The timestamp t_input of the input event indicates the time when the mobile phone receives the input event. If the input event is a target input event, the timestamp of the target input event indicates the time when the mobile phone receives the target input event.

[0111] In some embodiments, in step S401, when the mobile phone receives an input event, the timestamp of the input event can be obtained. Afterwards, if it is determined that the input event is a target input event, the timestamp of the input event obtained by the mobile phone is the timestamp of the target input event. In other embodiments, the mobile phone can obtain the timestamp of the target input event after determining that the input event is a target input event. It should be noted that the embodiments of the present application do not limit the timing for the mobile phone to obtain the timestamp of the target input event, as long as the mobile phone obtains the timestamp of the target input event before step S404.

[0112] For example, Figure 6As shown, the input time of the target input event 1 (input1) is t1, and the timestamp of the target input event 1 is t1; the input time of the target input event 2 (input2) is t2, and the timestamp of the target input event 2 is t2.

[0113] In the embodiment of the present application, the time difference represents the difference between the time when the next vertical synchronization signal 1 arrives and the timestamp of the target input event.

[0114] Continue as Figure 6 As shown, if the target input event is target input event 1, the timestamp of the target input event is t1, and the corresponding time difference t_diff1=t_vsync-t1; if the target input event is target input event 2, the timestamp of the target input event is t2, and the corresponding time difference t_diff2=t_vsync-t2.

[0115] S405: The mobile phone determines whether the time difference is less than the minimum reporting period of the input event.

[0116] The minimum reporting period T_input of the input event indicates the minimum period for the mobile phone to periodically collect and detect the touch operation (i.e., the corresponding input event) after receiving the user's touch operation. Figure 6 As shown, the interval between t1 and t2 is a minimum reporting cycle of an input event. The embodiment of the present application does not limit the duration of the minimum reporting cycle of an input event. Generally, the minimum reporting cycle of an input event is less than the screen refresh cycle T Z .

[0117] Optionally, the minimum reporting period of the input event may be configured in advance in the mobile phone, or may be set by the user in the mobile phone according to needs. The present application does not limit the setting time and setting method of the minimum reporting period of the input event.

[0118] In some embodiments, the mobile phone can obtain the minimum reporting period of the input event when receiving the input event; in other embodiments, the mobile phone can also obtain the minimum reporting period of the input event after determining that the received input event is a target input event. The embodiment of the present application does not limit the timing of obtaining the minimum reporting period of the input event, as long as the minimum reporting period of the input event is obtained before step S405.

[0119] After calculating the time difference, the mobile phone can determine the size relationship between the time difference and the minimum reporting period of the input event, thereby determining whether the time difference is less than the minimum reporting period of the input event. In other words, the mobile phone determines whether the current input event meets the preset conditions.

[0120] S406: If the time difference is less than the minimum reporting period of the input event, the mobile phone determines that the preset condition is met, and the mobile phone immediately processes the collected target input event.

[0121] In the embodiment of the present application, the mobile phone processes the collected target input events in advance, which means that the mobile phone can process the collected target input events immediately, that is, before the next vertical synchronization signal 1 arrives, and does not need to process the collected target input events after the next vertical synchronization signal 1 arrives. Processing the collected target input events means drawing one or more layers corresponding to these target input events.

[0122] If the time difference is not less than the minimum reporting period of the input event, the mobile phone continues to receive the next input event.

[0123] In some embodiments of the embodiments of the present application, if the time difference is not less than the minimum reporting period of the input event, the mobile phone may receive the next target input event before the next vertical synchronization signal 1 arrives. Since the mobile phone may receive the target input event before the next vertical synchronization signal 1 arrives, the mobile phone cannot determine that the target input events that need to be processed after the next vertical synchronization signal 1 arrives have been collected. In this way, the mobile phone will not process the collected target input events in advance, but continue to receive the next input event, that is, execute step S401 until the received input event is the target input event and the target input event meets the preset conditions. In other words, until the time difference between the timestamp of the target input event and the time of the next vertical synchronization signal 1 is less than the minimum reporting period of the input event.

[0124] For example, Figure 6 As shown, the time difference t_diff1 corresponding to the target input event 1 is t_diff1=t_vsync-t1, t_diff1>T_input, which means that before the next vertical synchronization signal 1 arrives, the mobile phone may receive the next input event, and the next input event may be the target input event. Since the mobile phone may receive the target input event before the next vertical synchronization signal 1 arrives, the mobile phone cannot be sure that all the target input events that need to be processed after the next vertical synchronization signal 1 arrives have been collected. In this case, the mobile phone will not process the collected target input events, such as target input event 1, in advance, but will continue to receive the next input event until the next input event received is the target input event and meets the preset conditions, that is, the time difference between the timestamp of the target input event and the next vertical synchronization signal 1 is less than the minimum reporting period of the input event. Only then will the mobile phone process the collected target input event.

[0125] In some other embodiments of the present application, if the time difference is less than the minimum reporting period of the input event, the mobile phone may receive the next input event only after the next vertical synchronization signal 1 arrives. Since the time to receive the next input event is later than the time of the next vertical synchronization signal 1, the mobile phone can determine that all the target input events to be processed after the arrival of the next vertical synchronization signal 1 have been collected. That is to say, when the mobile phone meets the preset conditions, it can immediately process the collected target input events (draw one or more layers corresponding to the target input events), that is, process the collected target input events before the next vertical synchronization signal 1 arrives, instead of waiting until after the next vertical synchronization signal 1 arrives to process the collected target input events, thus realizing the early processing of the target input events, that is, performing Figure 1A the input processing 1 shown.

[0126] Exemplarily, as Figure 6 shown, the time difference t_diff2 corresponding to the target input event 2 is t_vsync - t2. Since t_diff2 < T_input, it is impossible for the mobile phone to receive another input event before the next vertical synchronization signal 1 arrives. Therefore, it can be considered that all the target input events to be processed when the next vertical synchronization signal 1 arrives have been collected, and the mobile phone can immediately process the collected target input events, for example, the target input event 1 and the target input event 2, instead of waiting until after the next vertical synchronization signal 1 arrives to process the collected target input events.

[0127] Through the event processing method provided by the embodiments of the present application, the mobile phone can, when determining that the received target input events meet the preset conditions, process the collected target input events in advance without waiting until after the next vertical synchronization signal 1 arrives to process the collected target input events. Thereby, it can reduce the latency of the mobile phone, reduce the response time of the sliding screen interaction, and ensure the smoothness of the sliding.

[0128] In addition, by processing the collected target input events in advance, that is, Figure 1A processing 1 shown in advance, it can improve the image drawing efficiency and reduce the possibility of timeout (exceeding one screen refresh period) in the image drawing and rendering process, thereby improving the frame rate and reducing the possibility of frame drops. Especially when the screen refresh frequency is relatively high, that is, when higher requirements are imposed on the drawing time of each frame, such as when the screen refresh frequency reaches 90Hz or even 120Hz, it can effectively avoid the occurrence of frame drops.

[0129] The above takes the mobile phone as an example to describe an event processing method provided by the embodiments of the present application from the perspective of the device. Next, based on Figure 3The structure shown describes the event processing method provided in the embodiment of the present application from the perspective of each module of the electronic device.

[0130] like Figure 7 As shown, the event processing method provided in the embodiment of the present application includes:

[0131] S701. The InputEventReceiver module receives an input event.

[0132] In step S401, the mobile phone receives the input event, which is specifically performed by the InputEventReceiver module.

[0133] The InputEventReceiver module can receive different input events. For example, input events may include: ACTION_MOVE event, ACTION_DOWN event, or ACTION_UP event, etc.

[0134] S702: The InputEventReceiver module determines whether the received input event is a target input event.

[0135] In step S402, the mobile phone determines whether the received input event is a target input event, which is specifically performed by the InputEventReceiver module.

[0136] If the InputEventReceiver module determines that the received input event is a target input event, such as an ACTION_MOVE event, the InputEventReceiver module can determine whether the target input event meets the preset conditions. If the preset conditions are met, the InputEventReceiver module can immediately process the collected target input events, that is, send the collected target input events to the application layer for drawing processing, without waiting for the next vertical synchronization signal 1 to arrive before processing the target input event. If the preset conditions are not met, the InputEventReceiver module can save the current target input event and continue to receive the next input event.

[0137] The preset condition includes that the time difference between the timestamp of the target input event and the time when the next vertical synchronization signal 1 arrives is less than the minimum reporting period of the input event. In other words, the InputEventReceiver module can determine whether the target input event meets the preset condition through the timestamp of the target input event, the time when the next vertical synchronization signal 1 arrives, and the minimum reporting period of the input event.

[0138] In some embodiments, the InputEventReceiver module determines whether the target input event meets the preset condition, which may include the following steps:

[0139] S703: If the InputEventReceiver module determines that the received input event is a target input event, the frame time synchronization module calculates the time when the next vertical synchronization signal 1 arrives.

[0140] If the InputEventReceiver module determines that the received input event is not the target input event, the InputEventReceiver module continues to receive the next input event.

[0141] Among them, the frame time synchronization module can be based on the screen refresh cycle T Z Calculate the time t_vsync when the next vertical synchronization signal 1 arrives. Specifically, the time when the next vertical synchronization signal 1 arrives is equal to the time when the current vertical synchronization signal 1 arrives plus the screen refresh period.

[0142] In the embodiment of the present application, the screen refresh cycle is obtained by the frame time synchronization module. The frame time synchronization module can obtain the screen refresh cycle after the InputEventReceiver module determines that the received input event is the target input event; the frame time synchronization module can also obtain the screen refresh cycle before the InputEventReceiver module executes step S702. The embodiment of the present application does not limit the timing of the frame time synchronization module obtaining the screen refresh cycle, as long as the screen refresh cycle is obtained before the frame time synchronization module calculates the arrival time of the next vertical synchronization signal 1.

[0143] S704 . The InputEventReceiver module calculates the time difference according to the timestamp of the target input event and the time when the next vertical synchronization signal 1 arrives.

[0144] The timestamp t_input of the input event indicates the time when the InputEventReceiver module receives the input event.

[0145] In some embodiments, when the InputEventReceiver module receives an input event, it can obtain the timestamp of the input event. Afterwards, if the InputEventReceiver module determines that the input event is a target input event, the timestamp of the input event obtained by the InputEventReceiver module is the timestamp of the target input event. In other embodiments, the InputEventReceiver module can obtain the timestamp of the target input event after determining that the input event is a target input event. It should be noted that the embodiments of the present application do not limit the timing for the InputEventReceiver module to obtain the timestamp of the target input event, as long as the InputEventReceiver module obtains the timestamp of the target input event before executing step S704.

[0146] Among them, the InputEventReceiver module can obtain the screen refresh cycle and the arrival time of the next vertical synchronization signal 1 from the frame time synchronization module through the Choreographer module.

[0147] In the embodiment of the present application, the time difference represents the difference between the time when the next vertical synchronization signal 1 arrives and the timestamp of the target input event.

[0148] S705. The InputEventReceiver module determines whether the time difference is less than the minimum reporting period of the input event.

[0149] In the embodiment of the present application, the minimum reporting period of the input event is configured by the switch configuration module. For example, the switch configuration module can statically configure the minimum reporting period of the input event according to the configuration file.

[0150] Optionally, the switch configuration module may configure the minimum reporting period T_input of the input event in advance, or may configure the minimum reporting period of the input event according to user requirements. The present application does not limit the timing for the switch configuration module to configure the minimum reporting period of the input event.

[0151] The InputEventReceiver module can obtain the minimum reporting period of input events from the switch configuration module.

[0152] In some embodiments, the InputEventReceiver module can obtain the minimum reporting period of the input event when receiving the input event; in other embodiments, the InputEventReceiver module can also obtain the minimum reporting period of the input event after determining that the received input event is a target input event. The embodiment of the present application does not limit the timing of the InputEventReceiver module obtaining the minimum reporting period of the input event, as long as the minimum reporting period of the input event is obtained before step S705.

[0153] After the InputEventReceiver module calculates the time difference, it can determine the relationship between the time difference and the minimum reporting period of the input event, thereby determining whether the time difference is less than the minimum reporting period of the input event. In other words, the InputEventReceiver module determines whether the current input event meets the preset conditions.

[0154] S706: If the time difference is less than the minimum reporting period of the input event, the InputEventReceiver module determines that the preset condition is met, and the InputEventReceiver module processes the collected target input event in advance.

[0155] In an embodiment of the present application, the InputEventReceiver module processes the collected target input events in advance, indicating that the InputEventReceiver module can process the collected target input events immediately, that is, before the next vertical synchronization signal 1 arrives, without having to process the collected target input events after the next vertical synchronization signal 1 arrives. Processing the collected target input events refers to drawing one or more layers corresponding to the collected target input events.

[0156] If the time difference is not less than the minimum reporting period of the input event, the InputEventReceiver module continues to receive the next input event.

[0157] In the embodiment of the present application, when the InputEventReceiver module immediately processes the collected target input events, the InputEventReceiver module sends the collected target input events to the application layer for subsequent drawing and other processing. For example, the application layer calls the GPU and CPU to perform drawing, rendering, image frame synthesis and image frame display processing.

[0158] Through the event processing method provided in the embodiment of the present application, the InputEventReceiver module can process the collected target input events in advance (draw one or more layers corresponding to the collected target input events) when the received target input events meet the preset conditions, without waiting for the next vertical synchronization signal 1 to arrive before processing the collected target input events. Thereby reducing the latency of the mobile phone, reducing the response time of the sliding screen interaction, and ensuring the sliding hand-tracking. In addition, by processing the collected target input events in advance, it is also possible to improve the efficiency of image drawing, reduce the possibility of timeout (more than one screen refresh cycle) of the image drawing and rendering process, thereby improving the frame rate and reducing the possibility of frame drops.

[0159] The present application also provides an event processing method. Figure 8 As shown, taking the execution subject as a mobile phone as an example, the event processing method includes:

[0160] S801. After the mobile phone receives a first target vertical synchronization signal, if the input event received by the mobile phone is a target input event and meets a preset condition, the mobile phone processes the target input event before a second target vertical synchronization signal arrives.

[0161] The second target vertical synchronization signal is a next target vertical synchronization signal of the first target vertical synchronization signal.

[0162] In some embodiments, the target vertical synchronization signal refers to the above-mentioned vertical synchronization signal 1. The target input event represents an input event in the prior art that needs to wait for the next vertical synchronization signal 1 to arrive before being processed. For example, the target input event may be an ACTION_MOVE event.

[0163] In some embodiments, the mobile phone processes the target input event, including: the mobile phone draws one or more layers corresponding to the target input event. That is, in the embodiments of the present application, the mobile phone processes the target input event specifically means that the mobile phone draws one or more layers corresponding to the target input event, and then performs subsequent image frame synthesis and image frame display processes.

[0164] In some embodiments, the mobile phone processing the target input event also includes the mobile phone processing other target input events received within a second time period. The second time period represents the time period between the moment when the mobile phone receives the first target vertical synchronization signal and the moment when the target input event is received. That is, in the embodiment of the present application, the mobile phone can also process other target input events received within the time period between the moment when the first target vertical synchronization signal is received and the moment when the target input event is received.

[0165] In some embodiments, the preset condition specifically includes: the first time period corresponding to the target input event is less than the minimum reporting period of the input event. Here, the first time period refers to the time period between the moment when the mobile phone receives the target input event and the moment when the second target vertical synchronization signal arrives. In other words, the preset condition includes that the time difference between the timestamp of the target input event and the moment when the next vertical synchronization signal 1 arrives is less than the minimum reporting period of the input event.

[0166] If the received input event is a target input event and meets the preset conditions, the mobile phone can process the target input event in advance. That is, before the next vertical synchronization signal 1 arrives, the mobile phone processes the target input event. For example, before the next vertical synchronization signal 1 arrives, the mobile phone draws one or more layers corresponding to the target input event.

[0167] Here, step S801 may correspond to the method flow of steps S401 to S406 described above.

[0168] If the received target input event does not meet the preset condition, the event processing method further includes step S802:

[0169] S802: If the input event received by the mobile phone is a target input event and does not meet a preset condition, the mobile phone receives the next input event.

[0170] This step corresponds to the situation in the above step S405 where "the time difference is not less than the minimum reporting period of the input event".

[0171] If the received input event is the target input event and does not meet the preset conditions, it means that the time difference between the timestamp of the target input event and the time when the next vertical synchronization signal 1 arrives is greater than or equal to the minimum reporting period of the input event. In this case, the mobile phone may also receive the target input event before the next vertical synchronization signal 1 arrives, so it cannot be assumed that all the target input events that need to be processed after the next vertical synchronization signal 1 arrives have been collected. In this way, the mobile phone continues to receive the next input event.

[0172] Through the event processing method provided in the embodiment of the present application, the mobile phone can process the collected target input events in advance when it is determined that the received target input events meet the preset conditions, without waiting for the next vertical synchronization signal 1 to arrive before processing the collected target input events. This can reduce the latency of the mobile phone, reduce the response time of the sliding screen interaction, and ensure the sliding hand tracking.

[0173] In addition, by processing the collected target input events in advance, Figure 1AThe processing 1 shown in the figure can improve the efficiency of image drawing and reduce the possibility of timeout (exceeding one screen refresh cycle) of the image drawing and rendering process, thereby improving the frame rate and reducing the possibility of frame drops. Especially when the screen refresh frequency is high, that is, when the drawing time of each frame is required to be higher, such as when the screen refresh frequency reaches 90Hz or even 120Hz, frame drops can be effectively avoided.

[0174] For example, in a test scenario, as shown in Table 1, when a user clicks the recent key on the mobile phone desktop to enter the recent task, the event processing method of the prior art takes an average of 9313us; while the event processing method provided by the embodiment of the present application takes an average of only 6429us, and the response time is reduced by 30.97%. It can be seen that the event processing method provided by the embodiment of the present application can effectively reduce the response time of the user clicking the recent key to enter the recent task.

[0175] As another example, in another test scenario, as shown in Table 1, when a user slides the screen to enter the next interface of an application during the use of an application, the event processing method of the prior art takes an average of 7361us for the mobile phone to display the next interface; while the event processing method provided in the embodiment of the present application takes an average of 5873us for the mobile phone to display the next interface, and the response time is reduced by 20.62%. It can be seen that the event processing method provided in the embodiment of the present application can effectively reduce the response time of the user sliding to enter the next display interface of the application. In summary, the event processing method provided in the embodiment of the present application can effectively reduce the response time of the sliding screen interaction and ensure the sliding chirality.

[0176] Table 1

[0177] Test scenario Existing Technology (AVG) This method (AVG) Optimize ratio Click the recent button to enter the recent task 9313us 6429us 30.97% Slide the interface of an application 7361us 5873us 20.62%

[0178] In addition, when the user uses an application and slides the screen to enter the next interface of the application, the event processing method of the prior art is used, and 22 frames are lost in 144 frames of images, and the frame loss rate is 0.152778; while the event processing method provided in the embodiment of the present application is used, 4 frames are lost in 157 frames of images, and the frame loss rate is 0.025478, and the frame loss ratio is reduced by 12.73%. It can be seen that the event processing method provided in the embodiment of the present application can effectively improve the frame rate and reduce the possibility of frame drops. In addition, in another test scenario, when an application exits the background, the event processing method provided in the embodiment of the present application is used, and the average drawing time of the application can be optimized from 9.3ms to 6.5ms, and the average drawing time is optimized by 30%. It can be seen that the event processing method provided in the embodiment of the present application can reduce the application drawing time, which further illustrates that the event processing method provided in the embodiment of the present application can improve the frame rate and reduce the possibility of frame drops.

[0179] It is understandable that in order to implement the above functions, the electronic device includes hardware and / or software modules corresponding to the execution of each function. In combination with the algorithm steps of each example described in the embodiments disclosed herein, the present application can be implemented in the form of hardware or a combination of hardware and computer software. Whether a function is executed in the form of hardware or computer software driving hardware depends on the specific application and design constraints of the technical solution. Those skilled in the art can use different methods to implement the described functions for each specific application in combination with the embodiments, but such implementation should not be considered to be beyond the scope of the present application.

[0180] In this embodiment, the electronic device can be divided into functional modules according to the above method example. For example, each functional module can be divided according to each function, or two or more functions can be integrated into one processing module. The above integrated module can be implemented in the form of hardware. It should be noted that the division of modules in this embodiment is schematic and is only a logical function division. There may be other division methods in actual implementation.

[0181] For example, Fig. 9 This is a schematic diagram of the structure of an electronic device provided in an embodiment of the present application. Fig. 9 As shown, an embodiment of the present application provides an electronic device 900, including a receiving unit 901, a judging unit 902, an acquiring unit 903, a calculating unit 904 and a determining unit 905.

[0182] Among them, the receiving unit 901 is used to execute step S401 and step S701; the judging unit 902 is used to execute step S402, step S405, step S702 and step S705; the acquiring unit 903 is used to acquire the screen refresh cycle, the input event reporting cycle and the event stamp of the input event; the calculating unit 904 is used to execute step S403, step S404, step S703 and step S704; the determining unit 905 is used to execute step S406 and step S706.

[0183] An embodiment of the present application also provides a computer-readable storage medium, in which a computer program is stored. When the computer program is executed on an electronic device, the electronic device executes the above-mentioned related method steps to implement the electronic device event processing method in the above-mentioned embodiment.

[0184] An embodiment of the present application also provides a computer program product. When the computer program product is run on an electronic device, the electronic device executes the above-mentioned related steps to implement the electronic device event processing method executed by the electronic device in the above-mentioned embodiment.

[0185] In addition, an embodiment of the present application also provides a device, which can specifically be a chip, component or module, and the device may include a connected processor and a memory; wherein the memory is used to store computer execution instructions, and when the device is running, the processor can execute the computer execution instructions stored in the memory so that the chip executes the electronic device event processing method executed by the electronic device in the above-mentioned method embodiments.

[0186] Among them, the electronic device, computer-readable storage medium, computer program product or chip provided in the embodiments of the present application are used to execute the corresponding methods provided above. Therefore, the beneficial effects that can be achieved can refer to the beneficial effects in the corresponding methods provided above. No further details will be given here.

[0187] Through the description of the above implementation mode, those skilled in the art can understand that for the convenience and simplicity of description, only the division of the above functional modules is used as an example. In practical applications, the above 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.

[0188] In the several embodiments provided in the present 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 only schematic. For example, the division of the modules or units is only a logical function division. There may be other division methods in actual implementation, such as multiple units or components can be combined or integrated into another device, or some features can be ignored or not executed. In addition, 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.

[0189] The units described as separate components may or may not be physically separated, 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 different places. Some or all of the units may be selected according to actual needs to achieve the purpose of the present embodiment.

[0190] In addition, each functional unit in each embodiment of the present application may be integrated into one processing unit, or each unit may exist physically separately, or two or more units may be integrated into one unit. The above-mentioned integrated unit may be implemented in the form of hardware or in the form of software functional units.

[0191] 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, which is stored in a storage medium, including several instructions to enable a device (which can be a single-chip microcomputer, chip, etc.) or a processor (processor) to perform all or part of the steps of the method described in each embodiment of the present application. The aforementioned storage medium includes: U disk, mobile hard disk, read only memory (ROM), random access memory (RAM), disk or optical disk and other media that can store program code.

[0192] The above contents are only specific implementation methods of the present application, but the protection scope of the present application is not limited thereto. Any technician familiar with the technical field can easily think of changes or substitutions within the technical scope disclosed in the present application, which should be included in the protection scope of the present application. Therefore, the protection scope of the present application should be based on the protection scope of the claims.

Claims

1. An event processing method, applied to an electronic device, characterized in that: The method comprises: After receiving the first target vertical synchronization signal, if the received input event is a target input event, before the second target vertical synchronization signal arrives, processing the target input event; The second target vertical synchronization signal is a next target vertical synchronization signal of the first target vertical synchronization signal.

2. The method according to claim 1, characterized in that The method further comprises: Determining that the first time period corresponding to the target input event is less than a minimum reporting period of the input event; The first time period represents the time period between the moment when the target input event is received and the moment when the second target vertical synchronization signal arrives.

3. The method according to claim 1 or 2, characterized in that: The processing of the target input event comprises: Draw one or more layers corresponding to the target input event.

4. The method according to any one of claims 1 to 3, characterized in that The processing target input event also includes: Processing other target input events received within the second time period; The second time period represents a time period between a moment when the first target vertical synchronization signal is received and a moment when the target input event is received.

5. The method according to any one of claims 1 to 4, characterized in that The method further comprises: If the received input event is a target input event and the first time period is greater than or equal to the minimum reporting period, then the next input event is received.

6. The method according to any one of claims 1 to 5, characterized in that The target input event is a sliding action event.

7. An electronic device, characterized in that: The electronic device comprises a touch screen, a memory and one or more processors; the touch screen, the memory and the processor are coupled; the memory is used to store computer program code, the computer program code comprises computer instructions, and when the processor executes the computer instructions, the electronic device executes: After receiving the first target vertical synchronization signal, if the received input event is a target input event, before the second target vertical synchronization signal arrives, processing the target input event; The second target vertical synchronization signal is a next target vertical synchronization signal of the first target vertical synchronization signal.

8. The electronic device according to claim 7, characterized in that: The electronic device further performs: Determining that the first time period corresponding to the target input event is less than a minimum reporting period of the input event; The first time period represents the time period between the moment when the target input event is received and the moment when the second target vertical synchronization signal arrives.

9. The electronic device according to claim 7 or 8, characterized in that: The processing of the target input event comprises: Draw one or more layers corresponding to the target input event.

10. The electronic device according to any one of claims 7 to 9, characterized in that: The processing target input event also includes: Processing other target input events received within the second time period; The second time period represents a time period between a moment when the first target vertical synchronization signal is received and a moment when the target input event is received.

11. The electronic device according to any one of claims 7 to 10, characterized in that: The electronic device further performs: If the received input event is a target input event and the first time period is greater than or equal to the minimum reporting period, then the next input event is received.

12. The electronic device according to any one of claims 7 to 11, characterized in that: The target input event is a sliding action event.

13. A chip system, characterized in that: The chip system includes one or more interface circuits and one or more processors; the interface circuit and the processor are interconnected via lines; the interface circuit is used to receive a signal from the memory of the electronic device and send the signal to the processor, the signal including computer instructions stored in the memory; when the processor executes the computer instructions, the electronic device executes the method as described in any one of claims 1-6.

14. A computer storage medium comprising computer instructions, characterized in that: When the computer instructions are executed on an electronic device, the electronic device is caused to execute the method as claimed in any one of claims 1 to 6.

15. A computer program product, characterized in that When the computer program product is run on a computer, the computer is caused to execute the method according to any one of claims 1 to 6.