Input event processing method and electronic device
Patent Information
- Application Number
- CN202510496890.8
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-04-18
- Publication Date
- 2026-10-23
AI Technical Summary
[0007]本申请提供了一种输入事件处理方法及电子设备,用于在界面扩展场景中保证事件消费效率,解决事件冲突的问题
[0101]第七方面,本申请实施例提供一种计算机存储介质,该计算机存储介质存储有计算机程序指令,当所述计算机程序指令在电子设备上运行时,使得计算机执行上述任一方面提供的方法。
Smart Images

Figure CN122963823A_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of electronic device technology, and in particular to an input event processing method and an electronic device. Background Technology
[0002] Currently, in scenarios where application A launches application B to provide services, application A's window contains a component to display application B's content, thus expanding the interface. When a user performs a user action on application A's window via touch gestures or an input device, the electronic device's input management service generates an input event based on this user action and reports the input event to the target application so that the target application can process or respond to the corresponding input event. This process can be called the event consumption process.
[0003] In the aforementioned interface extension scenarios, electronic devices can currently employ the following two event consumption mechanisms:
[0004] Synchronous event consumption mechanism: The input management service reports each input event generated based on user operations to application A; application A delivers each received input event to application B, and after receiving the consumption result from application B, determines whether application A should consume the input event based on the consumption result.
[0005] Asynchronous event consumption mechanism: The input management service reports each input event generated based on user operations to application A; application A delivers each received input event to application B, and application A does not wait for application B's consumption result but directly consumes each received input event.
[0006] The synchronous event consumption mechanism described above requires application A to wait for the consumption result of application B before deciding whether to consume the input event, resulting in low event consumption efficiency and high performance overhead for electronic devices. In contrast, the asynchronous event consumption mechanism may allow application A and application B to consume input events simultaneously, leading to event conflicts. Summary of the Invention
[0007] This application provides an input event processing method and an electronic device to ensure event consumption efficiency and resolve event conflict issues in interface expansion scenarios.
[0008] In a first aspect, embodiments of this application provide an input event processing method, which can be applied to an electronic device, the electronic device including an input management service, a first application, and a second application, the method comprising the following steps:
[0009] A first application receives a first input event from an input management service; wherein the first input event is the first input event generated by the input management service based on a first user operation performed within a window of a second application; the location of the first input event is within a first area of the window, and the first area displays the content of the first application; the first application determines a first set of operation types based on at least one first component; wherein the at least one first component is a component within the first area; the first set of operation types includes at least one first operation type, which is used to control the at least one first component; the first application receives a second input event from the input management service; wherein the second input event is generated by the input management service based on the first user operation; and based on the first input event and the first user operation performed within a window of a second application, the first application determines a first set of operation types. Regarding the second input event, the first application determines that the first user operation successfully matches a first target operation type in the first operation type set. The first application executes a first processing action based on the second input event and sends a first message to the second application. The first message is used to instruct the second application to stop processing the input event of the first user operation. Alternatively, based on the first input event and the second input event, the first application determines that the first user operation successfully matches a second target operation type in the second operation type set. The first application sends the second input event to the second application. The second operation type set contains at least one second operation type, which is used to control at least one second component. The at least one second component is a component in the display content of the second application in the window.
[0010] This method allows the first application, upon receiving an input event reported by the input management service in an interface extension scenario, to compete for the attribution of the first user's operation between two applications on its own end. This determines the target application for the first user's operation, enabling the first application to decide whether to consume the input event or forward it to the second application. Compared to traditional synchronous event consumption mechanisms, the first application only needs to obtain the second set of operation types after receiving the first operation event from the first user. Upon receiving subsequent input events from the first user, it can proceed directly without waiting for a response from the second application, thus improving event consumption efficiency. Compared to traditional asynchronous event consumption mechanisms, the first application can compete for the attribution of the first user's operation between two applications, determining the target application and deciding whether to consume or forward the input event, avoiding event conflicts. In summary, the method provided in this application's embodiments can guarantee event consumption efficiency and resolve event conflict issues in interface extension scenarios.
[0011] In one possible design, if the first application determines that the first user operation successfully matches the first target operation type in the first operation type set, the first application may also perform a second processing action based on the third input event after receiving a third input event from the input management service; the third input event is generated by the input management service based on the first user operation.
[0012] This design allows the first application to directly consume subsequent input events from the first user's operation when it identifies itself as the target application. This eliminates the need to synchronize the input events to the second application, enabling the first application to complete the processing actions corresponding to the first user's operation and realize the user's intended action. This reduces the number of interactions between applications, thereby lowering the performance overhead of the electronic device and improving its overall performance.
[0013] In one possible design, if the first application determines that the first user operation successfully matches the second target operation type in the second operation type set, the first application may also send the fourth input event to the second application after receiving the fourth input event sent by the input management service; the fourth input event is generated by the input management service based on the first user operation.
[0014] This design allows the first application to directly forward any subsequent input events received from the first user's operation to the second application, once the first application has identified the second application as the target application. This eliminates the need for processing the input events themselves. Consequently, the latency of input event consumption is reduced, and event consumption efficiency is improved.
[0015] In one possible design, if the first application determines that the first user operation successfully matches the second target operation type in the second operation type set, the first application may also send a second message to the second application; the second message is used to notify the first user operation that it successfully matches the second target operation type, or the second message is used to notify the first user operation that it is an operation performed for the second application.
[0016] With this design, the second application can directly determine itself as the target application operated by the first user based on the second message.
[0017] In one possible design, the method further includes: based on the first input event and the second input event, the first application determines that the first user operation does not match the operation type in the first operation type set and the second operation type set, and the first application sends the second input event to the second application.
[0018] Since the target application of the first user operation is not determined, the first application does not need to consume the second input event. Instead, it can synchronize the second input event to the second application so that the second application can match the operation type of the first user operation with the operation types in the second operation type set based on the received input event of the first user operation.
[0019] In one possible design, if the first application determines that the first user action does not match the action type in the first action type set and the second action type set, the first application may further perform the following steps:
[0020] The first application receives a fifth input event from the input management service; the fifth input event is generated by the input management service based on the first user operation; if the first application determines that the first user operation successfully matches a first target operation type in the first operation type set based on the first input event, the second input event, and the fifth input event, the first application executes a third processing action based on the fifth input event and sends the first message to the second application; or, if the first application determines that the first user operation successfully matches a second target operation type in the second operation type set based on the first input event, the second input event, and the fifth input event, the first application sends the fifth input event to the second application.
[0021] With this design, if the first application does not determine the target application of the first user operation, when the first application subsequently receives input events of the first user operation, it can continue to match the first user operation with the operation types in the first operation type set and the second operation type set based on the multiple input events of the first user operation that have been received, and execute the corresponding operation based on the matching results.
[0022] In one possible design, the first application can match the first user operation with the operation types in the first operation type set and the second operation type set, respectively, based on the first input event and the second input event.
[0023] Through this design, the first application can match the first user operation with the operation types in the first operation type set and the second operation type set based on the multiple input events of the first user operation it has received, so as to determine the target application of the first user operation and realize the competition between the two applications for the operation ownership of the first user operation.
[0024] In one possible design, the first application can match the first user operation with the operation types in the first operation type set and the second operation type set respectively, based on the first input event and the second input event, in the following two ways:
[0025] Method 1: The first application determines the predicted operation type of the first user operation based on the event information of the first input event and the event information of the second input event; the first application matches the predicted operation type of the first user operation with the operation types in the first operation type set and the second operation type set, respectively;
[0026] Method 2: The first application determines whether the event information of the first user operation matches the event characteristics corresponding to the target operation type based on the event information of the first input event and the event information of the second input event; if the event information of the first user operation matches the event characteristics corresponding to the target operation type, the first application determines that the first user operation matches the target operation type; if the event information of the first user operation does not match the event characteristics corresponding to the target operation type, the first application determines that the first user operation does not match the target operation type.
[0027] The target operation type is any operation type in the first operation type set or the second operation type set; the event information includes at least one of the following: input device type, event type, reporting location, and timestamp.
[0028] With this design, the first application can match the first user operation with the operation types in the first operation type set and the second operation type set based on the event information of multiple input events of the first user operation.
[0029] In one possible design, the first set of operation types has a higher priority than the second set of operation types; the first application prioritizes matching the first user operation with the operation types in the first set of operation types.
[0030] Since the reporting location of the first input event is within the first area, the probability that the target application of the first user operation is the first application itself is relatively high. Based on this, the first application has a higher priority in determining the first operation type set. Thus, the first application prioritizes matching the first user operation with the operation types in the first operation type set, enabling it to quickly determine whether it is the target application of the first user operation. If it is the target application, it can then process the input event corresponding to the first user operation as quickly as possible, improving the efficiency of the electronic device in consuming input events.
[0031] In one possible design, if the first application determines that the first user operation successfully matches the first target operation type in the first operation type set, before the first application executes the first processing action based on the second input event, the first application may also determine, based on the location information of the first area and the layout information of the first component, that the reporting position of the first input event is located within the control area of the first target component corresponding to the first target operation type; wherein, the location information of the first area is used to indicate the position of the first area within the window, and the layout information of the first component is used to indicate the layout of the at least one first component in the first area.
[0032] Through this design, the first application can further verify whether it is the target application operated by the first user by determining whether the first input event hits the first target component corresponding to the first target operation type.
[0033] In one possible design, if the first application determines that the first user operation successfully matches the second target operation type in the second operation type set, before the first application sends the second input event to the second application, the first application may also determine, based on the second component layout information, that the reporting position of the first input event is located within the control area of the second target component corresponding to the second target operation type; wherein, the second component layout information is used to indicate the layout of the at least one second component in the window.
[0034] Through this design, the first application can further verify whether the second application is the target application operated by the first user by determining whether the first input event hits the second target component corresponding to the second target operation type.
[0035] In one possible design, the first application can receive location information of the first region from the second application. In this way, the first application can obtain the location of the first region and, based on the location information of the first region and the layout information of the first component, determine the control area of the first target component to determine whether the first input event hits the first target component.
[0036] In one possible design, the first application receives the layout information of the second component from the second application. In this way, the first application can obtain the layout information of the second component and, based on this information, determine the control area of the second target component in order to determine whether the first input event hits the second target component.
[0037] In one possible design, the first application may execute the first processing action based on the first target operation type, the event information of the second input event, the location information of the first area, and the layout information of the first component; wherein, the event information includes at least one of the following: input device type, event type, reporting location, and timestamp; the location information of the first area is used to indicate the position of the first area within the window, and the layout information of the first component is used to indicate the layout of the at least one first component in the first area.
[0038] With this design, the first application can consume the second input event.
[0039] In one possible design, the first application may also send the first input event to the second application and receive the second set of operation types from the second application.
[0040] With this design, the first application can trigger the second application to predict and feed back the range of operation types (i.e., the second set of operation types) of the first user operation by sending a first input event.
[0041] In one possible design, the at least one first component is a component in the display content of the first application within a first location range; the first location range includes the reporting position of the first input event; the at least one second component is a component in the display content of the second application within a second location range; the second location range includes the reporting position of the first input event; wherein the second location range is larger than the first location range.
[0042] Since the first user operation is usually more likely to control components near its operation location, this design allows the first and second applications to predict the operation type of the first user operation based on components located near its operation location. This reduces redundant operation types in the first and second operation type sets, thereby improving the efficiency of matching the first user operation with the operation types in the second operation type set.
[0043] Secondly, embodiments of this application provide an input event processing method, which can be applied to an electronic device, the electronic device including an input management service, a first application, and a second application, the method including the following steps:
[0044] The second application receives a first input event from the first application; wherein the first input event is the first input event generated by the input management service based on a first user operation performed within the window of the second application; the location of the first input event is within a first area of the window; the first area displays the content of the first application; the second application determines a second set of operation types based on at least one second component; wherein the at least one second component is a component within the display content of the second application in the window; the second set of operation types includes at least one second operation type, which is used to control the at least one second component; the second application sends the second set of operation types to the first application; the second application receives a first message from the first application and stops processing the input event of the first user operation based on the first message; wherein the first message instructs the second application to stop processing the input event of the first user operation; or, the second application receives a second input event from the first application; the second input event is generated by the input management service based on the first user operation.
[0045] Using this method, when the second application receives the first input event of the first user operation sent by the first application, it can trigger the prediction of the operation type range of the first user operation (i.e., the second operation type set) and feed back the second operation type set to the first application, so that the first application can compete for the operation ownership of the first user operation based on the second operation type set.
[0046] In one possible design, after the second application receives the second input event from the first application, the second application can also match the first user operation with the operation type in the second operation type set based on the first input event and the second input event; when it is determined that the first user operation is successfully matched with the second target operation type in the second operation type set, the second application executes the fourth processing action based on the second input event.
[0047] With this design, after receiving the first input event from the first user operation, the second application, upon receiving subsequent input events from the first user operation, matches the first user operation with operation types in the second set of operation types, until a match is found between the first user operation and an operation type in the second set, thus determining that the second application is the target application of the first user operation. In this way, the second application can consume the input events of the first user operation once it has determined itself to be the target application.
[0048] In one possible design, the second application receives a second message from the first application; the second message notifies the first user operation that it successfully matches a second target operation type in the second operation type set; or the second message is used to notify the first user operation that it is an operation performed by the user for the second application.
[0049] With this design, the second application can determine itself as the target application operated by the first user based on the second message.
[0050] In one possible design, the second application can match the first user action with the action type in the second action type set based on the first input event and the second input event:
[0051] Method 1: The second application determines the predicted operation type of the first user operation based on the event information of the first input event and the event information of the second input event; the second application matches the predicted operation type of the first user operation with the operation types in the second operation type set;
[0052] Method 2: The second application determines, based on the event information of the first input event and the event information of the second input event, whether the event information of the first user operation matches the event characteristics corresponding to the target operation type in the second operation type set; if the event information of the first user operation matches the event characteristics corresponding to the target operation type, the second application determines that the first user operation matches the target operation type; if the event information of the first user operation does not match the event characteristics corresponding to the target operation type, the second application determines that the first user operation does not match the target operation type.
[0053] The event information includes at least one of the following: input device type, event type, reporting location, and timestamp.
[0054] With this design, the second application can match the first user operation with the operation type in the second operation type set based on the event information of multiple input events of the first user operation.
[0055] In one possible design, before the second application executes the fourth processing action based on the second input event, the second application may also determine, based on the second component layout information, that the reporting position of the first input event is located within the control area of the second target component corresponding to the second target operation type; wherein, the second component layout information is used to indicate the layout of the at least one second component in the window.
[0056] Through this design, the second application can further verify whether the second application is the target application operated by the first user by determining whether the first input event hits the second target component corresponding to the second target operation type.
[0057] In one possible design, the second application may perform the fourth processing action based on the second target operation type, the event information of the second input event, and the second component layout information; wherein the event information includes at least one of the following: input device type, event type, reporting location, and timestamp; and the second component layout information is used to indicate the layout of the at least one second component in the window.
[0058] This design allows the second application to consume the second input event.
[0059] In one possible design, the second application may also perform a fifth processing action based on the fourth input event received from the first application; the fourth input event is generated by the input management service based on the first user's operation.
[0060] With this design, when the second application determines that it is the target application of the first user's operation, the second application can directly consume the input event of the first user's operation when it subsequently receives such an input event. In this way, the second application can consume subsequent input events from the first user's operation, enabling it to complete the processing actions corresponding to the first user's operation and realize the user's intention to execute the first user's operation.
[0061] In one possible design, the second application may also send the location information of the first region to the first application; wherein the location information of the first region is used to indicate the position of the first region within the window.
[0062] In one possible design, the second application may also send the second component layout information to the first application; wherein the second component layout information is used to indicate the layout of the at least one second component in the window.
[0063] In one possible design, the at least one second component is a component in the display content of the second application within a second location range; the second location range includes the reporting location of the first input event.
[0064] Thirdly, embodiments of this application provide an input event processing method, which can be applied to an electronic device, the electronic device including an input management service, a first application, and a second application, the method including the following steps:
[0065] A first application receives a first input event from an input management service; wherein the first input event is the first input event generated by the input management service based on a first user operation performed within the window of the first application; the window includes a first area, and the display content of a second application is displayed within the first area; the first application determines that the reporting position of the first input event is located within the first area; the first application determines a first set of operation types based on at least one first component; wherein the at least one first component is a component in the display content of the first application in the window; the first set of operation types includes at least one first operation type, which is used to control the at least one first component; the first application receives a second input event from the input management service; wherein the second input event is the first input event generated by the input management service based on a first user operation performed within the window of the first application. The user operation is generated; based on the first input event and the second input event, the first application determines that the first user operation successfully matches a first target operation type in the first operation type set, the first application executes a first processing action based on the second input event, and sends a first message to the second application; the first message is used to instruct the second application to stop processing the input event of the first user operation; or, based on the first input event and the second input event, the first application determines that the first user operation successfully matches a second target operation type in the second operation type set, the first application sends the second input event to the second application; wherein, the second operation type set contains at least one second operation type, the at least one second operation type is used to control at least one second component; the at least one second component is a component in the first area.
[0066] In one possible design, if the first application determines that the first user operation successfully matches the first target operation type in the first operation type set, the first application may also perform a second processing action based on the third input event after receiving a third input event from the input management service; the third input event is generated by the input management service based on the first user operation.
[0067] In one possible design, if the first application determines that the first user operation successfully matches the second target operation type in the second operation type set, the first application may also send the fourth input event to the second application after receiving the fourth input event sent by the input management service; the fourth input event is generated by the input management service based on the first user operation.
[0068] In one possible design, if the first application determines that the first user operation successfully matches the second target operation type in the second operation type set, the first application may also send a second message to the second application; the second message is used to notify the first user operation that it successfully matches the second target operation type, or the second message is used to notify the first user operation that it is an operation performed for the second application.
[0069] In one possible design, the method further includes: based on the first input event and the second input event, the first application determines that the first user operation does not match the operation type in the first operation type set and the second operation type set, and the first application sends the second input event to the second application.
[0070] In one possible design, if the first application determines that the first user action does not match the action type in the first action type set and the second action type set, the first application may further perform the following steps:
[0071] The first application receives a fifth input event from the input management service; the fifth input event is generated by the input management service based on the first user operation; if the first application determines that the first user operation successfully matches a first target operation type in the first operation type set based on the first input event, the second input event, and the fifth input event, the first application executes a third processing action based on the fifth input event and sends the first message to the second application; or, if the first application determines that the first user operation successfully matches a second target operation type in the second operation type set based on the first input event, the second input event, and the fifth input event, the first application sends the fifth input event to the second application.
[0072] In one possible design, the first application may also match the first user operation with the operation types in the first operation type set and the second operation type set, respectively, based on the first input event and the second input event.
[0073] In one possible design, the first application can match the first user action with the operation types in the first operation type set and the second operation type set, respectively, based on the first input event and the second input event, in the following way:
[0074] Method 1: The first application determines the predicted operation type of the first user operation based on the event information of the first input event and the event information of the second input event; the first application matches the predicted operation type of the first user operation with the operation types in the first operation type set and the second operation type set, respectively;
[0075] Method 2: The first application determines whether the event information of the first user operation matches the event characteristics corresponding to the target operation type based on the event information of the first input event and the event information of the second input event; if the event information of the first user operation matches the event characteristics corresponding to the target operation type, the first application determines that the first user operation matches the target operation type; if the event information of the first user operation does not match the event characteristics corresponding to the target operation type, the first application determines that the first user operation does not match the target operation type.
[0076] The target operation type is any operation type in the first operation type set or the second operation type set; the event information includes at least one of the following: input device type, event type, reporting location, and timestamp.
[0077] In one possible design, the second set of operation types has a higher priority than the first set of operation types; the first application prioritizes matching the first user operation with the operation types in the second set of operation types.
[0078] In one possible design, if the first application determines that the first user operation successfully matches the first target operation type in the first operation type set, before the first application executes the first processing action based on the second input event, the first application may also determine, based on the first component layout information, that the reporting position of the first input event is located within the control area of the first target component corresponding to the first target operation type; wherein, the first component layout information is used to indicate the layout of the at least one first component in the window.
[0079] In one possible design, if the first application determines that the first user operation successfully matches the second target operation type in the second operation type set, before the first application sends the second input event to the second application, the first application may also determine, based on the location information of the first area and the layout information of the second component, that the reporting position of the first input event is located within the control area of the second target component corresponding to the second target operation type; wherein, the location information of the first area is used to indicate the position of the first area within the window, and the layout information of the second component is used to indicate the layout of the at least one second component in the first area.
[0080] In one possible design, the first application may also receive the layout information of the second component from the second application.
[0081] In one possible design, the first application can also send the location information of the first region to the second application.
[0082] In one possible design, the first application can perform the first processing action based on the first target operation type, the event information of the second input event, and the first component layout information; wherein the event information includes at least one of the following: input device type, event type, reporting location, and timestamp; the first component layout information is used to indicate the layout of the at least one first component in the window.
[0083] In one possible design, the first application may also send the first input event to the second application and receive the second set of operation types from the second application.
[0084] In one possible design, the at least one first component is a component in the display content of the first application within a first location range; the first location range includes the reporting position of the first input event; the at least one second component is a component in the display content of the second application within a second location range; the second location range includes the reporting position of the first input event; wherein the first location range is larger than the second location range.
[0085] Fourthly, embodiments of this application provide an input event processing method, which can be applied to an electronic device, the electronic device including an input management service, a first application, and a second application, the method including the following steps:
[0086] The second application receives a first input event from the first application; wherein the first input event is the first input event generated by the input management service based on a first user operation performed within the window of the first application; the location of the first input event is located in a first area of the window; the first area displays the content of the second application; the second application determines a second operation type set based on at least one second component; wherein the at least one second component is a component in the first area; the second operation type set contains at least one second operation type, which is used to control the at least one second component; the second application sends the second operation type set to the first application; the second application receives a first message from the first application and stops processing the input event of the first user operation based on the first message; wherein the first message is used to instruct the second application to stop processing the input event of the first user operation; or, the second application receives a second input event from the first application; the second input event is generated by the input management service based on the first user operation.
[0087] In one possible design, after the second application receives the second input event from the first application, the second application can also match the first user operation with the operation type in the second operation type set based on the first input event and the second input event; when it is determined that the first user operation successfully matches the second target operation type in the second operation type set, a fourth processing action is executed based on the second input event.
[0088] In one possible design, the second application may also receive a second message from the first application; the second message notifies the first user operation that it successfully matches a second target operation type in the second operation type set; or the second message is used to notify the first user operation that it is an operation performed by the user for the second application.
[0089] In one possible design, the second application can match the first user action with the action type in the second action type set based on the first input event and the second input event:
[0090] Method 1: The second application determines the predicted operation type of the first user operation based on the event information of the first input event and the event information of the second input event; the second application matches the predicted operation type of the first user operation with the operation types in the second operation type set;
[0091] Method 2: The second application determines, based on the event information of the first input event and the event information of the second input event, whether the event information of the first user operation matches the event characteristics corresponding to the target operation type in the second operation type set; if the event information of the first user operation matches the event characteristics corresponding to the target operation type, the second application determines that the first user operation matches the target operation type; if the event information of the first user operation does not match the event characteristics corresponding to the target operation type, the second application determines that the first user operation does not match the target operation type.
[0092] The event information includes at least one of the following: input device type, event type, reporting location, and timestamp.
[0093] In one possible design, before the second application executes the fourth processing action based on the second input event, the second application may also determine, based on the location information of the first area and the layout information of the second component, that the reporting position of the first input event is located within the control area of the second target component corresponding to the second target operation type; wherein, the location information of the first area is used to indicate the position of the first area within the window, and the layout information of the second component is used to indicate the layout of the at least one second component in the first area.
[0094] In one possible design, the second application can perform the fourth processing action based on the second target operation type, the event information of the second input event, the location information of the first area, and the layout information of the second component; wherein the event information includes at least one of the following: input device type, event type, reporting location, and timestamp; the location information of the first area is used to indicate the position of the first area within the window, and the layout information of the second component is used to indicate the layout of the at least one second component in the first area.
[0095] In one possible design, the second application may also perform a fifth processing action based on the fourth input event received from the first application; the fourth input event is generated by the input management service based on the first user's operation.
[0096] In one possible design, the second application may also receive location information from the first application regarding the first region; wherein the location information of the first region is used to indicate the position of the first region within the window.
[0097] In one possible design, the second application may also send the second component layout information to the first application; wherein the second component layout information is used to indicate the layout of the at least one second component in the first region.
[0098] In one possible design, the at least one second component is a component in the display content of the second application within a second location range; the second location range includes the reporting location of the first input event.
[0099] Fifthly, embodiments of this application provide an electronic device including a display screen, one or more processors, and a memory; the display screen is used to display a user interface, the one or more processors are coupled to the memory, and the one or more processors are used to read a computer program stored in the memory to execute the method provided in any aspect. The computer program code includes computer instructions.
[0100] Sixthly, embodiments of this application provide a chip including a processor coupled to a memory. The processor is used to call computer program instructions stored in the memory during runtime to implement the methods provided in any of the above aspects. Optionally, the chip may further include components such as a memory, a communication interface, and a power supply module. The memory is used to store computer programs; the communication interface is used to receive and send data; and the power supply module is used to supply power to the processor.
[0101] In a seventh aspect, embodiments of this application provide a computer storage medium storing computer program instructions that, when executed on an electronic device, cause the computer to perform the methods provided in any of the above aspects.
[0102] Eighthly, embodiments of this application provide a computer program product comprising computer program instructions; when the computer program instructions are executed on a computer, the computer performs the method provided in either aspect.
[0103] The technical effects achievable in the third aspect above can be referenced to the description of the technical effects achievable by any possible design in the first aspect above; the technical effects achievable in the fourth aspect above can be referenced to the description of the technical effects achievable by any possible design in the second aspect above. The technical effects achievable in any of the fifth to eighth aspects above can be referenced to the description of the technical effects achievable by any possible design in the first and second aspects above, and any repetitions will not be discussed. Attached Figure Description
[0104] Figure 1 This is a schematic diagram of the structure of an electronic device provided in an embodiment of this application;
[0105] Figure 2 A software structure diagram of an electronic device provided in an embodiment of this application;
[0106] Figure 3A A schematic diagram illustrating an example of one application launching another application to provide services, as provided in this application embodiment;
[0107] Figure 3B A schematic diagram illustrating an example of one application launching another application to provide services, as provided in this application embodiment;
[0108] Figure 4 A flowchart illustrating an input event processing method provided in an embodiment of this application;
[0109] Figure 5 A schematic diagram of an operation type tree provided in an embodiment of this application;
[0110] Figure 6A A flowchart illustrating an input event processing method provided in an embodiment of this application;
[0111] Figure 6B An example diagram illustrating an input event processing method provided in an embodiment of this application;
[0112] Figure 7 A flowchart illustrating an input event processing method provided in an embodiment of this application;
[0113] Figure 8 A schematic diagram illustrating an input event processing method provided in an embodiment of this application;
[0114] Figure 9 An example diagram illustrating an input event processing method provided in an embodiment of this application;
[0115] Figure 10 This is a structural diagram of an electronic device provided in an embodiment of this application. Detailed Implementation
[0116] This application provides an input event processing method and an electronic device for ensuring event consumption efficiency and resolving event conflicts in interface expansion scenarios. The method and electronic device are based on the same technical concept. Since the methods and electronic devices solve problems based on similar principles, their implementations can be mutually referenced, and repeated details will not be elaborated further.
[0117] The following explanations of some terms used in this application are provided to facilitate understanding by those skilled in the art.
[0118] 1) Electronic equipment refers to devices or apparatuses that have data connectivity, data calculation, and processing capabilities. Generally, electronic equipment has a display screen capable of showing a user interface.
[0119] For example, the electronic device in this application may be a tablet computer, personal computer (PC), laptop computer, computer, netbook, in-vehicle computer, in-vehicle terminal, smartphone, smart wearable device (e.g., smartwatch, smart bracelet, smart glasses, smart helmet, etc.), personal digital assistant (PDA), smart home device (e.g., smart TV, smart mirror, smart speaker, etc.). This application does not limit the specific form of the electronic device.
[0120] Electronic devices can perform their functions and provide services to users through an operating system they run. For example, the electronic device may, but is not limited to, running an operating system... Or other operating systems.
[0121] 2) An application (APP) is installed on an electronic device and provides services to the user through specific business logic after it runs. Applications can be developed by the electronic device manufacturer, the operating system vendor, or a third-party application vendor; this application does not limit the scope of the application. Applications can also be called application programs, application software, etc.
[0122] For example, applications can include: various drawing applications, calling applications, camera applications, SMS applications, chat applications, video applications, music applications, electronic map applications, social applications, etc.
[0123] 3) Service users and service providers.
[0124] In a scenario where one application launches another to provide a service, the service user is the application that initiated the launch process, while the service provider is the application that was launched and provides services to the initiator. The service provider's content is embedded in the service user's window, expanding the interface. Therefore, the service user can also be called the host application, or simply the host.
[0125] 4) Process.
[0126] A process is a running activity of a program with certain independent functions on a specific set of data. A process is an independent unit for resource allocation and scheduling by the operating system. For example, when an application runs, an electronic device launches the corresponding process for that application. process, process.
[0127] It should be noted that different processes can communicate with each other, i.e., cross-process communication. Currently, cross-process communication methods include, but are not limited to, inter-process communication (IPC) and binder.
[0128] 5) Components.
[0129] A component is a reusable object in software that can interact with other objects. It can be implemented through classes; that is, a component is a reusable program or module.
[0130] Components may include those with user interface functionality or visual representation. At least one component may be laid out in a user interface, window, or page.
[0131] It should be understood that components can be nested. For example, a container component can display multiple components; these multiple components may include, for example, a confirmation component and a cancellation component.
[0132] In some examples, the confirmation component can also be called the confirmation control, and the cancellation component can also be called the cancellation control.
[0133] In some examples, the component can also be an image component or a text component.
[0134] In some examples, a container class component may contain image components and / or text components. For instance, a container class component may display editable or readable text components, or image components for the user to view. Alternatively, a container class component may display both image and text components.
[0135] It should be noted that for each type of component, users can control it through corresponding user operations. That is, each type of component has a corresponding operation type, and the operation types may differ between different types of components. For example, users can perform user operations on a component to scale, rotate, or move it, thereby managing the component; or they can perform user operations on a component to trigger corresponding processing actions, thus controlling the component.
[0136] Additionally, it should be noted that each component in the user interface has a corresponding control area to determine whether the user's operation has hit that component. It should be explained that the control area for each component can be the area occupied by that component, or it can include the area occupied by that component; the specific setting can be determined according to the actual situation.
[0137] 6) User actions and input events. User actions are operations performed by a user on an electronic device based on a specific user intent, in order to enable the electronic device to perform a target task. These actions are typically triggered by a combination of one or more input events. Input events are information generated by the electronic device's system services based on physical operation signals captured at the underlying level during the user's actions.
[0138] This application does not limit the type and triggering method of user operations. Optionally, user operations can be operations performed by the user through input devices such as mice, handwriting input tablets, and gamepads connected to the electronic device, such as: single-click operations, double-click operations, right-click operations, drag operations, etc.; or they can be touch operations performed by the user through their fingers or styluses on the touch sensors of the electronic device (such as touch screens, touchpads, etc.), such as: click operations, long-press operations, swipe operations, drag operations, pinch operations, rotation operations, multi-click operations, and swipe operations, etc.
[0139] For example, when a user performs a user action using a mouse, the input events captured by the underlying electronic device may include the following mouse events: click event, double-click event, mousedown event, mouseup event, mousemove event, right-click event (contextmenu), etc. For instance, when a user performs a single click action using the mouse, the electronic device may capture the following input events sequentially: mousedown event -> mouseup event -> click event.
[0140] For example, when a user performs a user operation via a touchscreen, the input events captured by the underlying electronic device may include the following touch events: finger down (touchstart or action_down) event, finger move (touchmove or action_move) event, finger up (touchend or action_up) event, and gesture events, etc. For instance, during a single touch operation, the electronic device may sequentially acquire the following input events: finger down (action_down) event -> multiple finger move (action_move) events -> finger up (action_up) event.
[0141] It should also be noted that when the system service of the electronic device generates input events based on the user's operation information, it can also generate event information for those input events. The event information for each input event describes the attributes of that input event. For example, the event information may include, but is not limited to, at least one of the following:
[0142] Input device type indicates the type of input device used to perform the user operation.
[0143] An operation identifier is used to identify the user operation to which an input event belongs. Throughout the entire process of a user operation, this operation identifier remains the same across all input events generated by the electronic device based on that user operation.
[0144] Event type, used to describe the type of input event, such as the input event in the example above.
[0145] The reporting position describes the location (e.g., a touch point) of a user's action on the display screen of an electronic device when an input event is generated. For example, the reporting position can be the coordinates of the action location in a defined coordinate system. This defined coordinate system may include the screen coordinate system, the coordinate system of the visible view area (e.g., the user interface or window) on the display screen, etc.
[0146] A timestamp is used to indicate when an input event was generated.
[0147] Motion information is used to describe the relative position (such as orientation and / or distance) between the reported position of the motion event and the reported position of the previous input event when the input event is a motion event.
[0148] Optionally, when the input event is a touch event, the event information of the input event may also include pressure sensitivity data, temperature, and other information.
[0149] In summary, this application does not limit the content of the event information of the input event.
[0150] It should be understood that in the embodiments of this application, "at least one" means one or more, and "more than one" means two or more. "And / or" describes the relationship between related objects, indicating that three relationships can exist. For example, A and / or B can represent: A alone, A and B simultaneously, or B alone, where A and B can be singular or plural. The character " / " generally indicates that the preceding and following related objects are in an "or" relationship. "At least one of the following" or similar expressions refer to any combination of these items, including any combination of single or plural items. For example, at least one of a, b, or c can represent: a, b, c, a and b, a and c, b and c, or a, b, and c, where a, b, and c can be single or multiple.
[0151] In the embodiments of this application, descriptions such as "when," "under the circumstances," "if," and "if" all refer to the electronic device making corresponding processing under certain objective circumstances. They are not time limits, nor do they require the electronic device to make a judgment action when implementing it, nor do they imply any other limitations.
[0152] It should be noted that in this application, "used for indicating" can include both direct and indirect indication. When describing information as being used to indicate A, it can include whether the information directly or indirectly indicates A, but does not necessarily mean that the information contains A. Taking first information used to indicate first content as an example, the first information can contain the first content, or a part of the first content, or an identifier, index, indicator, etc., of the first content, and can also contain algorithms, calculation parameters, etc., for determining the first content. This application does not limit the manner of "indication".
[0153] In this application, "containing / including A" may be equivalent to "containing / including information A". Information A is used to indicate A.
[0154] In addition, it should be understood that in the description of this application, the words "first" and "second" are used only for the purpose of distinguishing descriptions and should not be construed as indicating or implying relative importance or order.
[0155] The solutions provided in the embodiments of this application will be described in detail below with reference to the accompanying drawings.
[0156] This application provides an electronic device that can implement the input event processing method provided in this application. See below for reference. Figure 1 The structure of the electronic device provided in the embodiments of this application will be described.
[0157] like Figure 1As shown, the electronic device 100 may include: a processor 110, an external memory interface 120, an internal memory 121, a universal serial bus (USB) interface 130, a charging management module 140, a power management module 141, a battery 142, an antenna 1, an antenna 2, a mobile communication module 150, a wireless communication module 160, an audio module 170, a speaker 170A, a receiver 170B, a microphone 170C, a headphone jack 170D, a sensor module 180, buttons 190, a motor 191, an indicator 192, a camera 193, a display screen 194, and a SIM card interface 195, etc.
[0158] Processor 110 may include one or more processing units, such as a central processing unit (CPU), application processor (AP), modem processor, graphics processing unit (GPU), image signal processor (ISP), controller, video codec, digital signal processor (DSP), baseband processor, and / or neural network processing unit (NPU). These different processing units may be independent devices or integrated into one or more processors.
[0159] The processor 110 may also include a memory for storing instructions and data. In some embodiments, the memory in the processor 110 is a cache memory. This memory can store instructions or data that the processor 110 has just used or that are used repeatedly. If the processor 110 needs to use the instruction or data again, it can retrieve it directly from this memory. By providing memory, the number of times the processor 110 accesses data in the internal memory 121 can be reduced, thus reducing the processor 110's waiting time and improving system efficiency.
[0160] Display screen 194 is used to display various user interfaces. Display screen 194 includes a display panel. The display panel may be a liquid crystal display (LCD), an organic light-emitting diode (OLED), an active-matrix organic light-emitting diode (AMOLED), a flexible light-emitting diode (FLED), a Miniled LED, a MicroLED, a Micro-OLED, a quantum dot light-emitting diode (QLED), etc. In some embodiments, electronic device 100 may include one or N displays screens 194, where N is a positive integer greater than 1. Display screen 194 can be used to display information input by the user or information provided to the user, as well as various graphical user interfaces (GUIs). For example, display screen 194 may display windows, photos, videos, web pages, or documents, etc.
[0161] Internal memory 121 can be used to store computer executable program code, which includes instructions. Processor 110 executes various functional applications and data processing of electronic device 100 by running the instructions stored in internal memory 121. Internal memory 121 may include a program storage area and a data storage area. The program storage area may store the operating system, program code for at least one application, etc. The operating system may include, but is not limited to, […]. The program storage area can store computer programs for implementing the input event processing method provided in the embodiments of this application. When the processor 110 executes these computer programs, the electronic device can execute the input event processing method. The data storage area can store data created during the use of the electronic device 100.
[0162] In addition, the internal memory 121 may include high-speed random access memory, and may also include non-volatile memory, such as at least one disk storage device, flash memory device, universal flash storage (UFS), etc.
[0163] The sensor module 180 may include, but is not limited to, fingerprint sensors, touch sensors, pressure sensors, magnetic sensors, ambient light sensors, barometric pressure sensors, bone conduction sensors, etc.
[0164] A touch sensor, also known as a "touch panel," can be located on the display screen 194. The touch sensor detects touch operations applied to or near it. It transmits the detected touch operation to an application processor to determine the type of touch event. Visual output related to the touch operation can be provided through the display screen 194. In some embodiments, the touch sensor can be integrated with the display screen 194 to form a touch display. In other embodiments, the touch sensor may be located on the surface of the electronic device 100, in a different position than the display screen 194.
[0165] The wireless communication function of electronic device 100 can be implemented through antenna 1, antenna 2, mobile communication module 150, wireless communication module 160, modem processor, and baseband processor. Antenna 1 and antenna 2 are used to transmit and receive electromagnetic wave signals. Mobile communication module 150 can provide wireless communication solutions for electronic device 100, including 2G / 3G / 4G / 5G. Wireless communication module 160 can provide wireless communication solutions for electronic device 100, including wireless local area networks (WLAN) (such as wireless fidelity (Wi-Fi) networks), Bluetooth (BT), global navigation satellite system (GNSS), frequency modulation (FM), near field communication (NFC), and infrared (IR) technologies.
[0166] In this embodiment, the electronic device 100 can connect to peripheral devices via USB interface 130 or other interfaces; the electronic device 100 can also establish a wireless connection with peripheral devices via wireless communication module 160. For example, peripheral devices may include, but are not limited to, input devices such as keyboards, mice, gamepads, handwriting input tablets, remote controls, joysticks, etc.; output devices such as extended screens, speakers, printers, etc.; cameras, external storage devices, etc.
[0167] It should be understood that Figure 1 The electronic device 100 shown is merely an example and does not constitute a limitation on the electronic device. In practical applications, the electronic device 100 may have more or fewer components than those shown in the figure, may combine two or more components, or may have different component configurations. The various components shown in the figure may be implemented in hardware, software, or a combination of hardware and software, including one or more signal processing and / or application-specific integrated circuits.
[0168] The software system of the electronic device 100 provided in this application embodiment can adopt a layered architecture, event-driven architecture, microkernel architecture, microservice architecture, or cloud architecture. This application embodiment takes a layered architecture as an example. Figure 2 The software structure of an electronic device is illustrated by example.
[0169] A layered architecture divides the software within an electronic device into several layers, each with a clear role and function. Layers can communicate with each other through software interfaces. For example... Figure 2 As shown, the software architecture of an electronic device, from top to bottom, includes at least: an application layer, a system service layer, a kernel layer, and a hardware abstraction layer (HAL). Additionally, an electronic device may include a hardware layer to provide hardware resource support.
[0170] The application layer is the top layer of the operating system, including the operating system's native applications and installed third-party applications, such as camera, gallery, calendar, Bluetooth, music, video, messaging, calculator, chat applications, video applications, music applications, electronic map applications, social applications, and so on.
[0171] The system service layer is an important part of the operating system of an electronic device, including various system services provided by the operating system. For example, the system service layer may include: window management service, operation management service, notification management service, layer management service, input management service, etc.
[0172] The window management service manages the display and configuration of the window library. Based on display settings and multiple management functions, it controls the display of windows or interfaces on the screen, adjusting their transparency, position, and size. It also includes features such as screen locking and screenshot capabilities. The window management service can obtain parameters such as screen size and resolution, and can identify display areas in the user interface, such as the status bar.
[0173] The operation and management service is responsible for starting, switching, and scheduling various components in the system, as well as managing and scheduling applications.
[0174] Notification management services allow applications to display notification information in the status bar, as well as to convey informational messages. These messages can disappear automatically after a short pause, without requiring user interaction.
[0175] The input management service is used to collect, process, and distribute user operation information and input events. For example, after receiving operation information reported by touch drivers or other input device drivers (such as keyboard drivers, mouse drivers, etc.), the input management service can convert it into input events and distribute the input events to other modules for processing. For instance, when a user performs a user operation on an application, the input management service can generate an input event based on the received user operation information and distribute the input event to the application.
[0176] Layer management service is a standalone service provided by the operating system of an electronic device. It is a low-level, resident service of the operating system. During device operation, this layer management service needs to run continuously, and the operating system prioritizes allocating resources to it to ensure that it can perform image compositing at any time, thereby ensuring that the electronic device can display the user interface in real time. The layer management service is mainly responsible for the creation, control, and management of layers. It composites and renders the image frames of the corresponding window in each layer, and finally combines the graphic frames from all layers into the image of the user interface to be displayed on the screen.
[0177] Optionally, between the application layer and the system service layer, the software architecture of the electronic device may also include an application framework layer (FWK) (not shown in the figure). The application framework layer provides application programming interfaces (APIs) and programming frameworks for applications in the application layer. The application framework layer may include some predefined functions. For example, the application framework layer may include a content provider, a view system, a phone manager, a resource manager, etc. The content provider is used to store and retrieve data, making this data accessible to applications in the application layer. The view system includes visual components, such as components that display text, images, documents, etc.; components in the view system can be used to build the user interface of the application. The phone manager is used to provide communication functions for the electronic device.
[0178] The kernel layer provides the core system services of the operating system, such as security, memory management, process management, network protocol stack, and driver models, all of which are implemented based on the kernel layer. The kernel layer also serves as an abstraction layer between the hardware and software stacks. This layer contains many drivers related to electronic devices, including: display drivers; keyboard drivers; mouse drivers; Flash drivers for memory-based devices; camera drivers; audio drivers; Bluetooth drivers; WiFi drivers; and touch drivers.
[0179] Hardware Image Processing (HAL) is an interface layer located between the operating system kernel and the hardware circuitry of an electronic device. Its purpose is to abstract the hardware into standardized interfaces. Through this abstraction, upper-layer software of the operating system (such as kernel modules or drivers) does not need to directly manipulate the hardware; they only need to call the standardized interfaces in the HAL to complete their functions. For example, the HAL may include a hardware composer (HWC) and other standardized interfaces. Among them, the HWC is mainly responsible for using the image processor and other hardware resources to composite and display images in the layers, realizing the display of the user interface.
[0180] The hardware layer is located at the bottom layer of electronic devices and may include, but is not limited to, various hardware resources such as processors, sensors, displays, cameras, hard drives, mice, and keyboards.
[0181] It should be noted that, Figure 2 This is merely an example of the software architecture of an electronic device, simply listing some layers and software modules, and does not constitute any limitation on the software architecture of the electronic device. In practical applications, the operating system of an electronic device may include other layers, or each layer may include other software modules for implementing one or more functions or services. Furthermore, this application does not limit the specific layer where each software module resides. For example, some system services in the system service layer may be deployed in the application framework layer or in the kernel layer.
[0182] Furthermore, this application does not specifically limit the names of the various software modules in the software structure. For example, in In operating systems, the window management service can be WindowManagerServer (WMS), the layer management service can be the layer management engine (SurfaceFlinger), and the input management service can be InputManagerService. InputManagerService can include modules such as input management (InputManager), event hub (EventHub), and input dispatcher (InputDispatcher). operating system( In an OS, the window management service can be SceneBoard (SCB), the layer management service can be RenderService (RS), and the input management service can be Multimodal Input Service (INPUT).
[0183] The multimodal input service aims to support developers in providing users with a rich variety of human-computer interaction methods. Building upon its continuous improvement in supporting traditional input methods, the multimodal input service leverages the distributed advantages of OpenHarmony to enhance cross-device interaction experiences and provide system-level support for new scenarios and businesses. The input component of the multimodal input service adopts the OpenHarmony system-level input event management framework, connecting southbound to various input devices (touchscreens, mice, keyboards, remote controls, gamepads, etc.). It aggregates various input events (keyboard events, touch events, mouse events, etc.), processes them through normalization / standardization, and then distributes them to other system services or applications.
[0184] Electronic devices support one application launching another to provide services. Taking the example of a first application launching a second application, the first application can launch the second application through an internal component, thereby embedding the second application's display content within the first application's window and expanding the interface. The second application's display content runs through its own process; the first application's process does not participate in the layout and rendering of the second application's display content.
[0185] For example, when a user sets a profile picture, posts a message containing photos, or creates a video in a social media app, the user can activate the photo gallery app, displaying its content within the social media app's window. This allows the user to choose from multiple images or videos. Figure 3A As shown in (a), in the window of the social application, the user clicks the icon of the gallery application; in response to the user's click, the social application can launch the gallery application and embed and display the content of the gallery application in the window. This content may include pictures or videos saved in the gallery application for the user to select, such as... Figure 3A As shown in (b) of the diagram. Wherein, in Figure 3A In the user interface shown in (b), the dashed box represents the content displayed by the gallery application, and the area outside the dashed box represents the content displayed in the window of the social application.
[0186] For example, such as Figure 3B As shown in (a), when a user needs to open a document sent by another user while using a chat application, the user can click on the document icon displayed in the chat application window. In response to the user's click, the chat application can launch a document editor and embed the content of the document editor into the chat application window, so that the document can be opened within the content displayed in the document editor. See [reference needed]. Figure 3B As shown in (b) of the diagram.
[0187] In the scenario described above where the first application initiates the second application to provide services, the first application is the service user, and the second application is the service provider.
[0188] In the above-mentioned interface extension scenario, when a user performs a user operation in the area where the display content of the second application is displayed in the window of the first application (hereinafter referred to as the interface extension area), the electronic device can use a synchronous event consumption mechanism or an asynchronous event consumption mechanism to complete the event consumption, thereby enabling the electronic device to complete the processing process corresponding to the user operation and realize the user's operation intention.
[0189] As explained in point 6) above regarding the terminology of user operations and input events, during a user's execution of an operation, the electronic device can trigger a series of input events. If the electronic device adopts a synchronous event consumption mechanism, the first application needs to send each input event reported by the input management service to the second application first, and then decide whether to consume the input event after receiving the consumption result from the second application. This increases the consumption latency of each input event, resulting in low efficiency in the electronic device's input event consumption and ultimately increasing the performance overhead of the electronic device. If the electronic device adopts an asynchronous event consumption mechanism, the first application sends each input event reported by the input management service to the second application, and then the first and second applications can consume events in parallel. This may cause the two applications to execute the processing or response corresponding to the input event simultaneously, resulting in event conflict issues.
[0190] Based on this, in order to ensure event consumption efficiency and avoid event conflicts in interface extension scenarios, embodiments of this application provide an input event processing method, such as... Figure 4 As shown. This method can be applied to, for example... Figure 1 The electronic device shown can have a software structure as follows: Figure 2 As shown. In this embodiment, the software system in the electronic device may include: an input management service, a first application, and a second application.
[0191] The following is a description of some terms used in the embodiments of this application:
[0192] The first application and the second application are any applications installed on the electronic device, with the first application being the service provider and the second application being the service user, respectively. That is, the first application is the service provider and the second application is the service user; or the first application is the service user and the second application is the service provider.
[0193] The first window is the window for the service user.
[0194] The first area is the area within the first window used to display the content provided by the service provider; that is, the extended interface area within the first window.
[0195] The first user action is the user action performed within the first window.
[0196] The first input event, second input event, third input event, fourth input event, and fifth input event are input events generated by the input management service based on the first user's operation. For ease of description, the above-mentioned input events generated based on the first user's operation can also be collectively referred to as input events corresponding to the first user's operation, or input events of the first user's operation. In the subsequent description of the embodiments of this application, "input events corresponding to the first user's operation" and "input events of the first user's operation" can be replaced with "input events generated based on the first user's operation," and other similar descriptions are the same.
[0197] The first processing action is the result of the first application consuming the second input event, that is, the action performed by the first application based on the second input event.
[0198] The second processing action is the result of the first application consuming the third input event, that is, the action performed by the first application based on the third input event.
[0199] The third processing action is the result of the second application consuming the second input event, that is, the action performed by the second application based on the second input event.
[0200] The fourth processing action is the result of the second application consuming the fourth input event, that is, the action performed by the second application based on the fourth input event.
[0201] The fifth processing action is the result of the first application consuming the fifth input event, that is, the action performed by the first application based on the fifth input event.
[0202] See below. Figure 4 The flowchart shown below provides a detailed description of the embodiments of this application.
[0203] In a scenario where the service user initiates a service provider's activity, the electronic device can display a first window containing a first area on the screen. This first window is the service user's window, and the first area displays the service provider's content.
[0204] In this embodiment of the application, since the content displayed by the service provider can be displayed in the first area of the first window of the service user, the interface is extended. Therefore, the first area can be called the interface extension area.
[0205] Taking a first application as the service provider and a second application as the service user as an example: When a user needs to launch the first application within the window of the second application (i.e., the first window), they can perform a second user operation within the first window. The input management service in the electronic device can generate a corresponding input event based on the second user operation and report it to the second application. Upon receiving the input event, the second application can launch the first application based on the input event, embedding a virtual window of the first application within the first window to display the content of the first application, thus enabling the first application to provide services to the second application. This virtual window of the first application is not an independent window but a specific display area within the second application's window to display the content of the first application. Optionally, upon receiving the input event, the second application can create a component within the first window to display the content of the first application (i.e., the virtual window of the first application).
[0206] It should also be noted that an application acting as a service user can launch one or more applications, meaning that the service provider of the service user can be one or more. For example, in the first window of this application embodiment, one or more virtual windows of applications can be embedded, that is, the first window contains multiple interface extension areas that can display the display content of other applications, which is not limited in this application.
[0207] S401: When a user performs a first user operation within the first window, the input management service in the electronic device generates a first input event based on the first user operation; wherein, the first input event is the first input event generated by the input management service based on the first user operation, and the reporting position of the first input event is located within the first area. The input management service sends the first input event to the first application. The first application receives the first input event from the input management service.
[0208] In this embodiment of the application, the input management service can adopt two input event reporting methods:
[0209] Method 1: The input management service will generate all input events based on user operations and report them to the service user (i.e., the application to which the first window belongs).
[0210] In this embodiment of the application, when the input management service adopts Method 1, the input management service can report the first input event to the first application, which is the service user, during S401. In this case, after receiving the first input event, the first application determines whether the reported location of the first input event is located in the first area. If it is located in the first area, the method provided in this embodiment of the application is executed, and subsequent steps are performed; if it is not located in the first area, the traditional event handling method is executed.
[0211] Method 2: The input management service determines which application to report based on the location of the first input event triggered by the user's action. Optionally, when the input management service determines that the location of the first input event is within the area of the first window displaying the service provider's content, the input management service reports the first input event to the service provider and also reports all subsequent input events generated based on that user action to the service provider; when the input management service determines that the location of the first input event is within the area of the first window displaying the service user's content, the input management service reports the first input event to the service user and also reports all subsequent input events generated based on that user action to the service user.
[0212] In the case where the input management service adopts this method 2 in the embodiment of this application, when the input management service executes S401, it can report the first input event to the first application as the service provider when it is determined that the reporting location of the first input event is located in the first area.
[0213] It should be noted that the embodiments of this application do not limit the type of operation of the first user operation. For example, the first user operation can be a user operation performed by the user through an input device such as a mouse, handwriting input tablet, or gamepad connected to the electronic device, such as: single click, double click, right click, drag, etc.; it can also be a touch operation performed by the user with a finger or stylus on the touch sensor of the electronic device (such as a touch screen, touchpad, etc.), such as: click, long press, swipe, drag, pinch, rotate, multi-click, swipe, etc.
[0214] Optionally, in this embodiment, the input management service can receive operation information of user operations reported by the kernel layer driver; and generate input events based on the currently received operation information of user operations. It should be noted that the kernel layer driver can collect and report user operation information multiple times during the user's execution of user operations; therefore, the input management service can generate input events based on the operation information of each received user operation. The first input event, second input event, and other input events involved in this embodiment can all be generated through the above process.
[0215] The driver that reports the operation information varies depending on how the user performs the operation. For example, if the user performs the first operation within the first window displayed on the screen (touchscreen) using their finger or stylus, the operation information is sent to the input management service by the touch driver after receiving sensor data from the touch sensor. As another example, if the user performs the first operation within the first window using an input device such as a mouse, the operation information is generated by the driver of the corresponding input device (e.g., the mouse driver) and sent to the input management service.
[0216] Furthermore, this application does not limit the operation information of user operations. For example, the operation information of user operations may include, but is not limited to, at least one of the following: input device type, operation location, operation time, type of component or operation data of the component performing the user operation, and sensor data collected by sensors, etc. The specific content included in the operation information of user operations will vary depending on factors such as the type of input device used by the user to perform the user operation and the method of user operation (click, drag, button, etc.).
[0217] S402: The first application determines a first operation type set based on at least one first component. The at least one first component is a component displayed in the first application within a first window; the first operation type set includes at least one first operation type, which is used to control the at least one first component.
[0218] Since the first user operation is performed within the first window, the user's intention in performing the first user operation may be to control components within the displayed content of the first application in the first window. Based on this, the first application determines the first operation type set through S402, which is the range of operation types predicted by the first application for the first user operation.
[0219] Since the probability of a first user operation controlling components near its operation location is relatively high, the first application can determine a first operation type set based on the components of the first application located near the operation location of the first user operation. This reduces redundant operation types in the first operation type set, thereby improving the efficiency of subsequently matching the first user operation with the operation types in the first operation type set. Therefore, in this embodiment, at least one first component in S402 is a component in the display content of the first application located within a first position range. The first position range includes the reporting position of the first input event, that is, the first position range is the hit area of the first input event in the display content of the first application. This application does not limit the shape and / or size of the first position range. Optionally, the geometric features such as the shape and / or size of the first position range may be related to the geometric features of the outline of the area occupied by the display content of the first application.
[0220] For example, when at least one first component within the first position range contains a vertical scrolling view (such as a ScrollView) component, the first operation type set determined by the first application may include a vertical swipe operation; when at least one first component contains a horizontal scrolling view (such as a HorizontalScrollView) component, the first operation type set may include a horizontal swipe operation; when at least one first component contains a list view (such as a ListView) component, the first operation type set may include a vertical swipe operation; when the at least one first component contains a button (such as a Button) component, the first operation type set may include a click operation; when the at least one first component contains a slider (such as a Slider) component, the first operation type set may include a drag operation.
[0221] Furthermore, since the reporting location of the first input event is within the first window, the user's intention to perform the first user operation may also be to control components within the display content of the second application within the first window. Therefore, the first application can also obtain the range of operation types predicted by the second application for the first user operation, i.e., obtain the set of second operation types. Based on this, the first application can obtain the range of operation types predicted by the second application for the first user operation through the following steps S403-S405.
[0222] S403: The first application sends a first input event to the second application. The second application receives the first input event from the first application.
[0223] S404: The second application determines a set of second operation types based on at least one second component. The at least one second component is a component displayed in the content of the second application in the first window; the set of second operation types includes at least one second operation type used to control the at least one second component.
[0224] Since the probability of a first user operation controlling components near its operation location is relatively high, similar to the first application determining the first operation type in S402 above, the second application can determine a second operation type set based on components of the second application located near the operation location of the first user operation. This reduces redundant operation types in the second operation type set, thereby improving the efficiency of subsequently matching the first user operation with the operation types in the second operation type set. Therefore, in this embodiment, at least one second component in S404 is a component in the display content of the second application located within a second position range. The second position range includes the reporting position of the first input event, i.e., the second position range is the hit area of the first input event in the display content of the second application. This application does not limit the shape and / or size of the second position range. Optionally, the geometric features such as the shape and / or size of the second position range may be related to the geometric features of the outline of the area occupied by the display content of the second application.
[0225] It should also be noted that within the first window, the service user's display content is located within the first window, while the service provider's display content is located within the first area of the first window. Clearly, the service user's display content occupies a larger area. Therefore, to ensure the accuracy of the service user's prediction of the range of operation types for the first user's actions, the service user, compared to the service provider, will predict the range of operation types for the first user's actions based on components within a larger location range. Accordingly, optionally, when the first application is the service provider and the second application is the service user, the second location range is larger than the first location range; when the first application is the service user and the second application is the service provider, the first location range is larger than the second location range.
[0226] Similar to the first set of operation types, when the at least one second component contains a certain component, the second set of operation types determined by the second application contains the operation types that can control the control. For details, please refer to the example description of the first set of operation types in S402 above.
[0227] Through S404, the second application can predict the range of operation types of the first user operation based on the components of the second application in the first window.
[0228] Optionally, in this embodiment, the second application may trigger the step of determining the second set of operation types based on the received first input event. Additionally, the second application may save the first input event so that when receiving other input events based on the first user operation later, the operation type of the first user operation can be determined based on all the received input events of the first user operation.
[0229] S405: The second application sends a second set of operation types to the first application. The first application receives the second set of operation types from the second application.
[0230] Through S402 and S405 described above, the first application can obtain the range of operation types predicted by the first application and the second application respectively, i.e., the first operation type set and the second operation type set, triggered by the first input event. Then, when the first application receives another input event generated based on the first user operation, it can match the first user operation with the operation types in the two operation type sets based on the received first user operation input event, thereby achieving operation attribution competition between the two applications and determining the target application of the first user operation (i.e., the application to which the user intends to perform the first user operation, or the application to which the first user operation belongs). In this way, the target application can perform processing actions based on the input event of the first user operation (i.e., consume the input event corresponding to the first user operation), and ultimately the target application can complete the processing action corresponding to the first user operation, realizing the user's intention to perform the first user operation.
[0231] The following is a detailed explanation of the specific steps involved in the first application performing this operation within the competition process.
[0232] S406: After S401, the user continues to perform the first user operation within the first window. The input management service continues to generate a second input event based on the first user operation and continues to send the second input event to the first application. The first application receives the second input event from the input management service.
[0233] Optionally, the second input event can be any other input event after the first input event (i.e., the first input event) generated based on the first user operation, and this application does not limit it.
[0234] S407: The first application matches the first user operation with the operation types in the first operation type set and the second operation type set based on the first input event and the second input event.
[0235] In S407, the first application can match the first user operation with the operation types in the first operation type set and the second operation type set based on the multiple input events (including the first input event and the second input event) received from the first user operation.
[0236] As described above, the first application executes S407 to determine the target application for the first user operation, through a competition between the first and second applications regarding the ownership of the first user operation. Therefore, to avoid event conflicts, the first operation type set and the second operation type set are mutually exclusive during the execution of S407. That is, the first application first matches the first user operation with an operation type from one of the operation type sets. If the first user operation fails to match an operation type from that set, it then matches the first user operation with an operation type from the other operation type set.
[0237] In one implementation, the first set of operation types and the second set of operation types have different priorities. The first application can execute S407 through the following steps:
[0238] The first application matches the first user operation with the operation type in the set of high-priority operation types based on the first input event and the second input event; if the first user operation fails to match the operation type in the set of high-priority operation types, the first application matches the first user operation with the operation type in the set of low-priority operation types.
[0239] The high-priority operation type set is the set of operation types with higher priority among the first operation type set and the second operation type set; the low-priority operation type set is the set of operation types with lower priority among the first operation type set and the second operation type set.
[0240] Optionally, since the reporting location of the first input event is within the first area, the probability that the target application of the first user operation is the service provider is relatively high. Based on this, in one implementation, the set of operation types determined by the application that is the service provider has a higher priority. For example, when the first application is the service provider, the priority of the first set of operation types is higher than the priority of the second set of operation types. In this way, the first application prioritizes matching the first user operation with the operation types in the first set of operation types, so that the first application can quickly determine whether it is the target application of the first user operation, and if it is the target application, process the input event corresponding to the first user operation as quickly as possible, improving the efficiency of the electronic device in consuming input events. For another example, when the second application is the service provider, the priority of the second set of operation types is higher than the priority of the first set of operation types. In another implementation, the priorities of each set of operation types can be pre-set in the operating system (or set by the system developers).
[0241] In this application embodiment, the first application may, but is not limited to, matching the first user operation with the operation type in the two operation type sets through the following two implementation methods:
[0242] Implementation method A1: The first application determines the predicted operation type of the first user operation based on the event information of the first input event and the event information of the second input event; then, the first application matches the predicted operation type of the first user operation with the operation types in the first operation type set and the second operation type set.
[0243] In implementation method A1: the first application can predict the operation type of the first user operation based on all the input events corresponding to the first user operation received, and then match the predicted operation type of the first user operation with the operation types in two operation type sets to determine the target application of the first user operation.
[0244] Implementation A2: The first application can iterate through the operation types in each operation type set, and determine whether all input events corresponding to the received first user operation match the event characteristics corresponding to the iterated operation type, thereby completing the matching between the first user operation and the operation type. Optionally, the first application may include the following steps during the execution of S407:
[0245] Step A2-1: The first application determines whether the event information of the first user operation matches the event characteristics corresponding to the target operation type based on the event information of the first input event and the event information of the second input event. The target operation type is any operation type in either the first operation type set or the second operation type set; the event information of any input event includes the event type and / or the reporting location.
[0246] For example, the first application can determine whether the event type of the first input event and the event type of the second input event conform to the event type pattern corresponding to the target operation type; or determine whether the reporting position of the first input event and the reporting position of the second input event conform to the event reporting position pattern corresponding to the target operation type.
[0247] For example, the first application can calculate the matching degree between the event information of the first user operation and the event features corresponding to the target operation type based on the event information of the first input event and the second input event; when the matching degree is greater than or equal to a set matching degree threshold, it is determined that the event information of the first user operation conforms to the event features corresponding to the target operation type; when the matching degree is less than the set matching degree threshold, it is determined that the event information of the first user operation does not conform to the event features corresponding to the target operation type.
[0248] Step A2-2: If the event information of the first user operation matches the event characteristics corresponding to the target operation type, the first application determines that the first user operation matches the target operation type.
[0249] Step A2-3: If the event information of the first user operation does not match the event characteristics corresponding to the target operation type, the first application determines that the first user operation does not match the target operation type.
[0250] In one implementation scenario, the first set of operation types and the second set of operation types can be represented as an operation type tree. That is, the first set of operation types is a first operation type tree, and the second set of operation types is a second operation type tree. Each node in the first operation type tree represents the operation type corresponding to a first component in the first set of operation types. For example, in... Figure 5 In (a), node 1.1 in the first operation type tree represents the operation type corresponding to component a1; similarly, each node in the second operation type tree represents the operation type corresponding to a second component in the second operation type set, for example... Figure 5 The second operation type tree is shown in (a) of the diagram.
[0251] In this way, representing the set of operation types in the form of an operation type tree makes it easier for the first application to traverse the nodes in the operation type tree sequentially based on the relationship between the nodes in the operation type tree when matching the first user operation with each operation type tree.
[0252] Optionally, the relationships (such as parallel relationships, parent-child relationships) between nodes in the first operation type tree can correspond to the relationships between the at least one first component. For example, in the layout of the at least one first component, if component a1 and component a2 are parallel, then the nodes representing the operation types corresponding to component a1 and component a2 in the first operation type tree are parallel, such as... Figure 5 As shown in (a) of the first operation type tree, nodes 1.1 and 2.2 are used. For example, in the layout of at least one first component, components a4 and a5 are nested within component a3. Therefore, the node representing the operation type of component a3 in the first operation type tree has a parent-child relationship with the nodes representing the corresponding operation types of components a4 and a5, as shown below. Figure 5 The parent-child relationship between node 1.3 and nodes 1.3.1 and 1.3.2 in the first operation type in (a) is shown.
[0253] For example, when the electronic device supports touch operation and the first user operation is a touch operation, the operation type tree generated by the first application and the second application can also be called a gesture tree. The first operation type set (i.e., the first operation type tree) can be the first gesture tree, and the second operation type set (i.e., the second operation type tree) can be the second gesture tree.
[0254] Optionally, after obtaining the first operation type tree and the second operation type tree, in order to improve the matching efficiency between the first user operation and the operation types in the two operation type trees in S407, the first application can concatenate the first operation type tree and the second operation type tree into one operation type tree. This concatenated operation type tree can be called the third operation type tree. To avoid event conflicts, the nodes in the first operation type tree and the nodes in the second operation type tree in the third operation type tree are mutually exclusive. Therefore, when executing S407, the first application can first match the first user operation with the nodes in the third operation type tree that belong to the original first operation type tree. If the first user operation fails to match with the nodes in the original first operation type tree, then match the first user operation with the nodes in the third operation type tree that belong to the original second operation type tree; or first match the first user operation with the nodes in the third operation type tree that belong to the original second operation type tree. If the first user operation fails to match with the nodes in the original second operation type tree, then match the first user operation with the nodes in the third operation type tree that belong to the original first operation type tree. For example, suppose the first operation type tree and the second operation type tree are Figure 5 As shown in (a), the third operation type tree generated by concatenating the two operation type trees in the first application can be as follows: Figure 5 As shown in (b) of the diagram; in the third operation type tree, the two parts separated by the dashed line are mutually exclusive.
[0255] Following S407, depending on the different matching results between the first user operation and the operation types in the first operation type set and the second operation type set, the embodiments of this application will be described in the following three cases.
[0256] Scenario 1: The first user action successfully matches the first target operation type in the first set of operation types. That is, the first application successfully competes for the operation attribution of the first user action, and the first application determines itself as the target application of the first user action. For example... Figure 4 As shown, in this case, the electronic device may continue to perform the following steps S408-S410.
[0257] S408: If the first user operation successfully matches the first target operation type in the first operation type set, the first application executes the first processing action based on the second input event.
[0258] If the first application successfully wins the competition for the operation ownership of the first user's operation, the first application can perform the first processing action based on the second input event, that is, the first application consumes the second input event.
[0259] Optionally, in this case, the first application can also determine whether the first input event hits the first target component corresponding to the first target operation type, further verifying whether the first application is the target application operated by the first user. That is, when the first application determines, based on the first component layout information, that the reporting position of the first input event is within the control area of the first target component corresponding to the first target operation type (i.e., the first target component is the component hit by the second input event), the first application determines that it is the target application operated by the first user. The first component layout information is used to indicate the layout of the at least one first component. For example, the first component layout information may include: the type, size information, position information, affine transformation information, etc., of the at least one first component. When the first application is a service user, the first component layout information indicates the layout of the at least one first component within the first window.
[0260] Optionally, when the first application is a service provider, the first component layout information indicates the layout of the at least one first component within the first area. In this case, the first application can determine the control area of the first target component based on the location information of the first area and the first component layout information, so as to determine whether the first input event hits the first target component.
[0261] The location information of the first region indicates its position within the first window. For example, the location information of the first region may include: the size of the first region, the coordinates of the first region, and the offset of the first region's boundary relative to the boundary of the first window. When the first application is a service provider and the second application is a service user, the first application can obtain the location information of the first region from the second application. For instance, the second application can send the location information of the first region to the first application in step S405; that is, when executing step S405, the second application can send the second operation type set and the location information of the first region to the first application. Optionally, the second application can send the second operation type set and the location information of the first region to the first application through the same message.
[0262] Optionally, the first application may, but is not limited to, perform a first processing action based on a first target operation type, event information of a second input event, and layout information of a first component; wherein the event information includes at least one of the following: input device type, event type, reporting location, and timestamp. For example, the first application may determine a first target component from at least one of the first target operation type, reporting location of the first input event, and layout information of the first component (including location information of a first area if the first application is a service provider), i.e., determine that the reporting location of the first input event is located within the control area of the first target component corresponding to the first target operation type (the specific process is as described above); then the first application performs a first processing action on the first target component based on the first target operation type and / or the event type of the second input event. Optionally, in response to the first application performing the first processing action, the display content of the first application displayed on the electronic device within the first window may also change accordingly.
[0263] In the embodiments of this application, the specific process of each application consuming input event can refer to the traditional implementation scheme of application consuming input events, and this application will not elaborate on it.
[0264] S409: The first application sends a first message to the second application. The second application receives the first message from the first application. The first message instructs the second application to stop processing the input event of the first user's action.
[0265] S410: The second application stops (or cancels) the input event of the first user operation based on the first message.
[0266] Since the second application is not the target application of the first user operation, the second application can stop (or cancel) processing the input events of the first user operation according to the first message. Therefore, in order to reclaim storage space, the second application can delete the context environment created for the first user operation, delete the previously received input events of the first user operation, and the second operation type set.
[0267] In addition, when the first application receives the input event from the first user, it can directly consume the input event without synchronizing the input event to the second application, as shown in steps B1-B2.
[0268] Step B1: After S406, the user continues to perform the first user operation within the first window. The input management service continues to generate a third input event based on the first user operation and continues to send the third input event to the first application. The first application receives the third input event from the input management service.
[0269] Step B2: The first application executes the second processing action based on the third input event.
[0270] In this embodiment of the application, optionally, the first application can consume each input event of the first user operation in the same way. Therefore, the specific process of the first application consuming the third input event can refer to the process of the first application consuming the second input event in S408 above, and will not be repeated here.
[0271] It should also be noted that if the input management service continues to generate input events based on the first user's operation, the first application can continue to consume the input event using the process described in steps B1-B2 above, so that the first application can complete the processing action corresponding to the first user's operation and realize the user's intention to perform the first user's operation.
[0272] Scenario 2: The first user action successfully matches the second target action type in the second set of action types. That is, the second application successfully competes for the operation attribution of the first user action, and the first application determines the second application as the target application for the first user action. For example... Figure 4 As shown, in this case, the electronic device may continue to perform the following steps S411-S413.
[0273] S411: If the first user operation successfully matches the second target operation type in the second operation type set, the first application sends a second input event to the second application. The second application receives the second input event from the first application.
[0274] Through S411, if the first application determines that the second application has successfully won the competition for the operation ownership of the first user operation, the first application does not need to consume the second input event. Instead, it can continue to synchronize the currently received second input event to the second application so that the second application can consume the second input event. This second target operation type is the operation type of the first user operation predicted by the first application on the second application side.
[0275] Optionally, in this case, the first application can also determine whether the first input event hits the second target component corresponding to the second target operation type, further verifying whether the second application is the target application operated by the first user. That is, the first application can also determine that the second application is the target application operated by the first user when, based on the second component layout information, it determines that the reporting position of the first input event is within the control area of the second target component corresponding to the second target operation type (i.e., the second target component is the component hit by the second input event). The second component layout information is used to indicate the layout of the at least one second component. Similar to the first component layout information described above, the second component layout information may include: the type, size information, position information, affine transformation information, etc., of the at least one second component. When the second application is a service user, the second component layout information indicates the layout of the at least one second component within the first window.
[0276] Optionally, when the second application is a service provider, the second component layout information indicates the layout of the at least one second component within the first area. In this case, the first application can determine the control area of the second target component based on the location information of the first area and the second component layout information, so as to determine whether the first input event hits the second target component.
[0277] Optionally, the second component layout information can be sent from the second application to the first application. For example, the second application can send the second component layout information to the first application in step S405. Optionally, the second application can send the second operation type set and the second component layout information to the first application via the same message.
[0278] S411a: Optionally, the first application may also send a second message to the second application. The second application receives the second message from the first application. The second message may be used to notify the first user that the operation successfully matches the second target operation type, or it may be used to notify the first user that the operation is an operation performed on the second application (i.e., the second application is the target application of the first user's operation).
[0279] In this way, the second application can directly determine itself as the target application operated by the first user based on the second message.
[0280] S412: After receiving the second input event, the second application can match the first user operation with the operation type in the second operation type set according to the first input event and the second input event, and determine that the first user operation is successfully matched with the second target operation type in the second operation type set.
[0281] In this embodiment of the application, after receiving the first input event of the first user operation, the second application, each time it receives a subsequent input event of the first user operation, matches the first user operation with the operation type in the second operation type set according to the input event of the first user operation, until the first user operation is successfully matched with a certain operation type in the second operation type set and the second application is determined to be the target application of the first user operation.
[0282] Similar to implementation methods A1 and A2 in S407 above, in this scenario, the second application can also match the first user operation with the operation type in the second operation type set through the following implementation methods A1.1 and A2.1:
[0283] Implementation method A1.1: The second application determines the predicted operation type of the first user operation based on the event information of the first input event and the event information of the second input event; the second application matches the predicted operation type of the first user operation with the operation types in the second operation type set. Finally, the second application determines that the predicted operation type of the first user operation matches the second target operation type in the second operation type set.
[0284] Implementation method A2.1: The second application can sequentially traverse the operation types in the second operation type set, and determine whether all input events corresponding to the received first user operation match the event characteristics corresponding to the traversed operation type, thereby completing the matching of the first user operation with the operation type. The second application can execute S412 through the following steps:
[0285] The second application iterates through the operation types in the second set of operation types sequentially. Based on the event information of the first input event and the second input event, it determines whether the event information of the first user operation matches the event characteristics corresponding to the target operation type. If the event information of the first user operation matches the event characteristics corresponding to the target operation type, the second application determines that the first user operation matches the target operation type. If the event information of the first user operation does not match the event characteristics corresponding to the target operation type, the second application determines that the first user operation does not match the target operation type. Finally, the second application determines that the event information of the first user operation matches the event characteristics corresponding to the second target operation type.
[0286] S413: After determining that the first user operation and the second target operation type in the second operation type set are successfully matched, the second application can execute a third processing action based on the second input event.
[0287] It should also be noted that if the second application determines that the first user operation and the operation type in the second operation type set are not matched successfully, the second application can save the second input event and not execute S415.
[0288] Optionally, similar to S408 and S411, if the second application determines that the first user operation successfully matches the second target operation type in the second operation type set, the second application can also determine whether the first input event hits the second target component corresponding to the second target operation type, further verifying whether the second application is the target application of the first user operation. The specific process can be referred to the relevant descriptions in S408 and S411 above, and will not be repeated here. It should be noted that when the second application is a service provider, the second application can determine that the reporting position of the first input event is located within the control area of the second target value corresponding to the second target operation type based on the location information of the first area and the layout information of the second component. In this case, the location information of the first area is sent by the first application to the second application.
[0289] When the second application determines itself to be the target application of the first user's operation, the second application can perform a third processing action based on the second input event, that is, the second application consumes the second input event. Optionally, the second application can perform the third processing action based on, but is not limited to, the second target operation type, the event information of the second input event, the layout information of the second component, etc. For example, the second application can determine the second target component in at least one of the at least one second component based on the second target operation type, the reporting position of the second input event, and the layout information of the second component (including the location information of the first area when the second application is a service provider), that is, determine that the reporting position of the second input event is located within the control area of the second target component corresponding to the second target operation type (the specific process is as described above); then the second application performs the third processing action on the second target component based on the second target operation type and / or the event type of the second input event. Optionally, in response to the second application performing the third processing action, the display content of the second application displayed in the first window of the electronic device can also change accordingly.
[0290] In addition, when the first application receives the input event corresponding to the first user's operation again, it can directly forward the input event to the second application without processing the input event, as shown in steps C1-C3.
[0291] Step C1: After S406, the user continues to perform the first user operation within the first window. The input management service continues to generate a fourth input event based on the first user operation and continues to send the fourth input event to the first application. The first application receives the fourth input event from the input management service.
[0292] Step C2: The first application sends a fourth input event to the second application. The second application receives the fourth input event from the first application.
[0293] Through S417, the first application can synchronize the received fourth input event to the second application.
[0294] Optionally, in order to reclaim storage space, after determining that the first application is not the target application of the first user operation, the first application deletes the first operation type set and the second operation type set, and after synchronizing the input events of the received first user operation to the second application, deletes these input events.
[0295] Step C3: The second application executes the fourth processing action based on the fourth input event.
[0296] In this embodiment of the application, optionally, the second application can consume each input event of the first user operation in the same way. Therefore, the specific process of the second application consuming the fourth input event can refer to the process of the second application consuming the second input event in S413 above, and will not be repeated here.
[0297] It should also be noted that if the input management service continues to generate input events based on the first user's operation, the first application and the second application can continue to execute the above steps C1-C3, so that the second application can consume the input event and complete the processing action corresponding to the first user's operation, thereby realizing the user's intention to perform the first user's operation.
[0298] Scenario 3: The first user operation fails to match any operation type in either the first operation type set or the second operation type set. This means that the competition for operation attribution between the first application and the second application for the first user operation has failed, and the first application has not determined the target application for the first user operation. In this case, the electronic device can continue to execute the following steps D1-D3.
[0299] Step D1: If the first user action does not match the action type in the first action type set and the second action type set, the first application sends a second input event to the second application. The second application receives the second input event from the first application.
[0300] Since the target application of the first user operation is not determined, the first application does not need to consume the second input event. It can synchronize the second input event to the second application through step D1, so that both the first and second applications can save the second input event. Upon receiving the second input event, the second application can execute S412 above, matching the first user operation with the operation types in the second operation type set; if a match is successful, the second input event is consumed; otherwise, the second input event is saved. The specific process can be found in the descriptions of S412-S413 above.
[0301] In addition, in this case, when the first application receives an input event corresponding to the first user operation again, it can continue to match the first user operation with the operation types in the first operation type set and the second operation type set based on the multiple input events of the first user operation that have been received, as shown in steps D2 and D3.
[0302] Step D2: After S406, the user continues to perform the first user operation within the first window. The input management service continues to generate a fifth input event based on the first user operation and continues to send the fifth input event to the first application. The first application receives the fifth input event from the input management service.
[0303] Step D3: The first application continues to execute S407 and subsequent steps, that is, the first application matches the first user operation with the operation types in the first operation type set and the second operation type set based on the first input event, the second input event, and the fifth input event. Depending on the matching result, the first application can perform different operations in three cases, specifically including:
[0304] If the first user action successfully matches the first target operation type in the first set of operation types, the first application executes the fifth processing action based on the fifth input event and sends the first message to the second application.
[0305] If the first user action successfully matches the second target action type in the second action type set, the first application sends a fifth input event to the second application so that the second application can consume the fifth input event.
[0306] If the first user action fails to match the action type in either of the two action type sets, the first application sends a fifth input event to the second application.
[0307] The specific implementation process of step D3 can be found in the description of S407 and subsequent steps above, and will not be repeated here.
[0308] This application provides an input event handling method. The method is as follows: In an interface extension scenario, after receiving the first operation event (i.e., the first operation event) of a first user operation sent by the input management server, the first application can determine a first set of operation types and obtain a second set of operation types. The operation types in the first set of operation types are used to control components of the first application displayed in the first window; the operation types in the second set of operation types are used to control components of the second application displayed in the first window. The first application and the second application are respectively the service user and the service provider. When the first application subsequently receives an input event (i.e., the second operation event) of the first user operation, it can match the first user operation with the operation types in the first and second sets of operation types based on the multiple received operation events. When the first user operation successfully matches a first target operation type in the first set of operation types, the first application can consume the second input event and notify the second application to stop processing the input event of the first user operation. When the first user operation successfully matches a second target operation type in the second set of operation types, the first application can choose not to consume the input event of the first user operation but instead forward the received second operation event to the second application, allowing the second application to consume the second operation event.
[0309] This method allows the first application, upon receiving an input event reported by the input management service in an interface extension scenario, to compete with the second application for the ownership of the first user's operation. This determines the target application for the first user's operation, enabling the first application to decide whether to consume the input event or forward it to the second application. Compared to traditional synchronous event consumption mechanisms, the first application only needs to obtain the second operation type set from the second application after receiving the first operation event from the first user. Upon receiving subsequent input events from the first user, it can proceed directly without waiting for a response from the second application, thus improving event consumption efficiency. Compared to traditional asynchronous event consumption mechanisms, the first application can compete with the second application for the ownership of the first user's operation, determining the target application and deciding whether to consume or forward the input event, avoiding event conflicts. In summary, the method provided in this application's embodiments can guarantee event consumption efficiency and resolve event conflict issues in interface extension scenarios.
[0310] Furthermore, if the first application successfully wins the competition for ownership of the first user's operation, the first application does not need to synchronize subsequent input events of the first user's operation to the second application. This reduces the number of interactions between applications, thereby reducing the performance overhead of the electronic device and improving its performance.
[0311] based on Figure 4 The embodiments shown provide a method for handling input events, and this application provides an embodiment of such a method. Figure 6A As shown. This method can be applied to, for example... Figure 1 The electronic device shown can have a software structure as follows: Figure 2 As shown. In this embodiment, the software system in the electronic device may include: an input management service, application A, and application B. Application A and application B can be any application installed in the electronic device. Application A is the service provider, and application B is the service user. See below. Figure 6A The flowchart shown below provides a detailed description of the embodiments of this application.
[0312] S600: In a scenario where application B launches application A, the electronic device can display a first window containing a first area on the screen. The first window is the window of application B, and the content of application A is displayed within the first area.
[0313] The process of application B launching application A and displaying the content of application A in the first area of the first window can be found in [reference needed]. Figure 4 The relevant descriptions in the illustrated embodiments will not be repeated here.
[0314] S601: When a user performs a first user operation within the first window, the input management service in the electronic device generates a first input event based on the first user operation performed within the first window; wherein, the first input event is the first input event generated by the input management service based on the first user operation. When the input management service determines that the reporting position of the first input event is located in the first area, it sends the first input event to application A.
[0315] For details on the process of the input management service generating input events based on the first user's action, please refer to [link / reference]. Figure 4 The relevant description in S401 of the illustrated embodiment.
[0316] In this embodiment, the input management service can determine the application to report to based on the reporting location of the first input event performed by the user, i.e., it adopts the input event reporting method 2 in S401. Therefore, in S601, when the input management service determines that the reporting location of the first input event is within the first area, it directly sends the first input event to application A.
[0317] S602: Application A determines a first operation type set based on at least one first component displayed in the first area. The at least one first component is a component within the display content of application A in the first area; the first operation type set includes at least one first operation type, which is used to control the at least one first component.
[0318] Since the reporting location of the first input event is within the first area, the user's intention to perform the first user operation may be to control a component of application A within the first area. Based on this, application A determines the first operation type set through S602, which is the range of operation types predicted by application A for the first user operation.
[0319] To reduce redundant operation types in the first operation type set and improve the efficiency of subsequent matching of the first user operation with the operation types in the first operation type set by application A, application A can select components of application A located within a first position range in the first region. That is, the at least one first component is a component within the display content of application A located within the first position range in the first region. The first position range includes the reporting position of the first input event. This embodiment does not limit the size and shape of the first position range; these details can be specifically defined according to the actual application scenario.
[0320] Furthermore, since the first user operation is executed within the first window, the user's intention in performing the first user operation may also be to control components of application B within the first window. Based on this, application A can also obtain the range of operation types predicted by application B for the first user operation. Optionally, in this embodiment, application A can obtain the range of operation types predicted by application B for the first user operation through the following steps S603-S605.
[0321] S603: Application A sends the first input event to application B.
[0322] S604: Application B determines a set of second operation types based on at least one second component in the first window. The at least one second component is a component displayed in the content of application B in the first window; the set of second operation types includes at least one second operation type used to control the at least one second component.
[0323] Similar to S602, to reduce redundant operation types in the second operation type set and improve the efficiency of subsequent matching of the first user operation with the operation types in the second operation type set by application A, application B can also select components of application B located within the second position range in the first window. That is, the at least one second component is a component within the display content of application B within the second position range in the first window. The second position range includes the reporting position of the first input event. This embodiment does not limit the size and shape of the second position range; these information can be specifically defined according to the actual application scenario. The second position range is larger than the first position range.
[0324] Optionally, application B may trigger the step of determining the second set of operation types based on the received first input event. Additionally, application B may save the first input event so that, when receiving other input events for the first user operation subsequently, the operation type of the first user operation can be determined based on all received input events of the first user operation.
[0325] S605: Application B sends a second set of operation types to application A.
[0326] Through S602 and S605 described above, application A can determine a first set of operation types and a second set of operation types based on the first user operation. Then, when application A receives another input event generated based on the first user operation, it can match the first user operation with the operation types in the two sets of operation types to achieve operation attribution competition between the two applications, thereby determining the target application for the first user operation. In this way, the target application can execute processing actions based on the input event of the first user operation, ultimately completing the processing action corresponding to the first user operation and realizing the user's intention to perform the first user operation.
[0327] The following details the specific steps involved in applying A to perform this operation within the competition process.
[0328] S606: After S601, the user continues to perform the first user operation within the first window, and the input management service continues to generate a second input event based on the first user operation and continues to send the second input event to application A.
[0329] Optionally, the second input event can be any other input event after the first input event (i.e., the first input event) generated based on the first user operation, and this application does not limit it.
[0330] S607: Application A matches the first user operation with the operation types in the first operation type set and the second operation type set based on the first input event and the second input event.
[0331] The process by which application A matches the first user operation with the operation types in the first set of operation types and the second set of operation types can be referred to as follows: Figure 4 The description of S407 in the illustrated embodiment will not be repeated here.
[0332] Following S607, depending on the different matching results between the first user operation and the operation types in the first operation type set and the second operation type set, the embodiments of this application will be described in the following three cases.
[0333] Scenario 1: The first user operation successfully matches the first target operation type in the first set of operation types. That is, application A successfully competes for the operation attribution of the first user operation, and application A is determined to be the target application of the first user operation. For example... Figure 6A As shown, in this case, the electronic device may continue to perform the following steps S608-S612.
[0334] S608: If the first user operation successfully matches the first target operation type in the first operation type set, application A executes the first processing action based on the second input event.
[0335] Optionally, in this case, before determining that application A is the target application of the first user operation, application A may also determine whether the first input event hits the first target component corresponding to the first target operation type. When application A determines, based on the location information of the first region and the layout information of the first component, that the reporting position of the first input event is located within the control area of the first target component corresponding to the first target operation type, application A is determined to be the target application of the first user operation. The first component layout information is used to indicate the layout of the at least one first component within the first region. For example, the first component layout information may include: the type, size information, location information, affine transformation information, etc., of the at least one first component. The location information of the first region is sent to application A by application B.
[0336] If application A successfully wins the contention for the first user operation, application A can execute the first processing action based on the second input event, that is, application A consumes the second input event. The specific execution process can be found in [reference needed]. Figure 4 The relevant descriptions in S408 of the illustrated embodiment will not be repeated here.
[0337] S609: Application A sends a first message to application B. The first message instructs application B to stop processing the input event of the first user operation.
[0338] S610: Application B stops (or cancels) the input event of the first user operation based on the first message.
[0339] Since application B is not the target application of the first user operation, application B can stop or cancel processing the input events of the first user operation according to the first message. Therefore, in order to reclaim storage space, application B can delete the context environment created for the first user operation, as well as delete the previously received input events of the first user operation and the second operation type set.
[0340] In addition, when application A receives the input event corresponding to the first user operation, it can directly consume the input event without synchronizing the input event to application B, as shown in steps S611-S612.
[0341] S611: After S606, the user continues to perform the first user operation within the first window, and the input management service continues to generate a third input event based on the first user operation and continues to send the third input event to application A.
[0342] S612: Application A executes the second processing action based on the third input event.
[0343] In this embodiment of the application, optionally, application A can consume each input event of the first user operation in the same way. Therefore, the specific process of application A consuming the third input event is similar to the process of application A consuming the second input event in S608 above, and will not be described again here.
[0344] It should also be noted that if the input management service continues to generate input events based on the first user operation, application A can continue to consume the input event using the above S611-S612 process, so that application A can complete the processing action corresponding to the first user operation and realize the user's intention to perform the first user operation.
[0345] Scenario 2: The first user operation successfully matches the second target operation type in the second set of operation types. That is, application B successfully competes for the operation attribution of the first user operation, and application A determines application B as the target application for the first user operation. For example... Figure 6A As shown, in this case, the electronic device may continue to perform the following steps S613-S618.
[0346] S613: If the first user operation successfully matches the second target operation type in the second operation type set, application A sends a second input event to application B. Application B receives the second input event from application A.
[0347] Optionally, in this case, before application A determines that application B is the target application of the first user operation, application A may also determine whether the first input event hits the second target component corresponding to the second target operation type. When application A determines, based on the second component layout information, that the reporting position of the second input event is located within the control area of the second target component corresponding to the second target operation type, application B is determined to be the target application of the first user operation. The second component layout information is used to indicate the layout of the at least one second component within the first window.
[0348] Optionally, application B may send the layout information of the second component to application A during the execution of S605.
[0349] Through S613, if application A determines that application B has successfully won the competition for the operation ownership of the first user operation, application A does not need to consume the second input event. Instead, it can continue to synchronize the currently received second input event to application B so that application B can consume the second input event. This second target operation type is the operation type of the first user operation predicted by application A on the application B side.
[0350] S613a: Optionally, application A may also send a second message to application B. Application B receives the second message from application A. The second message is used to notify that the first user operation and the second target operation type are successfully matched, or to notify that the first user operation is an operation performed on application B (i.e., application B is the target application of the first user operation).
[0351] In this way, application B can directly determine itself as the target application of the first user based on the second message.
[0352] S614: Optionally, after receiving the second input event, application B may match the first user operation with the operation type in the second operation type set based on the first input event and the second input event, and determine that the first user operation is successfully matched with the second target operation type in the second operation type set.
[0353] For detailed instructions on this step, please refer to [link / reference]. Figure 4 The specific description of S412 in the illustrated embodiment will not be repeated here. It should also be noted that if application B determines that the first user operation and the operation types in the second operation type set do not match successfully, application B can save the second input event and not execute S615.
[0354] S615: After determining that the first user operation and the second target operation type in the second operation type set are successfully matched, application B can execute the third processing action based on the second input event.
[0355] Similar to S608 and S613, after determining that the first user operation successfully matches the second target operation type in the second operation type set, before determining that application B is the target application of the first user operation, application B can also determine whether the first input event hits the second target component corresponding to the second target operation type. When application B determines, based on the second component layout information, that the reporting position of the second input event is located within the control area of the second target component corresponding to the second target operation type, application B is determined to be the target application of the first user operation.
[0356] When application B determines itself to be the target application of the second user operation, application B can execute a third processing action based on the second input event; that is, application B consumes the second input event. The process of application B consuming the second input event can be found in [reference needed]. Figure 4 The description of S413 in the illustrated embodiment will not be repeated here.
[0357] In addition, when application A receives the input event corresponding to the first user operation again, it can directly forward the input event to application B without processing the input event, as shown in steps S616-S618.
[0358] S616: After S606, the user continues to perform the first user operation within the first window, and the input management service continues to generate a fourth input event based on the first user operation and continues to send the fourth input event to application A.
[0359] S617: Application A sends a fourth input event to application B.
[0360] Optionally, in order to reclaim storage space, after determining that application A is not the target application of the first user operation, application A deletes the first operation type set and the second operation type set, and after synchronizing the input events of the received first user operation to application B, deletes these input events.
[0361] S618: Application B executes the fourth processing action based on the fourth input event.
[0362] In this embodiment of the application, optionally, application B can consume each input event of the first user operation in the same way. Therefore, the specific process of application B consuming the fourth input event will not be described here.
[0363] It should also be noted that if the input management service continues to generate input events based on the first user operation, application A and application B can continue to execute the process of S616-S618, so that application B can consume the input event and complete the processing action corresponding to the first user operation, thereby realizing the user's intention to perform the first user operation.
[0364] Scenario 3: The first user operation fails to match either the first set of operation types or the second target operation type in the second set of operation types. That is, application A and application B failed to determine the target application for the first user operation, and application A has not identified the target application for the first user operation. For example... Figure 6A As shown, in this case, the electronic device may continue to perform the following steps S619-S621.
[0365] S619: If the first user operation does not match the operation type in the first operation type set and the second operation type set, application A sends a second input event to application B.
[0366] Since the target application of the first user operation is not determined, application A can synchronize the second input event to application B via S619, so that both application A and application B can save the second input event. After receiving the second input event, application B continues to match the first user operation with the operation types in the second operation type set based on the received first user operation input event; until the first user operation successfully matches the operation type in the second user operation type set, it does not need to consume the second input event.
[0367] In addition, in this case, when application A receives the input event corresponding to the first user operation again, it can continue to match the first user operation with the operation type in the first operation type set and the second operation type set based on the multiple input events of the first user operation that have been received, as shown in the following steps S620-S621.
[0368] S620: After S606, the user continues to perform the first user operation within the first window, and the input management service continues to generate a fifth input event based on the first user operation and continues to send the fifth input event to application A.
[0369] S621: Application A continues to execute S607 and subsequent steps, that is, application A matches the first user operation with the operation types in the first and second operation type sets based on the first, second, and fifth input events. Depending on the matching result, different operations can be performed in three cases. If the first user operation successfully matches the first target operation type in the first operation type set, application A executes the fifth processing action based on the fifth input event and sends the first message to application B. If the first user operation successfully matches the second target operation type in the second operation type set, application A sends the fifth input event to application B. If the first user operation fails to match with any operation type in either of the two operation type sets, application A sends the fifth input event to application B. The specific implementation process of this step can be referred to the descriptions of S607-S620 above, and will not be repeated here.
[0370] For example, see Figure 6B As shown, in a scenario where application B launches application A on a mobile phone, the phone's user interface is as follows: Figure 6BAs shown in (a), the mobile phone displays the window of application B (i.e., the first window), which contains an interface extension component. This interface extension component is used to display the content of application A (i.e., the virtual window of application A). The area where this interface extension component is located is the first area. The window of application B contains a list view component of application B, which supports vertical scrolling. The virtual window of application A contains a grid component, which also supports vertical scrolling.
[0371] See Figure 6B As shown in (b), when the user performs a first user action (slide action) within the first area of the first window, the electronic device can perform... Figure 6A The provided input processing method, in detail, is as follows:
[0372] S1: The input management service in the electronic device generates a first input event (i.e., a finger-dropping event, which can be simply referred to as a down event) based on the first user's operation. Since the reporting position of the first input event is located within the first area, the input management service reports the first input event to application A.
[0373] S2: Application A sends the first input event to application B.
[0374] S3: Application A uses the internal gesture manager 1 to determine the first gesture tree. For details, please refer to S602 above.
[0375] S4: Application B uses the internal gesture manager 2 to determine the second gesture tree. For details, please refer to S604 above.
[0376] S5: Application B sends the second gesture tree to application A.
[0377] S6: Application A uses the internal gesture manager 1 to splice the first gesture tree and the second gesture tree to generate the third gesture tree.
[0378] In the embodiments of this application, the relationships between nodes in the first gesture tree and the second gesture tree, the relationships between nodes and components, and the relationships between the two gesture trees can be referred to the relevant introduction of the operation type set in the above embodiments, and will not be repeated here.
[0379] S7: The input management service generates a second input event (i.e., a finger movement event, which can be simply referred to as a move event) based on the first user's operation; and continues to report it to application A.
[0380] Application A can match the first user action with the gesture type in the third gesture tree based on the received first and second input events. Figure 6AThe steps in S607 and subsequent steps are similar. This example explains three cases depending on the matching result:
[0381] If the first user operation successfully matches the first target gesture type in the third gesture tree, application A can consume the second input event and send a first message (i.e., a cancellation message (which may contain a cancel event)) to application B via S8-1; wherein, the first target gesture type is the gesture type in the original first gesture tree. The specific process of S8-1 and the execution process of other related steps of application A and application B can be referred to the description of case one in S608-S612 above, and will not be repeated here.
[0382] If the first user action successfully matches the second target gesture type in the third gesture tree, application A sends a second input event to application B via S8-2; wherein the second target gesture type is the gesture type in the original second gesture tree. The specific process of S8-2, as well as the execution process of other related steps of application A and application B, can be referred to the description of case two in S613-S618 above, and will not be repeated here.
[0383] If the first user operation and the gesture type in the third gesture tree do not match successfully, the relevant steps for application A and application B can refer to the description of case three in S619-S621 above, and will not be repeated here.
[0384] Continue with Figure 6B Taking (a) as an example, the method provided in this application embodiment allows the network layout component within the virtual window of application A to move up and down when the user performs a vertical swipe operation in the virtual window; and the list view component in the window of application B to move up and down when the user performs a vertical swipe operation outside the virtual window.
[0385] based on Figure 4 The embodiments shown provide a method for handling input events. This application provides another method for handling input events, such as... Figure 7 As shown. This method can be applied to, for example... Figure 1 The electronic device shown can have a software structure as follows: Figure 2 As shown. In this embodiment, the software system in the electronic device may include: an input management service, application a, and application b, where application a and application b can be any application installed in the electronic device. Application a is the service user, and application b is the service provider. See below for further details. Figure 7 The flowchart shown below provides a detailed description of the embodiments of this application.
[0386] S700: In a scenario where application a launches application b, the electronic device can display a first window containing a first area on the screen. The first window is the window of application a, and the content of application b is displayed within the first area.
[0387] The process of application A launching application B and displaying the content of application B in the first area of the first window can be found in [reference]. Figure 4 The relevant descriptions in the illustrated embodiments will not be repeated here.
[0388] S701: When a user performs a first user operation within the first window, the input management service in the electronic device generates a first input event based on the first user operation performed within the first window; wherein, the first input event is the first input event generated by the input management service based on the first user operation. The input management service sends the first input event to application a, which is the service user.
[0389] For details on the process of the input management service generating input events based on the first user's action, please refer to [link / reference]. Figure 4 The relevant description in S401 of the illustrated embodiment.
[0390] In this embodiment, the input management service can report all input events generated based on user operations to the service user, i.e., it adopts the input event reporting method provided in method 1 of S401. Therefore, in S701, after generating the first input event, the input management service directly sends the first input event to application a.
[0391] S702: When application a determines that the reported location of the received first input event is within the first area, it executes the input event processing method provided in this embodiment. Application a determines a first operation type set based on at least one first component in the first window. The at least one first component is a component displayed by application a in the first window; the first operation type set includes at least one first operation type, which is used to control the at least one first component.
[0392] Since the reporting location of the first input event is located within the first area and the first user operation is executed within the first window, the target application of the first user operation may be application b or application a. Therefore, application a can execute S702-S705 to obtain the first operation type set and the second operation type set, so that when the first user operation input event is received, the first user operation is matched with the operation type in the two operation type sets to realize the operation ownership competition between the two applications, thereby determining the target application of the first user operation.
[0393] The first set of operation types determined by application a through S702 is the range of operation types for the first user operation predicted by application a.
[0394] To reduce redundant operation types in the first operation type set and improve the efficiency of subsequent application a in matching the first user operation with the operation types in the first operation type set, application a can select components of application a located within a first position range in the first window. That is, the at least one first component is a component within the display content of application a located within the first position range in the first window. The first position range includes the reporting position of the first input event. This embodiment does not limit the size and shape of the first position range; the above can be specifically defined according to the actual application scenario.
[0395] Furthermore, since the reporting location of the first input event is located within the first area, the user's intention to perform the first user operation may be to control a component of application b within the first area. Based on this, application a can obtain the range of operation types predicted by application b through the following steps S703-S705.
[0396] S703: Application a sends the first input event to application b.
[0397] S704: Application b determines a second operation type set based on at least one second component displayed in the first area. The at least one second component is a component within the display content of application b in the first area; the second operation type set contains at least one second operation type used to control the at least one second component.
[0398] Similar to S702, to reduce redundant operation types in the second operation type set and improve the efficiency of subsequent application a in matching the first user operation with the operation types in the second operation type set, application b can also select a component of application b located within the second position range in the first region. That is, the at least one second component is a component within the display content of application b within the second position range in the first region. The second position range includes the reporting position of the first input event. This embodiment does not limit the size and shape of the second position range; the above can be specifically defined according to the actual application scenario. The first position range is larger than the second position range.
[0399] Optionally, application b may trigger the step of determining the second set of operation types based on the received first input event. Additionally, application b may save the first input event so that when receiving other input events for the first user operation, the operation type of the first user operation can be determined based on all the received input events of the first user operation.
[0400] S705: Application b sends a second set of operation types to application a.
[0401] Through S702 and S705 described above, application a can determine a first set of operation types and a second set of operation types for the first user operation. Then, when application a receives another input event generated based on the first user operation, it can match the first user operation with the operation types in the two sets of operation types based on the received input event, thus enabling operation attribution competition between the two applications and determining the target application for the first user operation. In this way, the target application can execute processing actions based on the input event of the first user operation, ultimately completing the processing action corresponding to the first user operation and realizing the user's intention to perform the first user operation.
[0402] The following details the specific steps involved in executing this operation using application a within the competition process.
[0403] S706: After S701, the user continues to perform the first user operation within the first window, and the input management service continues to generate a second input event based on the first user operation and continues to send the second input event to application a.
[0404] Optionally, the second input event can be any other input event after the first input event (i.e., the first input event) generated based on the first user operation, and this application does not limit it.
[0405] S707: Application a matches the first user operation with the operation types in the first operation type set and the second operation type set based on the first input event and the second input event.
[0406] The process by which application 'a' matches the first user operation with the operation types in the first set of operation types and the second set of operation types can be referred to as follows: Figure 4 The description of S407 in the illustrated embodiment will not be repeated here.
[0407] like Figure 7 As shown, after S707, depending on the different matching results between the first user operation and the operation types in the first operation type set and the second operation type set, the embodiments of this application are divided into three cases. Among them, steps S708-S712 in case one are... Figure 6A S608-S612 in the illustrated embodiment are similar, and identical or similar steps can be referred to each other; steps S713-S718 in case two are similar to... Figure 6A S613-S618 in the illustrated embodiment are similar, and identical or similar steps can be referred to each other; steps S719-S721 in case three are similar to... Figure 6AS619-S621 in the illustrated embodiments are similar, and the same or similar steps can be referred to each other. The embodiments of this application will not be described again.
[0408] Based on the input event processing methods provided in the above embodiments, this application also provides an input event processing method. (See attached document) Figure 8 As shown, the embodiments of this application continue to use... Figure 4 The first and second applications in the illustrated embodiments are used as examples. In scenarios where the user operation performed on the electronic device is a touch operation, according to the software logic function, the first application may include the following modules: a first event client, a first UI pipeline, an event decision service, and a first gesture manager; the second application may include the following modules: a second event client, a second UI pipeline, and a second gesture manager.
[0409] The first event client and the second event client are used to receive input events and transmit other information related to the processing of input events.
[0410] The first UI pipeline and the second UI pipeline form the user interface context runtime environment within the application, which can transmit input events and related information within the application.
[0411] The first gesture manager and the second gesture manager are used to generate and maintain the gesture tree.
[0412] Event decision service, used to decide whether to forward or consume input events.
[0413] based on Figure 8 The internal structures of the first and second applications shown are illustrated. The flow of the method provided in this application embodiment is as follows:
[0414] Step 801: When the first event client in the first application receives the first input event (i.e., the first input event) generated by the input management service based on the first user operation, it sends the first input event to the event decision service through the first UI pipeline.
[0415] Step 802: The event decision service sends the first input event to the second application according to the set rules.
[0416] For example, when the first application is the service user and the second application is the service provider, the event decision service can send the first input event to the second application when it determines that the reporting location of the first input event is within the first area.
[0417] For example, when the first application is the service provider and the second application is the service user, the event decision service sends the first input event to the second application when it determines that the first input event is the first input event of the first user's operation.
[0418] Step 803: The event decision service can also send the first input event to the first gesture manager through the first UI pipeline to trigger the first gesture manager to generate the first gesture tree based on the first input event.
[0419] Step 804: After receiving the first input event, the second event client in the second application sends the first input event to the second gesture manager through the second UI pipeline.
[0420] Step 805: The second gesture manager generates a second gesture tree based on the triggering of the first input event.
[0421] Step 806: The second gesture manager sends the generated second gesture tree to the second event client through the second UI pipeline.
[0422] Step 807: The second event client sends the second gesture tree to the first application.
[0423] Step 808: After receiving the second gesture tree, the event decision service in the first application sends the second gesture tree to the first gesture manager through the first UI pipeline.
[0424] Step 809: The first gesture manager concatenates the generated first gesture tree and the received second gesture tree to obtain the third gesture tree.
[0425] Step 810: The first gesture manager sends the third gesture tree to the event decision service through the first UI pipeline.
[0426] Step 811: When the event decision service receives a subsequent input event of the first user operation, it can match the first user operation with the gesture type in the third gesture tree based on the received input event of the first user operation and the third gesture tree, and determine the processing method of the input event of the first user operation based on the matching result. The specific process can be referred to the description in the above embodiments and examples, and will not be repeated here.
[0427] Based on the input event processing methods provided in the above embodiments of this application, event consumption efficiency and event conflict resolution can be ensured in interface extension scenarios. For example, ... Figure 9As shown, in a scenario where application a launches applications b, c, and d to provide services, virtual windows of applications b, c, and d can be embedded in the window of application a. Specifically, the window of application a contains components that support vertical movement; the virtual window of application b contains components that support vertical movement; the virtual window of application c contains components that support horizontal movement; and the virtual window of application d contains components that support both horizontal and vertical movement. The methods provided by the various embodiments of this application can achieve the following effect: avoiding the situation where multiple applications simultaneously respond to a single user operation, resulting in event conflicts.
[0428] When a user performs a vertical swipe operation within the virtual window of application b, they can drag the content in the virtual window of application b to move it up and down.
[0429] When a user performs a vertical swipe operation within the virtual window of application c, they can drag the content in the window of application a to move it up and down.
[0430] When a user performs a horizontal swipe operation within the virtual window of application c, they can drag the content in the virtual window of application c to move horizontally.
[0431] When a user performs a swipe operation within the virtual window of application d, the content within the virtual window of application d can be dragged and moved along the swipe direction.
[0432] It should be noted that this application does not limit the application scenarios to which the input event handling scheme provided in the embodiments of this application is applicable. The service provider and service user in this scheme can be any application installed in the electronic device, and are not limited to... Figure 3A and Figure 3B The application scenarios shown.
[0433] It should be noted that when applications and system services installed on an electronic device are running, the electronic device will start corresponding processes. For clarity and conciseness, the above description of the embodiments in this application uses the first application, the second application, and the input management service as examples of the execution subjects. However, this embodiment does not limit the execution subjects of each step. For example, the above-mentioned application and input management service can also be replaced by the application process and the input management service process.
[0434] It should also be noted that each step in the above embodiments can be executed by the corresponding device, or by components such as chips, processors, or chip systems within that device. The embodiments of this application do not limit their execution. The above embodiments are merely illustrative examples of execution by the corresponding device. Furthermore, the specific implementation methods or examples in the above embodiments do not limit the solutions provided by the embodiments of this application.
[0435] It should be noted that in the above embodiments, some steps may be selected for implementation, and the order of the steps in the figures may be adjusted. This application does not limit this. It should be understood that performing some of the steps in the figures, adjusting the order of the steps, or combining them in a specific implementation all fall within the protection scope of this application. In addition, in different embodiments, the same or similar steps can be referred to each other.
[0436] It is understood that, in order to achieve the functions described in the above embodiments, each device involved in the above embodiments includes a hardware structure and / or software module corresponding to perform each function. Those skilled in the art should readily recognize that, based on the units and method steps of the various examples described in conjunction with the embodiments disclosed in this application, this application can be implemented in hardware or a combination of hardware and computer software. Whether a function is executed by hardware or by computer software driving hardware depends on the specific application scenario and design constraints of the technical solution.
[0437] It is understood that the architecture and application scenarios described in the embodiments of this application are for the purpose of more clearly illustrating the technical solutions of the embodiments of the present invention, and do not constitute a limitation on the technical solutions provided by the embodiments of the present invention. As those skilled in the art will know, with the evolution of network architecture and the emergence of new services, the technical solutions provided by the embodiments of the present invention are also applicable to similar technical problems.
[0438] It should be noted that the "steps" in the embodiments of this application are merely illustrative and are intended to better understand one method of presentation used in the embodiments. They do not constitute a substantial limitation on the execution of the solution of this application. For example, the "step" can also be understood as a "feature". Furthermore, the steps do not constitute any limitation on the execution order of the solution of this application. Any changes to the order of steps, or the merging or splitting of steps made on this basis without affecting the overall solution implementation, resulting in a new technical solution, are also within the scope of disclosure of this application.
[0439] Based on the same concept, embodiments of this application also provide an electronic device. For example... Figure 10 As shown, the electronic device includes a display screen 1001, one or more processors 1002, and a memory 1003. Optionally, the electronic device may also include a transceiver 1004. For example, the above-mentioned devices can be connected via one or more communication buses. The one or more computer programs are stored in the memory 1003 and configured to be executed by the one or more processors 1002. The one or more computer programs include instructions that can be used to cause the electronic device to perform various steps of the methods in the above embodiments.
[0440] For example, the above-mentioned one or more processors 1002 may specifically be Figure 1The processor 110 in the illustrated electronic device 100. The aforementioned memory 1003 can specifically be... Figure 1 The illustrated electronic device 100 includes internal memory 121 and / or external memory connected to the electronic device. The transceiver 1004 can be... Figure 1 The mobile communication module 150 and / or wireless communication module 160 are shown. The aforementioned display screen 1001 can specifically be... Figure 1 The display screen 194 shown is not limited in this embodiment of the application.
[0441] Based on the same concept, embodiments of this application also provide an electronic device, which includes units for performing the various steps of the methods provided in the above embodiments.
[0442] For details on the specific functions of each module, please refer to the above embodiments; they will not be repeated here.
[0443] Based on the above embodiments, this application also provides a computer program product, which includes instructions; when the computer program is run on a computer, it causes the computer to execute the method provided in the above embodiments.
[0444] Based on the above embodiments, this application also provides a computer-readable storage medium storing computer program instructions, which, when executed by a computer, cause the computer to perform the methods provided in the above embodiments.
[0445] Optionally, the aforementioned computer may include, but is not limited to, electronic devices.
[0446] The storage medium can be any available medium that a computer can access. For example, but not limited to, a computer-readable medium can include RAM, ROM, EEPROM, CD-ROM or other optical disk storage, magnetic disk storage media or other magnetic storage devices, or any other medium that can be used to carry or store desired program code in the form of instructions or data structures and that can be accessed by a computer.
[0447] Based on the above embodiments, this application also provides a chip for reading a computer program stored in a memory to implement the method provided in the above embodiments. Optionally, the chip may include a processor and a memory, wherein the processor is coupled to the memory and is used to read the computer program stored in the memory to implement the method provided in the above embodiments.
[0448] Based on the above embodiments, this application provides a chip system including a processor for supporting a computer device in implementing the functions involved in the electronic devices described in the above embodiments. In one possible design, the chip system further includes a memory for storing necessary programs and data of the computer device. This chip system may be composed of chips or may include chips and other discrete components.
[0449] Those skilled in the art will understand that embodiments of this application can be provided as methods, systems, or computer program products. Therefore, this application can take the form of a completely hardware embodiment, a completely software embodiment, or an embodiment combining software and hardware aspects. Furthermore, this application can take the form of a computer program product embodied on one or more computer-usable storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) containing computer-usable program code.
[0450] This application is described with reference to flowchart illustrations and / or block diagrams of methods, apparatus (systems), and computer program products according to this application. It should be understood that each block of the flowchart illustrations and / or block diagrams, and combinations of blocks in the flowchart illustrations and / or block diagrams, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, special-purpose computer, embedded processor, or other programmable data processing apparatus to produce a machine, such that the instructions, which execute via the processor of the computer or other programmable data processing apparatus, generate instructions for implementing the flowchart illustrations. Figure 1 One or more processes and / or boxes Figure 1 A device that provides the functions specified in one or more boxes.
[0451] These computer program instructions may also be stored in a computer-readable storage medium that can direct a computer or other programmable data processing device to function in a particular manner, such that the instructions stored in the computer-readable storage medium produce an article of manufacture including instruction means, which are implemented in a process Figure 1 One or more processes and / or boxes Figure 1 The function specified in one or more boxes.
[0452] These computer program instructions may also be loaded onto a computer or other programmable data processing equipment to cause a series of operational steps to be performed on the computer or other programmable equipment to produce a computer-implemented process, thereby providing instructions that execute on the computer or other programmable equipment for implementing the process. Figure 1 One or more processes and / or boxes Figure 1 The steps of the function specified in one or more boxes.
Claims
1. An input event processing method, applied to an electronic device, characterized in that, The method includes: The first application receives a first input event from the input management service; wherein the first input event is the first input event generated by the input management service based on a first user operation performed within the window of the second application; the location of the first input event is located within a first area of the window, and the first area displays the content of the first application; The first application determines a first set of operation types based on at least one first component; wherein the at least one first component is a component in the first region; the first set of operation types includes at least one first operation type, which is used to control the at least one first component; The first application receives a second input event from the input management service; wherein the second input event is generated by the input management service based on the first user's operation; Based on the first input event and the second input event, the first application determines that the first user operation successfully matches a first target operation type in the first operation type set. The first application then executes a first processing action based on the second input event and sends a first message to the second application. The first message instructs the second application to stop processing the input event of the first user operation. Alternatively... Based on the first input event and the second input event, the first application determines that the first user operation successfully matches the second target operation type in the second operation type set, and the first application sends the second input event to the second application; wherein, the second operation type set contains at least one second operation type, and the at least one second operation type is used to control at least one second component; the at least one second component is a component in the display content of the second application in the window.
2. The method as described in claim 1, characterized in that, If the first application determines that the first user operation successfully matches the first target operation type in the first operation type set, the method further includes: The first application receives a third input event from the input management service; the third input event is generated by the input management service based on the first user's operation. The first application performs a second processing action based on the third input event.
3. The method as described in claim 1 or 2, characterized in that, If the first application determines that the first user operation successfully matches the second target operation type in the second operation type set, the method further includes: The first application receives a fourth input event sent by the input management service; the fourth input event is generated by the input management service based on the first user's operation. The first application sends the fourth input event to the second application.
4. The method according to any one of claims 1-3, characterized in that, If the first application determines that the first user operation successfully matches the second target operation type in the second operation type set, the method further includes: The first application sends a second message to the second application; the second message is used to notify the first user operation that it matches the second target operation type successfully, or the second message is used to notify the first user that the operation is an operation performed on the second application.
5. The method as described in claim 1, characterized in that, The method further includes: Based on the first input event and the second input event, the first application determines that the first user operation does not match the operation type in the first operation type set and the second operation type set, and the first application sends the second input event to the second application.
6. The method as described in claim 5, characterized in that, The method further includes: The first application receives a fifth input event from the input management service; the fifth input event is generated by the input management service based on the first user's operation. Based on the first input event, the second input event, and the fifth input event, if the first application determines that the first user operation successfully matches the first target operation type in the first operation type set, the first application executes a third processing action based on the fifth input event and sends the first message to the second application; or... Based on the first input event, the second input event, and the fifth input event, if the first application determines that the first user operation successfully matches the second target operation type in the second operation type set, the first application sends the fifth input event to the second application.
7. The method according to any one of claims 1-6, characterized in that, The method further includes: The first application matches the first user operation with the operation types in the first operation type set and the second operation type set, respectively, based on the first input event and the second input event.
8. The method as described in claim 7, characterized in that, The first application matches the first user operation with the operation types in the first operation type set and the second operation type set, respectively, based on the first input event and the second input event, including: The first application determines the predicted operation type of the first user operation based on the event information of the first input event and the event information of the second input event; the first application matches the predicted operation type of the first user operation with the operation types in the first operation type set and the second operation type set, respectively; or, The first application determines whether the event information of the first user operation matches the event characteristics corresponding to the target operation type based on the event information of the first input event and the event information of the second input event. If the event information of the first user operation matches the event characteristics corresponding to the target operation type, the first application determines that the first user operation matches the target operation type. If the event information of the first user operation does not match the event characteristics corresponding to the target operation type, the first application determines that the first user operation does not match the target operation type. The target operation type is any operation type in the first operation type set or the second operation type set; the event information includes at least one of the following: input device type, event type, reporting location, and timestamp.
9. The method as described in claim 7 or 8, characterized in that, The first set of operation types has a higher priority than the second set of operation types; the first application prioritizes matching the first user operation with the operation types in the first set of operation types.
10. The method according to any one of claims 1-9, characterized in that, If the first application determines that the first user operation successfully matches a first target operation type in the first operation type set, before the first application executes the first processing action based on the second input event, the method further includes: The first application determines, based on the location information of the first region and the layout information of the first component, that the reporting location of the first input event is located within the control area of the first target component corresponding to the first target operation type; wherein, the location information of the first region is used to indicate the position of the first region within the window, and the layout information of the first component is used to indicate the layout of the at least one first component in the first region.
11. The method as described in claim 10, characterized in that, If the first application determines that the first user operation successfully matches the second target operation type in the second operation type set, before the first application sends the second input event to the second application, the method further includes: The first application determines, based on the second component layout information, that the reporting location of the first input event is located within the control area of the second target component corresponding to the second target operation type; wherein, the second component layout information is used to indicate the layout of the at least one second component in the window.
12. The method as described in claim 11, characterized in that, The method further includes: The first application receives location information of the first region from the second application; and / or, The first application receives the second component layout information from the second application.
13. The method according to any one of claims 1-12, characterized in that, The first application performs a first processing action based on the second input event, including: The first application executes the first processing action based on the first target operation type, the event information of the second input event, the location information of the first area, and the layout information of the first component; The event information includes at least one of the following: input device type, event type, reporting location, and timestamp; the location information of the first area is used to indicate the location of the first area within the window, and the layout information of the first component is used to indicate the layout of the at least one first component in the first area.
14. The method according to any one of claims 1-13, characterized in that, The method further includes: The first application sends the first input event to the second application and receives the second set of operation types from the second application.
15. The method according to any one of claims 1-14, characterized in that, The at least one first component is a component in the display content of the first application within a first location range; the first location range includes the reporting location of the first input event; The at least one second component is a component in the display content of the second application within a second location range; the second location range includes the reporting location of the first input event; The second position range is larger than the first position range.
16. An input event processing method, applied to an electronic device, characterized in that, The method includes: The second application receives a first input event from the first application; wherein, the first input event is the first input event generated by the input management service based on a first user operation performed within the window of the second application; the location of the first input event is located within a first area of the window; the first area displays the content of the first application; The second application determines a second set of operation types based on at least one second component; wherein the at least one second component is a component in the display content of the second application in the window; the second set of operation types includes at least one second operation type, which is used to control the at least one second component; The second application sends the second set of operation types to the first application; The second application receives a first message from the first application and stops processing the input event of the first user operation based on the first message; wherein, the first message is used to instruct the second application to stop processing the input event of the first user operation; or, The second application receives a second input event from the first application; the second input event is generated by the input management service based on the first user's operation.
17. The method as described in claim 16, characterized in that, After the second application receives a second input event from the first application, the method further includes: The second application matches the first user operation with the operation type in the second operation type set based on the first input event and the second input event, and determines that the first user operation is successfully matched with the second target operation type in the second operation type set; The second application performs a fourth processing action based on the second input event.
18. The method as described in claim 17, characterized in that, The method further includes: The second application receives a second message from the first application; the second message notifies the first user that the operation successfully matches the second target operation type in the second operation type set; or the second message is used to notify the first user that the operation is an operation performed by the user on the second application.
19. The method as described in claim 17 or 18, characterized in that, The second application matches the first user operation with the operation types in the second operation type set based on the first input event and the second input event, including: The second application determines the predicted operation type of the first user operation based on the event information of the first input event and the event information of the second input event; the second application matches the predicted operation type of the first user operation with the operation types in the second operation type set; or, The second application determines, based on the event information of the first input event and the event information of the second input event, whether the event information of the first user operation matches the event characteristics corresponding to the target operation type in the second operation type set; if the event information of the first user operation matches the event characteristics corresponding to the target operation type, the second application determines that the first user operation matches the target operation type; if the event information of the first user operation does not match the event characteristics corresponding to the target operation type, the second application determines that the first user operation does not match the target operation type. The event information includes at least one of the following: input device type, event type, reporting location, and timestamp.
20. The method according to any one of claims 17-19, characterized in that, Before the second application executes the fourth processing action based on the second input event, the method further includes: The second application determines, based on the second component layout information, that the reporting position of the first input event is located within the control area of the second target component corresponding to the second target operation type; wherein, the second component layout information is used to indicate the layout of the at least one second component in the window.
21. The method according to any one of claims 17-20, characterized in that, The second application performs a fourth processing action based on the second input event, including: The second application executes the fourth processing action based on the second target operation type, the event information of the second input event, and the layout information of the second component; The event information includes at least one of the following: input device type, event type, reporting location, and timestamp; the second component layout information is used to indicate the layout of the at least one second component in the window.
22. The method according to any one of claims 17-21, characterized in that, The method further includes: The second application receives a fourth input event from the first application; the fourth input event is generated by the input management service based on the first user's operation. The second application executes the fifth processing action based on the fourth input event.
23. The method according to any one of claims 16-22, characterized in that, The method further includes: The second application sends the location information of the first region to the first application; and / or, The second application sends the layout information of the second component to the first application; The location information of the first region is used to indicate the position of the first region within the window, and the layout information of the second component is used to indicate the layout of the at least one second component within the window.
24. The method according to any one of claims 16-23, characterized in that, The at least one second component is a component in the display content of the second application within a second location range; the second location range includes the reporting location of the first input event.
25. An electronic device, characterized in that, The electronic device includes: A display screen used to show the user interface; Memory is used to store computer program instructions; A processor for executing the computer program instructions to support the electronic device in implementing the method as described in any one of claims 1-24.
26. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores computer program instructions that, when executed by a processing circuit, implement the method as described in any one of claims 1-24.
27. A computer program product containing instructions, characterized in that, When the computer program product is run on a computer, it causes the computer to perform the method as described in any one of claims 1-24.