Method for sharing input device, electronic device, and storage medium

By configuring keyboard and mouse sharing services and input management modules in the operating system of terminal devices, input device sharing is achieved, solving the problem of cumbersome operation between terminal devices and improving input efficiency and user experience.

CN119225542BActive Publication Date: 2025-11-28HONOR DEVICE CO LTD
View PDF 1 Cites 0 Cited by

Patent Information

Application Number
CN202310801731.5
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2023-06-30
Publication Date
2025-11-28
Estimated Expiration
2043-06-30

AI Technical Summary

Technical Problem

The independent input devices between existing terminal devices require users to switch back and forth between different devices, which is cumbersome and detrimental to the user experience.

Method used

By configuring a keyboard and mouse sharing service and an input management module in the operating system of the source device, input events are listened to and intercepted, and then forwarded to the peer device, thus enabling input device sharing.

Benefits of technology

It simplifies user operations across different input devices, improves input efficiency and user experience, and expands the application scenarios for shared input devices.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119225542B_ABST
    Figure CN119225542B_ABST
Patent Text Reader

Abstract

The application discloses a method for sharing an input device, an electronic device and a storage medium device, and belongs to the technical field of terminal interaction. The method comprises the following steps: a first electronic device is connected with an input device, an operating system of the first electronic device comprises a keyboard and mouse sharing service and an input management module, after the keyboard and mouse sharing service is started, the input management module is triggered to listen to an input event of the input device; in response to an operation for triggering the second electronic device to share the input device of the first electronic device, the keyboard and mouse sharing service controls a screen of the first electronic device to stop displaying a mouse cursor, and sends an interception instruction to the input management module; the input management module sends the first input event listened to to the keyboard and mouse sharing service according to the interception instruction; the keyboard and mouse sharing service receives the first input event, sends the first input event to the second electronic device, so that the second electronic device responds to the first input event. In this way, the input device can be shared among multiple devices.
Need to check novelty before this filing date? Find Prior Art

Description

TECHNICAL FIELD

[0001] The present application relates to the technical field of terminal interaction, and in particular relates to a method for sharing an input device, an electronic device and a storage medium. BACKGROUND

[0002] With the development of terminal technology, the types and quantities of terminal devices are increasing. The terminal devices can include mobile phones, tablets, computers and wearable devices, etc. At present, one terminal device cannot meet the needs of users, and users can use multiple terminal devices, such as mobile phones, tablets and computers to meet the needs of work and study. However, since each terminal device is independent, each terminal device has an input device matched with itself, and when multiple terminal devices all have business that needs to be processed by the user, the user needs to switch between the input devices of different terminal devices, which is complicated and is not conducive to user experience. SUMMARY

[0003] The present application provides a method for sharing an input device, an electronic device and a storage medium, which can realize sharing of an input device among multiple devices, so that the user can use the same input device to control multiple devices, thereby avoiding switching between different input devices, simplifying the operation of the user and improving the input efficiency. The technical solution is as follows:

[0004] In a first aspect, a method for sharing an input device is provided, which is applied to a first electronic device connected with an input device for inputting a control instruction, and the first electronic device is a source terminal device for sharing the input device. The first electronic device is configured with a keyboard and mouse sharing service and an input management module in an operating system, the keyboard and mouse sharing service is used to realize the business of sharing the input device between the first electronic device and other electronic devices, and the input management module is used to manage the input event of the first electronic device.

[0005] After the keyboard and mouse sharing service is started, the input management module can be triggered to listen to the input event of the input device. Then, if an operation for triggering the second electronic device to share the input device of the first electronic device is received, in response to the operation, the keyboard and mouse sharing service can control the screen of the first electronic device to stop displaying a mouse cursor, and send an interception instruction to the input management module, so that the input management module sends the first input event listened to to the keyboard and mouse sharing service according to the interception instruction. After the keyboard and mouse sharing service receives the first input event, the first input event can be sent to the second electronic device, so that the second electronic device responds to the first input event.

[0006] By configuring the keyboard-mouse sharing service and the input management module in the operating system of the source device, the input events of the source device are listened to and intercepted by the keyboard-mouse sharing service and the input management module, and then forwarded to the opposite device after interception, so that the opposite device responds to the input events of the source device, thereby realizing the sharing of the input device between the source device and the opposite device, allowing the user to control multiple devices using the same input device, avoiding switching between different input devices, thereby simplifying the user's operation, improving the input efficiency and user experience. Moreover, this scheme is applicable to the source device with an Android system, expanding the application scenarios of the shared input device.

[0007] The input device can be a mouse device, a keyboard device, a touchpad, a touch screen device, a sensor device, etc., and the embodiments of the present application do not limit the same. For example, the input device is an external input device, such as an external mouse or an external keyboard. By the method for sharing the input device provided in the embodiments of the present application, the input events of the external input device can be intercepted, and the intercepted input events can be forwarded to the second electronic device for response, thereby realizing the sharing of the external input device of the first electronic device by the second electronic device, so that the user can use the external input device of the first electronic device to input in the second electronic device.

[0008] The second operation refers to an operation of triggering the sharing of the input device of the first electronic device by the second electronic device, i.e., a switching operation of switching the input device to the second electronic device. As an example, whether the input device is switched to other devices can be indicated by whether the mouse cursor of the first electronic device crosses, for example, if the mouse cursor crosses, it indicates that the input device is switched to other devices, and if the mouse cursor does not cross, it indicates that the input device is not switched to other devices. The mouse cursor crossing refers to the movement of the mouse cursor outside the screen of the first electronic device, for example, the movement of the mouse cursor outside the screen of the first electronic device and pointing to the second electronic device.

[0009] After the keyboard-mouse sharing service is started, the input event listener can be configured for the input management module at an appropriate time, and the input management module can listen to the input events of the input device through the configured input event listener. By configuring the input event listener for the input management module, the listening to the input events of the input device can be realized.

[0010] In some embodiments, the input event listener can be configured for the input management module after the keyboard-mouse sharing service is started.

[0011] In some embodiments, the input management module can be configured with an input event listener when the key-mouse sharing service is started and when the first electronic device establishes a connection with the second electronic device. By configuring the input management module with an input event listener when the first electronic device establishes a connection with the second electronic device, the triggering of the listening of input events can save listening power consumption and avoid meaningless listening.

[0012] The input management module can include a first input management service and a first phone window manager. The first input management service is configured to listen to mouse events and can send the listened mouse events to the key-mouse sharing service. The mouse event refers to an input event of a mouse device, such as a click event, a movement event, or a scroll wheel scrolling event of the mouse device. The first input management service is an extended input management service based on a system native input management service, which extends the functions of listening and intercepting mouse events based on the functions of the system native input management service.

[0013] The first phone window manager is configured to listen to keyboard events and can send the listened keyboard events to the key-mouse sharing service. The keyboard event refers to a key event of a keyboard device. The first phone window manager can be an extended phone window manager based on a system native phone window manager, which extends the functions of listening and intercepting keyboard events based on the functions of the system native phone window manager.

[0014] In some embodiments, the key-mouse sharing service can configure a key-mouse event listener for the first input management service, so that the input management service listens to mouse events through the configured key-mouse event listener. In this way, the listening of mouse events can be achieved.

[0015] In some embodiments, the key-mouse sharing service can configure a key-mouse event listener for the first phone window manager, so that the first phone window manager listens to key events including keyboard events through the configured key-mouse event listener. In this way, the listening of keyboard events can be achieved.

[0016] In some embodiments, the input management module can also control the first electronic device not to respond to the first input event according to the interception instruction. In this way, only the second electronic device can respond to the first input event, avoiding the first electronic device and the second electronic device responding to the first input event at the same time, thereby avoiding input event response confusion and improving the accuracy of using input devices to control electronic devices.

[0017] In some embodiments, the input management module can send a stop distribution instruction to the input distributor, and the input distributor can not distribute events according to the stop distribution instruction, so that the first electronic device does not respond to the first input event.

[0018] Generally, when the second electronic device does not share the state of the input device of the first electronic device, after the input distributor receives the input event read by the input reader, the input event can be distributed to the response module corresponding to the input event in the first electronic device, and the response module responds to the input event, so as to realize the response of the first electronic device to the input event. In the embodiment of the application, in order to control the first electronic device not to respond to the input event, a stop distribution instruction can be sent to the input distributor to control the input distributor not to respond to the input event through the stop distribution instruction, thereby realizing the control of the first electronic device not to respond to the input event.

[0019] In some embodiments, the input management module includes a first input management service, which can send a first stop distribution instruction to the input distributor according to the interception instruction, and the input distributor can not distribute the mouse event according to the first stop distribution instruction. In this way, the first electronic device can not respond to the mouse event, avoiding the confusion of the response to the mouse event, improving the accuracy of responding to the mouse event, and further improving the accuracy of the user controlling the device through the mouse.

[0020] In some embodiments, the input management module includes a first telephone window manager, which can send a second stop distribution instruction to the input distributor, and the input distributor can not distribute the mouse event according to the second stop distribution instruction. In this way, the first electronic device can not respond to the mouse event, avoiding the confusion of the response to the keyboard event, improving the accuracy of responding to the keyboard event, and further improving the accuracy of the user controlling the device through the keyboard.

[0021] In some embodiments, after the first telephone window manager listens to the first key event, it can be determined whether the first key event is a keyboard event. If it is determined that the first key event is a keyboard event, the first key event is sent to the keyboard and mouse sharing service. If it is determined that the first key event is not a keyboard event, the first key event is not sent to the keyboard and mouse sharing service. In this way, only the key event of the external keyboard device of the first electronic device can be intercepted and forwarded, and other key events, such as system key events of the first electronic device, can still be responded by the first electronic device itself.

[0022] The system key event refers to the key event of the native key of the first electronic device. For example, the native key can be the power key, the volume key, etc. of the first electronic device.

[0023] In some embodiments, after the first input management service listens to the first mouse event, it can be determined whether the first mouse event is an input event of the mouse device. If yes, the first mouse event is sent to the keyboard and mouse sharing service. If no, the first key event is not sent to the keyboard and mouse sharing service. In this way, only the mouse event of the external mouse device of the first electronic device can be intercepted and forwarded, and other mouse events, such as touchpad triggered mouse events, are still responded by the first electronic device itself.

[0024] In some embodiments, before the input management module sends the first input event listened to the keyboard and mouse sharing service, the input reader reads the first input event; the input reader calls the input notification method of the input dispatcher, and sends the first input event to the input management module through the input notification method.

[0025] In this way, the input reader can send the read input event to the input management module, and then the input management module can listen to the input event.

[0026] In some embodiments, the input reader can call the mouse notification method of the input dispatcher, and send the first mouse event to the first input management service through the input notification method. The input reader can call the keyboard notification method of the input dispatcher, and send the first keyboard event to the first phone window manager through the keyboard notification method.

[0027] In this way, the input reader can send the read mouse event to the first input management module and send the read keyboard event to the first phone window manager, respectively, so as to listen to the mouse event and the keyboard event.

[0028] In some embodiments, after the keyboard and mouse sharing service is started, the input reader, the first input management service and the first phone window manager can also be state initialized at a suitable time. For example, after it is detected that the first electronic device and the second electronic device are connected, the input reader, the first input management service and the first phone window manager are state initialized.

[0029] The operation of initializing states for the input reader, the first input management service and the first phone window manager includes: determining a keyboard and mouse sharing state of the keyboard and mouse sharing service, and sending an initialization state parameter to the input reader, the first input management service and the first phone window manager, so that the input reader, the first input management service and the first phone window manager initialize the stored keyboard and mouse sharing state according to the initialization state parameter. The keyboard and mouse sharing state can include whether the tablet is connected to the second electronic device, whether the input device is switched to the second electronic device, and the like. The initialization state parameter includes the current keyboard and mouse sharing state, so that the input reader, the first input management service and the first phone window manager initialize the stored keyboard and mouse sharing state to the current keyboard and mouse sharing state.

[0030] In some embodiments, the operation of the keyboard and mouse sharing service controlling the screen of the first electronic device to stop displaying the mouse cursor includes: the keyboard and mouse sharing service sending a first control instruction to the input reader, and the input reader turning off the drawing function of the mouse cursor according to the first control instruction, so that the screen of the first electronic device stops displaying the mouse cursor.

[0031] In addition, the keyboard and mouse sharing service can also update the keyboard and mouse sharing state stored by the input reader, the first input management service and the first phone window manager according to the changed keyboard and mouse sharing state if the keyboard and mouse sharing state is detected to be changed.

[0032] By initializing and updating the states of the input reader, the first input management service and the first phone window manager, the input reader can control the opening or closing of the drawing function of the mouse cursor according to the keyboard and mouse sharing state, the first input management service can control the interception of the mouse event according to the keyboard and mouse sharing state, and the first phone window manager can control the interception of the keyboard event according to the keyboard and mouse sharing state.

[0033] For example, the above-mentioned first control instruction can be second keyboard and mouse sharing state information, and the second keyboard and mouse sharing state information is used to indicate that the second electronic device shares the input device of the first electronic device, that is, the input device of the first electronic device is switched to the second electronic device. For another example, the above-mentioned interception instruction can also be the second keyboard and mouse sharing state information.

[0034] In some embodiments, the keyboard-mouse sharing service can trigger the input management module to listen to the input event of the input device, and send the listened input event to the keyboard-mouse sharing service. Before the keyboard-mouse sharing service controls the screen of the first electronic device to stop displaying the mouse cursor, and sends the interception instruction to the input management module, the input management module can also listen to a second input event, and send the second input event to the keyboard-mouse sharing service. If the keyboard-mouse sharing service determines that the mouse cursor crosses according to the second input event, it is determined that the second electronic device shares the operation of the first electronic device is received, and then the keyboard-mouse sharing service controls the screen of the first electronic device to stop displaying the mouse cursor, and sends the interception instruction to the input management module. Wherein, the mouse cursor crossing refers to the mouse cursor of the first electronic device moving out of the screen of the first electronic device, such as moving out of the left boundary of the screen, or moving out of the right boundary of the screen.

[0035] In this way, the user can control the mouse cursor to cross by moving the mouse, that is, control the mouse cursor to move out of the screen of the first electronic device, such as moving out of the left boundary of the screen, or moving out of the right boundary of the screen, to switch the input device of the first electronic device to the second electronic device for use, which is convenient for the user to operate and improves the flexibility and efficiency of sharing the input device.

[0036] In a second aspect, a device for sharing an input device is provided, which has the function of implementing the method for sharing an input device in the first aspect. The device for sharing an input device includes at least one module for implementing the method for sharing an input device provided in the first aspect.

[0037] In a third aspect, a device for sharing an input device is provided, which includes a processor and a memory in its structure. The memory is used to store a program supporting the device for sharing an input device to execute the method for sharing an input device provided in the first aspect, and store data involved in the method for sharing an input device in the first aspect. The processor is configured to execute the program stored in the memory. The device for sharing an input device can also include a communication bus for establishing a connection between the processor and the memory.

[0038] In a fourth aspect, a computer readable storage medium is provided, which stores instructions when running on a computer, so that the computer executes the method for sharing an input device in the first aspect.

[0039] In a fifth aspect, a computer program product containing instructions is provided, which makes the computer execute the method for sharing an input device in the first aspect when running on the computer.

[0040] The technical effects obtained by the second aspect, the third aspect, the fourth aspect and the fifth aspect are similar to the technical effects obtained by the corresponding technical means in the first aspect, and will not be described here. BRIEF DESCRIPTION OF DRAWINGS

[0041] Figure 1 A schematic diagram of a communication system is shown;

[0042] Figure 2 A schematic diagram of a key mouse traversal is shown;

[0043] Figure 3 A schematic diagram of a key mouse reverse traversal is shown;

[0044] Figure 4 An interface diagram for setting up a key mouse sharing through a setting interface is shown;

[0045] Figure 5 A schematic diagram of the structure of a terminal is shown;

[0046] Figure 6 A block diagram of a software system of a terminal is shown;

[0047] Figure 7 A logical diagram for implementing a shared input device between a tablet and a PC is shown;

[0048] Figure 8 A flowchart of a method for sharing an input device is shown;

[0049] Figure 9 A flowchart of another method for sharing an input device is shown;

[0050] Figure 10 A schematic diagram of the structure of an electronic device is shown. DETAILED DESCRIPTION

[0051] In order to make the purposes, technical solutions and advantages of the present application clearer, the embodiments of the present application will be further described in detail below with reference to the drawings.

[0052] It should be understood that the "multiple" mentioned in the present application refers to two or more. In the description of the present application, unless otherwise specified, " / " represents the meaning of or, for example, A / B can represent A or B; "and / or" herein only describes the association relationship of the associated objects, which means that there can be three relationships, for example, A and / or B, which can represent: A exists alone, A and B exist together, and B exists alone. In addition, in order to clearly describe the technical solutions of the present application, the same items or similar items with basically the same functions and roles are distinguished by using "first", "second", etc. The skilled in the art can understand that "first", "second", etc. do not limit the quantity and execution order, and "first", "second", etc. also do not limit the difference. In the description of the embodiments of the present application, unless otherwise specified, the meaning of "multiple" is two or more. For example, multiple processing units refer to two or more processing units; multiple systems refer to two or more systems.

[0053] Before the method for sharing the input device provided by the embodiments of the present application is explained in detail, the application scenarios related to the embodiments of the present application are described.

[0054] Multi-device collaboration is a distributed technology applied to multiple electronic devices. With the multi-device collaboration technology, two or more electronic devices can be cross-system and cross-device collaboration, realizing resource sharing and collaborative operation.

[0055] Multi-device collaboration can be applied between electronic devices of the same type or different types. The types of electronic devices include, but are not limited to, mobile phones, tablet computers, notebook computers, large-screen devices (for example, smart TVs, smart screens), personal computers (PCs), handheld computers, netbooks, personal digital assistants (PDAs), wearable electronic devices, vehicle-mounted devices, virtual reality devices, etc.

[0056] Multi-device collaboration needs to be realized based on communication connection between devices. The communication connection can be wired communication connection or wireless communication connection. The wired communication connection solution may, for example, include USB On-The-Go (OTG) technology; the wireless communication solution may, for example, include wireless fidelity (Wi-Fi), Wi-Fi Direct, Bluetooth (BT), near field communication (NFC), infrared technology (IR), etc.

[0057] With the continuous development of terminal technology, multi-device collaboration has generated a variety of different collaboration types, such as keyboard and mouse collaboration.

[0058] Keyboard and mouse collaboration: Keyboard and mouse collaboration refers to sharing input devices among multiple devices, such as sharing a mouse or a keyboard. For example, electronic device A shares the input devices of electronic device A with electronic device B, that is, a user can use the shared input devices to input in electronic device A or in electronic device B.

[0059] In order to better understand the embodiments of the present application, first, a communication system suitable for the embodiments of the present application is introduced.

[0060] Please refer to Figure 1 , Figure 1 A schematic diagram of a communication system is shown. As Figure 1 shown, the communication system includes a tablet 101, a computer 102, and a mobile phone 103. The tablet 101 is externally connected with a mouse and a keyboard. Among them, the operating system of the tablet 101 and the mobile phone 103 is Android system, and the operating system of the computer 102 is Windows system. The tablet 101, the computer 102, and the mobile phone 103 can share the mouse and the keyboard externally connected with the tablet 101. That is, a user can use the mouse and the keyboard externally connected with the tablet 101 to input on the tablet 101, or use the mouse and the keyboard externally connected with the tablet 101 to input on the computer 102 or the mobile phone 103. In this case, the tablet 101 can be referred to as a source device or a sending end, and the computer 102 and the mobile phone 103 can be referred to as a target device or a receiving end, but the embodiments of the present application are not limited thereto.

[0061] As shown, the tablet 101 is connected with input devices such as a mouse and a keyboard through a wired manner, for example, through a USB interface. It should be understood that the tablet 101 can also be connected with input devices such as a mouse and a keyboard through a wireless manner, for example, through a near field wireless communication technology, which can be Wi-Fi or Bluetooth. It should also be understood that Figure 1 Only the mouse and the keyboard are taken as examples of the input devices shared by multiple devices, and the input devices can also be touch screen devices or sensing devices, and the embodiments of the present application do not limit the shared input devices.

[0062] In the case of sharing the keyboard and the mouse, if the keyboard and the mouse are switched between different devices, the tablet 101 and the computer 102 can implement the keyboard and mouse crossing. For example, the left side or the right side of the tablet 101 can implement the keyboard and mouse crossing with one device, that is, the tablet 101 can support the mouse crossing from the left side of the screen of the tablet 101 to one other device, or support the mouse crossing from the right side of the screen of the tablet 101 to one other device. If the tablet 101 can implement the keyboard and mouse crossing with the computer 102 and the mobile phone 103, the computer 102 is on the right side of the tablet 101, and the mobile phone 103 is on the left side of the tablet 101, or the computer 102 is on the left side of the tablet 101, and the mobile phone 103 is on the right side of the tablet 101. If the computer 102 and the mobile phone 103 are both on the left side of the tablet 101, or the computer 102 and the mobile phone 103 are both on the right side of the tablet 101, the tablet 101 can implement the keyboard and mouse crossing with one device (the computer 102 or the mobile phone 103) at a time.

[0063] After the keyboard and mouse of the tablet 101 cross to the computer 102 and / or the mobile phone 103, the user can use the mouse of the tablet 101 to click, drag or double-click the computer 102 and / or the mobile phone 103, and use the keyboard of the tablet 101 to input information on the computer 102 and / or the mobile phone 103.

[0064] Exemplarily, please refer to Figure 2 , Figure 2 a schematic diagram of the keyboard and mouse crossing is shown. As shown in FIG. a of Figure 2 , the tablet 101 is circumscribed by the mouse and the keyboard, the mouse and the keyboard currently perform input on the tablet 101, and the mouse cursor 1011 is displayed on the screen of the tablet 101. In addition, the tablet 101 and the computer 102 can share the mouse and the keyboard. If the keyboard and the mouse are switched from the tablet 101 to the computer 102 for use, the tablet 101 can implement the keyboard and mouse crossing with the computer 102, that is, the mouse cursor 1011 displayed by the tablet 101 can cross from the screen of the tablet 101 to the screen of the computer 102. For example, the user can move the mouse to implement the crossing operation of the mouse cursor 1011, and when the tablet 101 detects the crossing operation of the mouse cursor 1011, the interface shown in FIG. b of Figure 2 can be displayed, as shown in FIG. b of Figure 2 , the mouse cursor 1011 is displayed on the screen of the computer 102. The crossing operation of the mouse cursor 1011 can be the operation of moving the mouse cursor to the outside of the screen of the tablet 101. For example, please refer to Figure 2As shown in FIG. 1B, the mouse cursor 1011 can be displayed in the form of a circle on the screen of the tablet 101. As shown in FIG. 1B, the mouse cursor 1011 can be displayed in the form of a pointer on the screen of the computer 102. It should be understood that the mouse cursor can be displayed in other forms on the tablet 101 or the computer 102, and the embodiments of the present application do not limit the mouse cursor display form.

[0065] As shown in FIG. 1A, the mouse cursor 1011 is displayed in the form of a circle on the screen of the tablet 101. Figure 2 As shown in FIG. 1B, the mouse cursor 1011 is displayed in the form of a pointer on the screen of the computer 102. It should be understood that the mouse cursor can be displayed in other forms on the tablet 101 or the computer 102, and the embodiments of the present application do not limit the mouse cursor display form. Figure 2 As shown in FIG. 1B, the mouse cursor 1011 is displayed in the form of a pointer on the screen of the computer 102. It should be understood that the mouse cursor can be displayed in other forms on the tablet 101 or the computer 102, and the embodiments of the present application do not limit the mouse cursor display form.

[0066] In addition, after the mouse cursor 1011 is transferred from the tablet 101 to the computer 102, the user can input information in the computer 102 through the keyboard of the tablet 101. For example, based on FIG. 1B, the user can click the icon of "Document 1" through the mouse cursor 1011, and the computer 102 can display the interface shown in FIG. 1C in response to the user's operation of clicking the icon of "Document 1". Figure 2 As shown in FIG. 1C, the computer 102 displays the editing page of Document 1. The user can input information "My Document" in the editing page of Document 1 through the keyboard of the tablet 101, and the computer 102 can display "My Document" in the editing page of Document 1 in response to the user's operation of inputting information in the editing page of Document 1. Figure 2 As shown in FIG. 1C, the computer 102 displays the editing page of Document 1. The user can input information "My Document" in the editing page of Document 1 through the keyboard of the tablet 101, and the computer 102 can display "My Document" in the editing page of Document 1 in response to the user's operation of inputting information in the editing page of Document 1. Figure 3 As shown in FIG. 1C, the computer 102 displays the editing page of Document 1. The user can input information "My Document" in the editing page of Document 1 through the keyboard of the tablet 101, and the computer 102 can display "My Document" in the editing page of Document 1 in response to the user's operation of inputting information in the editing page of Document 1.

[0067] In addition, if the keyboard and the mouse are switched from the computer 102 to the tablet 101 for use, the mouse cursor 1011 can also be transferred from the computer 102 back to the tablet 101. Please refer to FIG. 1A and FIG. 1B. Figure 3 , Figure 3 FIG. 1A and FIG. 1B show a schematic diagram of reverse transfer of the keyboard and the mouse. As shown in FIG. 1A, the mouse cursor 1011 is displayed on the screen of the computer 102. The user can move the mouse to implement the transfer operation of the mouse cursor 1011, and the computer 102 can display the interface shown in FIG. 1B in response to the transfer operation of the mouse cursor 1011. Figure 3 As shown in FIG. 1B, the mouse cursor 1011 is displayed on the screen of the tablet 101. The transfer operation of the mouse cursor 1011 can be the operation of moving the mouse cursor to the outside of the screen of the computer 102. Please refer to FIG. 1A, and the transfer operation of the mouse cursor 1011 is the operation of moving the mouse cursor 1011 to the outside of the right boundary of the screen by moving the mouse to control the mouse cursor 1011. Figure 3 As shown in FIG. 1B, the mouse cursor 1011 is displayed on the screen of the tablet 101. The transfer operation of the mouse cursor 1011 can be the operation of moving the mouse cursor to the outside of the screen of the computer 102. Please refer to FIG. 1A, and the transfer operation of the mouse cursor 1011 is the operation of moving the mouse cursor 1011 to the outside of the right boundary of the screen by moving the mouse to control the mouse cursor 1011. Figure 3 As shown in FIG. 1B, the mouse cursor 1011 is displayed on the screen of the tablet 101. The transfer operation of the mouse cursor 1011 can be the operation of moving the mouse cursor to the outside of the screen of the computer 102. Please refer to FIG. 1A, and the transfer operation of the mouse cursor 1011 is the operation of moving the mouse cursor 1011 to the outside of the right boundary of the screen by moving the mouse to control the mouse cursor 1011. Figure 4 As shown in FIG. 1B, the mouse cursor 1011 is displayed on the screen of the tablet 101. The transfer operation of the mouse cursor 1011 can be the operation of moving the mouse cursor to the outside of the screen of the computer 102. Please refer to FIG. 1A, and the transfer operation of the mouse cursor 1011 is the operation of moving the mouse cursor 1011 to the outside of the right boundary of the screen by moving the mouse to control the mouse cursor 1011. As shown in FIG. 1B, the mouse cursor 1011 is displayed on the screen of the tablet 101. The transfer operation of the mouse cursor 1011 can be the operation of moving the mouse cursor to the outside of the screen of the computer 102. Please refer to FIG. 1A, and the transfer operation of the mouse cursor 1011 is the operation of moving the mouse cursor 1011 to the outside of the right boundary of the screen by moving the mouse to control the mouse cursor 1011.

[0068] The condition that the tablet 101 shares the input device with the computer 102 and the mobile phone 103 can be that the tablet 101, the computer 102, and the mobile phone 103 log in to the same account; and / or the tablet 101, the computer 102, and the mobile phone 103 are connected through Wi-Fi or Bluetooth. The Wi-Fi can include a local area network or peer to peer (P2P).

[0069] The tablet 101 can perceive all the devices that meet the condition of sharing the input device, but the number of devices that implement the shared input device with the tablet 101 can be two. When the number of devices that the tablet 101 perceives is more than two, the tablet 101 can implement the shared input device with the device selected by the user based on the operation of the user selecting the device, or the tablet 101 can autonomously select the device that implements the shared input device based on a preset rule, which is not limited by the embodiments of the present application.

[0070] The connection of the tablet 101 with the computer 102 and the mobile phone 103 to implement the device sharing includes two implementation manners. One possible implementation manner is manual selection. The manual selection option is that the tablet 101 can autonomously select the connected device, and in the case that the automatic selection option is closed (or not turned on), the user can manually drag or click the connectable device in the visual interface to implement the connection of the tablet 101 with the computer 102 and the mobile phone 103. Another possible implementation manner is automatic selection. In the case that the automatic selection option is turned on and the computer 102 and the mobile phone 103 meet the condition of sharing the input device, the tablet 101 can automatically connect the computer 102 and the mobile phone 103. The automatic selection option can be in different positions in different devices. For example, the automatic selection option can be in the setting interface or control center of the tablet 101 and the mobile phone 103. The automatic selection option can be in the computer manager of the computer 102.

[0071] Exemplarily, Figure 4 An interface schematic diagram for setting the keyboard and mouse sharing through the setting interface is shown. If the user wants to set the related parameters of the keyboard and mouse sharing, the user can click the setting icon, and the tablet 101 displays the setting interface in response to the clicking operation of the user, as shown in FIG. a of Figure 4 The setting interface can include the Bluetooth, mobile data, smart interconnection, and the like options, and of course can include other setting options, as shown in FIG. a of Figure 4 The tablet 101 displays the keyboard and mouse sharing setting interface in response to the operation of the user clicking the smart interconnection option, as shown in FIG. a of Figure 4 The keyboard and mouse sharing setting interface includes the switch control of the keyboard and mouse sharing, as shown in FIG. a of In response to the operation of the user clicking the switch control of the keyboard and mouse sharing, the tablet 101 displays the keyboard and mouse sharing setting interface, as shown in FIG. b ofFigure 4 As shown in Figure b, the switch control shared by the keyboard and mouse is switched to the on state.

[0072] In addition, such as Figure 4 As shown in Figure b, after the keyboard and mouse sharing switch is turned on, the keyboard and mouse sharing settings interface can also display automatic connection and automatic direction switching options. Users can click the automatic connection option to enable the automatic connection function, and click the automatic direction switching option to enable the automatic direction switching function. With automatic connection enabled, Tablet 101 can automatically connect to available devices. For example, users can trigger Tablet 101 to automatically connect to available devices by repeatedly hovering the mouse cursor close to the edge of the screen. Available devices refer to devices that can establish a shared input device connection with Tablet 101, i.e., devices that meet the conditions for shared input devices. With automatic direction switching enabled, Tablet 101 can automatically switch its screen arrangement position according to changes in device placement. For example, when it detects that Computer 102 is placed to the left of Tablet 101, the keyboard and mouse movement direction is configured to move from the left side of the screen to the screen of Computer 102; when it detects that Computer 102 is placed to the right of Tablet 101, the keyboard and mouse movement direction is configured to move from the right side of the screen to the screen of Computer 102.

[0073] In addition, the keyboard and mouse settings interface can also display device identifiers for available devices, such as... Figure 4 As shown in Figure b, the keyboard and mouse settings interface displays available devices: YOYO's computer, YOYO's phone, and HONOR Pad. Users can choose the device to connect to based on its device identifier. For example, a user can click on YOYO's computer, and in response, Tablet 101 establishes a connection with YOYO's computer. After connecting, Tablet 101 can display... Figure 4 The keyboard and mouse sharing settings interface is shown in Figure c. Figure 5 As shown in Figure c, the keyboard and mouse sharing settings interface can display an indication that Tablet 101 and YOYO's computer are connected, and can also display crossing direction options, such as left crossing and right crossing options. Assuming YOYO's computer is placed to the right of Tablet 101, the user can click the right crossing option. In response to this click, Tablet 101 can be configured to share the keyboard and mouse input devices with YOYO's computer in a direction that crosses to the right of the screen. That is, the mouse cursor on Tablet 101 can cross from the right side of the screen to YOYO's computer.

[0074] It should be understood that Figure 5Only by setting the interface to start the mouse and keyboard sharing function, and setting the related function parameters of the mouse and keyboard sharing function are described, in other embodiments, the mouse and keyboard sharing function can also be started by other ways, and the related function parameters of the mouse and keyboard sharing function are set, the embodiments of the application do not limit this.

[0075] It should be noted that the above embodiments are only examples of sharing mouse and keyboard between multiple devices, and other input devices can also be shared between multiple devices, and the embodiments of the application do not limit this. In addition, the above embodiments are only examples of the source device being a tablet, and the peer device being a computer and a mobile phone, it should be understood that in other embodiments, the source device and the peer device can also be other devices.

[0076] In some embodiments, for the scenario that the operating system of the source device is a Windows system, a scheme for sharing input devices between the source device and the peer device is proposed. However, due to the differences between different operating systems, the scheme for sharing input devices suitable for the operating system of the source device being a Windows system is not suitable for the scenario that the operating system of the source device is an Android system.

[0077] In some embodiments, for the scenario that the operating system of the source device is a Windows system, a scheme for sharing input devices between the source device and the peer device is proposed. However, due to the differences between different operating systems, the scheme for sharing input devices suitable for the operating system of the source device being a Windows system is not suitable for the scenario that the operating system of the source device is an Android system.

[0078] In the embodiments of the application, in order to enable input device sharing between devices when the operating system of the source device is a Windows system, the following method for sharing input devices is proposed: a mouse and keyboard sharing service and an input management module are configured in the operating system of the source device, wherein the mouse and keyboard sharing service is used to implement the business of sharing input devices between the source device and the peer device, and the input management module is used to manage the input events of the source electronic device. In the case that the source device is connected with an input device for inputting control instructions, the mouse and keyboard sharing service can trigger the input management module to listen to the input events of the input device after being started. Then, if an operation for triggering the peer device to share the input device of the source device is received, in response to the operation, the mouse and keyboard sharing service can control the screen of the source device to stop displaying the mouse cursor, and send an interception instruction to the input management module, so that the input management module sends the subsequent listened input events to the mouse and keyboard sharing service according to the interception instruction. After the mouse and keyboard sharing service receives the input events sent by the input management module, the input events are forwarded to the peer device, so that other devices respond to the input events.

[0079] By configuring the keyboard and mouse sharing service and the input management module in the operating system of the source device, the input events of the source device are listened to and intercepted by the keyboard and mouse sharing service and the input management module, and then forwarded to the opposite device after interception, so that the opposite device responds to the input events of the source device. The input device is shared between the source device and the opposite device, so that the user can use the same input device to control multiple devices, avoiding switching between different input devices, thereby simplifying the user's operation, improving the input efficiency and user experience. Moreover, this scheme is applicable to the source device with an Android system, expanding the application scenarios of sharing the input device.

[0080] In addition, according to the interception instruction, the input management module can not only send the subsequent intercepted input events to the keyboard and mouse sharing service, but also control the source device not to respond to the intercepted input events. For example, the input management module can send a stop distribution instruction to the input distributor, and the input distributor can stop distributing the input events according to the stop distribution instruction, that is, the input events will not be sent to the response module corresponding to the input events in the tablet for response, so that the tablet will not respond to the input events.

[0081] As an example, the input device is an external input device, such as an external mouse or an external keyboard. By the method for sharing the input device provided in the embodiments of the present application, the input events of the external input device can be intercepted and forwarded to the opposite device for response.

[0082] For ease of illustration, the following embodiments refer to the source device as the first electronic device and the opposite device as the second electronic device.

[0083] The first electronic device and the second electronic device can be terminal devices. Next, the structure of the first electronic device will be introduced taking the first electronic device as a terminal device as an example.

[0084] Figure 6 A structural diagram of a terminal is shown. Referring to Figure 6The terminal 100 can 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 headset jack 170D, a sensor module 180, a key 190, a motor 191, an indicator 192, a camera 193, a display screen 194, and a subscriber identification module (SIM) card interface 195, etc. The sensor module 180 can include a pressure sensor 180A, a gyroscope sensor 180B, a barometric sensor 180C, a magnetic sensor 180D, an acceleration sensor 180E, a distance sensor 180F, a proximity light sensor 180G, a fingerprint sensor 180H, a temperature sensor 180J, a touch sensor 180K, an ambient light sensor 180L, a bone conduction sensor 180M, etc.

[0085] It can be understood that the structure illustrated in the embodiments of the present application does not constitute a specific limitation on the terminal 100. In other embodiments of the present application, the terminal 100 can include more or fewer components than illustrated, or combine certain components, or split certain components, or different arrangement of components. The illustrated components can be implemented in hardware, software, or a combination of software and hardware.

[0086] The processor 110 can include one or more processing units, such as: the processor 110 can include an application processor (AP), a modem processor, a graphics processing unit (GPU), an image signal processor (ISP), a controller, a memory, a video codec, a digital signal processor (DSP), a baseband processor, and / or a neural-network processing unit (NPU), etc. Different processing units can be independent devices, or can be integrated in one or more processors.

[0087] The controller can be the nerve center and command center of the terminal 100. The controller can generate operation control signals according to instruction operation codes and timing signals, and complete the control of fetching instructions and executing instructions.

[0088] The processor 110 can also include a memory that stores instructions and data. In some embodiments, the memory in the processor 110 is a cache memory. The cache memory can hold instructions or data that the processor 110 has recently used or that are likely to be used again. If the processor 110 needs to use the instructions or data again, it can be retrieved directly from the cache memory. This avoids repeated accesses to the main memory, reducing the latency of the processor 110 and thus improving the efficiency of the system.

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

[0090] The I2C interface is a bidirectional synchronous serial bus that includes a serial data line (SDA) and a serial clock line (SCL). In some embodiments, the processor 110 can include multiple sets of I2C interfaces. The processor 110 can be coupled to the touch sensor 180K, the charger, the flash, the camera 193, etc. through different I2C interfaces, respectively. For example, the processor 110 can be coupled to the touch sensor 180K through an I2C interface, so that the processor 110 and the touch sensor 180K communicate through the I2C interface to realize the touch function of the terminal 100.

[0091] The I2S interface can be used for audio communication. In some embodiments, the processor 110 can include multiple sets of I2S interfaces. The processor 110 can be coupled to the audio module 170 through the I2S interface to realize communication between the processor 110 and the audio module 170. In some embodiments, the audio module 170 can deliver audio signals to the wireless communication module 160 through the I2S interface to realize the function of answering a phone through a Bluetooth headset.

[0092] The PCM interface can also be used for audio communication, sampling, quantizing and encoding analog signals. In some embodiments, the audio module 170 can be coupled with the wireless communication module 160 through the PCM interface. In some embodiments, the audio module 170 can also transmit audio signals to the wireless communication module 160 through the PCM interface, enabling the function of answering a phone call through a Bluetooth headset.

[0093] The UART interface is a universal serial bus for asynchronous communication. The UART interface can be a bidirectional communication bus. The UART interface can convert data to be transmitted between serial communication and parallel communication. In some embodiments, the UART interface is usually used to connect the processor 110 and the wireless communication module 160. For example, the processor 110 communicates with the Bluetooth module in the wireless communication module 160 through the UART interface, enabling the Bluetooth function. In some embodiments, the audio module 170 can transmit audio signals to the wireless communication module 160 through the UART interface, enabling the function of playing music through a Bluetooth headset.

[0094] The MIPI interface can be used to connect the processor 110 and peripheral devices such as the display screen 194 and the camera 193. The MIPI interface includes the camera serial interface (CSI), the display serial interface (DSI), etc. In some embodiments, the processor 110 and the camera 193 communicate through the CSI interface, enabling the shooting function of the terminal 100. The processor 110 and the display screen 194 communicate through the DSI interface, enabling the display function of the terminal 100.

[0095] The GPIO interface can be configured by software. The GPIO interface can be configured as a control signal or as a data signal. In some embodiments, the GPIO interface can be used to connect the processor 110 and the camera 193, the display screen 194, the wireless communication module 160, the audio module 170, the sensor module 180, etc. The GPIO interface can also be configured as an I2C interface, an I2S interface, a UART interface, a MIPI interface, etc.

[0096] The USB interface 130 is an interface conforming to the USB standard specification, and can be a Mini USB interface, a Micro USB interface, a USB Type C interface, etc. The USB interface 130 can be used to connect a charger to charge the terminal 100, and can also be used to transmit data between the terminal 100 and a peripheral device. It can also be used to connect a headset to play audio through the headset. The USB interface 130 can also be used to connect to other terminals, such as AR devices, etc. The USB interface 130 can also be used to connect to an input device. The input device can be a mouse, a keyboard, a touch screen device, or a sensor device, etc.

[0097] It can be understood that the interface connection relationship between the modules shown in the embodiments of the present application is only illustrative and does not constitute a structural limitation of the terminal 100. In other embodiments of the present application, the terminal 100 can also use different interface connection methods or combinations of multiple interface connection methods in the above embodiments.

[0098] The charging management module 140 is used to receive charging input from a charger. The charger can be a wireless charger or a wired charger. In some wired charging embodiments, the charging management module 140 can receive charging input from a wired charger through the USB interface 130. In some wireless charging embodiments, the charging management module 140 can receive wireless charging input through the wireless charging coil of the terminal 100. The charging management module 140 can charge the battery 142 while also supplying power to the terminal 100 through the power management module 141.

[0099] The power management module 141 is used to connect the battery 142, the charging management module 140, and the processor 110. The power management module 141 receives input from the battery 142 and / or the charging management module 140 to supply power to the processor 110, the internal memory 121, the external memory, the display screen 194, the camera 193, and the wireless communication module 160, etc. The power management module 141 can also be used to monitor parameters such as battery capacity, battery cycle count, battery health status (leakage, impedance), etc. In other embodiments, the power management module 141 can also be provided in the processor 110. In other embodiments, the power management module 141 and the charging management module 140 can also be provided in the same device.

[0100] The wireless communication function of the terminal 100 can be realized through the antenna 1, the antenna 2, the mobile communication module 150, the wireless communication module 160, the modem processor, and the baseband processor, etc.

[0101] Antennas 1 and 2 are used for transmitting and receiving electromagnetic wave signals. Each antenna in terminal 100 can be used to cover a single or multiple communication frequency bands. Different antennas can also be multiplexed to improve the utilization of antennas. For example, antenna 1 can be multiplexed as a diversity antenna for wireless local area networks. In some other embodiments, antennas can be used in combination with tuning switches.

[0102] Mobile communication module 150 can provide solutions for wireless communication including 2G / 3G / 4G / 5G, etc. applied on terminal 100. Mobile communication module 150 can include at least one filter, switch, power amplifier, low noise amplifier (LNA), etc. Mobile communication module 150 can receive electromagnetic waves by antenna 1, and perform filtering, amplification, etc. on the received electromagnetic waves, and transmit the processed electromagnetic waves to a modem processor for demodulation. Mobile communication module 150 can also amplify signals modulated by the modem processor, and convert the amplified signals into electromagnetic waves radiated by antenna 1. In some embodiments, at least part of the functional modules of mobile communication module 150 can be arranged in processor 110. In some embodiments, at least part of the functional modules of mobile communication module 150 can be arranged in the same device as at least part of the modules of processor 110.

[0103] The modem processor can include a modulator and a demodulator. The modulator is used to modulate low-frequency baseband signals to be transmitted into medium-high frequency signals. The demodulator is used to demodulate received electromagnetic wave signals into low-frequency baseband signals. The demodulator then transmits the demodulated low-frequency baseband signals to a baseband processor for processing. After the low-frequency baseband signals are processed by the baseband processor, the processed signals are transmitted to an application processor. The application processor outputs sound signals through audio devices (not limited to loudspeakers 170A and microphones 170B, etc.), or displays images or videos through display screen 194. In some embodiments, the modem processor can be a separate device. In some other embodiments, the modem processor can be independent of processor 110, and arranged in the same device as mobile communication module 150 or other functional modules.

[0104] The wireless communication module 160 can provide a solution for wireless communication including wireless local area networks (WLAN) (e.g., wireless fidelity (Wi-Fi) network), Bluetooth (BT), global navigation satellite system (GNSS), frequency modulation (FM), near field communication (NFC), infrared (IR) technology, etc. applied to the terminal 100. The wireless communication module 160 can be one or more devices that integrate at least one communication processing module. The wireless communication module 160 receives electromagnetic waves via the antenna 2, frequency-modulates and filters the electromagnetic wave signals, and transmits the processed signals to the processor 110. The wireless communication module 160 can also receive signals to be transmitted from the processor 110, frequency-modulate them, amplify them, and radiate them as electromagnetic waves via the antenna 2.

[0105] In some embodiments, the terminal 100 can connect with input devices such as a mouse, a keyboard, etc. through the wireless communication module 160. For example, the terminal 100 can connect with the input devices through Bluetooth.

[0106] In some embodiments, the terminal 100 can also establish a connection with other devices through the wireless communication module 160, to share the input devices with the other devices through the established connection.

[0107] In some embodiments, antenna 1 and mobile communication module 150 of terminal 100 are coupled, and antenna 2 and wireless communication module 160 are coupled, so that terminal 100 can communicate with a network and other devices through wireless communication technology. The wireless communication technology can include global system for mobile communications (GSM), general packet radio service (GPRS), code division multiple access (CDMA), wideband code division multiple access (WCDMA), time-division code division multiple access (TD-SCDMA), long term evolution (LTE), BT, GNSS, WLAN, NFC, FM, and / or IR technology, etc. The GNSS can include global positioning system (GPS), global navigation satellite system (GLONASS), beidou navigation satellite system (BDS), quasi-zenith satellite system (QZSS), and / or satellite based augmentation systems (SBAS).

[0108] Terminal 100 implements a display function through a GPU, display screen 194, and an application processor, etc. The GPU is a microprocessor for image processing, connected to the display screen 194 and the application processor. The GPU is used to perform mathematical and geometric calculations for graphics rendering. Processor 110 can include one or more GPUs that execute program instructions to generate or change display information.

[0109] The display screen 194 is configured to display images, videos, and the like. The display screen 194 includes a display panel. The display panel can be a liquid crystal display (LCD), an organic light-emitting diode (OLED), an active-matrix organic light-emitting diode (AMOLED), a flex light-emitting diode (FLED), a Miniled, a MicroLed, a Micro-oLed, a quantum dot light emitting diodes (QLED), or the like. In some embodiments, the terminal 100 can include one or N display screens 194, where N is an integer greater than 1.

[0110] The terminal 100 can implement the photographing function through the ISP, the camera 193, the video codec, the GPU, the display screen 194, and the application processor.

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

[0112] The camera 193 is configured to capture still images or videos. An object generates an optical image through a lens and projects it onto a photosensitive element. The photosensitive element can be a charge coupled device (CCD) or a complementary metal-oxide-semiconductor (CMOS) phototransistor. The photosensitive element converts the light signal into an electrical signal, which is then transmitted to the ISP to convert it into a digital image signal. The ISP outputs the digital image signal to the DSP for processing. The DSP converts the digital image signal into an image signal in a standard RGB, YUV, or the like format. In some embodiments, the terminal 100 can include one or N cameras 193, where N is an integer greater than 1.

[0113] The digital signal processor is used to process digital signals, in addition to being able to process digital image signals, it can also process other digital signals. For example, when the terminal 100 selects a frequency point, the digital signal processor is used to perform Fourier transform on the frequency point energy, etc.

[0114] The video codec is used to compress or decompress digital video. The terminal 100 can support one or more video codecs. In this way, the terminal 100 can play or record videos in multiple encoding formats, such as: moving picture experts group (MPEG) 1, MPEG 2, MPEG 3, MPEG 4, etc.

[0115] The NPU is a neural-network (NN) calculation processor, which can quickly process input information by drawing on the structure of a biological neural network, such as the transmission mode between human brain neurons, and can also continuously self-learn. Through the NPU, intelligent cognitive applications of the terminal 100 can be realized, such as: image recognition, face recognition, voice recognition, text understanding, etc.

[0116] The external memory interface 120 can be used to connect an external memory card, such as a Micro SD card, to expand the storage capacity of the terminal 100. The external memory card communicates with the processor 110 through the external memory interface 120 to realize data storage functions. For example, music, video, etc. Files are saved in the external memory card.

[0117] The internal memory 121 can be used to store computer executable program code, which includes instructions. The processor 110 executes various functional applications and data processing of the terminal 100 by running the instructions stored in the internal memory 121. The internal memory 121 can include a program storage area and a data storage area. The program storage area can store an operating system, at least one application program required by a function (such as a sound playing function, an image playing function, etc.), etc. The data storage area can store data created by the terminal 100 during use (such as audio data, a phonebook, etc.), etc. In addition, the internal memory 121 can include a high-speed random access memory, and can also include a non-volatile memory, such as at least one magnetic disk storage device, a flash memory device, a universal flash storage (UFS), etc.

[0118] The terminal 100 can realize audio functions such as music playing, recording, etc. through the audio module 170, the speaker 170A, the receiver 170B, the microphone 170C, the earphone interface 170D, and the application processor, etc.

[0119] The audio module 170 is configured to convert digital audio information into an analog audio signal output, and to convert an analog audio input into a digital audio signal. The audio module 170 can also be configured to encode and decode audio signals. In some embodiments, the audio module 170 can be disposed in the processor 110, or some of the functions of the audio module 170 can be disposed in the processor 110.

[0120] The speaker 170A, also referred to as a "loudspeaker", is configured to convert an audio electrical signal into a sound signal. The terminal 100 can listen to music or listen to a hands-free call through the speaker 170A.

[0121] The receiver 170B, also referred to as a "earpiece", is configured to convert an audio electrical signal into a sound signal. When the terminal 100 is on a call or listening to a voice message, the user can listen to the voice by holding the receiver 170B close to the ear.

[0122] The microphone 170C, also referred to as a "microphone", "sound collector", is configured to convert a sound signal into an electrical signal. When making a call or sending a voice message, the user can make a sound by holding the microphone 170C close to the mouth, and input the sound signal into the microphone 170C. The terminal 100 can be provided with at least one microphone 170C. In other embodiments, the terminal 100 can be provided with two microphones 170C, in addition to collecting sound signals, noise reduction functions can also be achieved. In other embodiments, the terminal 100 can also be provided with three, four or more microphones 170C, to achieve the functions of collecting sound signals, noise reduction, and identifying the source of the sound, and achieving directional recording functions, etc.

[0123] The earphone interface 170D is configured to connect a wired earphone. The earphone interface 170D can be a USB interface 130, or a 3.5mm open mobile terminal platform (OMTP) standard interface, a cellular telecommunications industry association of the USA (CTIA) standard interface.

[0124] The keys 190 include a power-on key, a volume key, etc. The keys 190 can be mechanical keys or touch keys. The terminal 100 can receive key inputs and generate key signal inputs related to user settings and function control of the terminal 100.

[0125] The motor 191 can generate a vibration prompt. The motor 191 can be used for incoming call vibration prompt, and can also be used for touch vibration feedback. For example, touch operations for different applications (such as taking pictures, playing audio, etc.) can correspond to different vibration feedback effects. Touch operations on different regions of the display screen 194 can also correspond to different vibration feedback effects. Different application scenarios (such as time reminders, received messages, alarms, games, etc.) can also correspond to different vibration feedback effects. The touch vibration feedback effect can also support customization.

[0126] The indicator 192 can be an indicator light, which can be used to indicate the charging state, the power change, and can also be used to indicate messages, missed calls, notifications, etc.

[0127] The SIM card interface 195 is used to connect the SIM card. The SIM card can be inserted into or pulled out of the SIM card interface 195 to realize contact and separation with the terminal 100. The terminal 100 can support one or N SIM card interfaces, and N is an integer greater than 1. The SIM card interface 195 can support Nano SIM cards, Micro SIM cards, SIM cards, etc. The same SIM card interface 195 can simultaneously insert multiple cards. The types of multiple cards can be the same or different. The SIM card interface 195 can also be compatible with different types of SIM cards. The SIM card interface 195 can also be compatible with external storage cards. The terminal 100 interacts with the network through the SIM card to realize functions such as calling and data communication. In some embodiments, the terminal 100 uses an eSIM, that is, an embedded SIM card. The eSIM card can be embedded in the terminal 100 and cannot be separated from the terminal 100.

[0128] Next, the software system of the terminal 100 is described.

[0129] The software system of the terminal 100 can adopt a layered architecture, an event-driven architecture, a microkernel architecture, a microservice architecture, or a cloud architecture. The embodiment of the present application takes the Android system with a layered architecture as an example to exemplarily describe the software system of the terminal 100.

[0130] Figure 6 A block diagram of a software system of a terminal 100 is shown. Referring to Figure 6 , the layered architecture divides the software into several layers, and each layer has a clear role and division of labor. The layers communicate with each other through software interfaces. In some embodiments, the Android system is divided into four layers, from top to bottom, the application layer, the application framework layer (Fraemwork), the native service layer (Native), and the driver layer.

[0131] The application layer can include a series of application packages. For example, Figure 6As shown, the application package can include a keyboard and mouse sharing service. The keyboard and mouse sharing service is used to implement the service of sharing the input device between the terminal 100 and other devices.

[0132] In addition, the application package can further include camera, gallery, calendar, call, map, navigation, WLAN, Bluetooth, music, video, short message, etc. application programs.

[0133] The application framework layer provides an application programming interface (API) and a programming framework for the application programs of the application layer. The application framework layer includes some pre-defined functions. For example, Figure 6 As shown, the application framework layer can include an input management module, a first input manager, and an input management interface.

[0134] The input management module is used to manage the input events of the input device connected to the terminal 100. In the embodiments of the present application, the input management module can also be used to listen to the input events of the input device of the terminal 100, and send the listened input events to the keyboard and mouse sharing service. That is, the input management module can be used to intercept the input events of the input device of the terminal 100, and forward the intercepted input events to the keyboard and mouse sharing service. As shown, Figure 6 As shown, the input management module can include a first input management service and a first phone window manager. The first input management service is used to listen to the mouse events of the terminal 100, and can also send the listened mouse events to the keyboard and mouse sharing service. The mouse event refers to the input event of the mouse device, such as the click event, the movement event, and the scroll event of the scroll wheel of the mouse, etc. The first input management service is an input management service extended based on the system original input management service, which extends the functions of listening and intercepting the mouse events on the basis of the functions of the system original input management service. For example, the first input management service can be HwInputMangerService. The first phone window manager is used to listen to the keyboard events of the terminal 100, and can also send the listened keyboard events to the keyboard and mouse sharing service. The keyboard event refers to the key event of the keyboard device. The first phone window manager can be an extended phone window manager based on the system original phone window manager, which extends the functions of listening and intercepting the keyboard events on the basis of the functions of the system original phone window manager. For example, the first phone window manager is HwPhoneWindowManager.

[0135] In addition, the first input management service can configure the interception logic, through the configured interception logic, only specific types of mouse events can be intercepted, i.e., only specific types of mouse events are sent to the keyboard and mouse sharing service, and for other types of mouse events, no interception is performed, i.e., no sending to the keyboard and mouse sharing service, but continue to be responded by the terminal 100. For example, after receiving the mouse event reported by the input reader, the interception logic can be used to identify whether the mouse event is a mouse event triggered by an external mouse device, if yes, the mouse event is intercepted, if not, the mouse event is not intercepted.

[0136] In addition, the first phone window manager can configure the interception logic, through the configured interception logic, only specific types of key events can be intercepted, i.e., only specific types of key events are sent to the keyboard and mouse sharing service, and for other types of key events, no interception is performed, i.e., no sending to the keyboard and mouse sharing service, but continue to be responded by the terminal 100. For example, after receiving the key event reported by the input reader, the interception logic can be used to identify whether the key event is a key event triggered by an external keyboard device, if yes, the key event is intercepted, if not, the key event is not intercepted.

[0137] In the above, the input management interface (InputMnagerEx) is an external interface of the input management module, and the first input manager is an internal interface of the input management module. An external module needs to call the input management module through the input management interface and the first input manager. For example, the process of calling the input management module by the external module includes: the external module first calls the input management interface, calls the first input manager through the input management interface, and then calls the input management module through the first input manager. For example, the first input management service or the first phone window manager is called through the first input manager. The first input manager is an input manager extended based on the system original input manager, for example, the first input manager is HwInputManager.

[0138] In addition, as Figure 6As shown, the application framework layer can further include a second input management service, a mouse and keyboard event listener, an input filter, window management callbacks, and a native input management service. The second input management service is a system native input management service (InputMangerService) configured to manage input events. The mouse and keyboard event listener is configured to listen to keyboard events and mouse events. The input filter is configured to filter input events to filter out input events that meet requirements. The window management callbacks are configured to determine a window on which a mouse event acts. The native input management service is configured to manage underlying input event data.

[0139] As an example, the input management module can listen to input events through an input event listener configured by the mouse and keyboard sharing service, which can include a mouse and keyboard event listener, etc. For example, the mouse and keyboard sharing service can invoke an input management interface, invoke a first input manager through the input management interface, and configure an input event listener for the input management module through the first input manager, so that the input management module can listen to input events through the configured input event listener. For example, the mouse and keyboard event listener is configured for the first input management service through the first input manager, so that the first input management service can listen to mouse events through the configured mouse and keyboard event listener. For another example, the mouse and keyboard event listener is configured for the first phone window manager through the first input manager, so that the first phone window manager can listen to keyboard events through the configured mouse and keyboard event listener.

[0140] The input event listener can be a listening callback for input events, and correspondingly, the mouse and keyboard event listener can be a listening callback for mouse and keyboard events. The mouse and keyboard sharing service configures an input event listener for the input management module, which means that a listening callback is registered for the input management module in an input reader, so that when the input reader reads an input event, the input event is called back to the input management module through the registered listening callback. For example, a listening callback for mouse events is registered for the first input management service in the input reader, and a listening callback for keyboard events is registered for the first phone window manager in the input reader.

[0141] In addition, the application framework layer can further include a window manager, a content provider, a view system, a phone manager, a resource manager, a notification manager, etc., which are not limited by the embodiments of the present application.

[0142] The native service layer mainly includes some native services and link libraries. Please refer to Figure 6The local service layer can include an InputFlinger and a Libinput.

[0143] The InputFlinger is mainly responsible for reading and distributing original input events. Figure 7 As shown in FIG. 1, the InputFlinger includes a second input manager, an InputReader, an InputDispatcher, an InputDevice, and an EventHub. The second input manager is a system native input manager. The InputReader is used to read input events and to start and stop drawing a mouse cursor. The InputDispatcher is used to distribute input events. The InputDevice corresponds to an input device node of the driver layer and is created by the EventHub according to a newly added input device node. The EventHub is used to read original input events and to create an input device.

[0144] The Libinput mainly supports an event distribution process. As shown in FIG. 2, the Libinput can include an InputTransport, an InputPublisher, an InputMessager, an InputConsumer, an InputChannel, and a VelocityTracker. Figure 7

[0145] The driver layer includes at least an input device node, such as an input device node 1 and an input device node 2. In addition, the driver layer also includes a display driver and a processor driver.

[0146] After a mouse, a keyboard, a touchpad, or the like is connected to the terminal 100, the terminal 100 can create a device node in the driver layer according to a device driver of the input device. When an input device is connected to the terminal 100, the terminal 100 can add information of the created device node to a device node directory after creating a corresponding device node in the driver layer for the connected input device. The EventHub can scan the device node directory, read a newly added device node from the device node directory, and create an input module in the local service layer for the newly added device node. When the device node reports an input event, the EventHub can read an original input event reported by the device node and send the original input event to the InputReader. After receiving the original input event sent by the EventHub, the InputReader can encapsulate the original input event, generate a specific type of input event, send the generated input event to the input management module through an input event listener configured by the input management module, and then send the input event to the input management module for processing by the keyboard and mouse sharing service.

[0147] ​Next, the workflow of the terminal 100 software will be described by way of example. Figure 7

[0148] Please refer to Figure 6 , Figure 6 A logical diagram for implementing sharing of an input device between a tablet and a PC is shown. As shown in Figure 7 , after the keyboard-mouse sharing service is started, a keyboard-mouse event listener can be configured for the first input management service and the first phone window manager respectively. Then, on one hand, if a mouse event is read by the input reader, a mouse notification method of the input distributor can be called, the mouse event is sent to the first input management service through the mouse notification method, the first input management service receives the mouse event, and the received mouse event is sent to the keyboard-mouse sharing service. On the other hand, if a keyboard event is read by the input reader, a key notification method of the input distributor can be called, the keyboard event is sent to the first phone window manager through the key notification method, the first phone window manager receives the keyboard event, and the received keyboard event is sent to the keyboard-mouse sharing service.

[0149] In addition, after the keyboard-mouse sharing service receives the mouse event sent by the first input management service, the keyboard-mouse sharing service can also determine whether the mouse cursor has crossed according to the received mouse event. For example, after the input reader reports a mouse event, if the keyboard-mouse sharing service determines that the mouse cursor has crossed according to the mouse event listened by the first input manager, the keyboard-mouse sharing service can perform the following operations: 1, a control instruction 1 is sent to the input reader to make the input reader close the drawing function of the mouse cursor according to the control instruction 1; 2, the mouse event listened by the first input management service is forwarded to the PC; 3, a setting parameter is sent to the first input management service and the first phone window manager, the setting parameter includes first keyboard-mouse service state information, the first state information is used to indicate that the mouse cursor has crossed. According to the first keyboard-mouse service state information, the first input management service can send a stop distribution instruction 1 to the input distributor to make the input distributor stop distributing the mouse event according to the stop distribution instruction 1. According to the first keyboard-mouse service state information, the first phone window manager can send a stop distribution instruction 2 to the input distributor to make the input distributor stop distributing the keyboard event according to the stop distribution instruction 2. Then, if the keyboard-mouse sharing service receives the mouse event listened by the first input manager, the received mouse event is forwarded to the PC for processing, and if the keyboard-mouse sharing service receives the keyboard event listened by the first phone window manager, the received keyboard event is forwarded to the PC for processing. The PC includes an event receiving module and an event response module, the PC can receive the mouse event or the keyboard event forwarded by the keyboard-mouse sharing service through the event receiving module, and respond to the received mouse event or keyboard event through the event response module.

[0150] In addition, as Figure 8 ​As shown, the first input management service is configured with a FilterInputEvent mechanism and is configured with intercept logic. The FilterInputEvent mechanism is used to intercept the mouse event reported by the input reader, and the intercept logic is used to determine whether the read mouse event meets the intercept condition. The input distributor can call the FilterInputEvent mechanism of the first input management service, and first determine whether the mouse event reported by the input reader meets the intercept condition based on the intercept logic through the FilterInputEvent mechanism. If it meets, the mouse event is intercepted, i.e., the mouse event is sent to the keyboard and mouse sharing service. Similarly, the first phone window management service is configured with an IinterceptKeyBeforeQueueing mechanism and is configured with intercept logic. The IinterceptKeyBeforeQueueing mechanism is used to intercept the key event reported by the input reader, and the intercept logic is used to determine whether the key event reported by the input reader meets the intercept condition. The input distributor can call the IinterceptKeyBeforeQueueing mechanism of the first window manager, and first determine whether the key event reported by the input reader meets the intercept condition based on the intercept logic through the IinterceptKeyBeforeQueueing mechanism. If it meets, the key event is intercepted, i.e., the key event is sent to the keyboard and mouse sharing service. For example, it is determined whether the key event is a key event of an external keyboard. If it is, the key event is sent to the keyboard and mouse sharing service.

[0151] Next, the scheme of sharing an input device provided by the embodiments of the present application will be described in detail. Figure 9 and Figure 8 Next, the scheme of sharing an input device provided by the embodiments of the present application will be described in detail.

[0152] Figure 4 and Figure 4 A method flowchart of sharing an input device is shown, as shown in the method, the following steps are included: Figure 9

[0153] Step 801: the user performs operation 1, and the operation 1 is an operation of starting the keyboard and mouse sharing service of the tablet.

[0154] The operation 1 can be an operation of clicking the on-off control of the keyboard and mouse sharing service displayed in the related interface of the tablet, and the on-off control of the keyboard and mouse sharing service is used to start or stop the keyboard and mouse sharing service of the tablet. For example, please refer to FIG. a in the Figure 10 The operation 1 can be an operation of clicking the on-off control of the keyboard and mouse sharing service in the keyboard and mouse sharing setting interface.

[0155] Step 802: in response to the operation 1, the keyboard and mouse sharing service is started.

[0156] ​After the keyboard and mouse sharing service is started, the keyboard and mouse sharing state of the keyboard and mouse sharing service can be detected. The keyboard and mouse sharing state can include whether the tablet has established a connection with other devices, whether the input device is switched to use by other devices, and the like. The established connection refers to a connection capable of sharing the input device with other devices.

[0157] In the embodiments of the present application, whether the input device is switched to use by other devices can be indicated by whether the mouse cursor of the tablet crosses. For example, if the mouse cursor crosses, it indicates that the input device is switched to use by other devices, and if the mouse cursor does not cross, it indicates that the input device is not switched to use by other devices. The mouse cursor crossing refers to the movement of the mouse cursor outside the screen of the tablet.

[0158] It should be understood that the keyboard and mouse sharing state can also include other states, and whether the input device is switched to use by other devices can also be indicated by other information, which is not limited in the embodiments of the present application.

[0159] Step 803: The user performs operation 2, and operation 2 is an operation of establishing a connection between the tablet and the PC.

[0160] Operation 2 is used to trigger the tablet to establish a connection with the PC, and the established connection is a connection capable of sharing the input device.

[0161] As an example, operation 2 can be an operation of selecting the PC from available devices, and the available devices are devices that meet the conditions of sharing the input device with the tablet, such as devices logged into the same account as the tablet. For example, please refer to FIG. b in Figure 1 The setting interface of the keyboard and mouse sharing includes the device identifier of the available device, and the device identifier of the available device includes the PC (YOYO's computer). Operation 2 can be an operation of clicking "YOYO's computer".

[0162] In addition, operation 2 can also be other operations for triggering the tablet to establish a connection with the PC, such as an operation of continuously placing the mouse pointer close to the edge of the tablet twice, and the like.

[0163] In the embodiments of the present application, in response to operation 2, the keyboard and mouse sharing service can perform state initialization for the input reader, the first input management service, and the first phone window manager, and configure the first input management service and the first phone window manager to listen. The process of performing state initialization and configuring the listener can include steps 804-810.

[0164] Step 804: In response to operation 2, the keyboard and mouse sharing service sends an initialization state parameter of the keyboard and mouse sharing service to the input reader, and the initialization state parameter includes keyboard and mouse sharing state 1, which is used to indicate that the tablet and the computer have been connected.

[0165] That is, the keyboard and mouse sharing service can configure the initialization keyboard and mouse sharing state for the input reader, and the initialization keyboard and mouse sharing state is keyboard and mouse sharing state 1.

[0166] The keyboard and mouse sharing state of the keyboard and mouse sharing service can include whether the tablet and the computer are connected, whether the mouse cursor crosses, and the like. The initialization state parameter of the keyboard and mouse sharing service includes the initialization keyboard and mouse sharing state, and the initialization keyboard and mouse sharing state is keyboard and mouse sharing state 1.

[0167] After the input reader receives the initialization state parameter, the initialization state parameter can be stored.

[0168] It should be understood that state initialization and configuration monitoring can also be performed at other times, and accordingly, the configured initialization keyboard and mouse sharing state can also be other initialization sharing states, which are not limited in the embodiments of the application. For example, state initialization and configuration monitoring can also be performed after the keyboard and mouse sharing service is started, and accordingly, the initialization keyboard and mouse sharing state can be keyboard and mouse sharing state 3, which is used to indicate that the tablet and the computer are not connected.

[0169] Step 805: In response to operation 2, the keyboard and mouse sharing service sends the initialization state parameter to the first input manager.

[0170] For example, the keyboard and mouse sharing service can call the first input manager according to the initialization state parameter to send the initialization state parameter to the first input manager.

[0171] In the embodiments of the application, the keyboard and mouse sharing service can perform state initialization on the first input management service and the first phone window manager through the first input manager. For example, the first input manager is called according to the initialization state parameter, and the initialization state parameter is sent to the first input management service and the first phone window manager through the first input manager.

[0172] As an example, the keyboard and mouse sharing service can first call the input management interface, and call the first input manager through the input management interface.

[0173] Step 806: After the first input manager receives keyboard and mouse sharing state 1, the initialization state parameter is sent to the first input management service.

[0174] Step 807: After the first input manager receives keyboard and mouse sharing state 1, the initialization state parameter is sent to the first phone window manager.

[0175] After the first input management service and the first phone window manager receive the initialization state parameter, the initialization state parameter can be stored.

[0176] Step 808: In response to operation 2, the keyboard-mouse sharing service sends a configuration monitoring instruction to the first input manager.

[0177] For example, the keyboard-mouse sharing service can invoke the first input manager according to the configuration monitoring instruction, so as to send the configuration monitoring instruction to the first input manager.

[0178] The configuration monitoring instruction is used to instruct the first input management service and the first phone window manager to configure a keyboard-mouse event listener.

[0179] Step 809: The first input manager configures the keyboard-mouse event listener for the first input management service according to the configuration monitoring instruction.

[0180] Step 810: The first input manager configures the keyboard-mouse event listener for the first phone window manager according to the configuration monitoring instruction.

[0181] After that, the first input management service can monitor the mouse event through the keyboard-mouse event listener, and the first phone window manager can monitor the key event, including the keyboard event, through the keyboard-mouse event listener.

[0182] Step 811: The user moves the mouse.

[0183] For example, the user can move the mouse cursor by moving the mouse, that is, move the mouse cursor out of the screen of the tablet.

[0184] Step 812: The input reader reads the mouse event 1.

[0185] After the user moves the mouse, the input reader can read the mouse event 1. The mouse event 1 is triggered by the user moving the mouse.

[0186] Step 813: The input reader invokes the input dispatcher and sends the mouse event 1 to the input dispatcher.

[0187] For example, the input reader can invoke the mouse notification method of the input dispatcher, and process the mouse event 1 through the mouse notification method.

[0188] Step 814: The input dispatcher sends the mouse event 1 to the first input management service.

[0189] For example, the input dispatcher can send the mouse event 1 to the first input management service through the mouse notification method based on the keyboard-mouse event listener configured by the first input manager.

[0190] In addition, the input dispatcher can also perform event distribution on the mouse event 1, so that the tablet responds to the mouse event 1.

[0191] Step 815: The first input management service sends the mouse event 1 to the keyboard-mouse sharing service.

[0192] After receiving the mouse event 1, the first input management service can send the mouse event 1 to the keyboard-mouse sharing service.

[0193] After receiving the mouse event 1, the keyboard-mouse sharing service can determine whether the mouse cursor crosses according to the mouse event 1. If yes, step 817 and subsequent steps are executed. If no, no processing is performed, i.e., step 817 and subsequent steps are not executed, and the keyboard-mouse sharing service continues to receive the mouse event reported by the first input management service and determines whether the mouse cursor crosses according to the reported mouse event.

[0194] Step 816: The keyboard-mouse sharing service determines that the mouse cursor crosses according to the mouse event 1.

[0195] After determining that the mouse cursor crosses, the keyboard-mouse sharing service can update the keyboard-mouse sharing state stored by the input reader, the first input management service, and the first phone window manager. For example, the state update can be implemented through steps 817-822 as follows.

[0196] By updating the keyboard-mouse sharing state stored by the first input management service, the function of the first input management service to intercept mouse events can be configured. By updating the keyboard-mouse sharing state stored by the first phone window manager, the function of the first phone window manager to intercept keyboard events can be configured.

[0197] After the keyboard-mouse sharing service determines that the mouse cursor crosses according to the mouse event 1, the keyboard-mouse sharing service can also send the mouse event 1 to the PC, and the PC responds to the mouse event 1. In response to the mouse event 1, the PC can display a mouse pointer at a fixed position on the screen, such as the center of the screen. Alternatively, in response to the mouse event 1, the PC can display a mouse pointer on the screen according to the offset of the mouse event 1, which is not limited in the embodiments of the present application.

[0198] For example, the keyboard-mouse sharing service can send the mouse event 1 to the event receiving module of the PC, and then the event receiving module sends the mouse event 1 to the event response module, and the event response module responds to the mouse event 1.

[0199] Step 817: The keyboard-mouse sharing service sends the keyboard-mouse sharing state 2 to the input reader, where the keyboard-mouse sharing state 2 is used to indicate that the mouse cursor crosses.

[0200] Step 818: The input reader closes the drawing function of the mouse cursor according to the keyboard-mouse sharing state 2.

[0201] The input reader can also update the stored key-mouse sharing state according to the key-mouse sharing state 2, such as updating the key-mouse sharing state from the key-mouse sharing state 1 to the key-mouse sharing state 2.

[0202] In the embodiments of the present application, the input reader can control the opening and closing of the drawing function of the mouse cursor according to the key-mouse sharing state. For example, the input reader can keep the drawing function of the mouse cursor in an open state when the key-mouse sharing state is the key-mouse sharing state 1, and keep the drawing function of the mouse cursor in a closed state when the key-mouse sharing state is the key-mouse sharing state 2. The input reader can close the drawing function of the mouse cursor if it detects that the key-mouse sharing state switches to the key-mouse sharing state 2, and can open the drawing function of the mouse cursor if it detects that the key-mouse sharing state switches from the key-mouse sharing state 2 to another state.

[0203] Step 819: The key-mouse sharing service sends the key-mouse sharing state 2 to the first input management service.

[0204] The key-mouse sharing service can call the first input manager to send the key-mouse sharing state 2 to the first input management service through the first input manager.

[0205] Step 820: The first input management service updates the stored key-mouse sharing state to the key-mouse sharing state 2 after receiving the key-mouse sharing state.

[0206] For example, the first input management service updates the stored key-mouse sharing state 1 to the key-mouse sharing state 2.

[0207] In the embodiments of the present application, the first input management service can control the first input management service to open or close the function of intercepting mouse events according to the key-mouse sharing state. The function of intercepting mouse events refers to the first input management service sending the monitored mouse events to the key-mouse sharing service, or sending the monitored mouse events to the key-mouse sharing service and controlling the tablet not to respond to the monitored mouse events.

[0208] Step 821: The key-mouse sharing service sends the key-mouse sharing state 2 to the first phone window manager.

[0209] The key-mouse sharing service can call the first input manager to send the key-mouse sharing state 2 to the first phone window manager through the first input manager.

[0210] Step 822: The first phone window manager updates the stored key-mouse sharing state to the key-mouse sharing state 2.

[0211] In this embodiment, the first phone window manager can control the function of intercepting keyboard events to be enabled or disabled based on the keyboard and mouse sharing status. The function of intercepting keyboard events refers to the first phone window manager sending the monitored keyboard events to the keyboard and mouse sharing service, or controlling the tablet not to respond to the monitored keyboard events.

[0212] After the First Input Management Service updates the keyboard and mouse sharing state to Keyboard and Mouse Sharing State 2, it can enable the function of intercepting mouse events based on Keyboard and Mouse Sharing State 2, and then intercept mouse events thereafter. After the First Telephone Window Manager updates the keyboard and mouse sharing state to Keyboard and Mouse Sharing State 2, it can enable the function of intercepting keyboard events based on Keyboard and Mouse Sharing State 2, and then intercept keyboard events thereafter.

[0213] like Figure 9 As shown, the process of the first input management service intercepting mouse events and the first telephone window manager intercepting keyboard events may include the following steps:

[0214] Step 823: The user moves the mouse.

[0215] Step 824: The input reader reads mouse event 2.

[0216] After the input reader reads mouse event 2, it can send mouse event 2 to the first input management service through the keyboard and mouse event listener configured in the first input management service. For example, the input reader can call the input dispatcher, which then sends mouse event 2 to the first input management service based on the keyboard and mouse event listener configured in the first input management service.

[0217] For example, the input reader can call the mouse notification method of the input dispatcher, and through the mouse notification method, send mouse event 2 to the first input management service based on the keyboard and mouse event listener configured in the first input management service.

[0218] Step 825: The input reader sends mouse event 2 to the input distributor.

[0219] Step 826: The input dispatcher sends mouse event 2 to the first input management service through the keyboard and mouse event listener configured in the first input management service.

[0220] For example, the input dispatcher can send mouse event 2 to the first input management service based on the keyboard and mouse event listener configured in the first input management service through the mouse notification method.

[0221] After receiving the mouse event 2, the first input management service detects that the mouse sharing state is the keyboard-mouse sharing state 2, and sends the mouse event 2 to the keyboard-mouse sharing service and sends an instruction of stopping event distribution to the input distributor, so that the input distributor stops distributing the mouse event 2.

[0222] Step 827: The first input management service sends the mouse event 2 to the keyboard-mouse sharing service according to the keyboard-mouse sharing state 2.

[0223] Step 828: The keyboard-mouse sharing service sends the mouse event 2 to the event receiving module of the PC.

[0224] Step 829: The event receiving module of the PC sends the mouse event 2 to the event responding module of the PC.

[0225] Step 830: The event responding module of the PC responds to the mouse event 2.

[0226] Step 831: The first input management service sends the stop distribution instruction 1 to the input distributor according to the keyboard-mouse sharing state 1.

[0227] The stop distribution instruction 1 is used to instruct the input distributor to stop distributing the mouse event 2.

[0228] Step 832: The input distributor stops distributing the mouse event 2 according to the stop distribution instruction 1, so that the tablet does not respond to the mouse event 2.

[0229] Generally, when the keyboard-mouse sharing state is in a state other than the keyboard-mouse sharing state 2, the input distributor receives a mouse event and distributes the mouse event to a responding module corresponding to the mouse event in the tablet, and the responding module responds to the mouse event, so that the tablet responds to the mouse event. In the embodiment of the application, in order to control the tablet not to respond to the mouse event 2, a stop distribution instruction can be sent to the input distributor, so that the input distributor does not distribute the mouse event 2.

[0230] After step 832, the tablet can cyclically execute steps 824-832 to intercept and forward the next mouse event.

[0231] Step 833: The user presses a keyboard key.

[0232] Step 834: The input reader reads the keyboard event 1.

[0233] After the input reader reads the keyboard event 1, the input reader can send the mouse event 1 to the first phone window manager through the mouse event listener configured by the first phone window manager. For example, the input reader can invoke the input dispatcher, and send the keyboard event 1 to the first phone window manager based on the mouse event listener configured by the first phone window manager through the input dispatcher.

[0234] For example, the input reader can invoke the keyboard notification method of the input dispatcher, and send the keyboard event 1 to the first phone window manager based on the mouse event listener configured by the first phone window manager through the keyboard notification method.

[0235] Step 835: The input reader sends the keyboard event 1 to the input dispatcher.

[0236] For example, the input dispatcher can send the keyboard event 1 to the first input management service based on the mouse event listener configured by the first input management service through the mouse notification method.

[0237] Step 836: The input dispatcher sends the keyboard event 1 to the first phone window manager through the mouse event listener configured by the first phone window manager.

[0238] After the input dispatcher sends the keyboard event 1 to the first phone window manager, the first phone window manager can receive the keyboard event 1 through the configured keyboard event listener.

[0239] After the first phone window manager receives the keyboard event 1, if it is detected that the mouse sharing state is the keyboard-mouse sharing state 2, the first phone window manager can send the keyboard event 1 to the keyboard-mouse sharing service on one hand, and send an instruction to stop event distribution to the input dispatcher on the other hand, so that the input dispatcher stops event distribution on the keyboard event 1.

[0240] Step 837: The first phone window manager sends the keyboard event 1 to the keyboard-mouse sharing service according to the keyboard-mouse sharing state 2.

[0241] Step 838: The keyboard-mouse sharing service sends the keyboard event 1 to the event receiving module of the PC.

[0242] Step 839: The event receiving module of the PC sends the keyboard event 1 to the event response module of the PC.

[0243] Step 840: The event response module of the PC responds to the keyboard event 1.

[0244] Step 841: The first phone window manager sends the stop distribution instruction 2 to the input dispatcher according to the keyboard-mouse sharing state 2.

[0245] The stop distribution instruction 2 is used to instruct the input distributor to stop event distribution of the keyboard event 1.

[0246] Step 842: The input distributor stops event distribution of the keyboard event 1 according to the stop distribution instruction 2, so that the tablet does not respond to the keyboard event 1.

[0247] Generally, when the keyboard event is received by the input distributor, the keyboard event is distributed to the response module corresponding to the keyboard event in the tablet, and the response module responds to the keyboard event, so that the tablet responds to the keyboard event. In the embodiment of the application, in order to control the tablet not to respond to the keyboard event 1, a stop distribution instruction can be sent to the input distributor, so that the input distributor does not distribute the keyboard event 1.

[0248] After step 842, the tablet can cyclically execute steps 834-843 to intercept and forward the next keyboard event.

[0249] It should be noted that after the first telephone window manager configures the keyboard and mouse event listener, it can not only listen to keyboard events, but also listen to other key events. Among them, the key event can include other key events in addition to the keyboard event, such as system key events. Among them, the system key event refers to the key event of the native key of the tablet, such as the key event of the power key, the volume key, etc. of the tablet. After the first telephone window manager listens to the key event, it can first determine whether the key event is a keyboard event, and if so, execute the above interception and forwarding mechanism, and if not, do not execute the above interception and forwarding mechanism.

[0250] For example, after the input reader reads the key event, the key event can be sent to the first telephone window manager, such as sending the key event to the first telephone window manager through the input distributor. The first telephone window manager can first determine whether the key event is a keyboard event through the configured keyboard and mouse event listener. If so, including the following two cases: first, in the case where the keyboard and mouse sharing state is keyboard and mouse sharing state 2, the keyboard event is sent to the keyboard and mouse sharing service, and the tablet is controlled not to respond to the keyboard event; second, in the case where the keyboard and mouse sharing state is other than keyboard and mouse sharing state 2, the keyboard event is not sent to the keyboard and mouse sharing service, or the keyboard event is sent to the keyboard and mouse sharing service, and the tablet is not controlled not to respond to the keyboard event. In addition, if not, the keyboard event is not sent to the keyboard and mouse sharing service, or the keyboard event is sent to the keyboard and mouse sharing service, and the tablet is not controlled not to respond to the keyboard event.

[0251] In addition, after step 842, when the user moves the mouse to reverse traverse the mouse cursor, the tablet no longer forwards the input event to the PC, but responds by itself. For example, the keyboard and mouse sharing service no longer sends the mouse event sent from the first input management service or the keyboard event sent from the first phone window manager to the PC. In addition, the keyboard and mouse sharing service can also update the state of the input reader, the first input management service and the first phone window manager according to the current keyboard and mouse sharing state. The reverse traversal of the mouse cursor refers to the movement of the mouse cursor outside the screen of the PC, such as moving to the left boundary of the screen of the PC or moving to the right boundary of the screen of the PC.

[0252] For example, after step 842, the first input management service sends the mouse event 3 listened to the keyboard and mouse sharing service. If the keyboard and mouse sharing service determines that the mouse cursor reversely traverses according to the mouse event 3, the input event forwarding function is closed, that is, the mouse event after the mouse event 3 or the keyboard event is no longer forwarded to the PC. For the mouse event 3, the keyboard and mouse sharing service can forward it to the PC or not, which is not limited by the embodiments of the application. In addition, the keyboard and mouse sharing service can also control the input reader to start the drawing function of the mouse cursor, and can also control the input distributor to start event distribution on the received input event. For example, the keyboard and mouse sharing service can update the state of the input reader, the first input management service and the first phone window manager according to the current keyboard and mouse sharing state, and control the input reader to start the drawing function of the mouse cursor and control the input distributor to start event distribution on the received input event through the state update.

[0253] It should be noted that the step number order in the embodiments of the application does not limit the execution order of the steps, some of which can be executed in sequence or in parallel, which is not limited by the embodiments of the application.

[0254] Figure 9 A structural schematic diagram of an electronic device is shown, which is a second electronic device, such as a computer 102 or a mobile phone 103 shown in Figure 9 The operating system of the second electronic device can be an Android system or a Windows system. Referring to ​ The electronic device includes at least one processor 201, a communication bus 202, a memory 203 and at least one communication interface 204.

[0255] The processor 201 may be a microprocessor (including a central processing unit (CPU) or the like), an application-specific integrated circuit (ASIC), or one or more integrated circuits used to control the execution of the program of the present application.

[0256] The communication bus 202 may include a path for transmitting information between the aforementioned components.

[0257] The memory 203 may be a read-only memory (ROM), random access memory (RAM), electrically erasable programmable read-only memory (EEPROM), optical disc (including compact disc read-only memory (CD-ROM), compressed optical disc, laser disc, digital versatile optical disc, Blu-ray disc, etc.), magnetic disk storage medium, or other magnetic storage device, or any other medium capable of carrying or storing desired program code in the form of instructions or data structures that can be accessed by a computer, but not limited thereto. The memory 203 may exist independently and be connected to the processor 201 via the communication bus 202. The memory 203 may also be integrated with the processor 201.

[0258] Communication interface 204 uses any transceiver-like device to communicate with other devices or communication networks, such as Ethernet, radio access network (RAN), wireless local area network (WLAN), etc.

[0259] In a specific implementation, as one example, the processor 201 may include one or more CPUs, such as... ​ CPU0 and CPU1 are shown in the diagram.

[0260] In a specific implementation, as one example, an electronic device may include multiple processors, such as... ​ The processors 201 and 205 are shown. Each of these processors may be a single-core processor or a multi-core processor. Here, "processor" may refer to one or more devices, circuits, and / or processing cores used to process data (such as computer program instructions).

[0261] In a specific implementation, as an embodiment, the electronic device can further include an output device 206 and an input device 207. The output device 206 is in communication with the processor 201 and can display information in a variety of ways. For example, the output device 206 can be a liquid crystal display (LCD), a light emitting diode (LED) display device, a cathode ray tube (CRT) display device, a projector, or the like. The input device 207 is in communication with the processor 201 and can receive input from a user in a variety of ways. For example, the input device 207 can be a mouse, a keyboard, a touch screen device, a sensor device, or the like.

[0262] The electronic device described above can be a general electronic device or a special electronic device. In a specific implementation, the electronic device can be a desktop computer, a laptop computer, a network server, a palmtop computer, a mobile phone, a tablet computer, a wireless terminal device, a communication device, or an embedded device, and the embodiments of the present application do not limit the type of electronic device.

[0263] The memory 203 is configured to store program code 210 for implementing the scheme of the present application, and the processor 201 is configured to execute the program code 210 stored in the memory 203. The electronic device can implement the method of sharing an input device provided in the above embodiments by means of the processor 201 and the program code 210 in the memory 203.

[0264] In the above embodiments, all or part of the embodiments can be implemented by software, hardware, firmware or any combination thereof. When implemented by software, all or part of the embodiments can be implemented in the form of a computer program product. The computer program product includes one or more computer instructions. When the computer instructions are loaded and executed on a computer, all or part of the processes or functions described in the embodiments of the present application are generated. The computer can be a general purpose computer, a special purpose computer, a computer network or other programmable apparatus. The computer instructions can be stored in a computer readable storage medium or transmitted from one computer readable storage medium to another computer readable storage medium, such as the computer instructions can be transmitted from one website site, computer, server or data center to another website site, computer, server or data center through wired (such as coaxial cable, optical fiber, digital subscriber line (DSL)) or wireless (such as infrared, wireless, microwave, etc.) mode. The computer readable storage medium can be any available medium accessible by a computer, or a data storage device such as a server, data center, etc. integrated with one or more available media. The available media can be magnetic media (such as floppy disk, hard disk, magnetic tape), optical media (such as digital versatile disc (DVD)) or semiconductor media (such as solid state disk (SSD)) and the like.

[0265] The above is an optional embodiment provided by the present application, and is not used to limit the present application. Any modification, equivalent replacement, improvement, etc. made within the technical scope disclosed by the present application shall be included in the protection scope of the present application.

Claims

1. A method of sharing an input device, the method comprising: The method is applied to a first electronic device connected with an input device for inputting control instructions, an operating system of the first electronic device comprising a keyboard-mouse sharing service, an input management module and an input distributor, the operating system being an Android system, the keyboard-mouse sharing service being used for realizing a service of sharing the input device between the first electronic device and other electronic devices, the input management module being used for managing input events of the first electronic device, and the input distributor being used for distributing input events; the method comprises: In response to a first operation, the keyboard-mouse sharing service is started; The keyboard-mouse sharing service triggers the input management module to listen to input events of the input device; In response to a second operation, the keyboard-mouse sharing service controls a screen of the first electronic device to stop displaying a mouse cursor, sends an interception instruction to the input management module, and the second operation is used for triggering a second electronic device to share the input device of the first electronic device; The input management module sends the first input events listened to the keyboard-mouse sharing service according to the interception instruction, and sends a stop distribution instruction to the input distributor; The keyboard-mouse sharing service receives the first input events, sends the first input events to the second electronic device, so that the second electronic device responds to the first input events; The input distributor does not distribute events according to the first input events according to the stop distribution instruction, so that the first electronic device does not respond to the first input events.

2. The method of claim 1, wherein, The keyboard-mouse sharing service triggers the input management module to listen to input events of the input device, comprising: The keyboard-mouse sharing service configures an input event listener for the input management module; The input management module listens to input events of the input device through the configured input event listener.

3. The method of claim 2, wherein, The input device comprises a mouse device, and the input management module comprises a first input management service; The keyboard-mouse sharing service configures an input event listener for the input management module, comprising: The keyboard-mouse sharing service configures a keyboard-mouse event listener for the first input management service; The input management module listens to input events of the input device through the configured input event listener, comprising: The input management service listens to mouse events through the configured keyboard-mouse event listener, the mouse events being input events of the mouse device.

4. The method of claim 2, wherein, The input device comprises a keyboard device, and the input management module comprises a first phone window manager; The keyboard-mouse sharing service configures an input event listener for the input management module, comprising: The keyboard-mouse sharing service configures a keyboard-mouse event listener for the first phone window manager; The input management module listens to input events of the input device through the configured input event listener, comprising: The first phone window manager listens to key events through the configured keyboard-mouse event listener, the key events comprising keyboard events, and the keyboard events being key events of the keyboard device.

5. The method of claim 1, wherein, The input device comprises a mouse device, the first input event is a first mouse event, and the input management module comprises a first input management service; The first input management service sends a first stop distribution instruction to the input distributor; The input distributor does not distribute events according to the first stop distribution instruction, so that the first electronic device does not respond to the first mouse event.

6. The method of claim 1, wherein, The input device comprises a keyboard device, the first input event is a first keyboard event, and the input management module comprises a first telephone window manager; The first telephone window manager sends a second stop distribution instruction to the input distributor; The input distributor does not distribute events according to the second stop distribution instruction, so that the first electronic device does not respond to the first keyboard event.

7. The method of claim 1, wherein, The input device comprises a keyboard device, the input management module comprises a first telephone window manager, and before the input management module sends the first input event to the keyboard and mouse sharing service, the input management module further comprises: The first telephone window manager listens to a first key event; The first telephone window manager determines whether the first key event is a keyboard event, wherein the keyboard event refers to a key event of the keyboard device; The input management module sends the first input event to the keyboard and mouse sharing service, comprising: If the first telephone window manager determines that the first key event is the keyboard event, the first telephone window manager sends the first key event to the keyboard and mouse sharing service.

8. The method of claim 7, wherein, The method further comprises: If the first telephone window manager determines that the first key event is not the keyboard event, the first telephone window manager does not send the first key event to the keyboard and mouse sharing service.

9. The method of claim 1, wherein, The input device comprises a mouse device, the first input event is a first mouse event of the mouse device, and the input management module comprises a first input management service; The input management module sends the first input event to the keyboard and mouse sharing service according to the interception instruction, comprising: The first input management service sends the first mouse event to the keyboard and mouse sharing service according to the interception instruction; The keyboard and mouse sharing service receives the first input event and sends the first input event to the second electronic device, so that the second electronic device responds to the first input event, comprising: The keyboard and mouse sharing service receives the first mouse event and sends the first mouse event to the second electronic device, so that the second electronic device responds to the first mouse event.

10. The method of claim 1, wherein, The input device comprises a keyboard device, the first input event is a first keyboard event of the keyboard device, and the input management module comprises a first telephone window manager; The input management module sends the first input event to the keyboard and mouse sharing service according to the interception instruction, comprising: The first telephone window manager sends the first keyboard event to the keyboard and mouse sharing service according to the interception instruction; The keyboard and mouse sharing service receives the first input event, and sends the first input event to the second electronic device to make the second electronic device respond to the first input event. The keyboard and mouse sharing service receives the first keyboard event, and sends the first keyboard event to the second electronic device to make the second electronic device respond to the first keyboard event.

11. The method of any one of claims 1-10, wherein, The method further comprises: If the keyboard and mouse sharing service detects that the first electronic device and the second electronic device are connected, the keyboard and mouse sharing service triggers the input management module to listen to the input event of the input device.

12. The method of claim 11, wherein, The operating system further comprises an input reader configured to read the input event and start or stop the drawing function of the mouse cursor, and a keyboard and mouse sharing service configured to control the drawing function of the mouse cursor. After the keyboard and mouse sharing service detects that the first electronic device and the second electronic device are connected, the method further comprises: The keyboard and mouse sharing service sends first keyboard and mouse sharing state information to the input reader, and the first keyboard and mouse sharing state information is used to indicate that the first electronic device and the second electronic device are connected.

13. The method of any one of claims 1-10, further comprising: the intercepting instruction being second keyboard and mouse sharing state information, and the second keyboard and mouse sharing state information being used to indicate that the second electronic device shares the input device of the first electronic device.

14. The method of any one of claims 1-10, wherein, The operating system further comprises an input reader configured to read the input event and start or stop the drawing function of the mouse cursor, and a keyboard and mouse sharing service configured to control the drawing function of the mouse cursor. The keyboard and mouse sharing service controls the screen of the first electronic device to stop displaying the mouse cursor, comprising: The keyboard and mouse sharing service sends a first control instruction to the input reader. The input reader stops the drawing function of the mouse cursor according to the first control instruction, so that the screen of the first electronic device stops displaying the mouse cursor.

15. The method of claim 14, wherein, The first control instruction is second keyboard and mouse sharing state information, and the second keyboard and mouse sharing state information is used to indicate that the second electronic device shares the input device of the first electronic device.

16. The method of any one of claims 1-10, wherein, The operating system further comprises an input reader and an input distributor, the input reader is configured to read the input event, and the input distributor is configured to distribute the input event. Before the input management module sends the first input event listened to to the keyboard and mouse sharing service, the method further comprises: The input reader reads the first input event. The input reader calls an input event notification method of the input distributor, and sends the first input event to the input management module through the input event notification method.

17. The method of any one of claims 1-10, wherein, The keyboard and mouse sharing service triggers the input management module to listen to the input event of the input device, comprising: The keyboard and mouse sharing service triggers the input management module to listen to the input event of the input device, and sends the input event listened to to the keyboard and mouse sharing service. Before the keyboard and mouse sharing service controls the screen of the first electronic device to stop displaying the mouse cursor, and sends an intercepting instruction to the input management module, the method further comprises: The input management module listens to a second input event. The input management module sends the second input event to the key-mouse sharing service; The key-mouse sharing service receives the second input event; If the key-mouse sharing service determines that a mouse cursor crossing according to the second input event, the key-mouse sharing service determines that the second operation is received, the mouse cursor crossing refers to a mouse cursor of the first electronic device moving out of a screen of the first electronic device.

18. An electronic device, comprising: The electronic device comprises a memory, a processor, and a computer program stored in the memory and executable on the processor, and the computer program implements the method of any one of claims 1 to 17 when executed by the processor.

19. A computer-readable storage medium, characterized in that, The computer readable storage medium stores instructions, when executed on a computer, cause the computer to perform the method of any one of claims 1-17.

Citation Information

Patent Citations

  • Display method and device

    CN114816294A