Input event processing method, electronic equipment and readable storage medium

By combining the processing methods of heterologous input events in the system service module of the electronic device, the problem of low input event processing performance is solved, the processing performance and communication performance of input events are improved, and the processing complexity of the application is reduced.

CN120295808APending Publication Date: 2025-07-11HUAWEI TECH CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202410046668.3
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-01-10
Publication Date
2025-07-11

AI Technical Summary

Technical Problem

In the prior art, the input event processing performance of the input device of the electronic device is low, resulting in high communication channel occupation, large application processing volume, and high complexity.

Method used

Configure logic in the system service module of electronic devices, merge the processing methods of heterologous input events, reduce the number of reports of input events, and improve processing performance and communication performance.

Benefits of technology

Without affecting the timely response of the application, the number of times the input event is reported is reduced, the processing performance of the input event and the communication performance of the communication channel is improved, and the processing complexity of the application is reduced.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120295808A_ABST
    Figure CN120295808A_ABST
Patent Text Reader

Abstract

The invention provides an input event processing method, an electronic device and a readable storage medium, in the method, when an input event processing system receives input events from different input devices, whether the input events from the different input devices are combined and reported or not can be judged by combining with scenes of the electronic device, so that the input event processing efficiency is improved. When it is determined to merge and report input events from different input devices, the input event processing system may merge and report input events from different input devices to the application. The input events from different input devices can be combined and reported, the number of times of independently reporting the input events is reduced, and the processing performance of the input events is improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] Embodiments of the present application relate to the technical field of terminals, and in particular, to a method for processing input events, an electronic device, and a readable storage medium. Background Art

[0002] With the development of electronic devices, the functions of electronic devices are increasing day by day, and the input devices of electronic devices are also increasing accordingly. Exemplarily, taking the electronic device as a personal computer (PC) as an example, the input devices of the PC may include: the touch screen of the PC, a touchpad, a stylus, a keyboard, and a mouse, etc. Users can use any input device to input to the electronic device, and the electronic device can perform corresponding operations.

[0003] Currently, all input events of the input device are reported separately to the application of the electronic device, and the performance of event processing is low. Summary of the Invention

[0004] Embodiments of the present application provide a method for processing input events, an electronic device, and a readable storage medium, which can merge and report input events from different input devices to the application according to the application scenario, thereby improving the performance of input event processing.

[0005] In a first aspect, embodiments of the present application provide a method for processing input events. The execution entity of the method may be an electronic device or a chip in the electronic device. Among them, the electronic device includes: an input event processing system and an application. The input event processing system is a system service module of the electronic device. In other words, the input event processing system is a system on the system side of the electronic device. Hereinafter, the interaction between the input event processing system and the application will be used to introduce a method for processing input events provided by embodiments of the present application.

[0006] In this method, the input event processing system obtains a first input event. In some embodiments, the input event processing system may read the first input event from the bottom layer (such as the kernel layer) of the electronic device, or the kernel layer may periodically report the first input event to the input event processing system. In short, the input event processing system can obtain the first input event.

[0007] The first input event is an input event from a first input device of the electronic device. In other words, the first input event is an input event of the first input device. Exemplarily, the input devices of the electronic device may include but are not limited to: a touch screen, a stylus, a touchpad, a keyboard, a mouse, etc.

[0008] After obtaining the first input event, the input event processing system may report the first input event to the application. After receiving the first input event, the application may perform corresponding operations. Exemplarily, for example, if the first input event is triggered by a user using a stylus to select a control on an electronic device, the application may perform the operations triggered when the control is selected, such as page jumping, audio playing, etc.

[0009] The input event processing method provided by the embodiments of this application can support multiple input devices to input to the electronic device simultaneously. Correspondingly, the input event processing system obtains a second input event, and the second input event is an input event from a second input device of the electronic device. It can be understood that since the first input event comes from the first input device and the second input event comes from the second input device, and the first input event and the second input event come from different input devices, the first input event and the second input event can be referred to as heterogeneous input events. The heterogeneous input events refer to input events from different input devices.

[0010] When the input event processing system receives heterogeneous input events, it may determine whether to merge and report the heterogeneous input events. In some embodiments, rules for merging heterogeneous events may be preset in an electronic device (such as the input event processing system), and the input event processing system may determine whether to merge heterogeneous input events according to the rules.

[0011] Among them, when the input event processing system determines to merge heterogeneous input events, it may wait for the next input event from the first input device and merge the next input event and the second input event. Exemplarily, when the input event processing system obtains a third input event, the third input event is an input event from the first input device. The input event processing system may merge and report the second input event and the third input event to the application.

[0012] In the embodiments of this application, corresponding logic may be configured in the system service module of the electronic device, such as the input event processing system. The input event processing system may merge and report heterogeneous input events. On the one hand, it can reduce the number of reported input events and improve the processing performance of input events and the communication performance of the communication channel without affecting the timely response of the application. On the other hand, since the corresponding logic is configured in the system server module of the electronic device, there is no need to adapt in the application, and the complexity of modification and the implementation difficulty are small.

[0013] In a possible implementation, before the input event processing system acquires the second input event, the input event processing system can also acquire input events from a first input device. That is, the input events continuously acquired by the input event processing system are of the same source. The input event processing system can report the input events of the first input device separately. Herein, input events of the same source can be understood as input events from the same input device.

[0014] Exemplarily, before the input event processing system acquires the second input event, it also receives a fourth input event, and the fourth input event is an input event from the first input device. The input event processing system reports the fourth input event to the application.

[0015] In the embodiments of the present application, the input event processing system can report input events of the same source separately, enabling the application to respond to the input of the first input device in a timely manner.

[0016] In a possible implementation, within a preset duration after the input event processing system acquires the second input event, when the input event processing system acquires the third input event, the input event processing system can report the second input event and the third input event to the application in a combined manner. However, within the preset duration after the input event processing system acquires the second input event, if the input event processing system does not acquire the third input event, the input event processing system reports the second input event to the application separately.

[0017] In this implementation, a preset duration can be set, which can avoid the problem that the timely response of the application is affected because the input event processing system does not receive the next input event from the first input device in a timely manner. Within the preset duration after the input event processing system acquires the second input event, if the input event processing system does not acquire the third input event, the input event processing system can report the second input event separately, so that the application can respond to the second input event in a timely manner without affecting the normal use of the application.

[0018] In a possible implementation, when the input event processing system reports the second input event and the third input event to the application in a combined manner, the input event processing system can merge the third input event into the second input event, that is, merge the later-received third input event into the earlier-received second input event, and report the merged input event.

[0019] In a possible implementation, when the input event processing system reports the second input event and the third input event to the application in a combined manner, the input event processing system may determine the combination method according to the priority of the input events. In some embodiments, the priority of the input event is related to the priority of the input device, and / or the priority of the input event is related to the type of the input event (such as the down event, the move event, and the up event).

[0020] Exemplarily, the priority of the second input event is higher than that of the third input event, and the input event processing system combines the third input event into the second input event to obtain a combined input event. In this way, the input event processing system reports the combined input event to the application.

[0021] The following introduces the process for the input event processing system to determine whether to combine heterogeneous input events:

[0022] In some embodiments, in the electronic device or the input event processing system, rules for combining and reporting heterogeneous input events in different scenarios may be pre-configured. The rules include: rules for combining and reporting heterogeneous input events in the scenario where the first input device and the second input device input to the electronic device simultaneously.

[0023] In a possible implementation, the different scenarios refer to different application programs running on the electronic device.

[0024] In a possible implementation, the different scenarios refer to: different input devices of the electronic device, and the number of input devices of the electronic device is at least two. Exemplarily, the input devices in Scenario 1 include a stylus and a touch screen, the input devices in Scenario 2 include a touchpad and a touch screen, and the input devices in Scenario 3 include a touch screen, a stylus, a keyboard, and a touchpad, etc.

[0025] The following exemplarily introduces several different scenarios:

[0026] Scenario 1: The first input device is a touch screen, and the second input device is a stylus.

[0027] In Scenario 1, the rule for merging and reporting heterogeneous input events can be as follows: When the first input event is a press event, the fourth input event is a press event, and the second input event is a press event, the input event processing system merges and reports the second input event and the third input event. Among them, both the first input event and the fourth input event are press (down) events, indicating that the user performs a long - press operation. During the user's long - press operation, the input event processing system will continuously obtain press events from the first input device. Because during the user's long - press operation, the user's touch position remains unchanged, merging the second input event and the next press event from the first input device will not affect the application's processing of the second input event and the next press event from the first input device, and can also reduce the reporting frequency of the press events from the first input device, improving the processing performance of input events.

[0028] Exemplarily, when the user's finger long - presses on the touch screen, the input event processing system can obtain press events from the touch screen. For example, the input event processing system can obtain the first input event and the fourth input event from the touch screen, and both the first input event and the fourth input event are press events. The user can use a stylus to operate on the touch screen. When the stylus touches the touch screen, the input event processing system can obtain a press event from the touch screen, and this press event is the second input event. In this way, the input event processing system receives heterogeneous input events. The input event processing system can determine to merge and report the second input event and the next input event from the touch screen (such as a press event or a slide event, etc.) according to the rule for merging and reporting heterogeneous input events in this scenario. When the input event processing system obtains the third input event from the touch screen, the input event processing system can merge and report the second input event and the third input event.

[0029] Scenario 2: The first input device is a touch screen, and the second input device is a stylus.

[0030] In Scenario 2, the rule for merging and reporting heterogeneous input events can be: when the fourth input event is a swipe event, the second input event is a press event, and the third input event is a swipe event, the input event processing system merges and reports the second input event and the third input event. Among them, the fourth input event being a swipe event indicates that the user is performing a swipe operation on the touch screen. During the user's swipe operation, the input event processing system will also continuously obtain swipe events from the first input device. To reduce the reporting frequency of the swipe events of the first input device, the input event processing system therefore merges the second input event and the next swipe event of the first input device. Among them, when the input event processing system receives the second input event, it can wait for the next input event from the first input device. In the embodiments of the present application, since the third input event is a swipe event, the input event processing system determines to merge and report the second input event and the third input event.

[0031] Exemplarily, when the user's finger performs a swipe operation on the touch screen, the input event processing system can obtain a swipe event from the touch screen. For example, the input event processing system can obtain a fourth input event from the touch screen, and the fourth input event is a swipe event. In some embodiments, the first input event is a press event from the touch screen, and the fourth input event is a swipe event from the touch screen, indicating that the user's finger touches the touch screen and starts to swipe. In some embodiments, the first input event is a swipe event from the touch screen, and the fourth input event is a swipe event from the touch screen, indicating that the user's finger is swiping on the touch screen.

[0032] The user can use a stylus to operate on the touch screen. When the stylus touches the touch screen, the input event processing system can obtain a press event from the touch screen, and this press event is the second input event. In this way, the input event processing system receives a heterogeneous input event, and the input event processing system can determine to merge and report the second input event and the next swipe event from the touch screen according to the rule for merging and reporting heterogeneous input events in this scenario. When the input event processing system obtains a third input event (swipe event) from the touch screen, the input event processing system can merge and report the second input event and the third input event.

[0033] Scenario 3: The first input device is a touchpad, and the second input device is a touch screen.

[0034] In Scenario 3, the rule for combining and reporting heterogeneous input events can be: when the fourth input event is a swipe event, the second input event is a press event, and the third input event is a swipe event, the input event processing system combines and reports the second input event and the third input event. Similar to the principle of Scenario 2 above, the input devices in Scenario 3 and Scenario 2 are different.

[0035] Among them, the fourth input event being a swipe event indicates that the user is performing a swipe operation on the touch screen. During the user's swipe operation, the input event processing system will also continuously obtain swipe events from the first input device. To reduce the reporting frequency of the swipe events of the first input device, the input event processing system therefore combines the second input event and the next swipe event of the first input device. Among them, when the input event processing system receives the second input event, it can wait for the next input event from the first input device. In the embodiments of the present application, the third input event is a swipe event, so the input event processing system determines to combine and report the second input event and the third input event.

[0036] Exemplarily, when the user's finger performs a swipe operation on the touchpad, the input event processing system can obtain the swipe event from the touchpad. For example, the input event processing system can obtain the fourth input event from the touchpad, and all the fourth input events are swipe events. In some embodiments, the first input event is a press event from the touchpad, and the fourth input event is a swipe event from the touchpad, indicating that the user's finger touches the touchpad and starts to swipe. In some embodiments, the first input event is a swipe event from the touchpad, and the fourth input event is a swipe event from the touchpad, indicating that the user's finger is swiping on the touchpad.

[0037] The user can use a stylus to operate on the touch screen. When the stylus touches the touch screen, the input event processing system can obtain the press event from the touch screen, and this press event is the second input event. In this way, the input event processing system receives heterogeneous input events, and the input event processing system can determine to combine and report the second input event and the next swipe event from the touchpad according to the rule of combining and reporting heterogeneous input events in this scenario. When the input event processing system obtains the third input event (swipe event) from the touchpad, the input event processing system can combine and report the second input event and the third input event.

[0038] It should be understood that the above three scenarios are for illustrative purposes. The method for processing input events provided in the embodiments of the present application can also be applicable to other scenarios that include simultaneous input from at least two input devices. The rules for combining and reporting heterogeneous input events in different scenarios can be set according to actual use.

[0039] In a second aspect, an embodiment of the present application provides an electronic device, which may include: a processor and a memory. The memory is used to store computer-executable program code, and the program code includes instructions; when the processor executes the instructions, the instructions cause the electronic device to execute the method in the first aspect.

[0040] In a third aspect, an embodiment of the present application provides an electronic device, which may include units, modules or circuits for executing the method provided in the above first aspect.

[0041] In a fourth aspect, an embodiment of the present application provides a computer program product containing instructions, which when run on a computer, causes the computer to execute the method in the above first aspect.

[0042] In a fifth aspect, an embodiment of the present application provides a computer-readable storage medium, in which instructions are stored, and when run on a computer, cause the computer to execute the method in the above first aspect.

[0043] For the possible implementation manners of the above second aspect to fifth aspect, the beneficial effects can refer to the beneficial effects brought by the above first aspect, and will not be elaborated here. Description of the Drawings

[0044] Figure 1 A schematic diagram of an input device of an electronic device;

[0045] Figure 2 A schematic diagram of a scenario applicable to the input event processing method provided by an embodiment of the present application;

[0046] Figure 3 Another schematic diagram of a scenario applicable to the input event processing method provided by an embodiment of the present application;

[0047] Figure 4 A schematic diagram of the structure of an electronic device provided by an embodiment of the present application;

[0048] Figure 5 A flowchart of a method for processing input events that currently exists;

[0049] Figure 6 Provided by an embodiment of the present application Figure 2 A flowchart of the method for processing input events in the scenario shown;

[0050] Figure 7 Provided by an embodiment of the present application Figure 3 A flowchart of the method for processing input events in the scenario shown;

[0051] Figure 8A schematic flowchart of a method for processing input events provided by an embodiment of the present application;

[0052] Figure 9 Another schematic structural diagram of an electronic device provided by an embodiment of the present application. Detailed implementation manners

[0053] The electronic device in the embodiment of the present application is a device with multiple input devices. The electronic device can be referred to as a user equipment (UE), a terminal, etc. For example, the electronic device can be a mobile phone, a personal computer (PC), a tablet (portable android device, PAD), a personal digital assistant (PDA), a handheld device with wireless communication function, a computing device, a vehicle-mounted device or a wearable device, a virtual reality (VR) terminal device, an augmented reality (AR) terminal device, a wireless terminal in industrial control, a wireless terminal in a smart home, etc. In the embodiment of the present application, the form of the electronic device is not specifically limited.

[0054] The input device of the electronic device can be understood as a device capable of inputting data, instructions, etc. to the electronic device.

[0055] In some embodiments, the input device of the electronic device can be integrated with the electronic device. For example, the input device can be the touch screen of the electronic device.

[0056] In some embodiments, the input device of the electronic device can also be separately provided from the electronic device. In this example, the input device can be connected to the electronic device. For example, the input device can be a keyboard, a mouse, an earphone, etc. Exemplarily, the input device and the electronic device can be interconnected through a communication network to achieve the interaction of data, instructions, etc. The communication network can be but is not limited to: a WI-FI hotspot network, a WI-FI peer-to-peer (P2P) network, a Bluetooth network, a zigbee network or a near field communication (NFC) network, etc.

[0057] Exemplarily, when the electronic device is a mobile phone, the input devices of the electronic device may include: a touch screen, buttons, earphones, etc. Exemplarily, when the electronic device is a television, the input devices of the electronic device may include: a touch screen, a remote control, etc. Exemplarily, when the electronic device is a PC, a PAD, etc., the input devices of the electronic device may include: a touch screen, a touchpad, a stylus, a keyboard, and a mouse, etc., as Figure 1 shown. It should be understood that Figure 1 the input devices of the electronic device are described by taking the electronic device as a PC as an example in

[0058] The embodiments of the present application do not exhaustively list the input devices of all types of electronic devices. In the following embodiments, the electronic device is taken as a PC as an example for description.

[0059] First, the following combines Figure 2 and Figure 3 shown scenarios to introduce the current method for processing input events:

[0060] Figure 2 FIG. is a schematic diagram of a scenario applicable to the method for processing input events provided by the embodiments of the present application. In other words, Figure 2 it shows a scenario where the electronic device simultaneously receives inputs from multiple input devices and responds. Referring to Figure 2 a in, the input devices of the electronic device may include a touch screen and a stylus. The user can operate the touch screen with a finger, and the user can operate the touch screen with a stylus. The touch screen and the stylus can be used as heterogeneous input devices of the electronic device. Among them, the definition of heterogeneous input devices can be referred to the description in the following embodiments.

[0061] Referring to Figure 2 a in, on the interface of the electronic device, it may display: control 21, and table area 22. Exemplarily, the table area 22 may include a table with multiple rows and multiple columns. In the actual use process, the user's left thumb can hold down control 21, and the user's right hand can hold the stylus to operate the table area 22 to edit the table.

[0062] Exemplarily, referring to Figure 2 b and c in, the user's left hand holds down control 21, and the user uses the stylus to click on a cell, and the cell can be selected. Exemplarily, referring to Figure 2 b, d, and e in, the user's left hand holds down control 21, the user uses the stylus to click on a cell, and slides down, and a column of cells can be selected.

[0063] In this scenario, the electronic device has two input devices, and the user can operate the two input devices to input to the electronic device simultaneously. The electronic device can respond to the inputs of the two input devices and perform the operation of selecting a cell.

[0064] Figure 3 Another schematic diagram of a scenario applicable to the method for processing input events provided by the embodiments of the present application. Refer to Figure 3 a in, the input devices of the electronic device may include a touchpad and a touch screen. The user can operate the touchpad and the touch screen with fingers, and the touchpad and the touch screen can be used as heterogeneous input devices of the electronic device. Refer to Figure 3 a in, the electronic device displays a desktop interface 31, and the desktop interface 31 may include icons of multiple applications. The user can operate the touchpad and the touch screen with the left and right hands respectively to switch the application icon 1 from the desktop interface 31 to another desktop interface 32 of the electronic device.

[0065] Exemplarily, refer to Figure 3 a and b in, the user can operate the touchpad with the left hand to select and drag the application icon 1. At the same time, the user can operate the touch screen with the right hand to slide the desktop to the left to switch the desktop interface 31 to another desktop interface 32. In this way, as the user switches the desktop interface and drags the application icon 1, the application icon 1 can be switched to another desktop interface 31. It should be understood that Figure 3 the process of switching the desktop interface is not shown in

[0066] In this scenario, the electronic device has two input devices, and the user can operate the two input devices to input to the electronic device simultaneously. The electronic device can respond to the input of the two input devices and perform an operation of adjusting the position of the application icon on the desktop interface.

[0067] Figure 2 and Figure 3 Exemplarily introduced an example in which the electronic device can perform corresponding operations based on the input of multiple input devices. As the functions of the electronic device become increasingly rich, the scenario of simultaneous input of multiple input devices will be more and more. The following combines Figure 2 the scenario shown to introduce the current method for processing input events.

[0068] For ease of understanding, before introducing the current method for processing input events, the structure of the electronic device provided by the embodiments of the present application is first introduced.

[0069] Figure 4 A schematic diagram of a structure of the electronic device provided by the embodiments of the present application. Refer to Figure 4 , the software system of the electronic device may adopt a layered architecture, an event-driven architecture, a microkernel architecture, a microservices architecture, or a cloud architecture. The layered architecture can divide the software system of the electronic device into several layers, each layer has a clear role and division of labor, and the layers communicate through software interfaces.

[0070] In some embodiments, the software system of an electronic device may include: an applications layer and an application framework layer. The embodiments of the present application do not limit the layering of the software structure of the electronic device. The modules included in each layer in the following embodiments are the modules involved in the embodiments of the present application. The modules included in each of the following layers do not constitute a limitation on the structure of the electronic device, and the hierarchical levels (illustrative examples) of module deployment do not constitute a limitation on the structure of the electronic device either.

[0071] In the embodiments of the present application, an application program may be abbreviated as an application for short. Correspondingly, the applications layer may be abbreviated as the application layer for short.

[0072] Among them, the applications layer may include application program packages. Exemplarily, the applications layer may include: application program packages such as camera, gallery, calendar, call, map, navigation, Bluetooth, music, video, short message, etc. It should be understood that Figure 4 the above takes the applications layer including application programs as an example.

[0073] The application framework layer may provide application programming interfaces (APIs) and programming frameworks for the application programs in the applications layer. Referring to Figure 4 , the application framework layer may include: an input event processing system and event nodes. It should be understood that the input event processing system belongs to the system side of the electronic device, that is, the input event processing system is a system in the system side of the electronic device. In some embodiments, the system side may be understood as the application framework layer in the electronic device.

[0074] The event nodes correspond to the input devices of the electronic device. In some embodiments, the application framework layer may include at least one event node, and each event node may correspond to an input device. It should be understood that Figure 4 the above takes the electronic device including N event nodes as an example for illustration, where N is an integer greater than or equal to 2.

[0075] Taking a PC as an example, the event nodes of the PC may include: event nodes of the touch screen and event nodes of the touchpad. When the PC is connected to a keyboard, the PC may create an event node of the keyboard in the application framework layer. When the PC is connected to a mouse, the PC may create an event node of the mouse in the application framework layer. When the PC is connected to a stylus 1, the PC may create an event node of the stylus 1 in the application framework layer. When the PC is connected to a stylus 2, the PC may create an event node of the stylus 2 in the application framework layer.

[0076] A heterogeneous input device can be understood as: input devices corresponding to different event nodes. Examples of heterogeneous input devices include a stylus and a touch screen, a touchpad and a touch screen, a mouse and a keyboard, etc.

[0077] An event node is used to store event data (or input events) of an input device. Taking the input device as a touch screen as an example, exemplary event data of the touch screen may include: the touch position of a user's finger (or joint, palm, etc.), the touch duration, the touch pressure, etc. Exemplary event data of a stylus may include: the touch position of the stylus on the touch screen, the touch duration, the touch pressure, etc.

[0078] In some embodiments, a heterogeneous input event can be understood as: an input event determined by event data of different event nodes. Exemplarily, based on the event data of the event node of the stylus, a first input event can be determined, and based on the event data of the event node of the touch screen, a second input event can be determined. The first input event and the second input event can be regarded as heterogeneous input events.

[0079] In other words, a heterogeneous input event can be understood as: input events of different event nodes. Exemplarily, the input event of the event node of the stylus and the input event of the event node of the touch screen can be regarded as heterogeneous input events.

[0080] Similarly, a homogeneous input event can be understood as: an event determined by event data of the same event node, or an input event of the same event node. Exemplarily, when a user continuously clicks on a touch screen, the event node of the touch screen can store the event data of the user's multiple clicks on the touch screen. The input event determined by the event data of the user's multiple clicks on the touch screen can be regarded as a homogeneous input event. In other words, the input event of the event node of the touch screen can be regarded as a homogeneous input event.

[0081] In some embodiments, an input event processing system may include: an input event reading module (InputReader) and an input event dispatching module (InputDispatcher).

[0082] The input event reading module can periodically obtain input events from the event node and send the read input events to the input event dispatching module.

[0083] The input event dispatching module can process the received input events, such as adding an identifier of an application to the input event so as to dispatch the input event to the application. In some implementation manners, the application can be understood as the application corresponding to the focus window. Wherein, the identifier of the application is used to distinguish different applications, and the identifier of the application may be, for example, the name or number of the application.

[0084] In some embodiments, the steps performed by the input event reading module and the input event distributing module can be regarded as the steps performed by the input event processing system.

[0085] Referring to Figure 4 , in some embodiments, when an application in the application layer is launched, an application process can be created, and the application process can include a view (view / activity) processing system. The view processing system is used to receive input events from the input event distributing module and perform corresponding operations based on the input events. It should be understood that Figure 4 illustrates an example of an application.

[0086] The view processing system belongs to the application side of the electronic device, that is, the input event processing system is a system in the application side of the electronic device. In some embodiments, the application side can be understood as the application of the electronic device.

[0087] In some embodiments, the view processing system may include: ViewRootImpl and a view processing module. Among them, ViewRootImpl is used to implement communication between the input event processing system and the view processing system. Exemplarily, the input event distributing module can send input events to ViewRootImpl through a socket channel. It should be understood that Figure 4 ViewRootImpl and the view processing module are not shown in

[0088] ViewRootImpl can transmit the input events from the input event distributing module to the view processing module.

[0089] The view processing module is used to process input events and perform corresponding operations based on the input events.

[0090] In some embodiments, the operations performed by ViewRootImpl and the view processing module can be regarded as the operations performed by the application.

[0091] The above introduced the software system of the electronic device. In some embodiments, the electronic device may further include a hardware layer. Exemplarily, the hardware layer includes hardware devices such as a touch screen, a display screen, a Bluetooth chip, a sensor, etc. It should be understood that Figure 4 the touch screen and the touchpad involved in the embodiments of the present application are shown in

[0092] In some embodiments, the software system of the electronic device may further include a kernel layer. The kernel layer at least includes drivers for hardware. The drivers are used to drive the hardware to work. For example, the kernel layer may include a touch screen driver and a touchpad driver, etc., and the embodiments of the present application do not make any limitations thereto. It should be understood that among them, the touch screen driver can drive the touch screen to work, and the touchpad driver can drive the touchpad to work. It should be understood that Figure 4 the kernel layer is not shown. Exemplarily, the kernel layer may be located between the hardware layer and the application framework layer.

[0093] In some embodiments, the touch screen may include a touch sensor, and the touch sensor can sense the operations of the user's finger on the touch screen and the operations of the stylus on the touch screen. The touchpad may include a touch sensor, and the touch sensor can sense the operations of the user's finger on the touch screen. In some embodiments, the touchpad may further include buttons, and the buttons can implement the functions of the left mouse button and the right mouse button.

[0094] It can be understood that Figure 4 the shown structure does not constitute a specific limitation on the electronic device. In other embodiments of the present application, the electronic device may include more or fewer components than shown, or combine certain components, or split certain components, or have different component arrangements. The shown components may be implemented in hardware, software, or a combination of software and hardware.

[0095] Next, in combination with Figure 4 the structure of the electronic device shown, taking Figure 2 the scenario shown as an example, the current method for processing input events will be introduced.

[0096] Figure 5 is a flowchart of the current method for processing input events. Referring to Figure 5 , the method may include:

[0097] S501, when the user presses a control (control 21) on the touch screen, the input event reading module sends a first event to the input event distribution module.

[0098] In some embodiments, the first event can be understood as: the event read by the input event reading module from the event node of the touch screen, or the event determined based on the event data in the event node. It should be understood that in the embodiments of the present application, in order to distinguish different input events triggered by different user actions, the first event may be a down event.

[0099] S502, the input event distribution module sends the first event to the ViewRootImpl.

[0100] It should be understood that the input event distribution module can process the first event and send the processed first event to the ViewRootImpl. In the embodiments of the present application, for the sake of briefly expounding the existing method for processing input events, this step is abbreviated as the input event distribution module sending the first event to the ViewRootImpl.

[0101] S503, the ViewRootImpl sends the first event to the view processing module.

[0102] S504, the view processing module processes the first event.

[0103] The view processing module can determine that the user touches the touch screen according to the first event.

[0104] S505, during the process that the user long presses the control 21 and does not lift the hand (that is, the user continuously presses the control 21), the input event reading module sends the first event to the input event distribution module.

[0105] S506, the input event distribution module sends the first event to the ViewRootImpl.

[0106] S507, the ViewRootImp sends the first event to the view processing module.

[0107] S508, the view processing module processes the first event.

[0108] In S505 - S508, because the user long presses the control and does not lift the hand, during this period, since the input event reading module will periodically read input events (or event data) from the event node of the touch screen, the input event reading module can periodically send the first event to the input event distribution module. Correspondingly, the input event distribution module can periodically send the first event to the ViewRootImpl, the ViewRootImpl can periodically send the first event to the view processing module, and the view processing module can process the first event reported by the ViewRootImpl each time.

[0109] Among them, the view processing module can determine that the user long presses the control according to the first event reported by the ViewRootImpl each time.

[0110] It should be understood that Figure 5 taking reporting the first event twice as an example, it can be understood that before the user long presses the control and does not lift the hand, actually the first event can be reported more times. For example, the input event reading module, the input event distribution module, and the ViewRootImpl can report the first event respectively according to their respective preset reporting periods.

[0111] S509. When the stylus clicks on the touch screen, the input event reading module sends a second event to the input event distribution module.

[0112] The second event and the first event are heterogeneous input events. In some embodiments, the second event may be a down event.

[0113] S510. The input event distribution module sends the second event to the ViewRootImpl.

[0114] S511. The ViewRootImpl sends the second event to the view processing module.

[0115] S512. The view processing module processes the second event.

[0116] S513. While the user long - presses the control 21 and does not lift the hand, the input event reading module sends the first event to the input event distribution module.

[0117] S514. The input event distribution module sends the first event to the ViewRootImpl.

[0118] S515. The ViewRootImp sends the first event to the view processing module.

[0119] S516. The view processing module processes the first event.

[0120] It should be understood that during the process of the electronic device executing S509 - S512, because the user long - presses the control and does not lift the hand, the electronic device can also execute S513 - S516.

[0121] S517. When the stylus is lifted from the touch screen, the input event reading module sends a third event to the input event distribution module.

[0122] The third event and the second event are homogeneous input events. In some embodiments, the third event may be an up event, which can represent that the stylus is lifted, that is, the stylus leaves the touch screen.

[0123] S518. The input event distribution module sends the third event to the ViewRootImpl.

[0124] S519. The ViewRootImpl sends the third event to the view processing module.

[0125] S520. The view processing module processes the third event.

[0126] S521. When the user lifts the hand, the input event reading module sends a fourth event to the input event distribution module.

[0127] The fourth event is a homologous input event with the first event. In some embodiments, the fourth event can be an up event, which can represent that the user raises their hand, i.e., the user's finger leaves the touch screen.

[0128] S522, the input event distribution module sends the fourth event to the ViewRootImpl.

[0129] S523, the ViewRootImpl sends the fourth event to the view processing module.

[0130] S524, the view processing module processes the fourth event.

[0131] Refer to Figure 2 For the description in, according to the continuously received first event, the view processing module can determine that the user has been holding down the control 21 and has not raised their hand. During the period when the user has not raised their hand, the view processing module can determine that the stylus has clicked on a cell according to the second event and the third event. Correspondingly, the view processing module can perform the operation of selecting the cell.

[0132] In some embodiments, refer to Figure 2 For the description in, when the user's left thumb holds down the control 21 and the user uses the stylus to click on a cell and swipe down, in this scenario, the electronic device can also perform the following steps before S517:

[0133] S517A, the stylus slides, and the input event reading module sends the fifth event to the input event distribution module.

[0134] S518A, the input event distribution module sends the fifth event to the ViewRootImpl.

[0135] S519A, the ViewRootImpl sends the fifth event to the view processing module.

[0136] S520A, the view processing module processes the fifth event.

[0137] After the user holds the stylus and touches the touch screen, they can perform a downward sliding operation. Therefore, the electronic device can repeatedly execute S517A - S520A. It should be understood that Figure 5 S517A - S520A are not shown in.

[0138] Among them, the fifth event can be regarded as a move event, and the move event can indicate that the stylus slides on the touch screen. It should be understood that in the fifth events reported at different times, the position of the stylus on the touch screen is different, which can reflect that the stylus is currently performing a sliding operation.

[0139] In this example, based on the continuously received first event, the view processing module can determine that the user has been pressing the control without lifting the hand. During the period when the user does not lift the hand, the view processing module can determine that the stylus has selected a column of cells based on the second event, the fifth event, and the third event. Correspondingly, the view processing module can perform an operation of selecting the column of cells.

[0140] Referring to Figure 5 the method for processing input events introduced in, it can be seen that currently, heterogeneous input events are reported separately, and each input event is reported to the application (such as the view processing system in the application process) for processing. For example, when the user presses and holds a control without lifting the hand, the input event distribution module will continuously report the first event (down event) to the application. On the one hand, the reporting of a large number of input events will occupy the communication channel (such as the socket channel), affecting the communication performance. On the other hand, the application has been processing a large number of input events, resulting in a large processing volume of the application, reduced working performance, and the application needs to maintain a large number of heterogeneous input events, with high complexity.

[0141] In the current method for processing input events, although the application can respond to input events from different input devices simultaneously, the sending performance of input events is low. The embodiments of the present application provide a method for processing input events, which can configure corresponding logic in the system service module of the electronic device, such as the input event processing system. The input event processing system can merge and report heterogeneous input events. On the one hand, it can reduce the reporting frequency of input events and improve the processing performance of input events and the communication performance of the communication channel without affecting the timely response of the application. On the other hand, because the corresponding logic is configured in the system service module of the electronic device, there is no need to adapt in the application, with small modification complexity and low implementation difficulty.

[0142] The following describes the method for processing input events provided by the embodiments of the present application in combination with specific embodiments. These embodiments can be combined with each other, and the same or similar concepts or processes may not be repeated in some embodiments.

[0143] Figure 6 For the Figure 2 flow schematic diagram of the method for processing input events in the scenario shown. It should be understood that Figure 6 the embodiments of Figure 2 are based on the Figure 6 shown scenario and provide a method for processing input events. Referring to Figure 6 the method for processing input events provided by the embodiments of the present application may include:

[0144] S601. When the user presses the control 21 on the touch screen, the input event reading module sends a first event to the input event distribution module.

[0145] S602, the input event distribution module sends a first event to the ViewRootImpl.

[0146] S603, the ViewRootImpl sends the first event to the view processing module.

[0147] S604, the view processing module processes the first event.

[0148] S605, during the process that the user long - presses the control 21 and has not lifted the hand, the input event reading module sends a first event to the input event distribution module.

[0149] S606, the input event distribution module sends a first event to the ViewRootImpl.

[0150] S607, the ViewRootImp sends the first event to the view processing module.

[0151] S608, the view processing module processes the first event.

[0152] S601 - S608 can refer to the descriptions in S501 - S508.

[0153] In the embodiments of the present application, before the input event distribution module detects a heterologous input event, a homologous input event can be reported separately.

[0154] S609, when the stylus clicks on the touch screen, the input event reading module sends a second event to the input event distribution module.

[0155] S610, the input event distribution module detects the existence of a heterologous input event and determines whether to merge and report the heterologous input event. If so, execute S611.

[0156] It should be understood that since the input event reading module can periodically read input events (or event data) from different event nodes, in order to distinguish the sources of different input events, before sending an event to the input event distribution module, the input event reading module can mark the event source in the input event, and the event source is used to distinguish whether the event is a homologous event or a heterologous event. Exemplarily, the event source can be: the number of the event node, the name of the hardware corresponding to the event node, the number, etc.

[0157] In the embodiments of the present application, the input event distribution module may determine whether the event is a homologous input event or a heterologous input event according to the event source in the input event. In other words, the input event distribution module may detect whether the event is a heterologous input event according to the event source in the input event. Among them, since the second event and the first event are heterologous input events, and the input event distribution module detects the existence of a heterologous input event, it may determine whether to merge and report the heterologous input event.

[0158] In some embodiments, the merge and report rules for different scenarios may be pre-configured in the input event distribution module. For example, the merge and report rules include Figure 2 the merge and report rules for the scenario shown as follows. Specifically, when it is detected that the input event of the touch screen is always a down event, the down event may be merged and reported in another heterologous input event. The purpose of such a setting is that when the input event of the touch screen is always a down event, it indicates that the user is always in the state of pressing the touch screen without lifting the hand, that is, the user performs a long-press operation. During the long-press operation of the user, multiple down events need to be continuously reported. However, since the user long-presses a position and the position does not change, merging the down event in another heterologous input event for reporting will not affect the processing of the down event.

[0159] It should be understood that when the input event distribution module determines that it is necessary to merge and report a heterologous input event, it may not report the second event first, but wait for the arrival of the next heterologous input event (such as the first event), and then merge and report the second event and the heterologous input event.

[0160] It should be understood that in the embodiments of the present application, if the input event distribution module determines that it is not necessary to merge and report a heterologous input event, each input event may be reported separately, which may refer to Figure 5 the description in, and details are not described here, and Figure 6 this process is not shown in.

[0161] S611. The input event reading module sends the first event to the input event distribution module.

[0162] S612. The input event distribution module merges the first event and the second event to obtain the merged event.

[0163] It should be understood that the first event in S612 refers to the first event received after the second event. For example, the first event is the first event in S611.

[0164] In some embodiments, the combined reporting rule may further include an event priority. When the input event distribution module combines input events, it may combine low-priority input events into high-priority input events. Exemplarily, for example, the priority of the down event of the touch screen is lower than the priority of the down event of the stylus. Therefore, the input event distribution module may combine the down event of the touch screen into the down event of the stylus.

[0165] In some embodiments, the input event distribution module may carry the information included in the first event in the second event to obtain a combined event.

[0166] In some embodiments, the input event distribution module may carry the event source of the first event (such as the touch screen) and the user action represented by the first event (such as down) in the second event to obtain a combined event.

[0167] S613. The input event distribution module sends the combined event to the ViewRootImpl.

[0168] S614. The ViewRootImpl sends the combined event to the view processing module.

[0169] S615. The view processing module processes the combined event.

[0170] It should be noted that in S610, when the input event distribution module determines that it is necessary to combine and report heterogeneous input events, it may not report the second event first. Instead, it needs to wait for the next heterogeneous input event to arrive and then combine and report the second event and the next heterogeneous input event. To avoid affecting the reporting of the second event, that is, to avoid the event distribution module waiting for the first event for too long, in some embodiments, a preset duration may be set in advance. In this example, when the input event distribution module determines that it is necessary to combine and report heterogeneous input events, it may not report the second event first. When the input event distribution module waits for the preset duration, if the input event distribution module receives the first event from the input event reading module, the input event distribution module may combine and report the first event and the second event. However, when the input event distribution module waits for the preset duration and does not receive the first event from the input event reading module, the input event distribution module may report the second event separately so that the application (such as the view processing module) can process the second event in time.

[0171] In some embodiments, after the electronic device executes S612, since the user long-presses the control and does not lift the hand, the first event may also be reported, and reference may be made to S605 - S608.

[0172] After the electronic device executes S612, since the user long presses the control and does not lift their hand, in some embodiments, in order to reduce the reporting of the first event, before the user lifts their hand, the electronic device may not report the first event. Correspondingly, after the view processing module receives the merged event, if it has not received the user's hand-lifting event (such as the fourth event) all the time, the view processing module may determine that the user long presses the control and does not lift it. Or, in some embodiments, before the user lifts their hand, the electronic device may report the first event at intervals of a period of time, and this period of time is longer than the period for reporting the first event in the original S605 - S608, whereby the number of times of reporting the first event can be reduced.

[0173] S616, when the stylus is lifted, the input event reading module sends a third event to the input event distribution module.

[0174] S617, the input event distribution module sends the third event to the ViewRootImpl.

[0175] S618, the ViewRootImpl sends the third event to the view processing module.

[0176] S619, the view processing module processes the third event.

[0177] S620, when the user lifts their hand, the input event reading module sends a fourth event to the input event distribution module.

[0178] S621, the input event distribution module sends the fourth event to the ViewRootImpl.

[0179] S622, the ViewRootImpl sends the fourth event to the view processing module.

[0180] S623, the view processing module processes the fourth event.

[0181] In some embodiments, in S616, since the input event distribution module receives a third event that is a heterologous input event with the first event, the input event distribution module may determine whether to merge and report the heterologous input events. For example, the merge reporting rules include Figure 2 the merge reporting rules in the scenarios shown, specifically: when it is detected that the input event of the stylus is an up event and touch screen touch operations are supported, in this scenario, the input event reading module may merge and report the third event and the first event (down). That is to say, after the input event reading module receives the third event, it can wait for the next first event and merge and report the third event and this first event.

[0182] Exemplarily, after the stylus is lifted, if the user continues to perform the operation of pressing the control, the input event distribution module may receive a first event, and the input event distribution module may merge and report the first event and the third event.

[0183] In some embodiments, after the stylus is lifted and the user raises the hand, the input event distribution module may receive a fourth event, and the input event distribution module may merge and report the fourth event and the third event. That is to say, after the input event reading module receives the third event, it may wait for the next event from the touch screen and merge and report the third event and the event from the touch screen (such as the fourth event). Correspondingly, S617-S623 may be replaced with: when the user raises the hand, the input event reading module sends the fourth event to the input event distribution module, and the input event distribution module merges the fourth event into the third event to obtain a merged event. The input event distribution module sends the merged event to the ViewRootImpl, and the ViewRootImpl sends the merged event to the view processing module, and the view processing module processes the merged event.

[0184] In the embodiments of the present application, based on Figure 2 the scenarios shown, when the input event distribution module detects the existence of heterogeneous input events, it may determine whether to merge and report the heterogeneous input events according to the specific scenarios. In the embodiments of the present application, for different scenarios, the input event distribution module may adaptively merge and report the heterogeneous input events, which can reduce the occupancy of the communication channel, improve the communication performance, and can reduce the processing volume of the input events of the application and improve the processing performance of the application.

[0185] Next, in combination with Figure 3 the scenarios shown, the processing method of the input events provided by the embodiments of the present application will be introduced. Referring to Figure 7 , the processing method of the input events provided by the embodiments of the present application may include:

[0186] S701, when the user operates the touchpad to select the application icon 1, the input event reading module sends a sixth event to the input event distribution module.

[0187] The sixth event may be a down event, indicating that the user touches the touchpad, or indicating that the input event of the touchpad is a down event.

[0188] S702, the input event distribution module sends the sixth event to the ViewRootImpl.

[0189] S703, the ViewRootImpl sends the sixth event to the view processing module.

[0190] S704, the view processing module processes the sixth event.

[0191] S705, during the process that the user operates the touchpad to drag the application icon 1, the input event reading module sends a seventh event to the input event distribution module.

[0192] The seventh event can be regarded as a move event, indicating that the user operates the touchpad to perform a drag operation, or it can also indicate that the input event of the touchpad is a move event.

[0193] S706, the input event distribution module sends the seventh event to the ViewRootImpl.

[0194] S707, the ViewRootImp sends the seventh event to the view processing module.

[0195] S708, the view processing module processes the seventh event.

[0196] In the embodiments of the present application, before the input event distribution module detects a heterologous input event, the homologous input event can be reported separately.

[0197] S709, when the user touches the touch screen, the input event reading module sends an eighth event to the input event distribution module.

[0198] The eighth event is a down event, indicating that the user touches the touch screen, or it can also indicate that the input event of the touch screen is a down event.

[0199] S710, the input event distribution module detects the existence of a heterologous input event and determines whether to merge and report the heterologous input event. If so, execute S711.

[0200] The input event distribution module can detect whether there is a heterologous input event according to the event source in the event. Among them, the eighth event and the seventh event are heterologous input events. When the input event distribution module detects the existence of a heterologous input event, it can determine whether to merge and report the heterologous input event.

[0201] In some embodiments, the merge and report rules in different scenarios can be pre-configured in the input event distribution module. For example, the merge and report rules include Figure 3 the merge and report rules in the scenarios shown as follows. Specifically: when it is detected that the input event of the touchpad represents a dragged object and there is an input event of the touch screen, the input events of the touchpad and the touch screen can be merged. It should be understood that according to the sixth event and the seventh event, the input event distribution module can determine that the user operates the touchpad to perform a drag operation. In addition, according to the eighth event, the input event distribution module can determine that the user touches the touch screen. Therefore, the input event distribution module can determine to merge the input events of the touchpad and the touch screen.

[0202] It should be understood that when the input event distribution module determines that it is necessary to merge and report heterogeneous input events, it may not report the eighth event first, but wait until the next heterogeneous input event arrives, and then merge and report the eighth event and the next heterogeneous input event.

[0203] It should be understood that in the embodiments of the present application, if the input event distribution module determines that it is not necessary to merge and report heterogeneous input events, each input event can be reported separately, which can refer to the description in Figure 5 , and details are not described herein, and Figure 7 this process is not shown therein.

[0204] S711. During the process of the user operating the touchpad to drag the application icon 1, the input event reading module sends the seventh event to the input event distribution module.

[0205] It should be understood that during the process of the user operating the touchpad to drag the application icon 1, the input event reading module will continuously send the seventh event to the input event distribution module.

[0206] S712. The input event distribution module merges the seventh event and the eighth event to obtain the merged event.

[0207] It should be understood that the seventh event in S712 refers to the seventh event received after the eighth event. For example, the seventh event is the seventh event in S711.

[0208] The merging method of the input events in S712 can refer to the descriptions in S612 and S615.

[0209] S713. The input event distribution module sends the merged event to the ViewRootImpl.

[0210] S714. The ViewRootImpl sends the merged event to the view processing module.

[0211] S715. The view processing module processes the merged event.

[0212] S716. During the process of the user performing a sliding operation on the touch screen, the input event reading module sends the ninth event to the input event distribution module.

[0213] For example, when the user performs a left swipe operation on the touch screen, triggering the electronic device to switch the desktop interface, that is, the process of the user performing a sliding operation on the touch screen. Among them, the ninth event is a move event, indicating that the user performs a sliding operation on the touch screen, and it can also indicate that the input event of the touch screen is a move event.

[0214] S717. During the process of the user operating the touchpad to drag the application icon 1, the input event reading module sends the seventh event to the input event distribution module.

[0215] In S718, the input event distribution module combines the seventh event and the ninth event to obtain the combined event.

[0216] It should be understood that the seventh event in S718 refers to the seventh event received after the ninth event. For example, the seventh event is the seventh event in S717.

[0217] It should be understood that because Figure 3 The combined reporting rule in the shown scenario is: when it is detected that the input event of the touchpad represents dragging an object and there is an input event of the touch screen as a sliding event, the input events of the touchpad and the touch screen can be combined. The input event distribution module can determine that the input event of the touch screen is a sliding event based on the ninth event; the input event distribution module can determine that the input event of the touchpad represents dragging an object based on the seventh event; therefore, the input event distribution module can combine and report the ninth event and the seventh event.

[0218] In S719, the input event distribution module sends the combined event to ViewRootImpl.

[0219] In S720, ViewRootImp sends the combined event to the view processing module.

[0220] In S721, the view processing module processes the combined event.

[0221] In S722, when the user raises a hand from the touch screen, the input event reading module sends the tenth event to the input event distribution module.

[0222] The tenth event is an up event, indicating that the user leaves the touch screen, or it can also indicate that the input event of the touch screen is an up event.

[0223] In S723, the input event distribution module sends the tenth event to ViewRootImpl.

[0224] In S724, ViewRootImpl sends the tenth event to the view processing module.

[0225] In S725, the view processing module processes the tenth event.

[0226] In S726, when the user raises a hand from the touchpad, the input event reading module sends the eleventh event to the input event distribution module.

[0227] The eleventh event is an up event, indicating that the user leaves the touchpad, or it can also indicate that the input event of the touchpad is an up event.

[0228] In S727, the input event distribution module sends the eleventh event to ViewRootImpl.

[0229] S728, the ViewRootImpl sends the eleventh event to the view processing module.

[0230] S729, the view processing module processes the eleventh event.

[0231] It should be understood that the first event to the eleventh event introduced in the above examples are all input events.

[0232] The embodiments of the present application have the same technical effects as the embodiments Figure 6 shown above, and the descriptions in the above embodiments can be referred to and will not be elaborated here.

[0233] As described above in combination with the scenario, the processing method of the input events provided by the embodiments of the present application is introduced. The following embodiments introduce the processing method of the input events provided by the embodiments of the present application from the perspective of the input event processing system and application interaction. Refer to Figure 8 , the processing method of the input events provided by the embodiments of the present application may include:

[0234] S801, the input event processing system obtains a first input event.

[0235] According to the description in the above embodiments, the input event reading module in the input event processing system can periodically obtain input events from the event node, and it can be considered that the input event processing system can obtain input events. In order to facilitate the distinction between different input events, prefixes such as "first", "second", etc. can be used for distinction.

[0236] The first input event corresponds to the first input device of the electronic device. That is to say, the first input event is the input event of the first input device, or the first input event is the input event from the first input device. Or, the first input event corresponds to the first event node, the first event node is the event node of the first input device, or the first input event is the input event from the event node of the first input device.

[0237] S802, the input event processing system reports the first input event to the application.

[0238] It can be understood that after S802, if the input event processing system obtains a fourth input event, the fourth input event corresponds to the first input device of the electronic device. That is to say, the fourth input event is the input event of the first input device. The fourth input event and the first input event are homologous input events, and the input event processing system can report the fourth input event to the application. In the embodiments of the present application, before the input event processing system obtains heterologous input events, the input event processing system can report homologous input events separately.

[0239] In S803, the input event processing system obtains a second input event and determines whether to merge and report heterogeneous input events. If so, S804 is executed; if not, S807 is executed.

[0240] In some embodiments, since the input event may include the event source of the input event, and the event source may indicate the input device, the input event processing system may determine whether a heterogeneous input event is obtained according to the event source in the obtained input event. In the embodiments of the present application, the second input event corresponds to the second input device of the electronic device. That is to say, the second input event is the input event of the second input device, or the second input event is from the second input device. The second input device is different from the first input device.

[0241] That is to say, the second input event corresponds to the second event node. The second event node is the event node of the second input device, or the second event node is the input event from the event node of the second input device. The second event node is different from the first event node. In this way, the second input event and the first input event are heterogeneous input events.

[0242] When the input event processing system determines that the second input event and the first input event are heterogeneous input events, the input event processing system may determine whether the heterogeneous input events can be merged and reported. It should be understood that in different scenarios, the rules for merging and reporting heterogeneous input events may be different. In some embodiments, the rules for merging and reporting heterogeneous input events in different scenarios (hereinafter referred to as rules) may be pre-configured in the input event processing system. It should be understood that different scenarios may refer to scenarios with different input devices. Among them, there are at least two input devices.

[0243] For different input devices, different rules can be configured. Exemplarily, the input devices of the electronic device include: a first input device and a second input device, and the rules corresponding to the first input device and the second input device may be Rule 1. Exemplarily, the input devices of the electronic device include: a first input device and a third input device, and the rules corresponding to the first input device and the third input device may be Rule 2. In some embodiments, the rule can be regarded as: the rule for merging and reporting heterogeneous input events in the scenario where the first input device and the second input device input to the electronic device at the same time.

[0244] Exemplarily, the input devices of the electronic device include a touch screen and a stylus. The configured rules may be: 1) When the user long-presses the touch screen, merge and report the down event of the touch screen and the input event of the stylus. 2) Merge and report the move event of the stylus and the input events of the touch screen (such as down event, move event). 3) Do not merge and report the remaining input events.

[0245] Exemplarily, when the input device of the electronic device includes a touchpad and a touch screen, the configured rules can be: 1) Combine and report the move event of the touchpad and the input events of the touch screen (such as down event, move event). 2) Do not combine and report the remaining input events.

[0246] In the embodiment of the present application, the input event processing system can determine whether heterogeneous input events can be combined and reported according to the rules configured in the input event processing system.

[0247] S804, the input event processing system obtains a third input event.

[0248] The third input event corresponds to a first input device. In other words, the third input event is the input event of the first input device, or the third input event is an input event from the first input device. The input event processing system can determine that the third input event and the first input event are homogeneous input events. In the embodiment of the present application, the third input event is taken as an example of the input event type that meets the condition of being combined and reported with the second input event. For example, if the second input event is the move event of a stylus and the third input event is the move event of the touch screen, the input event processing system determines that the second input event and the third input event can be combined and reported.

[0249] S805, the input event processing system combines the second input event and the third input event to obtain a combined input event.

[0250] In the embodiment of the present application, when the input event processing system determines to combine and report heterogeneous input events, the input event processing system can combine the second input event and the third input event to obtain a combined input event. Specifically, the way of combining the input events can refer to the descriptions in S612 and S615.

[0251] S806, the input event processing system reports the combined input event to the application.

[0252] S807, the input event processing system reports the second input event to the application.

[0253] In the embodiment of the present application, when the input event processing system determines not to combine and report heterogeneous input events, the input event processing system can separately report each input event to the application.

[0254] In the embodiments of the present application, when the input event processing system detects the existence of heterogeneous input events, it can determine whether to merge and report the heterogeneous input events according to the specific scenario. When the input event processing system determines to merge and report the heterogeneous input events, it can merge and report the heterogeneous input events to the application, which can reduce the occupation of the communication channel, improve the communication performance, and can also reduce the processing volume of the input events of the application, improving the processing performance of the application. In addition, in the embodiments of the present application, for different scenarios, different rules for merging and reporting heterogeneous input events can be pre-configured in the input event processing system, and the input event processing system can determine whether to merge and report the heterogeneous input events based on this rule. It should be understood that configuring different rules for merging and reporting heterogeneous input events in the input event processing system in the embodiments of the present application can ensure the merging and reporting of input events without affecting the application's timely response to input events.

[0255] It should be noted that the data involved in the present application (including but not limited to the data for analysis, the stored data, the displayed data, etc.), as well as the input events, etc., are all information and data that have been authorized by the user or fully authorized by all parties, and the collection, use, and processing of the relevant data need to comply with the relevant laws, regulations, and standards of the relevant countries and regions, and corresponding operation entrances are provided for the user to choose to authorize or refuse.

[0256] In some embodiments, the embodiments of the present application further provide an electronic device. Referring to Figure 9 , the electronic device may include: a processor 901 (such as a CPU) and a memory 902. The memory 902 may include a high-speed random access memory (RAM), and may also include a non-volatile memory (NVM), such as at least one disk memory. Various instructions can be stored in the memory 902 to complete various processing functions and implement the method steps of the present application.

[0257] Optionally, the electronic device involved in the present application may further include: a power supply 903, a communication bus 904, and a communication port 905. The above communication port 905 is used to implement connection and communication between the electronic device and other peripherals. In the embodiments of the present application, the memory 902 is used to store computer-executable program code, and the program code includes instructions; when the processor 901 executes the instructions, the instructions cause the processor 901 of the electronic device to perform the actions in the above method embodiments, and its implementation principle and technical effects are similar and will not be elaborated here.

[0258] Optionally, the electronic device involved in the present application may further include: a display screen 906. The display screen 906 is used to display the interface of the electronic device.

[0259] It should be noted that the modules or components described in the above embodiments may be one or more integrated circuits configured to implement the above methods. For example: one or more application specific integrated circuits (ASICs), or, one or more digital signal processors (DSPs), or, one or more field programmable gate arrays (FPGAs), etc. Again, when a certain module above is implemented in the form of a processing element scheduling program code, the processing element may be a general-purpose processor, such as a central processing unit (CPU) or other processors that can call program code, such as a controller. Again, these modules may be integrated together and implemented in the form of a system-on-a-chip (SOC).

[0260] In the above embodiments, it can be implemented in whole or in part by software, hardware, firmware, or any combination thereof. When implemented using software, it can be implemented in whole or in part in the form of a computer program product. The computer program product includes one or more computer instructions. When the computer program instructions are loaded and executed on a computer, the processes or functions according to the embodiments of the present application are generated in whole or in part. The computer may be a general-purpose computer, a special-purpose computer, a computer network, or other programmable devices. The computer instructions may be stored in a computer-readable storage medium, or transmitted from one computer-readable storage medium to another. For example, the computer instructions may be transmitted from one website, computer, server, or data center to another website, computer, server, or data center via wired (such as coaxial cable, optical fiber, digital subscriber line (DSL)) or wireless (such as infrared, wireless, microwave, etc.) means. The computer-readable storage medium may be any available medium that the computer can access or a data storage device such as a server or data center that includes one or more integrated available media. The available medium may be a magnetic medium (for example, a floppy disk, a hard disk, a magnetic tape), an optical medium (for example, a DVD), or a semiconductor medium (for example, a solid state disk (SSD)), etc.

[0261] As used herein, the term "a plurality of" means two or more. As used herein, the term "and / or" is merely a description of the relationship between associated objects, indicating that three relationships may exist. For example, A and / or B may represent: A exists alone, A and B exist simultaneously, and B exists alone. Additionally, the character " / " herein generally indicates an "or" relationship between the associated objects before and after; in a formula, the character " / " indicates a "division" relationship between the associated objects before and after. It should be further understood that in the description of this application, terms such as "first" and "second" are only used for the purpose of distinguishing descriptions, and should not be construed as indicating or implying relative importance, nor as indicating or implying an order.

[0262] It can be understood that the various numerical numbers involved in the embodiments of this application are only for convenience of description and do not limit the scope of the embodiments of this application.

[0263] It can be understood that in the embodiments of this application, the magnitudes of the sequence numbers of the above processes do not imply the order of execution. The order of execution of each process should be determined by its function and internal logic, and should not constitute any limitation to the implementation process of the embodiments of this application.

Claims

1. A method for processing input events, characterized in that, Applied to an electronic device, the electronic device includes: an input event processing system and an application, the input event processing system is a system service module of the electronic device, and the method includes: The input event processing system obtains a first input event, and the first input event is an input event from a first input device of the electronic device; The input event processing system reports the first input event to the application; The input event processing system obtains a second input event, and the second input event is an input event from a second input device of the electronic device; The input event processing system determines whether to merge heterogeneous input events, and the heterogeneous input events represent input events from different input devices; If so, when the input event processing system obtains a third input event, it reports the second input event and the third input event to the application in a merged manner, and the third input event is an input event from the first input device.

2. The method according to claim 1, wherein Before the input event processing system obtains the second input event, it further includes: The input event processing system obtains a fourth input event, and the fourth input event is an input event from the first input device; The input event processing system reports the fourth input event to the application.

3. The method according to claim 2, wherein The input event processing system determines whether to merge heterogeneous input events, including: The input event processing system determines whether to merge heterogeneous input events according to the rules for reporting heterogeneous input events in a merged manner in different scenarios. The rules include: in the scenario where the first input device and the second input device simultaneously input to the electronic device, the rules for reporting heterogeneous input events in a merged manner.

4. The method according to claim 3, wherein In different scenarios, the input devices of the electronic device are different, and the number of input devices of the electronic device is at least two.

5. The method according to claim 3 or 4, characterized in that, The first input device is a touch screen, and the second input device is a stylus. The rules include at least one of the following: When the first input event is a press event, the fourth input event is a press event, and the second input event is a press event, it is determined to report the second input event and the third input event in a merged manner; Or, When the fourth input event is a slide event, the second input event is a press event, and the third input event is a slide event, it is determined to report the second input event and the third input event in a merged manner.

6. The method according to claim 3 or 4, characterized in that, The first input device is a touchpad, and the second input device is a touch screen. The rules include: When the fourth input event is a slide event, the second input event is a press event, and the third input event is a slide event, it is determined to report the second input event and the third input event in a merged manner.

7. The method according to any one of claims 1-6, characterized in that, When the input event processing system obtains the third input event, reporting the second input event and the third input event to the application in a merged manner includes: Within a preset duration after the input event processing system obtains the second input event, when the input event processing system obtains the third input event, it reports the second input event and the third input event to the application in a merged manner.

8. The method according to claim 7, characterized in that, The method further includes: Within the preset duration after the input event processing system acquires the second input event, if the input event processing system does not acquire the third input event, the input event processing system separately reports the second input event to the application.

9. The method according to any one of claims 1-8, characterized in that, Before merging and reporting the second input event and the third input event to the application, it further includes: The input event processing system merges the third input event into the second input event to obtain a merged input event, and the priority of the second input event is higher than that of the third input event. Merging and reporting the second input event and the third input event to the application includes: The input event processing system reports the merged input event to the application.

10. An electronic device, characterized in that, It includes: A processor and a memory; The memory stores computer execution instructions; The processor executes the computer execution instructions stored in the memory, so that the processor executes the method according to any one of claims 1-9.

11. A computer-readable storage medium, characterized in that, A computer program or instruction is stored in the computer-readable storage medium, and when the computer program or instruction is run, the method according to any one of claims 1-9 is implemented.