A communication system, device connection method and electronic device

CN122498232APending Publication Date: 2026-07-31HUAWEI TECH CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
HUAWEI TECH CO LTD
Filing Date
2025-07-18
Publication Date
2026-07-31

AI Technical Summary

Technical Problem

In existing technologies, users need to manually select devices for multi-screen collaboration or screen mirroring, which is cumbersome and results in a poor user experience.

Method used

By detecting changes in the capacitance parameters of the device screen and preset actions, the system automatically recognizes when a device is close by, eliminating the need for manual selection by the user and enabling automatic connection between devices.

Benefits of technology

It improves the efficiency of connection between devices, enhances the user experience, and simplifies the operation process.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN122498232A_ABST
    Figure CN122498232A_ABST
Patent Text Reader

Abstract

This application provides a communication system, a device connection method, and an electronic device. A first electronic device approaches the screen of a second electronic device. The second electronic device identifies the approach by changes in its screen parameters and sends a request message. Upon receiving the request message, the first electronic device determines that it has approached the screen of the device that sent the request message and can reply with a response message to the second electronic device. When the first electronic device determines that the two devices can establish a connection, it initiates a connection request to the second electronic device, and the connection is established. This enables seamless interconnection and communication between multiple devices, eliminating the need for manual device selection by the user and simplifying operation.
Need to check novelty before this filing date? Find Prior Art

Description

A communication system, device connection method and electronic device

[0001] Cross-reference to related applications

[0002] This application claims priority to Chinese Patent Application No. 202411746348.5, filed on November 30, 2024, entitled "A Communication System, Device Connection Method and Electronic Device", and to International Patent Application No. PCT / CN2025 / 102234, filed on June 19, 2025, entitled "A Communication System, Device Connection Method and Electronic Device", the entire contents of which are incorporated herein by reference. Technical Field

[0003] This application relates to the field of terminal technology, and in particular to a communication system, a device connection method, and an electronic device. Background Technology

[0004] To facilitate cross-system and cross-device operations and multi-device collaboration, such as multi-screen collaboration or screen casting, are becoming increasingly popular. Currently, both multi-screen collaboration and screen casting require users to manually select the target device for collaboration or casting. For example, if a user wants to cast a video from their phone to a TV, they need to tap the "cast" button on their phone. The phone then responds by displaying a list of available devices, from which the user can select the TV. The phone then sends a connection request to the selected TV and establishes a connection. This method is cumbersome and provides a poor user experience. Summary of the Invention

[0005] This application provides a communication system, a device connection method, and an electronic device to improve the efficiency of establishing connections between different devices.

[0006] In a first aspect, this application provides a communication system comprising a first electronic device and a second electronic device. Specifically, the second electronic device is configured to issue a first request message when a first condition is met, the first condition including detecting that a device is approaching the screen of the second electronic device; the first electronic device is configured to receive the request message and, when a second condition is met, reply to the electronic device with a first response message, the second condition including determining that the first electronic device is approaching the second electronic device; the second electronic device is further configured to establish a communication link with the first electronic device based on the first response message.

[0007] With the above technical solution, the first electronic device and the second electronic device can establish a connection without the user having to manually select the device. The second electronic device can send a request when it determines that a device is close to its screen, and the first electronic device can reply with a response message when it determines that it is close to the second electronic device. Thus, the two devices complete the device selection by the screen of the device that is close to it, and then establish a communication connection. This can improve the efficiency of establishing a communication connection between devices, and it can improve the user experience by eliminating the need for manual selection by the user.

[0008] In one possible design, the first electronic device is a mobile phone, and the second electronic device is a personal computer (PC), an in-vehicle terminal, or a tablet.

[0009] In one possible design, the first electronic device is a mobile terminal, such as a mobile phone or tablet.

[0010] In one possible design, the first condition may further include: a first preset application running in the foreground of the second electronic device. The first preset application may be a file management application, a gallery application, or a document application.

[0011] In one possible design, the second condition may further include: the account logged in on the first electronic device and the account logged in on the second electronic device are the same account. Confirming that the same account is logged in on different devices can improve the security of subsequent content transmission and protect user privacy.

[0012] In one possible design, the second condition may further include: a second preset application running in the foreground of the first electronic device. This second preset application may be a file management application, a gallery application, a document application, a navigation application, a music application, or a video application.

[0013] In one possible design, the second electronic device detects that a device is approaching the screen of the second electronic device, including:

[0014] The second electronic device determines that a device is approaching the screen of the second electronic device based on the change in the capacitance parameter of the screen.

[0015] The above technical solution can determine whether a device is approaching by observing changes in the screen's capacitance parameters, thereby identifying the proximity of the device.

[0016] In one possible design, determining that the first electronic device is near the second electronic device includes:

[0017] The first electronic device determines that the first electronic device has performed a preset action, and the distance between the first electronic device and the second electronic device is less than a set threshold. The preset action is an action that indicates that the first electronic device moves in front of the screen of the first electronic device and then stops. The first electronic device is used to capture images through a camera and determine that the screen of the second electronic device is in the image captured by the camera.

[0018] Through the above technical solution, the first electronic device can determine whether it is close to other devices by preset actions and the distance to the second electronic device or the image captured by the camera, and then complete the selection of the device after determining that the device is close.

[0019] In one possible design, the second electronic device establishes a communication link with the first electronic device based on the first response message:

[0020] After receiving the first response message, the second electronic device sends a link establishment request message to the first electronic device, which is used to request the establishment of a communication link with the first electronic device.

[0021] In one possible design, the second electronic device detects that a device is approaching the screen of the second electronic device, including:

[0022] The second electronic device detects that a device is approaching an area on the screen of the second electronic device where content can be shared.

[0023] Through the above technical solution, the second electronic device can determine that a device is close to its screen when it detects that another device is close to an area on its screen where content can be shared. This allows the device to be selected and connected when the user's intention to share content is strong in a content sharing scenario.

[0024] In one possible design, the second electronic device sends a connection establishment request message to the first electronic device, including:

[0025] When the second electronic device meets the first set condition, it sends a connection establishment request message to the first electronic device. The first set condition includes at least one of the following: the first response message carries a first flag bit, which is used to indicate that the first electronic device has content that can be shared with the second electronic device; or the second electronic device has content that can be shared with the first electronic device.

[0026] The above technical solution allows for initiating a connection request when an electronic device has content to share with other electronic devices, thus improving the success rate of device connection establishment.

[0027] In one possible design, the first response message is a chain establishment request message.

[0028] The second electronic device establishes a communication link with the first electronic device according to the first response message, including:

[0029] The second electronic device establishes a communication link with the first electronic device based on the link establishment request message.

[0030] In this application, the first electronic device can initiate a chain establishment request to the second electronic device, and the second electronic device can also initiate a chain establishment request to the first electronic device.

[0031] In one possible design, the second electronic device establishes a communication link with the first electronic device based on the link establishment request message:

[0032] When the second electronic device meets the second set condition, it establishes a communication link with the first electronic device according to the link establishment request message. The second set condition includes at least one of the following: the first request message carries a second flag bit, which is used to indicate that the second electronic device has content that can be shared with the first electronic device; or the first electronic device has content that can be shared with the second electronic device.

[0033] Secondly, this application also provides a communication system, which includes a first electronic device and a second electronic device. Specifically, the first electronic device is configured to send a second request message when a third condition is met, the third condition including the first electronic device determining that the first electronic device is near the second electronic device; the second electronic device is configured to receive the second request message and, when a fourth condition is met, reply to the first electronic device with a second response message, the fourth condition including detecting that a device is near the screen of the second electronic device; the first electronic device is configured to establish a communication link with the second electronic device according to the second response message.

[0034] Using the above technical solution, the first electronic device can send a request when it determines that it is close to the screen of another device. After receiving the request, the second electronic device can establish a communication link with the first electronic device if it determines that a device is close to its screen. This method eliminates the need for the user to manually select a device; device selection and connection are completed simply by determining the proximity of the device.

[0035] In one possible design, the first electronic device determines that it is near the second electronic device, including:

[0036] The first electronic device determines that it has performed a preset action, and the distance between the first electronic device and the second electronic device is less than a set threshold. The preset action is an action that indicates that the first electronic device moves forward and then stops.

[0037] In one possible design, the second electronic device detects that a device is approaching the screen of the second electronic device, including:

[0038] The second electronic device determines that a device is approaching the screen of the second electronic device based on the change in the capacitance parameter of the screen.

[0039] In one possible design, the second electronic device detects that a device is approaching the screen of the second electronic device, including:

[0040] The second electronic device detects that a device is approaching an area on the screen of the second electronic device where content can be shared.

[0041] In one possible design, the first electronic device establishes a communication link with the second electronic device based on the second response message, including:

[0042] After receiving the second response message, the first electronic device sends a link establishment request message to the second electronic device, which is used to request the establishment of a communication link with the second electronic device.

[0043] In one possible design, the first electronic device sends a connection establishment request message to the second electronic device, including:

[0044] When the first electronic device meets a third preset condition, it sends a connection establishment request message to the second electronic device. The third preset condition includes at least one of the following:

[0045] The first electronic device has content that can be shared with the second electronic device; or the second response message carries a second flag bit, which is used to indicate that the second electronic device has content that can be shared with the first electronic device.

[0046] In one possible design, the second response message is a chain establishment request message;

[0047] The first electronic device establishes a communication link with the second electronic device according to the second response message, including:

[0048] The first electronic device establishes a communication link with the second electronic device based on the link establishment request message.

[0049] In one possible design, the first electronic device establishes a communication link with the second electronic device based on the link establishment request message, including:

[0050] When the fourth preset condition is met, the first electronic device establishes a communication link with the second electronic device according to the link establishment request message, wherein the fourth preset condition includes at least one of the following:

[0051] The second request message carries a first flag bit, which is used to indicate that the first electronic device has content that can be shared with the second electronic device; or the second electronic device has content that can be shared with the first electronic device.

[0052] Thirdly, this application also provides a communication system, which includes a first electronic device and a second electronic device. Specifically, the first electronic device is configured to send a second request message when a third condition is met. This second request message can be sent via broadcast, such as a Bluetooth broadcast message. The third condition includes the first electronic device determining that it is near another electronic device. The second electronic device is configured to receive the second request message and, when a fourth condition is met, reply to the first electronic device with a second response message. The fourth condition includes detecting that a device is near the screen of the second electronic device. The first electronic device is configured to establish a communication link with the second electronic device based on the second response message.

[0053] Using the above technical solution, the first electronic device can send a request when it determines that it is close to the screen of another device. After receiving the request, the second electronic device can establish a communication link with the first electronic device if it determines that a device is close to its screen. This method eliminates the need for the user to manually select a device; device selection and connection are completed simply by determining the proximity of the device.

[0054] In one possible design, the first electronic device determines that it is near other electronic devices, including:

[0055] The first electronic device determines that it has touched the screen of the other electronic device.

[0056] In one possible implementation, the first electronic device touching the screen of the other electronic device includes: touching the screen of the other electronic device along a first direction, the angle between the first direction and a first target direction being less than 90 degrees, and / or the angle between the first direction and a second target direction being less than 90 degrees, the first target direction being the direction from the bottom to the top of the first electronic device, and the second target direction being a direction perpendicular to the screen of the first electronic device and away from the screen.

[0057] In one possible design, the first electronic device determines that it is near other electronic devices, including:

[0058] It is determined that the first electronic device has performed a preset action, which is an action indicating that the first electronic device has moved and touched another electronic device. The movement can be a movement in a first direction.

[0059] In one possible design, the first electronic device being near other electronic devices also includes detecting that the distance between the first electronic device and the second electronic device is less than a set threshold.

[0060] In one possible design, the second electronic device detects that a device is approaching the screen of the second electronic device, including: the second electronic device determines that a device is approaching the screen of the second electronic device based on a change in the capacitance parameter of the screen.

[0061] In one possible design, the fourth condition further includes at least one of the following: the second electronic device is in an unlocked state; the second electronic device determines that the distance between it and the device that sent the second request message is less than a preset distance. That is, the second electronic device is in an unlocked state when the first electronic device approaches it, or in other words, the second electronic device detects a device approaching its screen while in an unlocked state.

[0062] In one possible design, when a device is detected approaching the first window of the second electronic device, and the first window includes shareable content, the second response message includes a second flag bit, which is used to identify that the second electronic device has content that can be shared.

[0063] The first electronic device is further configured to display a first animation effect when it is determined from the second flag bit that the second electronic device has content to share, the first animation effect being used to indicate that the first electronic device is about to receive shared content sent by the second electronic device.

[0064] In one possible design, the second response message includes the account information logged in by the second electronic device; the first electronic device is specifically used to display the first animation when it is determined, based on the second response message, that the account information logged in by the second electronic device is the same as the account information logged in by the first electronic device, and when it is determined that the second electronic device has content to share.

[0065] In one possible design, when the first electronic device satisfies the third condition and the window displayed by the first electronic device includes shareable content, the second request message includes a first flag bit, which is used to identify that the first electronic device has content to share; the second electronic device is further configured to, when the fourth condition is met and it is determined according to the first flag bit that the first electronic device has content to share, preload a second animation effect, and when it is determined that the account logged in by the second electronic device is the same as the account logged in by the first electronic device, play the second animation effect, which is used to indicate that the second electronic device is about to receive the shared content sent by the first electronic device.

[0066] In one possible design, the second electronic device is further configured to, upon receiving the second request message and determining that the second electronic device has content to share, preload a third animation effect, and, upon determining that the account logged into the second electronic device is the same as the account logged into the first electronic device, play the third animation effect, wherein the third animation effect is used to indicate that the second electronic device is about to send shared content to the first electronic device.

[0067] In one possible design, the second response message is a Wi-Fi action frame.

[0068] In one possible design, the first electronic device is also used to enable listening to Wi-Fi action frames after determining that the third condition is met.

[0069] In one possible design, the first electronic device is further configured to, upon receiving the second response message, send a link establishment request message to the second electronic device if it is determined that the first electronic device has content to share. The link establishment request message is used to request the establishment of a communication link with the second electronic device.

[0070] In one possible design, the second response message includes the account information logged in by the second electronic device;

[0071] The first electronic device is further configured to, based on the second response message, determine that the account information logged in by the second electronic device is the same as the account information logged in by the first electronic device, and that the first electronic device has content to share, send a connection request message to the second electronic device.

[0072] In one possible design, the first electronic device is further configured to, upon receiving the second response message, send a third response message to the second electronic device, the third response message including the account information logged in by the first electronic device; the second electronic device is further configured to, based on the third response message, determine that the account information logged in by the first electronic device is the same as the account information logged in by the second electronic device, and that the second electronic device has content to share, send a link establishment request message to the first electronic device, the link establishment request message being used to request the establishment of a communication link with the first electronic device.

[0073] In one possible design, the second electronic device is further configured to display a fifth animation effect when, based on the third response message, it is determined that the account information logged in by the first electronic device is the same as the account information logged in by the second electronic device, and neither the first electronic device nor the second electronic device has any content to share. The fifth animation effect is used to indicate that there is no content to share.

[0074] In one possible design, the second request message is a Bluetooth broadcast message; the second electronic device is also configured to increase the Bluetooth signal scanning duty cycle of the second electronic device when a device is detected approaching the screen of the second electronic device.

[0075] In one possible design, the third response message is a Wi-Fi action frame; the second electronic device is further configured to, upon receiving the second request message, enable listening for Wi-Fi action frames.

[0076] Fourthly, this application provides a device connection method applied to a first electronic device. Specifically, the method may include: the first electronic device receiving a first request message, and, upon meeting a second condition, replying to a second electronic device with a first response message, the second condition including determining that the first electronic device is near the second electronic device, the first request message being sent by the second electronic device upon meeting the first condition, the first condition including detecting that a device is near the screen of the second electronic device; and the first electronic device establishing a communication link with the second electronic device.

[0077] In one possible design, the second condition further includes: the account logged in on the first electronic device and the account logged in on the second electronic device are the same account.

[0078] In one possible design, the first electronic device determines that it is near the second electronic device, including:

[0079] The first electronic device determines that it has performed a preset action, and the distance between the first electronic device and the second electronic device is less than a set threshold. The preset action is an action that indicates that the first electronic device moves forward and then stops.

[0080] Fifthly, this application also provides a device connection method, which is applied to a second electronic device. Specifically, the method may include: when the second electronic device meets a first condition, it sends a first request message, the first condition including detecting that a device is approaching the screen of the second electronic device; the second electronic device receives a first response message sent by a first electronic device, the first response message being sent by the first electronic device after receiving the first request message and meeting a second condition, the second condition including determining that the first electronic device is approaching the second electronic device; and the second electronic device establishes a communication link with the first electronic device based on the first response message.

[0081] In one possible design, the first condition further includes: the first application is running in the foreground of the second electronic device.

[0082] In one possible design, the second electronic device establishes a communication link with the first electronic device based on the first response message, including:

[0083] After receiving the first response message, the second electronic device sends a link establishment request message to the first electronic device, which is used to request the establishment of a communication link with the first electronic device.

[0084] In one possible design, the second electronic device detects that a device is approaching the second electronic device, including:

[0085] The second electronic device detects that a device is approaching an area on the screen of the second electronic device where content can be shared.

[0086] In one possible design, the second electronic device sends a connection establishment request message to the first electronic device, including:

[0087] When the second electronic device meets the first set condition, it sends a connection establishment request message to the first electronic device. The first set condition includes at least one of the following: the first response message carries a first flag bit, which is used to indicate that the first electronic device has content that can be shared with the second electronic device; or the second electronic device has content that can be shared with the first electronic device.

[0088] In one possible design, the first response message is a chain establishment request message;

[0089] The second electronic device establishes a communication link with the first electronic device according to the first response message, including:

[0090] The second electronic device establishes a communication link with the first electronic device based on the link establishment request message.

[0091] In one possible design, the second electronic device establishes a communication link with the first electronic device based on the link establishment request message, including:

[0092] When the second electronic device meets the second set condition, it establishes a communication link with the first electronic device according to the link establishment request message. The second set condition includes at least one of the following: the first request message carries a second flag bit, which is used to indicate that the second electronic device has content that can be shared with the first electronic device; or the first electronic device has content that can be shared with the second electronic device.

[0093] Sixthly, this application also provides a device connection method applied to a first electronic device. Specifically, the method may include: the first electronic device sending a second request message when a third condition is met, the third condition including the first electronic device determining that the first electronic device is near a second electronic device; the first electronic device receiving a second response message sent by the second electronic device, the second response message being a reply from the second electronic device after receiving the second request message and when a fourth condition is met, the fourth condition including detecting that a device is near the screen of the second electronic device; and then, the first electronic device establishing a communication link with the second electronic device based on the second response message.

[0094] In one possible design, the first electronic device establishes a communication link with the second electronic device based on the second response message, including:

[0095] After receiving the second response message, the first electronic device sends a link establishment request message to the second electronic device, which is used to request the establishment of a communication link with the second electronic device.

[0096] In one possible design, the first electronic device sends a connection establishment request message to the second electronic device, including:

[0097] When the first electronic device meets a third preset condition, it sends a connection establishment request message to the second electronic device. The third preset condition includes at least one of the following:

[0098] The first electronic device has content that can be shared with the second electronic device; or the second response message carries a second flag bit, which is used to indicate that the second electronic device has content that can be shared with the first electronic device.

[0099] In one possible design, the second response message is a chain establishment request message;

[0100] The first electronic device is specifically used to establish a communication link with the second electronic device according to the second response message in the following manner:

[0101] The first electronic device establishes a communication link with the second electronic device based on the link establishment request message.

[0102] In one possible design, the first electronic device establishes a communication link with the second electronic device based on the link establishment request message, including:

[0103] When the fourth set condition is met, the first electronic device establishes a communication link with the second electronic device according to the link establishment request message. The fourth set condition includes at least one of the following: the second request message carries a first flag bit, which is used to indicate that the first electronic device has content that can be shared with the second electronic device; or the second electronic device has content that can be shared with the first electronic device.

[0104] Seventhly, this application also provides a device connection method applied to a second electronic device. Specifically, the method may include: the second electronic device receiving a second request message, and, upon satisfying a fourth condition, replying to a first electronic device with a second response message, wherein the fourth condition includes detecting that a device is approaching the screen of the second electronic device; the second request message is sent by the first electronic device upon satisfying a third condition, and the second request message may be sent via broadcast, such as a Bluetooth broadcast message; the third condition includes the first electronic device determining that it is approaching the second electronic device; and the second electronic device establishing a communication link with the first electronic device.

[0105] In one possible design, the second electronic device detects that a device is approaching the screen of the second electronic device, including:

[0106] The second electronic device determines that a device is approaching the screen of the second electronic device based on the change in the capacitance parameter of the screen.

[0107] In one possible design, the second electronic device detects that a device is approaching the screen of the second electronic device, including:

[0108] The second electronic device detects that a device is approaching an area on the screen of the second electronic device where content can be shared.

[0109] Eighthly, this application also provides a device connection method applied to a first electronic device. The method includes: when the first electronic device satisfies a third condition, it sends a second request message, the third condition including the first electronic device determining that it is near another electronic device; the first electronic device receives a second response message, the second response message being a reply from a second electronic device to the first electronic device when a fourth condition is satisfied, the fourth condition including detecting that a device is near the screen of the second electronic device; and the first electronic device establishes a communication link with the second electronic device based on the second response message.

[0110] In one possible design, the first electronic device determines that it is near other electronic devices, including:

[0111] The first electronic device determines that it has touched the screen of the other electronic device.

[0112] In one possible design, the first electronic device touching the screen of the other electronic device includes:

[0113] The first electronic device touches the screen of the other electronic device along a first direction, the angle between the first direction and the first target direction is less than 90 degrees, and / or the angle between the first direction and the second target direction is less than 90 degrees, the first target direction is the direction from the bottom to the top of the first electronic device, and the second target direction is the direction perpendicular to the screen of the first electronic device and away from the screen.

[0114] In one possible design, the first electronic device is located close to other electronic devices, including:

[0115] The distance between the first electronic device and the second electronic device is detected to be less than a set threshold.

[0116] In one possible design, the second response message includes a second flag bit, which is used to identify that the second electronic device has content to share;

[0117] The method further includes: when the first electronic device determines that the second electronic device has content to share based on the second flag bit, the first electronic device displays a first animation effect, the first animation effect being used to indicate that the first electronic device is about to receive the shared content sent by the second electronic device.

[0118] In one possible design, the second response message includes the account information logged in by the second electronic device;

[0119] The method further includes: if the first electronic device determines, based on the second response message, that the account information logged in by the second electronic device is the same as the account information logged in by the first electronic device, and determines that the second electronic device has content to share, then the first animation effect is displayed.

[0120] In one possible design, the second response message is a Wi-Fi action frame.

[0121] In one possible design, the method further includes:

[0122] After determining that the third condition is met, the first electronic device starts listening for Wi-Fi action frames.

[0123] In one possible design, the method further includes:

[0124] After receiving the second response message, if the first electronic device determines that it has content to share, it sends a link establishment request message to the second electronic device. The link establishment request message is used to request the establishment of a communication link with the second electronic device.

[0125] In one possible design, the method further includes:

[0126] If the first electronic device determines that the account information logged in by the second electronic device is the same as the account information logged in by the first electronic device, and the first electronic device has content to share, then the first electronic device sends a connection request message to the second electronic device.

[0127] In one possible design, the method further includes:

[0128] When the first electronic device determines that the account information logged in by the second electronic device is the same as the account information logged in by the first electronic device, and determines that the first electronic device has content to share, it displays a fourth animation effect, which is used to indicate that the first electronic device is about to send shared content.

[0129] In one possible design, the method further includes: after receiving the second response message, the first electronic device sends a third response message to the second electronic device, the third response message including the account information logged in by the first electronic device.

[0130] In one possible design, before sending the second request message, the method further includes: detecting a first display screen that is close to the second electronic device; after establishing the communication link, the method further includes: receiving first shared content sent by the second electronic device, the first shared content being determined based on a first window, the first window being the window on the first display screen where the first electronic device is close.

[0131] In one possible design, the first shared content includes at least one of the following: first content in the first window; or, first information indicating the first content; or, second information indicated by the first content.

[0132] In one possible design, receiving the first shared content sent by the second electronic device includes:

[0133] The system receives first information sent by the second electronic device to indicate the first content and displays the first information; upon detecting a user operation to trigger the acquisition of the first content, the system sends a request message to the second electronic device, the request message being used to request the first content; and receives the first content sent by the second electronic device.

[0134] In one possible design, receiving the first shared content sent by the second electronic device includes:

[0135] The system receives first information sent by the second electronic device to indicate the first content and displays the first information; if no user operation to trigger the acquisition of the first content is detected, and the system detects proximity to the first display screen again, it receives third information sent by the second electronic device to indicate the second content and switches the display of the first information to the display of the third information; wherein the second content is the content in the second window, and the second window is the window that the first electronic device is close to when the system detects proximity to the first display screen again, and the second window and the first window belong to the same application or different applications.

[0136] In one possible design, the communication link between the second electronic device and the first electronic device remains uninterrupted in the absence of a detected user action to trigger the retrieval of the first content. Receiving the third information sent by the second electronic device indicating the second content includes:

[0137] The third information sent by the second electronic device, which indicates the second content, is received through the communication link.

[0138] In one possible design, the first information used to indicate the first content includes: preview information of the first content.

[0139] The third information used to indicate the second content includes: preview information of the second content.

[0140] In one possible design, the preview information of the first content is a preview image of the first content; the preview information of the second content is a preview image of the second content.

[0141] Ninthly, this application also provides a device connection method applied to a second electronic device, the method comprising: the second electronic device receiving a second request message, the second request message being sent by a first electronic device when a third condition is met, the third condition including the first electronic device determining that the first electronic device is near another electronic device; the second electronic device replying to the first electronic device with a second response message when a fourth condition is met, the fourth condition including detecting that a device is near the screen of the second electronic device; and the second electronic device establishing a communication link with the first electronic device.

[0142] In one possible design, the second electronic device detects that a device is approaching the screen of the second electronic device, including:

[0143] The second electronic device determines that a device is approaching the screen of the second electronic device based on the change in the capacitance parameter of the screen.

[0144] In one possible design, the fourth condition also includes that the second electronic device is in an unlocked state.

[0145] In one possible design, the second request message includes a first flag bit, which is used to identify that the first electronic device has content to share;

[0146] The method further includes: when the second electronic device satisfies the fourth condition and determines that the first electronic device has content to share according to the first flag bit, it preloads the second animation effect, and when it is determined that the account logged in by the second electronic device is the same as the account logged in by the first electronic device, it plays the second animation effect, wherein the second animation effect is used to indicate that the second electronic device is about to receive the shared content sent by the first electronic device.

[0147] In one possible design, the method further includes:

[0148] When the second electronic device receives the second request message and determines that it has content to share, it preloads a third animation effect. When it determines that the account logged in by the second electronic device is the same as the account logged in by the first electronic device, it plays the third animation effect. The third animation effect is used to indicate that the second electronic device is about to send shared content to the first electronic device.

[0149] In one possible design, the method further includes:

[0150] After sending the second response message, the second electronic device receives a third response message sent by the first electronic device, the third response message including the account information logged in by the first electronic device;

[0151] If the second electronic device determines, based on the third response message, that the account information logged in by the first electronic device is the same as the account information logged in by the second electronic device, and that the second electronic device has content to share, then the second electronic device sends a link establishment request message to the first electronic device. The link establishment request message is used to request the establishment of a communication link with the first electronic device.

[0152] In one possible design, the method further includes:

[0153] If the second electronic device determines, based on the third response message, that the account information logged in by the first electronic device is the same as the account information logged in by the second electronic device, and neither the first electronic device nor the second electronic device has any content to share, then the fifth animation effect is displayed, which is used to indicate that there is no content to share.

[0154] In one possible design, the second request message is a Bluetooth broadcast message;

[0155] The method further includes: when the second electronic device detects that a device is approaching the screen of the second electronic device, increasing the Bluetooth signal scanning duty cycle of the second electronic device.

[0156] In one possible design, the third response message is a Wi-Fi action frame;

[0157] The method further includes: after receiving the second request message, the second electronic device starts listening for Wi-Fi action frames.

[0158] In one possible design, before replying to the first electronic device with the second response message, the method further includes: detecting that the first electronic device is close to the first display screen of the second electronic device; after establishing the communication link, the method further includes: sending first sharing content to the first electronic device through the communication link, the first sharing content being determined according to a first window; and / or: receiving second sharing content sent by the first electronic device through the communication link, and processing the second sharing content through a first application to which the first window belongs;

[0159] The first window is the window on the first display screen where the first electronic device is located.

[0160] In one possible design, the first shared content includes at least one of the following:

[0161] The first content in the first window; or, the first information used to indicate the first content; or, the second information indicated by the first content.

[0162] In one possible design, the first window is one of N windows on the first display screen, where N is an integer greater than or equal to 2.

[0163] In one possible design, the first window is a non-focus window.

[0164] In one possible design, sending the first shared content to the first electronic device includes: sending the first information to the first electronic device to indicate the first content; and, upon receiving a request message from the first electronic device, sending the first content to the first electronic device, wherein the request message is used to request the first content.

[0165] In one possible design, sending the first shared content to the first electronic device includes: sending the first information to the first electronic device to indicate the first content; and not sending the first content to the first electronic device if a request message is not received from the first electronic device, wherein the request message is used to request the first content.

[0166] In one possible design, the method further includes:

[0167] The first electronic device is detected to be close to the first display screen again; a third sharing content is sent to the first electronic device, the third sharing content being determined based on a second window, the second window being the window that the first electronic device is close to when it is detected to be close to the first display screen again, the second window and the first window belonging to the same application or different applications.

[0168] In one possible design, if the second electronic device does not receive a request message from the first electronic device, the second electronic device does not interrupt the communication link between the second electronic device and the first electronic device, and the third shared content is sent through the communication link.

[0169] In one possible design, the first information used to indicate the first content includes:

[0170] Preview information for the first content.

[0171] In one possible design, the preview information of the first content is a preview image of the first content.

[0172] In one possible design, before sending the first shared content to the first electronic device, the method includes:

[0173] The first shared content in the first window is obtained from the first application, where the first application is the application to which the first window belongs.

[0174] In one possible design, obtaining the first shared content from the first application within the first window includes:

[0175] The callback function of the first window is invoked, and the callback function is used to trigger the first application to provide the first shareable content in the first window.

[0176] In one possible design, before sending the first shared content to the first electronic device, the method further includes:

[0177] Get the first shared content in the first display element, where the first display element is the display element in the first window that the first electronic device is close to.

[0178] In one possible design, obtaining the first shared content in the first display element includes:

[0179] The callback function of the first display element is invoked. The callback function is used to trigger the first application to provide the first shareable content in the first display element. The first application is the application to which the first window belongs.

[0180] In one possible design, processing the second shared content through the first application to which the first window belongs includes:

[0181] The second shared content is displayed in the first window through the first application.

[0182] In one possible design, after receiving the second shared content sent by the first electronic device, the method further includes:

[0183] The first electronic device was detected to be near the first display screen again;

[0184] The system receives the fourth shared content sent by the first electronic device, processes the fourth shared content through the second application to which the third window belongs, and the third window is the window that the first electronic device approaches when it is detected that the first electronic device is approaching the first display screen again. The third window and the first window are either windows of the same application or windows of different applications.

[0185] In one possible design, processing the second shared content through the first application to which the first window belongs includes:

[0186] Send the second shared content to the first application so that the first application processes the second shared content within the first window.

[0187] In one possible design, sending the second shared content to the first application includes:

[0188] The callback function of the first window is invoked, and the callback function is used to send the second shared content to the first application.

[0189] In one possible design, processing the second shared content through the first application to which the first window belongs includes:

[0190] The second shared content is sent to the first application so that the first application processes the second shared content in a first display element within the first window, wherein the first display element is the display element within the first window in which the first electronic device is located.

[0191] In one possible design, sending the second shared content to the first application includes:

[0192] The callback function of the first display element is invoked, and the callback function is used to send the second shared content to the first application.

[0193] In one possible design, the method further includes:

[0194] If the first window is not the focus window, then switch the first window to the focus window.

[0195] In one possible design, switching the first window to the focus window includes:

[0196] A virtual event is generated for the first window, which is used to trigger the first window to switch to the focus window.

[0197] In a tenth aspect, this application provides an electronic device, the electronic device including a processor; a memory and one or more computer programs; wherein the one or more computer programs are stored in the one or more memories, and the one or more computer programs include instructions that, when invoked and executed by the one or more processors, cause the electronic device to perform the methods described in the fourth aspect and any possible design of the fourth aspect.

[0198] Eleventhly, this application provides an electronic device, the electronic device including a processor; a memory and one or more computer programs; wherein the one or more computer programs are stored in the one or more memories, and the one or more computer programs include instructions that, when invoked and executed by the one or more processors, cause the electronic device to perform the methods described in the fifth aspect and any possible design of the fifth aspect.

[0199] In a twelfth aspect, this application provides an electronic device comprising a processor, a memory, and one or more computer programs; wherein the one or more computer programs are stored in the one or more memories, and the one or more computer programs include instructions that, when invoked and executed by the one or more processors, cause the electronic device to perform the methods described in the sixth aspect and any possible design of the sixth aspect.

[0200] In a thirteenth aspect, this application provides an electronic device comprising a processor, a memory, and one or more computer programs; wherein the one or more computer programs are stored in the one or more memories, and the one or more computer programs include instructions that, when invoked and executed by the one or more processors, cause the electronic device to perform the methods described in the seventh aspect and any possible design of the seventh aspect.

[0201] In a fourteenth aspect, this application provides an electronic device including a processor, a memory, and one or more computer programs; wherein the one or more computer programs are stored in the one or more memories, and the one or more computer programs include instructions that, when invoked and executed by the one or more processors, cause the electronic device to perform the methods described in the eighth aspect and any possible design of the eighth aspect.

[0202] In a fifteenth aspect, this application provides an electronic device comprising a processor, a memory, and one or more computer programs; wherein the one or more computer programs are stored in the one or more memories, and the one or more computer programs include instructions that, when invoked and executed by the one or more processors, cause the electronic device to perform the methods described in the ninth aspect and any possible design of the ninth aspect.

[0203] In a sixteenth aspect, this application also provides a computer-readable storage medium storing instructions that, when executed on an electronic device, cause the electronic device to perform the methods of the fourth to ninth aspects and any possible design of the fourth to ninth aspects.

[0204] In a seventeenth aspect, this application also provides a computer program product that, when run on an electronic device, causes the electronic device to perform the methods of the fourth to ninth aspects and any possible design of the fourth to ninth aspects.

[0205] For the various aspects from the third to the seventeenth aspects mentioned above, and the technical effects that each aspect may achieve, please refer to the description of the technical effects that can be achieved by the various possible solutions for the first and second aspects mentioned above. They will not be repeated here. Attached Figure Description

[0206] Figure 1 is a schematic diagram of an application scenario provided by an embodiment of this application;

[0207] Figure 2 is a schematic diagram of the structure of an electronic device provided in an embodiment of this application;

[0208] Figure 3 is a schematic diagram of capacitance change on a screen provided in an embodiment of this application;

[0209] Figure 4 is a schematic diagram of a user interface provided in an embodiment of this application;

[0210] Figure 5 is a flowchart of a device connection method provided in an embodiment of this application;

[0211] Figure 6 is a schematic diagram of a user interface provided in an embodiment of this application;

[0212] Figure 7 is a schematic diagram of a user interface provided in an embodiment of this application;

[0213] Figure 8 is a flowchart of a device connection method provided in an embodiment of this application;

[0214] Figure 9 is a flowchart illustrating a communication method provided in an embodiment of this application;

[0215] Figure 10 is a schematic diagram of an application scenario provided by an embodiment of this application;

[0216] Figure 11A is a schematic diagram of a first device determining a first window according to an embodiment of this application;

[0217] Figure 11B is another schematic diagram of a first device determining a first window according to an embodiment of this application;

[0218] Figure 11C is another schematic diagram of a first device determining a first window according to an embodiment of this application;

[0219] Figure 12 is a schematic diagram of a user selecting shareable content on the desktop according to an embodiment of this application;

[0220] Figure 13A is a schematic diagram of content sharing when a mobile phone is brought close to the desktop according to an embodiment of this application;

[0221] Figure 13B is a schematic diagram of content sharing when a mobile phone is brought close to an application window according to an embodiment of this application;

[0222] Figure 13C is a schematic diagram of a mobile phone displaying elements near an application window to achieve content sharing according to an embodiment of this application;

[0223] Figure 13D is another schematic diagram of content sharing provided by an embodiment of this application, whereby a mobile phone displays elements when it is near an application window.

[0224] Figure 14A is a schematic diagram of a focus switching window provided in an embodiment of this application;

[0225] Figure 14B is an example diagram of a first device sharing content with a second device according to an embodiment of this application;

[0226] Figure 14C is another example diagram of a first device sharing content with a second device according to an embodiment of this application;

[0227] Figure 15 is a schematic diagram of instruction information provided in an embodiment of this application;

[0228] Figure 16A is another schematic diagram of the instruction information provided in an embodiment of this application;

[0229] Figure 16B is another schematic diagram of the instruction information provided in an embodiment of this application;

[0230] Figure 17 is a schematic diagram of another application scenario provided by an embodiment of this application;

[0231] Figure 18 is a schematic flowchart of another communication method provided in an embodiment of this application;

[0232] Figure 19A is a schematic diagram of a second device delivering content to the desktop window of a first device according to an embodiment of this application;

[0233] Figure 19B is a schematic diagram of a second device delivering content to the application window of a first device according to an embodiment of this application;

[0234] Figure 19C is another schematic diagram of a second device delivering content to the application window of a first device according to an embodiment of this application;

[0235] Figure 20A is a schematic diagram of a second device delivering content to an icon component of a first device according to an embodiment of this application;

[0236] Figure 20B is a schematic diagram of a second device delivering content to the search component of a first device according to an embodiment of this application;

[0237] Figure 20C is a schematic diagram of a second device delivering content to a rich text editing component of a first device according to an embodiment of this application;

[0238] Figure 21A is an example diagram of a second device sharing content with a first device according to an embodiment of this application;

[0239] Figure 21B is an example diagram of a second device sharing content with a first device according to an embodiment of this application;

[0240] Figure 21C is an example diagram of a second device sharing content with a first device according to an embodiment of this application;

[0241] Figure 21D is an example diagram of a second device sharing content with a first device according to an embodiment of this application;

[0242] Figure 22 is another schematic diagram of a communication system provided in an embodiment of this application;

[0243] Figure 23 is a schematic flowchart of a communication method provided in an embodiment of this application;

[0244] Figure 24 is a schematic flowchart of another communication method provided in an embodiment of this application;

[0245] Figure 25 is a schematic diagram of an application scenario provided by an embodiment of this application;

[0246] Figure 26 is a schematic diagram of the IMU touch detection process provided in the embodiment of this application;

[0247] Figure 27 is a schematic diagram of the structure of an electronic device provided in an embodiment of this application. Detailed Implementation

[0248] The technical solutions in the embodiments of this application will be described in detail below with reference to the accompanying drawings.

[0249] As exemplified, Figure 1 illustrates an application scenario provided by an embodiment of this application. Referring to Figure 1, this application scenario may include a first electronic device 10 and a second electronic device 20. The first electronic device 10 or the second electronic device 20 may be, but is not limited to, mobile phones, tablets, desktop computers, laptops, handheld computers, personal computers (PCs), ultra-mobile personal computers (UMPCs), netbooks, personal digital assistants (PDAs), augmented reality (AR) devices, virtual reality (VR) devices, artificial intelligence (AI) devices, wearable devices, in-vehicle devices, smart home devices, and various other electronic devices with displays. Furthermore, the operating system installed on the first electronic device 10 or the second electronic device 20 may include, but is not limited to, […]. Or other operating systems.

[0250] It should be understood that the first electronic device 10 in Figure 1 is an example of a mobile phone, and the second electronic device 20 is an example of a PC. In practical applications, it can also be other electronic devices.

[0251] In some embodiments, the first electronic device 10 can act as the initiator of multi-device collaboration, initiating a connection request to the second electronic device 20; the second electronic device 20 can act as the receiver of multi-device collaboration, receiving the connection request initiated by the first electronic device 10. Alternatively, the second electronic device 20 can also act as the initiator of multi-device collaboration, initiating a connection request to the first electronic device 10; and the first electronic device 10 can act as the receiver of multi-device collaboration, receiving the connection request initiated by the second electronic device 20. That is, in the embodiments of this application, either the first electronic device 10 or the second electronic device 20 can act as either the initiator or the receiver of multi-device collaboration. For example, if the first electronic device 10 is a mobile phone and the second electronic device 20 is a laptop computer, the mobile phone can act as the initiator, initiating a connection request to the laptop computer; the mobile phone can also act as the receiver, with the laptop computer initiating a connection request to the mobile phone.

[0252] In some embodiments, a user can move the first electronic device 10 closer to the display screen of the second electronic device 20. When the second electronic device 20 determines that a device is near its display screen, it can send a request message. Correspondingly, the first electronic device 10 can receive the request message from the second electronic device 20. When the first electronic device 10 determines that the device near it is the second electronic device 20, it can reply with a response message to the second electronic device 20. After receiving the response message from the first electronic device 10, the second electronic device 20 can send a connection request message to the first electronic device 10. Then, the first electronic device 10 can establish a communication connection with the second electronic device 20. Of course, when the first electronic device 10 determines that the device near it is the second electronic device 20, it may not reply with a response message to the second electronic device 20 and may directly initiate a connection request message to the second electronic device 20; this application does not limit this approach.

[0253] It should be understood that the request message in this application embodiment can be sent in the form of broadcast, such as Bluetooth broadcast. Similarly, the response message can also be sent in the form of broadcast. Of course, the response message can also be in other forms, such as WiFi action frame messages. This application does not limit this.

[0254] In other embodiments, a user can move the first electronic device 10 closer to the display screen of the second electronic device 20. Once the first electronic device 10 determines that it is close to the display screen of the second electronic device 20, it can send a request message. Correspondingly, the second electronic device 20 can receive the request message from the first electronic device 10. Once the second electronic device 20 determines that the first electronic device 10 is close to its own display screen, it can initiate a connection request message to the first electronic device 10. Alternatively, after the second electronic device 10 determines that the first electronic device 10 is close to its own display screen, the second electronic device 20 can also reply with a response message to the first electronic device 10. Then, after receiving the response message, the first electronic device 10 can then initiate a connection request message to the second electronic device 20. This application does not limit this approach.

[0255] Optionally, the first electronic device 10 and the second electronic device 20 can establish a connection via wired or wireless communication technology. For example, wireless communication technologies may include, but are not limited to, Bluetooth (BT), Starlink, near field communication (NFC), wireless local area networks (WLAN) (such as Wireless Fidelity (Wi-Fi) networks), Zigbee, frequency modulation (FM), and infrared (IR).

[0256] For example, Figure 2 shows a schematic diagram of the structure of an electronic device provided in an embodiment of this application. This electronic device can be the first electronic device 10 in the application scenario shown in Figure 1 above, or the second electronic device 20 in the application scenario shown in Figure 1 above. As shown in Figure 2, the electronic device 100 may include a processor 110, a memory 120, a universal serial bus (USB) interface 130, a charging management module 140, a power management module 141, a battery 142, antenna 1, antenna 2, a mobile communication module 150, a wireless communication module 160, an audio module 170, a sensor module 180, buttons 190, a camera 191, a display screen 192, etc.

[0257] Processor 110 may include one or more processing units, such as an application processor (AP), a modem processor, a graphics processing unit (GPU), an image signal processor (ISP), a controller, memory, a video codec, a digital signal processor (DSP), a baseband processor, and / or a neural network processing unit (NPU). Different processing units may be independent devices or integrated into one or more processors. The controller may serve as the central nervous system and command center of the electronic device 100. The controller can generate operation control signals based on instruction opcodes and timing signals to control instruction fetching and execution. Processor 110 may also include memory for storing instructions and data. In some embodiments, the memory in processor 110 is a cache memory. This memory can store instructions or data that processor 110 has recently used or is repeatedly used. If processor 110 needs to reuse an instruction or data, it can directly retrieve it from the memory. This avoids repeated access, reduces the waiting time of processor 110, and thus improves system efficiency.

[0258] The memory 120 can be used to store computer executable program code, which includes instructions. The memory 120 may include a program storage area and a data storage area. The program storage area may store the operating system, applications required for at least one function, etc. The data storage area may store data created during the use of the electronic device 100, etc. Furthermore, the memory 120 may include high-speed random access memory, and may also include non-volatile memory, such as at least one disk storage device, flash memory device, universal flash storage (UFS), etc. The processor 110 executes various functional applications and data processing of the electronic device 100 by running instructions stored in the memory 120 and / or instructions stored in memory disposed in the processor.

[0259] USB interface 130 is a USB standard compliant interface, specifically a Mini USB interface, Micro USB interface, USB Type-C interface, etc. USB interface 130 can be used to connect a charger to charge electronic device 100, and can also be used for data transfer between electronic device 100 and peripheral devices. Charging management module 140 receives charging input from the charger. Power management module 141 connects battery 142, charging management module 140, and processor 110. Power management module 141 receives input from battery 142 and / or charging management module 140, providing power to processor 110, internal memory 121, external memory, display 194, camera 193, and wireless communication module 160, etc.

[0260] The wireless communication function of electronic device 100 can be implemented through antenna 1, antenna 2, mobile communication module 150, wireless communication module 160, modem processor, and baseband processor. Antenna 1 and antenna 2 are used to transmit and receive electromagnetic wave signals. Each antenna in electronic device 100 can be used to cover one or more communication frequency bands. Different antennas can also be multiplexed to improve antenna utilization. For example, antenna 1 can be multiplexed as a diversity antenna for a wireless local area network. In some other embodiments, the antennas can be used in conjunction with tuning switches.

[0261] The mobile communication module 150 can provide solutions for wireless communication, including 2G / 3G / 4G / 5G, applied to the electronic device 100. The mobile communication module 150 may include at least one filter, switch, power amplifier, low noise amplifier (LNA), etc. The mobile communication module 150 can receive electromagnetic waves via antenna 1, and perform filtering, amplification, and other processing on the received electromagnetic waves before transmitting them to a modem processor for demodulation. The mobile communication module 150 can also amplify the signal modulated by the modem processor and convert it into electromagnetic waves for radiation via antenna 1. In some embodiments, at least some functional modules of the mobile communication module 150 may be housed in the processor 110. In some embodiments, at least some functional modules of the mobile communication module 150 and at least some modules of the processor 110 may be housed in the same device.

[0262] The wireless communication module 160 can provide solutions for wireless communication applications on the electronic device 100, including WLAN (such as Wi-Fi networks), BT, Starflash technology, Global Navigation Satellite System (GNSS), FM, NFC, IR, etc. The wireless communication module 160 can be one or more devices integrating at least one communication processing module. The wireless communication module 160 receives electromagnetic waves via antenna 2, modulates and filters the electromagnetic wave signals, and sends the processed signal to processor 110. The wireless communication module 160 can also receive signals to be transmitted from processor 110, modulate and amplify them, and then convert them into electromagnetic waves for radiation via antenna 2.

[0263] In some embodiments, antenna 1 of electronic device 100 is coupled to mobile communication module 150, and antenna 2 is coupled to wireless communication module 160, enabling electronic device 100 to communicate with networks and other devices via wireless communication technology. The wireless communication technology may include Global System for Mobile Communications (GSM), General Packet Radio Service (GPRS), Code Division Multiple Access (CDMA), Wideband Code Division Multiple Access (WCDMA), Time-Division Code Division Multiple Access (TD-SCDMA), Long Term Evolution (LTE), the fifth generation (5G) mobile communication system, future communication systems such as the sixth generation (6G) system, BT, GNSS, WLAN, NFC, FM and / or IR technologies, etc. The GNSS may include the Global Positioning System (GPS), the Global Navigation Satellite System (GLONASS), the BeiDou Navigation Satellite System (BDS), the Quasi-Zenith Satellite System (QZSS), and / or satellite-based augmentation systems (SBAS).

[0264] Electronic device 100 can implement audio functions through audio module 170, such as speakers, receivers, microphones, headphone jacks, and application processors. Examples include music playback and recording.

[0265] The sensor module 180 may include one or more sensors that can be used by the electronic device 100 to determine whether a display screen of another electronic device is nearby, or to determine whether another electronic device is nearby. For example, these one or more sensors may include one or more of a pressure sensor 180A, a gyroscope sensor 180B, an accelerometer sensor 180C, etc.

[0266] Pressure sensor 180A is used to sense pressure signals and convert them into electrical signals. In some embodiments, pressure sensor 180A may be disposed on display screen 192; in other embodiments, pressure sensor 180A may also be disposed in other locations, such as the frame of electronic device 100. In some embodiments of this application, pressure sensor 180A can be used to detect whether pressure is applied to electronic device 100 to determine whether a scenario of handheld electronic device 100 is occurring.

[0267] The gyroscope sensor 180B can be used to determine the motion attitude of the electronic device 100. In some embodiments, the angular velocity of the electronic device 100 about three axes (i.e., the x, y, and z axes) can be determined by the gyroscope sensor 180B.

[0268] Accelerometer 180C can detect the magnitude of acceleration of electronic device 100 in various directions (generally three axes). In some embodiments of this application, gyroscope sensor 180B and accelerometer 180C can be used to detect whether electronic device 100 is in motion, and thus to determine whether electronic device 100 is near a display screen with other electronic devices.

[0269] It should be understood that the sensor shown in Figure 2 is only an illustrative example. In actual applications, electronic device 100 may include more or fewer sensors or different types of sensors to sense whether electronic device 100 is near a display screen with other electronic devices, or whether there are other electronic devices near the display screen with electronic device 100.

[0270] Buttons 190 include a power button, volume buttons, etc. Buttons 190 can be mechanical buttons or touch-sensitive buttons. Electronic device 100 can receive button input and generate key signal inputs related to user settings and function control of electronic device 100.

[0271] Camera 191 is used to capture still images or videos. Camera 191 may include a front-facing camera and a rear-facing camera. In this embodiment, camera 191 can acquire images to determine whether the device near the first electronic device 10 is a device with a screen.

[0272] The display screen 192 includes a display panel. The display panel can be a liquid crystal display (LCD), an organic light-emitting diode (OLED), an active-matrix organic light-emitting diode (AMOLED), a flexible light-emitting diode (FLED), a Mini LED, a MicroLED, a Micro-OLED, a quantum dot light-emitting diode (QLED), etc. In some embodiments, the electronic device 100 may include one or N display screens 192, where N is a positive integer greater than 1. In this embodiment, the display screen 192 can be used to display application interfaces, etc.

[0273] Optionally, the display screen 192 can be various types of touch screens, such as capacitive touch screens, infrared touch screens, and acoustic wave touch screens. In some embodiments of this application, the display screen 192 can be used to determine whether other electronic devices are near the electronic device 100. As one possible implementation, when other electronic devices approach the display screen 192 of the electronic device 100, the detection parameters corresponding to the display screen 192 can change, thereby determining that other electronic devices are near the display screen 192 of the electronic device 100. For example, assuming that the display screen 192 of the electronic device 100 is a capacitive touch screen, the detection parameters corresponding to the display screen 192 can include capacitance, voltage, current, etc. When other electronic devices approach the display screen 192 of the electronic device 100, the capacitance corresponding to the display screen 192 will change.

[0274] It is understood that the structure shown in Figure 2 does not constitute a specific limitation on the first electronic device 10 or the second electronic device 20. The first electronic device 10 or the second electronic device 20 may include more or fewer components than shown, or combine some components, or split some components, or have different component arrangements. The components shown may be implemented in hardware, software, or a combination of software and hardware.

[0275] The technical solution of the embodiments of this application will be described below using a first electronic device 10 as the first electronic device and a second electronic device 20 as the second electronic device as an example. In the embodiments of this application, the request message can be initiated by the first electronic device 10 (for example, the request message can be a proximity broadcast), or the request message can be initiated by the second electronic device 20. The device connection method of this application will be described below using two different devices initiating request messages.

[0276] Scenario 1: The second electronic device 20 initiates a request message

[0277] Based on the request message issued by the second electronic device 20, scenario 1 can be further subdivided according to the different devices that initiate the chain establishment request. Specifically, it can be divided into the following situations:

[0278] Scenario 1: The second electronic device 20 initiates a connection establishment request.

[0279] Option A: In some embodiments, a user moves the first electronic device 10 closer to the display screen of the second electronic device 20. The display screen of the second electronic device 20 can detect a change in screen parameters (e.g., capacitance parameters) and determine that a device is approaching its display screen. At this time, it can send a request message. Correspondingly, the first electronic device 10 can receive the request message sent by the second electronic device 20 and determine whether it is itself approaching the second electronic device 20. If it determines that it is approaching the second electronic device 20, it replies with a response message to the second electronic device 20 (this response message can be a wireless broadcast). After receiving the response message, the second electronic device 20 can initiate a connection establishment request to the first electronic device 10. It should be understood that after the second electronic device 20 initiates a connection establishment request to the first electronic device 10, the first electronic device 10 can reply with a response message agreeing to establish a connection, thus enabling the second electronic device 20 to establish a connection with the first electronic device 10.

[0280] Optionally, the request message may carry the change value of screen parameters (e.g., the change value of capacitance parameters), the time when the screen parameters changed, and the time difference between the screen parameters changing and sending the request message (e.g., the time difference between the capacitance change and sending the request message is 100ms). Optionally, the request message may also carry information such as the specific area of ​​the display screen of the first electronic device 10 that is close to the second electronic device 20, and the account information logged in by the first electronic device 10.

[0281] Optionally, the response message can be in the form of a broadcast, such as a Bluetooth broadcast or a star broadcast.

[0282] Optionally, the display screen of the second electronic device 20 detects a change in screen parameters (e.g., capacitance parameters), determines that a device is approaching its display screen, and can also determine the shape of the object approaching its display screen. For example, the object shape can be determined based on the capacitance value distribution map of a specific location on the display screen of the first electronic device 10 approaching the second electronic device 20. For example, the detected capacitance data of the display screen can be input into a preset model, and the recognition result can be output through the preset model. Of course, the object shape can also be determined in other ways, and this application does not limit this.

[0283] It should be understood that "the first electronic device 10 is close to the display screen of the second electronic device 20" means that the distance between the first electronic device 10 and the display screen of the second electronic device 20 is less than or equal to a certain threshold. "Close" can include the two first electronic devices 10 contacting (or touching) the screen of the second electronic device 20, or the first electronic device 10 and the screen of the second electronic device 20 being x (x is greater than 0) centimeters apart.

[0284] It should be understood that, in the embodiments of this application, proximity may include non-contact proximity and / or contact proximity (e.g., touching).

[0285] As one possible implementation, the first electronic device 10 can determine whether it is approaching the second electronic device 20 based on its own state and parameters such as its distance from the second electronic device 20. Specifically, if the first electronic device 10 is in a handheld hovering state and the distance between the first electronic device 10 and the second electronic device 20 is less than a set threshold, then it can be determined that the first electronic device 10 is approaching the display screen of the second electronic device 20. It should be understood that the handheld hovering state refers to a state in which a preset action occurs, which can be the action of the first electronic device 10 moving and then stopping. In one possible implementation, this preset action can be the action of the first electronic device 10 moving and then touching another electronic device. That is to say, moving and then touching is one implementation of moving and then stopping.

[0286] The handheld hovering state includes the state within a preset time period before and after the first electronic device 10 receives the request message (i.e., whether a preset action occurs within the preset time period before and after the first electronic device 10 receives the request message). For example, assuming the time when the first electronic device 10 receives the request message is t1, it can be determined whether a preset action occurs within the preset time period before t1 (e.g., 3 seconds), i.e., the time period (t1-3), or it can be determined whether a preset action occurs within the preset time period after t1 (e.g., 3 seconds), i.e., the time period (t1+3).

[0287] Alternatively, the handheld hovering state can also include the state during the time period between when the screen parameters of the second electronic device 20 change and when the first electronic device 10 receives the request message. For example, the state of the first electronic device 10 during this time difference can be determined by subtracting the capacitance change time (the time when the screen parameters change) carried in the request message from the current time.

[0288] In some embodiments, determining that the first electronic device 10 is close to another electronic device may include determining that the first electronic device 10 touches the screen of the other electronic device. The touch may be a touch action along a first direction. The angle between the first direction and a first target direction is less than 90 degrees, and / or the angle between the first direction and a second target direction is less than 90 degrees. The first target direction is the direction from the bottom to the top of the first electronic device 10, and the second target direction is a direction perpendicular to the screen of the first electronic device 10 and away from the screen.

[0289] In other embodiments, the proximity of the first electronic device 10 to other electronic devices further includes detecting that the distance between the first electronic device 10 and other electronic devices (e.g., the second electronic device 20) is less than a set threshold. Whether the distance between the first electronic device 10 and the second electronic device 20 is less than the set threshold can be obtained by ranging. For example, when the first electronic device 10 receives a request message, it can determine the distance between the first electronic device 10 and the second electronic device 20 based on the difference between the received signal strength indicator (RSSI) of the received request message and the RSSI of the second electronic device 20 when it sends the request message. Then, it compares the distance between the first electronic device 10 and the second electronic device 20 with a set threshold to determine whether it is less than the set threshold. Alternatively, the distance between the first electronic device 10 and the second electronic device 20 can be determined based on the difference between the RSSI of the received request message and the transmission power of the second electronic device 20 when it sends the request message. Alternatively, when the first electronic device 10 receives a request message, it can initiate an ultrasonic ranging request message to the second electronic device 20. After receiving the ultrasonic ranging request message, the second electronic device 20 can send an ultrasonic ranging signal, and then the first electronic device 10 performs ranging based on the ultrasonic ranging signal. Alternatively, when the first electronic device 10 receives a request message, it can initiate a satellite stroboscopic ranging request message to the second electronic device 20. After receiving the satellite stroboscopic ranging request message, the second electronic device 20 can send a satellite stroboscopic ranging signal, and then the first electronic device 10 performs ranging based on the satellite stroboscopic ranging signal. Of course, the distance between the first electronic device 10 and the second electronic device 20 can also be measured in other ways, and this application does not specifically limit this.

[0290] Optionally, the sending power when sending the request message can be carried in the request message.

[0291] The above process is described using a mobile phone as the first electronic device 10 and a PC as the second electronic device 20 as an example. For instance, as shown in Figure 3, assume a user holds the mobile phone and moves it closer to the PC screen. The PC screen may experience capacitance changes (capacitance data can be found in the schematic diagram in Figure 3; different patterns represent different capacitance values, and area 1 in the figure represents the area of ​​capacitance change). When the PC senses the capacitance change, it can determine that a device is approaching its screen and then send a request message. The mobile phone receives the request message from the PC, determines the distance between itself and the PC based on the request message, and checks whether its state is hovering. If the mobile phone determines that the distance between itself and the PC screen is less than a threshold and the mobile phone is hovering, it can determine that it is approaching the PC and then reply with a response message to the PC. After receiving the response message, the PC can initiate a connection request to the mobile phone.

[0292] Option B: In some embodiments, the user moves the first electronic device 10 closer to the display screen of the second electronic device 20. The display screen of the second electronic device 20 can detect a change in screen parameters (e.g., capacitance parameters) and determine that a device is approaching its display screen. At this time, it can send a request message. Correspondingly, the first electronic device 10 can receive the request message from the second electronic device 20, then turn on its own camera (e.g., a rear camera), capture an image through the camera, and then determine whether the image captured by the camera contains a screen. If the image captured by the camera contains a screen, it replies with a response message to the second electronic device 20. After receiving the response message, the second electronic device 20 can initiate a connection establishment request to the first electronic device 10. It should be understood that after the second electronic device 20 initiates a connection establishment request to the first electronic device 10, the first electronic device 10 can reply with a response message agreeing to establish a connection, thus enabling the second electronic device 20 to establish a connection with the first electronic device 10.

[0293] Continuing with the example of a mobile phone as the first electronic device 10 and a PC as the second electronic device 20, as shown in Figure 4, the user holds the mobile phone and moves it closer to the PC screen. The PC screen senses the change in capacitance, confirming the presence of a device, and then sends a request message. The mobile phone receives the request message from the PC, activates its camera to capture an image (e.g., the image shown in Figure 4), and if it determines that the PC screen is present in the captured image, it sends a response message back to the PC. Upon receiving the response message, the PC initiates a connection request to the mobile phone.

[0294] In other words, in scenario 1, the first electronic device 10 can determine whether to reply to the second electronic device 20 using two different methods, Scheme A and Scheme B; the second electronic device 20 determines whether a device is approaching by detecting changes in screen parameters, and then sends a request message. For the specific implementation of the same steps in Scheme A and Scheme B, please refer to the detailed description in Scheme A, which will not be repeated here.

[0295] Scenario 2: The first electronic device 10 initiates a chain establishment request.

[0296] Option A: In some embodiments, a user moves the first electronic device 10 closer to the display screen of the second electronic device 20. The display screen of the second electronic device 20 can detect a change in screen parameters (e.g., capacitance parameters) and determine that a device is approaching its display screen. At this time, it can send a request message. Correspondingly, the first electronic device 10 can receive the request message from the second electronic device 20 and determine whether it is itself approaching the display screen of the second electronic device 20. If it determines that it is approaching the display screen of the second electronic device 20, it directly initiates a connection establishment request to the second electronic device 20. It should be understood that after the first electronic device 10 initiates a connection establishment request to the second electronic device 20, the second electronic device 20 can reply with a response message agreeing to establish a connection, thus enabling the first electronic device 10 to establish a connection with the second electronic device 20.

[0297] Taking a mobile phone as the first electronic device 10 and a PC as the second electronic device 20 as an example, the user holds the mobile phone and moves it closer to the PC screen. After the PC screen senses the change in capacitance, it determines that a device is approaching its screen and can then send a request message. The mobile phone receives the request message from the PC, determines the distance between itself and the PC based on the request message, and determines whether its state is hovering. If the mobile phone determines that the distance between itself and the PC screen is less than a threshold and the mobile phone is in a hovering state, it can determine that it is approaching the PC screen and can then directly initiate a connection request to the PC.

[0298] Option B: In some embodiments, the user moves the first electronic device 10 closer to the display screen of the second electronic device 20. The display screen of the second electronic device 20 can detect a change in screen parameters (e.g., capacitance parameters) and determine that a device is approaching its display screen. At this time, it can send a request message. Correspondingly, the first electronic device 10 can receive the request message sent by the second electronic device 20, then turn on its own camera (e.g., a rear camera), capture an image through the camera, and then determine whether the image captured by the camera contains a screen. If the image captured by the camera contains a screen, it can directly initiate a connection request to the second electronic device 20.

[0299] Continuing with the example of a mobile phone as the first electronic device 10 and a PC as the second electronic device 20, the user holds the mobile phone and moves it closer to the PC screen. After the PC screen senses the change in capacitance, it confirms that a device is near its screen and can then send a request message. The mobile phone receives the request message from the PC, turns on its camera, and if it confirms that the screen is in the image captured by the camera, it can directly initiate a connection request to the PC.

[0300] It should be understood that the difference between scenario 1 and scenario 2 in scenario 1 lies in the different initiators of the chain. For the specific implementation of scenario 2, please refer to the detailed introduction in scenario 1, which will not be repeated here.

[0301] Scenario 2: The first electronic device 10 initiates a request message

[0302] Based on the request message issued by the first electronic device 10, scenario 2 can be further subdivided according to the different devices that initiate the chain establishment request. Specifically, it can be divided into the following situations:

[0303] Scenario 1: The first electronic device 10 initiates a chain establishment request.

[0304] Option A: In some embodiments, the user moves the first electronic device 10 closer to the display screen of the second electronic device 20. The first electronic device 10 can determine whether it is itself that is close to the display screen of the second electronic device 20. If the first electronic device 10 determines that it is itself that is close to the display screen of the second electronic device 20, it sends a request message. Correspondingly, the second electronic device 20 can receive the request message sent by the first electronic device 10, detect whether the screen parameters (e.g., capacitance parameters) have changed, and if it is determined that the screen parameters have changed, it can determine that a device is close to its own display screen. Then, the second electronic device 20 can reply with a response message to the first electronic device 10. After receiving the response message, the first electronic device 10 can initiate a connection establishment request to the second electronic device 20. It should be understood that after the first electronic device 10 initiates a connection establishment request to the second electronic device 20, the second electronic device 20 can reply with a response message agreeing to establish a connection, thus enabling the second electronic device 20 to establish a connection with the first electronic device 10.

[0305] In some embodiments, the second electronic device 20 may reply with a response message to the first electronic device 10 when it determines that a device is near its display screen and that the second electronic device 20 is in an unlocked state. After receiving the response message, the first electronic device 10 may initiate a connection request to the second electronic device 20.

[0306] Taking a mobile phone as the first electronic device 10 and a PC as the second electronic device 20 as an example, when a user moves the mobile phone closer to the PC screen, the mobile phone detects its own status and parameters such as the distance from the PC to determine whether it is close to the PC screen. When the mobile phone determines that it is close to the PC screen, it can send a request message. Correspondingly, the PC can receive the request message sent by the mobile phone, detect changes in the screen's capacitance, and if it determines that a device is close to its screen, it can reply with a response message to the mobile phone. After receiving the response message, the mobile phone can initiate a connection request to the PC.

[0307] Option B: In some embodiments, the first electronic device 10 activates its camera to capture images. If the captured image contains a screen, it can send a request message. Correspondingly, the second electronic device 20 receives the request message from the first electronic device 10, detects whether screen parameters (e.g., capacitance parameters) have changed, and if a change is detected, it determines that a device is near its display screen. Then, the second electronic device 20 can reply with a response message to the first electronic device 10. After receiving the response message, the first electronic device 10 can initiate a connection request to the second electronic device 20.

[0308] Continuing with the example of a mobile phone as the first electronic device 10 and a PC as the second electronic device 20, the user opens the phone's camera, captures an image, and determines whether a screen is present in the captured image. If a screen is present in the captured image, a request message can be sent. Correspondingly, the PC receives the request message from the phone, detects changes in the screen's capacitance, and if it determines that a device is near its screen, it can reply with a response message to the phone. After receiving the response message, the phone can initiate a connection request to the PC.

[0309] Scenario 2: The second electronic device 20 initiates a connection establishment request.

[0310] Option A: In some embodiments, the user moves the first electronic device 10 closer to the display screen of the second electronic device 20. The first electronic device 10 can determine whether it is itself that is approaching the display screen of the second electronic device 20. If the first electronic device 10 determines that it is itself that is approaching the display screen of the second electronic device 20, it sends a request message. Correspondingly, the second electronic device 20 can receive the request message sent by the first electronic device 10, detect whether the screen parameters (e.g., capacitance parameters) have changed, and if it is determined that the screen parameters have changed, it can determine that a device is approaching its own display screen. Then, the second electronic device 20 can initiate a connection establishment request to the first electronic device 10. It should be understood that after the second electronic device 20 initiates a connection establishment request to the first electronic device 10, the first electronic device 10 can reply with a response message agreeing to establish a connection, thus enabling the second electronic device 20 to establish a connection with the first electronic device 10.

[0311] Taking a mobile phone as the first electronic device 10 and a PC as the second electronic device 20 as an example, when a user moves the mobile phone closer to the PC screen, the mobile phone detects its own status and parameters such as the distance from the PC to determine whether it is close to the PC screen. When the mobile phone determines that it is close to the PC screen, it can send a request message. Correspondingly, the PC can receive the request message sent by the mobile phone, detect the change in the screen's capacitance, and if it determines that a device is close to its screen, it can directly initiate a connection request to the mobile phone.

[0312] It should be understood that the execution steps for the second electronic device 20 to determine that a device is approaching its display screen and the first electronic device 10 to determine that it is approaching the display screen of another device are not limited in this embodiment. For example, if a user moves the first electronic device 10 so that it is close to the display screen of the second electronic device 20, the display screen of the second electronic device 20 can detect a change in screen parameters (e.g., capacitance parameters) and determine that a device is approaching its display screen. Then, the first electronic device 10 determines whether it is close to the display screen of the second electronic device 20. If it determines that it is close to the display screen of the second electronic device 20, it sends a request message. The second electronic device 20 can then receive the request message sent by the first electronic device 10 and initiate a connection request to the first electronic device 10.

[0313] Option B: In some embodiments, when the first electronic device 10 approaches the screen of the second electronic device 20, the first electronic device 10 can activate its camera to capture an image. If the image captured by the camera contains a screen, a request message can be sent. Correspondingly, the second electronic device 20 can receive the request message from the first electronic device 10, detect whether screen parameters (e.g., capacitance parameters) have changed, and if it is determined that the screen parameters have changed, it can determine that a device is approaching its display screen. Then, the second electronic device 20 can initiate a connection request to the first electronic device 10.

[0314] Continuing with the example of a mobile phone as the first electronic device 10 and a PC as the second electronic device 20, the user opens the mobile phone's camera, captures an image, and determines whether the captured image contains a screen. If the image captured by the camera contains a screen, a request message can be sent. Correspondingly, the PC can receive the request message sent by the mobile phone, detect changes in the screen's capacitance, and if it determines that a device is close to its own screen, it can directly initiate a connection request to the mobile phone.

[0315] Similarly, for Scheme B, when the first electronic device 10 approaches the screen of the second electronic device 20, the display of the second electronic device 20 can detect a change in screen parameters (e.g., capacitance parameters) and determine that a device is approaching its display. Then, the first electronic device 10 can determine from the image captured by its camera that it has approached the screen of another device, and at this point, it can send a request message. Accordingly, after receiving the request message, the second electronic device 20 can initiate a connection request to the first electronic device 10.

[0316] It should be understood that the difference between Scenario 1 and Scenario 2 lies in the device that initiates the request message. Within each scenario, the difference lies in the party initiating the connection establishment request.

[0317] Through the above embodiments, the first electronic device 10 and the second electronic device 20 can complete device selection and connection by bringing them close to the screen, avoiding the tedious operation of manually selecting devices when establishing a connection, realizing seamless interconnection and communication between devices, and improving the user experience.

[0318] The following describes the specific implementation of scenario 1 above, using the data transmission process between a mobile phone and a PC as an example. In this specific implementation, the PC can also be replaced by other second electronic devices, such as a tablet. For example, as shown in Figure 5, a flowchart of a device connection method provided in this application embodiment is shown. Referring to Figure 5, the method may include the following steps:

[0319] Step 501, PC determines that the first condition is met.

[0320] The first condition may include detecting that a device is near its screen.

[0321] Optionally, the first condition may also include the PC running a first preset application in the foreground. The first preset application may be a file management application, a gallery application, or a document application.

[0322] In some embodiments, when a device approaches the PC's display, the PC can detect a change in the display's screen parameters, such as a change in capacitance parameters, and then determine that a device is approaching its display based on the change in capacitance parameters. For example, a device can be determined to be approaching the PC screen when the change in capacitance parameters on the PC screen exceeds a set threshold.

[0323] In other embodiments, the PC can detect when a device approaches an area of ​​its screen where content can be shared. For example, as shown in FIG6, a user interface diagram provided in an embodiment of this application is illustrated. FIG6 shows different areas on the PC screen; for example, the first area can be an area where content can be shared (or transmitted), and the second area can be a blank area.

[0324] One possible implementation is to determine whether the phone is near a blank area or a shareable area of ​​the PC screen by using the coordinates of a point within the area the phone is near. Referring to the schematic diagram in Figure 3, when the phone approaches the PC screen, the capacitance of area 1 on the PC screen changes. The coordinates of the center point of area 1, such as point A, can then be taken to determine whether point A is in a shareable area or a blank area. If point A is in a shareable area, the area near the PC screen by other devices is designated as the first area (shareable area); if point A is in a blank area, the area near the PC screen by other devices is designated as the second area (blank area). It should be understood that using the center point of area 1 is merely illustrative; in this embodiment, coordinates of other points within area 1 can also be used, such as the center point of the top edge of the rectangle containing area 1, etc., without specific limitation.

[0325] Step 502: The PC sends the first request message.

[0326] In some embodiments, the PC may send a first request message via broadcast. For example, the first request message may be a Bluetooth broadcast message.

[0327] As one possible implementation, the first request message may carry a first flag bit, which indicates that there is content on the PC screen that can be shared with other electronic devices (such as mobile phones). Optionally, the first request message may also carry a second flag bit, which indicates that there is space on the PC screen that can receive content shared by other electronic devices. It should be understood that in this embodiment, the first request message may not carry a flag bit. Whether or not to carry a flag bit depends on the actual scenario. For example, when the PC has content that can be shared with the mobile phone and the PC initiates a connection establishment request to the mobile phone, the first request message may not carry a flag bit; when the PC has content that can be shared with the mobile phone and the mobile phone initiates a connection establishment request to the PC, the first request message may carry the first flag bit.

[0328] As one possible implementation, the first request message can also carry the business type of the request, such as file transfer, screen mirroring, etc.

[0329] It should be understood that the embodiment shown in Figure 5 takes the blank space of the currently displayed interface of the PC as an example where content transmitted from other devices can be received. In other embodiments, it could also be that any interface of the PC can receive content transmitted from other devices, etc. This application does not make specific limitations in this regard. That is to say, in the embodiments of this application, when the first request message carries the second flag bit, it can be understood that the device can receive content transmitted from other devices, and there are no specific limitations on which interface or area can receive it.

[0330] Optionally, the first request message may also carry account information logged in on the PC, PC power information, etc. It should be understood that when the first request message carries account information, after the mobile phone receives the first request message from the PC, it can compare the account information logged in on its own device with the account information in the first request message, and filter out request messages that do not match the account information logged in on its own device. This ensures that the account logged in on the device corresponding to the received request message is the same account logged in on the mobile phone's own device.

[0331] Step 503: The mobile phone receives the first request message and sends the first response message to the PC when the second condition is met.

[0332] The second condition may include the mobile phone determining that it is close to the PC screen.

[0333] Optionally, the second condition may also include: the account information logged in on the mobile phone is the same as the account information carried in the first request message, that is, the account logged in on the mobile phone and the PC is the same account.

[0334] Optionally, the second condition may also include: a second preset application running in the foreground of the phone. This second preset application can be a file management application, a gallery application, a document application, a navigation application, a music application, or a video application. In other words, when the phone opens the second preset application, it can be assumed that the phone has content that can be shared with the PC, and thus the phone can reply with the first response message to the PC.

[0335] In some embodiments, after the PC sends a first request message, the mobile phone can receive the first request message from the PC, then detect whether its own state is a hovering state, and detect whether the distance between itself and the device that sent the first request message is less than a set threshold. If it is determined that its own state is a hovering state, and the distance between its own position and the PC display screen is less than the set threshold, then it can be determined that the mobile phone is close to the PC screen.

[0336] It should be understood that, in this embodiment, the hovering state (also referred to as the moving hovering state) refers to the state after executing a preset action, which indicates that the phone has moved forward and then stopped. The front of the phone screen can be directly in front, or to the side, such as the left front, right front, top front, or bottom front. Specifically, the movement can be within a preset angle range, which can be 0 degrees to 180 degrees. Furthermore, the direction of movement of the phone is based on the direction of movement from the top of the phone.

[0337] Optionally, the mobile phone can acquire detection data (such as the phone's tilt angle data, acceleration data, etc.) through an inertial measurement unit (IMU), and then determine the phone's state based on the detection data, such as determining that the phone enters a stopped state after moving.

[0338] As one possible implementation, the first response message may carry a third flag, which indicates that the mobile phone has content that can be shared with the PC. Optionally, the first response message may also carry a fourth flag, which indicates that the mobile phone has a location available to receive content transmitted from other devices. It should be understood that, in this embodiment, the first response message may also not carry a flag. Whether or not to carry a flag depends on the actual scenario. For example, when the PC has content that can be shared with the mobile phone and the PC initiates a connection request to the mobile phone, the first response message may carry a third flag; when the PC has content that can be shared with the mobile phone and the mobile phone initiates a connection request to the PC, the first response message may not carry a third flag.

[0339] For example, as shown in Figure 7, which is a schematic diagram of a user interface provided in an embodiment of this application, referring to the schematic diagram shown in Figure 7(a), assuming the current interface of the mobile phone is the gallery interface 1, the first response message may carry a third flag bit; assuming the current interface of the mobile phone is the gallery interface 2, such as the interface shown in Figure 7(b), the first response message may carry a fourth flag bit. It should be understood that in the interface shown in Figure 7(a), the user has already selected some pictures, indicating that the user may want to share the selected pictures, and there is an intention to share; while in the interface shown in Figure 7(b), the user's intention to share pictures is weaker. Therefore, when the interface is the interface shown in Figure 7(b), the first response message may not carry a third flag bit.

[0340] It should be understood that, similar to the PC side, the mobile phone side has the right to receive content transmitted from other devices. In this application embodiment, there is no limitation on which interface or area the mobile phone can receive content transmitted from other devices.

[0341] As one possible implementation, in the embodiments of this application, the second condition may not include opening the second preset application. If the preset application is opened, a flag bit can be carried in the response message to indicate that there is content that can be shared with the peer device. This application does not limit this.

[0342] Step 504: When the first set condition is met, the PC sends a connection establishment request message to the mobile phone.

[0343] The first setting condition may include at least one of the following:

[0344] 1. Content on the PC can be transferred to the mobile phone.

[0345] 2. The mobile phone has content that can be transmitted to the PC (i.e., the third flag is carried in the first response message).

[0346] In other words, a PC can trigger a connection request message to be sent to the mobile phone when it determines that at least one of the above two conditions is met. If neither the mobile phone nor the PC has content to transmit to the other, then there is no need to send a connection request message.

[0347] This can also be understood as follows: when a PC determines that a mobile phone has content that can be shared with it, it can initiate a connection request to the mobile phone; or, when a PC determines that it has content that can be shared with the mobile phone, it can initiate a connection request to the mobile phone; or, when a PC determines that it has content that can be shared with the mobile phone, and the mobile phone has content that can be shared with the PC, it can initiate a connection request to the mobile phone.

[0348] Step 505: The mobile phone replies to the PC with a message indicating agreement to establish the blockchain.

[0349] Step 506: The connection between the PC and the mobile phone has been successfully established.

[0350] It should be understood that the specific implementation process of how the PC determines that a device is approaching its display screen and how the mobile phone determines that it is approaching the PC display screen in the embodiment shown in Figure 5 can be found in the detailed description of the embodiments described above, and will not be repeated here.

[0351] It should be understood that step 503 in the embodiment shown in Figure 5 takes the example of the mobile phone determining that it is close to the PC display screen. According to the implementation of scheme B described above, step 503 can also be: the mobile phone receives the first request message, opens the camera to capture an image, and determines that the image captured by the camera contains a screen. That is to say, the triggering condition for step 504 can also be: the mobile phone receives the first request message and determines that the image captured by the camera contains a screen.

[0352] Furthermore, Figure 5 only illustrates the example of the PC sending the first request message and initiating a connection establishment request. In practical applications, the PC can also send the first request message and the mobile phone can initiate the connection establishment request. That is to say, after step 503 is executed, the mobile phone does not need to reply to the PC with a response message and can directly send a connection establishment request message to the PC. This application does not make specific limitations on this.

[0353] In other embodiments, if the PC sends the first request message and the mobile phone initiates a connection establishment request, the first response message can be a connection establishment request message. Then, the PC can establish a communication link with the mobile phone based on the connection establishment request message. Specifically, the PC can establish a communication link with the mobile phone based on the connection establishment request message when a second set condition is met.

[0354] The second setting condition includes at least one of the following: the first request message carries a second flag bit, which is used to indicate that the PC has content that can be shared with the mobile phone; or the mobile phone has content that can be shared with the PC.

[0355] As one possible implementation, when the PC senses a change in capacitance and determines that a device is approaching its display, it can send a request message. Upon receiving the request message, the mobile phone confirms that it is indeed near the PC's screen and can then reply with a response message. At this point, the mobile phone can display a prompt (e.g., a playing animation or text prompt) prompting the user to move the phone even closer to the PC's display. When the user moves the phone again, the PC can detect a stronger capacitance signal and can send another request message. The mobile phone, upon receiving this request message, will again reply with a response message to confirm. Finally, after receiving the response message from the mobile phone, the PC sends a connection establishment request message to the mobile phone.

[0356] Continuing with the example of data transmission between a mobile phone and a PC, the specific implementation of scenario 2 above will be described. In this specific implementation, the PC can also be replaced by other second electronic devices, such as a tablet. For example, as shown in Figure 8, a device connection flowchart provided by an embodiment of this application is shown. Referring to Figure 8, the method may include the following steps:

[0357] Step 801: When the third condition is met, the mobile phone sends a second request message.

[0358] The third condition may include the mobile phone determining that it is close to another electronic device. Specifically, the mobile phone being close to another electronic device may include the mobile phone touching the screen of the other electronic device along a first direction, such as the mobile phone touching the screen of a PC along the first direction. The angle between the first direction and the first target direction is less than 90 degrees, and / or the angle between the first direction and the second target direction is less than 90 degrees. The first target direction is the direction from the bottom to the top of the mobile phone, and the second target direction is the direction perpendicular to the mobile phone screen and away from the mobile phone screen.

[0359] In some embodiments, the second request message may include flags, such as a first flag (i.e., the phone has content to share with the PC). Optionally, the second request message may also include the account information logged in by the phone.

[0360] As one possible implementation, the second request message can be a Bluetooth broadcast message. The second electronic device 20 (e.g., a PC) is also used to increase the Bluetooth signal scanning duty cycle of the second electronic device 20 (e.g., the PC) when a device is detected approaching its screen. Furthermore, the original Bluetooth signal scanning duty cycle can be restored after a preset duration.

[0361] In some embodiments, the mobile phone can determine its proximity to other devices by determining its hovering state, its distance from the PC, etc., and then trigger the sending of a second request message. It should be understood that the method of triggering the mobile phone to send the second request message in step 801 can also be other methods, such as the user clicking the screen projection operation, shaking the phone, etc., and this application does not limit this.

[0362] In other embodiments, the user can open the phone's camera and capture images while the user moves the phone. When the phone determines that the captured image contains a screen, it can send a second request message. As one possible implementation, the user can perform a user action, such as shaking the phone or triggering screen mirroring, before moving the phone close to the PC screen. It should be understood that the specific implementation of how the phone determines its proximity to the PC screen can be found in the detailed descriptions of the embodiments described above, and will not be repeated here.

[0363] As one possible implementation, the mobile phone can start listening for Wi-Fi action frames after determining that the third condition is met. Furthermore, starting the listening for Wi-Fi action frames can be performed before sending the second request message, after sending the second request message, or simultaneously with sending the second request message; the order of these actions is not limited in this embodiment.

[0364] Step 802: The PC receives the second request message and sends a second response message to the mobile phone when the fourth condition is met.

[0365] The fourth condition may include detecting that a device is near the PC screen.

[0366] In some embodiments, the fourth condition may further include: the PC is in an unlocked state. That is, the PC can send a second response message to the mobile phone after determining that a device is near its display and that the PC is in an unlocked state. The second response message may include the account information logged into the PC.

[0367] In some embodiments, the fourth condition may further include: detecting that the distance between the PC and the device that sent the second request message is less than a set threshold.

[0368] In some embodiments, after receiving the second request message, the PC can perform distance measurement, that is, the PC measures the distance between itself and the mobile phone. For example, after receiving the second request message sent by the mobile phone, the PC can determine the distance between the PC and the mobile phone based on the difference between the RSSI of the received second request message and the transmission power of the mobile phone when sending the second request message. Then, the distance between the PC and the mobile phone is compared with a set threshold to determine whether it is less than the set threshold. The transmission power when sending the second request message can be carried in the second request message.

[0369] Alternatively, after receiving the second request message, the PC can initiate an ultrasonic ranging request message to the mobile phone. Upon receiving the ultrasonic ranging request message, the mobile phone can emit an ultrasonic ranging signal, and then the PC performs distance measurement based on the ultrasonic ranging signal. Alternatively, after receiving the second request message, the PC can initiate a satellite ranging request message to the mobile phone. Upon receiving the satellite ranging request message, the mobile phone can emit a satellite ranging signal, and then the PC performs distance measurement based on the satellite ranging signal. Of course, other methods can also be used to measure the distance between the PC and the mobile phone; this application does not specifically limit this method.

[0370] As one possible implementation, the second response message could be a Wi-Fi action frame.

[0371] As one possible implementation, the PC can start listening for Wi-Fi action frames after receiving the second request message. For example, it can start listening after receiving the second request message but before replying to the mobile phone with the second response message (Wi-Fi action frame), or it can start listening at the same time as sending the second response message, etc. This application does not limit this.

[0372] It should be understood that the solution for how a PC determines that a device is near its screen can be found in the detailed description in the embodiments described above, and will not be repeated here.

[0373] Step 803: When the third set condition is met, the mobile phone sends a connection establishment request message to the PC.

[0374] The third condition may include at least one of the following:

[0375] 1. The PC has content that can be transferred to the mobile phone (i.e., the second response message from the PC contains a flag indicating that the content can be shared with the mobile phone).

[0376] 2. Data on the mobile phone can be transferred to the PC.

[0377] In other words, a mobile phone can send a connection request message to the PC when it determines that at least one of the above conditions is met. If neither the mobile phone nor the PC has content to transmit to the other, then there is no need to send a connection request message.

[0378] In this application embodiment, the content that can be shared may include the following situations:

[0379] The first type: The electronic device's display screen shows selected content, such as a gallery application window displaying a selected image in its image list, or a file management application window displaying a selected file in its file list. It should be understood that the selected content can be chosen by the user through a long press or by the user using a mouse to select the screen; this application does not limit this to either.

[0380] The second type: The electronic device's screen displays open content, such as images or files. Examples include multiple images displayed on the screen by a gallery app, or a document opened by a document editing app.

[0381] In some embodiments, before step 803 is executed, the process may further include: the mobile phone replying to the PC with a third response message. That is, after receiving the second response message from the PC, the mobile phone can reply to the PC with a third response message, which may include the account information logged in on the mobile phone. As one possible implementation, the third response message may be a Wi-Fi action frame.

[0382] After the PC receives the third response message from the mobile phone, it can determine whether the account information in the third response message is the same as the account information logged in on its own device. If the account logged in on the mobile phone is the same as the account logged in on the PC, then the subsequent steps are executed. For example, if the PC has content to share with the mobile phone, then step 804 can be executed; if the mobile phone has content to share with the PC, then step 803 can be executed. In one possible implementation, if the mobile phone has content to share with the PC, the third response message can be the same message as the connection request message in step 803. Of course, it can also be sent as two separate messages; this application does not limit this.

[0383] As one possible implementation, after receiving the second response message, the mobile phone can determine whether its own logged-in account information is the same as the account information logged in on the PC based on the account information in the second response message. If the accounts are the same, the following steps can be performed.

[0384] Step 804: The PC sends a response message to the mobile phone agreeing to establish the blockchain.

[0385] Step 805: PC and mobile phone connection established successfully.

[0386] It should be understood that the difference between the embodiment shown in Figure 8 and the embodiment shown in Figure 5 lies in the different devices that send the request message and initiate the connection request. Secondly, the triggering conditions for message interaction differ. For the similarities between the two embodiments, such as the PC determining that a device is near its display screen, please refer to the detailed descriptions in the preceding embodiments; these will not be repeated here.

[0387] It should be understood that in practical applications, the embodiment shown in Figure 8 can also involve the mobile phone sending a second request message and the PC initiating a connection establishment request. That is, after step 804 is executed, the PC does not need to reply to the mobile phone with a response message, and can directly send a connection establishment request message to the mobile phone. This application does not specifically limit this.

[0388] When the mobile phone sends the second request message and the PC initiates a connection establishment request, the second response message can be a connection establishment request message. Then, the mobile phone can establish a communication link with the PC based on the connection establishment request message initiated by the PC. Specifically, the mobile phone can establish a communication link with the PC based on the connection establishment request message when the fourth predefined condition is met.

[0389] The fourth setting condition includes at least one of the following: the second request message carries a first flag bit, which is used to indicate that the mobile phone has content that can be shared with the PC; or the PC has content that can be shared with the mobile phone.

[0390] Furthermore, some display animations that may be involved in the embodiments of this application are described below:

[0391] For the second electronic device 20, such as a PC, the following situations may be included:

[0392] 1. When the second request message sent by the mobile phone includes a first flag (i.e., the mobile phone has content to share with the PC), after receiving the second request message, the PC can preload part or all of the receiving animation 1. The receiving animation 1 is used to indicate that the PC is about to receive the shared content. When the PC receives the third response message and confirms that the accounts logged in by the mobile phone and the PC are the same, it can play the receiving animation 1.

[0393] It should be understood that the animation effect can be a single receiving animation effect or multiple animation effects. For example, when the PC has content to share with the mobile phone, the PC can play receiving animation effect 1, or it can play sending animation effect at the same time. Furthermore, the sending animation effect and the receiving animation effect can be played simultaneously, or they can be played at different times, such as playing the receiving animation effect first and then playing the sending animation effect, etc. This application does not limit this.

[0394] 2. When the second request message sent by the mobile phone includes a third flag (i.e., the mobile phone has no content to share with the PC), after receiving the second request message, if the PC determines that it has no content to share with the mobile phone, it preloads part or all of the animation effect for the content not to be shared. When the PC receives the third response message and determines that the accounts logged in by the mobile phone and the PC are the same, it can play the animation effect for the content not to be shared.

[0395] 3. When the second request message sent by the mobile phone includes a third flag (i.e., the mobile phone has no content to share with the PC), after the PC receives the second request message, if the PC has content to share with the mobile phone, it preloads part or all of the sending animation 1. This sending animation 1 is used to indicate that the PC is about to send the shared content. When the PC receives the third response message and determines that the accounts logged in by the mobile phone and the PC are the same, it can play the sending animation 1.

[0396] 4. When the second request message sent by the mobile phone includes the first flag (i.e., the mobile phone has content to share with the PC), after the PC receives the second request message, if the PC has content to share with the mobile phone, it can preload part or all of the sending animation 1. When the PC receives the third response message and determines that the accounts logged in by the mobile phone and the PC are the same, it can play the sending animation 1.

[0397] It should be understood that in the embodiments of this application, the animation effect can be a single animation effect or a multi-functional animation effect. For example, when a mobile phone has content to share with a PC, and the PC has content to share with a mobile phone, the animation effect can be a two-in-one animation effect that can indicate both sending and receiving.

[0398] For the first electronic device 10, such as a mobile phone, the following situations may be included:

[0399] 1. When the mobile phone receives a response message from the PC, and the response message includes a second flag (i.e., the PC has content to share with the mobile phone), and it is confirmed that the accounts logged in on the mobile phone and the PC are the same, the receiving animation 2 is displayed.

[0400] 2. When the mobile phone receives a response message from the PC, the response message includes a second flag (i.e., the PC has content to share with the mobile phone), and it is confirmed that the accounts logged in on the mobile phone and PC are the same. If the mobile phone has content to share with the PC, sending animation 2 can be displayed. It should be understood that, in this case, sending animation 2 and receiving animation 2 can be displayed simultaneously, or a combined animation that can indicate both sending and receiving can be displayed. This application does not limit this.

[0401] 3. The mobile phone receives a response message from the PC. The response message includes a fourth flag (meaning the PC has no content to share with the mobile phone) and confirms that the accounts logged in on the mobile phone and PC are the same. If the mobile phone has no content to share with the PC, an animation of "No content to share" can be displayed.

[0402] It should be understood that the description of the display animation effects introduced above is applicable to all the embodiments described above, and the specific animation effects that may be involved in each embodiment can be referred to the description here.

[0403] The above embodiments enable rapid selection and connection between multiple devices without requiring users to manually select devices, thus improving the efficiency of establishing connections between devices.

[0404] The above describes the connection process between multiple devices. Once multiple devices are connected, content sharing between them becomes possible. The following examples illustrate the content sharing process after multiple devices have established a connection.

[0405] It should be understood that in the embodiments of this application, electronic devices can also be referred to as "devices," and communication links can also be referred to as "communication connections," "connections," etc. Establishing a communication link can also be described as establishing a communication connection, establishing a link, etc. Furthermore, it should be noted that in the embodiments of Figures 9 to 24 described below, "first device" is equivalent to "second electronic device" in the embodiments described above, and "second device" is equivalent to "first electronic device" in the embodiments described above. The communication connection process between the first device and the second device in the embodiments of Figures 9 to 24 can be found in the descriptions of the embodiments described above.

[0406] In practical applications, users may want to send information from a first device to a second device. Currently, there is a method for cross-device information transmission that relies on a relay application. Generally, this relay application is an instant messaging application. For example, an instant messaging application is installed on the first device (e.g., The second device also has an instant messaging application installed (e.g., In this method, the first device sends information to the instant messaging application on the second device via a locally installed instant messaging application, thus achieving cross-device information transmission. However, this method is cumbersome, requiring users to open a relay application, select contacts, and perform a series of other operations to complete the transmission, making it inconvenient and inefficient.

[0407] In view of this, this application provides a communication method applicable to communication systems, such as the communication system in the application scenario shown in Figure 1 above. In this method, when a first device detects that a second device is approaching the first display screen of the first device, it sends first information to the second device. The first information includes first sharing content of the first device, which is determined based on a first window. The first window can be the focus window on the first display screen, or a window on the first display screen that the second device is approaching. The technical solution provided by this application improves convenience. For example, a user only needs to bring the second device close to the first display screen of the first device to trigger the first device to transmit information to the second device, eliminating the need for complex operation procedures and improving user experience. Furthermore, when the second device approaches the first display screen, it triggers the first device to share information related to the focus window; or, when the second device approaches window 1 on the first display screen, it triggers the first device to share sharing content determined based on window 1; when the second device approaches window 2 on the first display screen, it triggers the first device to share sharing content determined based on window 2, achieving the effect of "sharing wherever it is close".

[0408] Next, taking the communication system shown in Figure 1 as an example, the technical solution provided in the embodiments of this application will be described in detail.

[0409] For example, please refer to Figure 9, which is a schematic flowchart of a communication method provided in an embodiment of this application. This method can be applied to the communication system shown in Figure 1. As shown in Figure 9, the flow of this method may include:

[0410] Step 900: The first device detects that the second device is close to the first display screen of the first device.

[0411] In some embodiments, when the first device detects that the second device is approaching the first display screen of the first device, it may include: the first device detecting that the distance between the second device and the first display screen is less than a first preset distance. For example, the first preset distance may be 10cm, 15cm, etc., and the specific value is not limited. As one possible implementation, the first device detects the distance between the second device and the first display screen through a ranging unit, which may be a laser ranging unit, an ultrasonic ranging unit, a Bluetooth ranging unit, etc., and is not limited.

[0412] In other embodiments, the detection of a second device approaching the first display screen of the first device by the first device may include: the first device determining that the second device is approaching the first display screen by observing changes in the detection parameters of the first display screen. Taking a capacitive touchscreen as an example, when the second device approaches the first display screen, the capacitance value on the first display screen changes. This change in capacitance indicates the presence of an electronic device (e.g., the second device) near the first display screen. While this is an example of a capacitive touchscreen, it is understood that the first display screen could also be an infrared touchscreen, a sound wave touchscreen, or other types of touchscreens. For these other types of touchscreens, changes in the display screen's detection parameters (e.g., infrared or sound wave signals) can also be used to determine if an electronic device is approaching the display screen.

[0413] Optionally, the proximity in this embodiment can include: non-contact proximity, and / or contact proximity (i.e., touching), that is, the distance between the second device and the first display screen is 0. Optionally, the second device approaching the first display screen can be the top, bottom, or side of the second device approaching the first display screen. For example, as shown in Figure 10, the top of the second device is approaching the first display screen.

[0414] Continuing with the example of a first device determining the proximity of a second device to the first display screen based on changes in detection parameters, it's important to note that while the first device can determine the proximity of another device by observing changes in the detection parameters, it cannot determine the identity of that other device. As one possible implementation, the other device can broadcast a signal (e.g., via Bluetooth) carrying its identity information. Optionally, this identity information includes, but is not limited to, at least one of: device ID, device type, device name, and logged-in system account. Upon receiving this signal, the first device can determine the identity of the other device based on it.

[0415] Step 901: The first device determines the first position coordinates on the first display screen. The first position coordinates are the proximity position of the second device on the first display screen.

[0416] Continuing with Figure 10 as an example, the first display screen of the first device is relatively large. When the second device approaches the first display screen, the first device can determine the proximity position of the second device on the first display screen. Optionally, the proximity position of the second device on the first display screen can be a position coordinate on the first display screen (referred to as: the first position coordinate). As one possible implementation, the first device can determine a first area on the first display screen, which is the proximity area of ​​the second device on the first display screen, and then determine the first position coordinate within the first area.

[0417] As an example, taking a capacitive touchscreen as an example, the first display screen includes an array of capacitor modules. When a second device approaches a certain area on the first display screen, the capacitance value of the capacitor modules distributed in that area changes. Therefore, the first device can determine the area on the first display screen where the capacitance change occurs as the first area. It is understandable that when a user's finger, stylus, or other object touches a certain area on the first display screen, the capacitance value of the capacitor modules in that area also changes. Therefore, after determining the first area on the first display screen, the first device can also determine whether the capacitance change in the first area is caused by the approach of the second device or by the approach of the user's finger or stylus. As one possible implementation, the first device can determine whether the approach is caused by the second device or the user's finger or stylus based on the shape of the first area. For example, if the shape of the first area is rectangular, it is determined that the second device is approaching; if the shape of the first area is circular, it is determined that a finger or stylus is approaching.

[0418] After determining a first region on the first display screen, the first device can determine first position coordinates within the first region. Optionally, the first position coordinates can be the coordinates of any position within the first region, such as the coordinates of the center point, or the coordinates of the position within the first region where the capacitance change is the greatest.

[0419] Step 902: The first device determines that the first position coordinates are located within the first window.

[0420] In this embodiment, after determining the first position coordinates, the first device can determine which window on the first display screen contains the first position coordinates; in other words, which window on the first display screen contains the first position coordinates. It is understood that when N windows are displayed on the first display screen, the first position coordinates may be located in one of the N windows, or simultaneously in multiple windows. If the first position coordinates are located in only one window, that window is the first window. If the first position coordinates are located in multiple windows simultaneously, then the first window is determined among the multiple windows. One possible determination method is that the first device determines the topmost window among the multiple windows as the first window.

[0421] Next, we will illustrate the process of determining the first window with an example. For ease of understanding, the following examples will use N=1, 2, and 3 as examples.

[0422] Example 1, N=1, meaning that one window is displayed on the first display screen of the first device. This window is a desktop application window, referred to as the "desktop window". For example, please refer to Figure 11A. The first display screen of the first device contains only one window, namely the desktop window. The first device determines that the first position coordinates of the second device on the first display screen are (X, Y), and determines that (X, Y) is located within the desktop window, then the desktop window is determined to be the first window.

[0423] Example 2, N=2, meaning two windows are displayed on the first display screen of the first device. For example, see Figure 11B, where the first display screen of the first device displays two windows: a desktop window and window A of application A (e.g., an instant messaging application). The first device determines the first position coordinates (X, Y) of the second device on the first display screen, and determines that (X, Y) is located both within the desktop window and within window A. In this case, the first device can determine the first window from the two windows. For example, the first device determines the window on top of the two windows as the first window; for example, if window A is on top, then window A is determined to be the first window.

[0424] Example 3, N=3, meaning three windows are displayed on the first display screen of the first device. For example, see Figure 11C. The first display screen of the first device displays three windows: a desktop window, window A of application A (e.g., an instant messaging application), and window B of application B (e.g., a browser application), with window B located above window A. Application A and application B can be the same application or different applications. The first device determines the first position coordinates (X, Y) of the second device on the first display screen, and determines that (X, Y) is located within the desktop window and window A, but not within window B. In this case, the first device can determine the first window from among the desktop window and window A; for example, since window A is on top, window A is determined to be the first window.

[0425] In summary, the first device determines that the first position coordinates are located within the first window. The first window is any one of the N windows, which may be the focus window (for example, window A in Figure 11B is the focus window) or the non-focus window (for example, window A in Figure 11C is the non-focus window).

[0426] Step 903: The first device determines the content to be shared based on the first window.

[0427] Optionally, in this embodiment of the application, step 903 may include at least one of the following three methods.

[0428] The first method involves sharing content from the first window; this method is called "window-level content sharing".

[0429] In other words, the first approach involves the first device determining the content to be shared within the first window. One possible implementation is that the first device retrieves the content to be shared from the first application corresponding to the first window. It should be noted that this first approach can be executed by the operating system of the first device. If executed by the operating system, the operating system retrieves the content to be shared from the first application corresponding to the first window. In other words, in this approach, the content to be shared is determined by the first application and is located within the first window. Optionally, the first application may be a system application or a third-party application. As an example, the operating system can send a request to the first application to retrieve the content to be shared within the first window. After receiving the request, the first application provides the content to be shared within the first window to the operating system. In this approach, the operating system needs to communicate with the first application; for example, the operating system can communicate with the first application through an interface or function call.

[0430] In one specific implementation, a first device (e.g., an operating system) can call a callback function / interface of a first window to retrieve content to be shared within the first window. The callback function of the first window triggers the first application to provide the content to be shared within the first window to the operating system. In this approach, the operating system of the first device needs to pre-store the callback function of the first window.

[0431] As one possible implementation, taking the application to which the first window belongs as an example, when the first application opens the first window, it can register a sharing event (or send event) with the operating system. Optionally, the registered sharing event can be a sharing event for the first window. This registered sharing event for the first window can be understood as an event indicating "content sharing is needed in the first window" or an event indicating "content sharing is supported in the first window." In other words, by registering the event, the operating system is instructed that when content sharing is needed in the first window, the shared content in the first window can be obtained from the first application. This allows the operating system to obtain the content to be shared in the first window from the first application after detecting the "content sharing is needed in the first window" event. The "content sharing is needed in the first window" event could be an event of a second device approaching the first window, or other events, without limitation. Optionally, during the registration process, the first application can pass the callback function of the first window, such as callback function 1, to the operating system, so that the operating system can obtain the content to be shared in the first window through callback function 1. In short, the operating system can obtain the content to be shared in the first window from the first application through the callback function of the first window. Optionally, the operating system may also notify the first application through the callback function of the first window that an event "requires the first window to share content" has been detected. This event could be the second device approaching the first window, or it could be any other event, without limitation.

[0432] Optionally, when the first application opens the second window, it can also register a sharing event with the operating system. This registered sharing event can be a sharing event specific to the second window. The registered sharing event for the second window can be understood as instructing the operating system to retrieve the content to be shared from the second window when it needs to share content from the second window. This allows the operating system to retrieve the content to be shared from the second window after detecting the "requires sharing content from the second window" event. The "requires sharing content from the second window" event could be the second device approaching the second window, or other events, without limitation. Optionally, during the registration process, the first application can pass the callback function of the second window, such as callback function 2, to the operating system, allowing the operating system to retrieve the content to be shared from the second window through callback function 2. Therefore, the first device can store a first correspondence, which records the callback functions corresponding to different windows, as shown in Table 1 below. When the first device detects which window the second device is approaching, it queries the callback function corresponding to that window through the first correspondence and retrieves the content to be shared from that window based on that callback function.

[0433] Table 1: First Correspondence

[0434] As mentioned earlier, when the first application opens the first window, it can register a sharing event for the first window with the operating system, and during the registration process, pass the first window's callback function to the operating system. In one possible implementation, the first application can call a registration function to register the sharing event for the first window. As an example, the registration function can be the `on` function or other functions. Taking the `on` function as an example, the `on` function can be represented as `on(event, callback)`, where `event` represents the event to be registered, such as the event that "the first window needs to share content," such as the `knock share` event; `callback` is the callback function of the first window. In other words, when the first application calls the `on` function, it passes two parameters to the operating system: one is `event`, and the other is `callback`. The operating system determines the event registered by the first application through `event`, and determines the callback function of the first window through `callback`.

[0435] As mentioned above, in this method, the content to be shared is determined by the first application and is located in the first window. Optionally, the first application can determine that the content within the first window that meets the first condition is the content to be shared. Optionally, the content that meets the first condition includes, but is not limited to: content that the user is interested in, content with a large display area, content that is displayed in the middle, user-specified content, content pre-configured by the first application, content that is frequently used / opened, etc.

[0436] In this embodiment of the application, the content to be shared determined by the first device according to the first window may include at least one of the following: first content in the first window, first information for indicating the first content, and second information indicated by the first content.

[0437] Taking the first content in the first window as an example, one possible scenario is that the first window is a gallery application window containing a list of images, with M thumbnails (M being a positive integer). If the user selects K thumbnails (K being a positive integer less than or equal to M), then the first content is the K complete images corresponding to the selected K thumbnails. Another possible scenario is that the first window is a gallery application window, and an image from the gallery application is open within it; then the first content is the image opened within that window. Yet another possible scenario is that the first window is a file manager window, containing a list of P files (P being a positive integer). If the user selects Q files (Q being a positive integer less than or equal to P), then the first content is the Q files selected by the user. Finally, another possible scenario is that the first window is a document editing application window, and a document (e.g., Word or PowerPoint) is open within it, for example, displaying a page of the document; then the first content is the document itself.

[0438] Taking the content to be shared as first information indicating the first content as an example. For example, the first information could be preview information of the first content. Optionally, the preview information of the first content could be a preview image of the first content or something else. As an example, if the first content is a document, then the preview information of the first content is the preview information of the document, such as the document's icon, name, format, content summary, content page screenshots, etc. As another example, if the first content is an image, then the preview information of the first content is a preview image / thumbnail of the image. As yet another example, if the first content is text information, then the preview information of the first content is the preview information of the text information, for example, only including the beginning and end of the text information, with the middle part replaced by ellipses. Assume the first application is a browser application, and the first window is the window of the browser application, which includes news content. Assume the first application determines that the content to be shared in the first window, i.e., the first content, is the news content. Considering that the news content has a large data volume and slow transmission, the first application can send the first information indicating the news content (e.g., the URL information of the news content) to the operating system, so that the operating system can send the first information to the second device. After receiving the first information, the second device can open the first content based on the first information, that is, open the news content based on the URL information.

[0439] Let's take the example where the content to be shared is the second information indicated by the first content. Assume the first application is a browser application, and the first window is the browser application's window, containing the web version download address of application A. Assume the first application determines that the content to be shared in the first window, i.e., the first content, is the web version download address of application A. Considering the second device is a terminal device, and the web version download address of application A is not compatible with the second device, the first application can send the second information indicated by the first content (e.g., the terminal version download address of application A, such as the download link for application A in the app store) to the operating system, so that the operating system sends the second information to the second device. After receiving the second information, the second device can download application A from the app store based on the second information (e.g., the download link for application A in the app store).

[0440] As mentioned in the above embodiments, when the first application opens the first window, it registers a sharing event for the first window with the operating system. Optionally, there can be multiple registration times. One possible scenario is that the first application registers a sharing event for the first window with the operating system in response to opening the first window. Another possible scenario is that after the first application opens the first window, it registers a sharing event for the first window in response to the user's operation of specifying content within the first window.

[0441] Continuing with the gallery application example, after the gallery application opens window 1, if it receives an action from the user within window 1 (e.g., selecting K thumbnails), it registers a share event for window 1 in response to this selection action. Thus, when the first device detects that the second device is near window 1, it shares the user-specified content within window 1 with the second device.

[0442] Taking a desktop application as an example, by default, a desktop application does not register sharing events for the desktop window. However, if it receives an action from the user specifying content within the desktop window, it registers a sharing event for the desktop window in response to that action. For example, see Figure 12(a): the first device displays a desktop window, and the user selects an area within the desktop window (the area enclosed by the dotted line in the figure). The desktop application registers a sharing event for the desktop window in response to the user's selection. Optionally, before registration, the desktop application can also display a prompt message, as shown in Figure 12(b), which asks "Register for sharing?" Optionally, it can also display "Yes" and "No" buttons. If the desktop application receives an action for the "Yes" button, it registers a sharing event for the desktop window with the operating system. Thus, when the first device detects that the second device is near the desktop window, it calls the desktop window's callback function / interface to obtain the content to be shared, which is the content within the user-selected area (the area enclosed by the dotted line in the figure).

[0443] The above explains the principle of the first method (content sharing in the first window dimension). Next, several examples of the first method will be given.

[0444] Example 1, taking Figure 11A above as an example, the first device displays a desktop window on its first screen, and this desktop window is identified as the first window (the identification process has been described previously and will not be repeated). The first device can call the callback function / interface of the desktop window to obtain the content to be shared within it. For example, in Figure 11A, the first device shares document 1 within the desktop window with the second device, so the second device's screen displays a preview of document 1. Optionally, the preview information may include the document 1's icon, name, format, brief content description, and screenshots of the content pages.

[0445] Example 2, taking Figure 11B as an example, shows a desktop window and instant messaging application window A on the first display screen of the first device. The first device determines that window A is the first window (the determination process has been described above and will not be repeated). The first device can call the callback function / interface of window A to obtain the content to be shared within window A. For example, in Figure 11B, the first device shares an image from window A with the second device, so the second device's display screen shows a preview of the image, such as a thumbnail.

[0446] Example 3, taking Figure 11C above as an example, shows a desktop application, an instant messaging application window A, and a browser window B on the first display screen of the first device. Window A is a non-focused window. The first device determines that window A is the first window (the determination process has been described previously and will not be repeated). The first device can call the callback function / interface of window A to obtain the content to be shared within window A. For example, in Figure 11C, the first device shares an image from window A with the second device, so the second device's display screen shows a preview of the image, such as a thumbnail.

[0447] The second method involves sharing content from the first displayed element within the first window. This method is called "content sharing at the display element level".

[0448] The difference between this method and the first method described above is as follows: In the first method, once the first device determines that the first position coordinates are within the first window, it calls the callback function / interface of the first window to retrieve the content to be shared within the first window. In the second method, after determining that the first position coordinates are within the first window, the first device also needs to determine which display element within the first window the first position coordinates are located in. Assuming it is within the first display element, the content to be shared is determined based on the first display element.

[0449] As mentioned above, in the second method, the first device needs to determine which display element within the first window the first position coordinates are located in. In one possible implementation, the first device can determine which display element within the first window the first position coordinates are located in by querying a control tree. The control tree records all display elements within the first window, as well as the display position, size, etc., of each display element. Therefore, by querying the control tree, the display element within which the first position coordinates are located can be determined. Optionally, the display elements in this embodiment may include various components, such as icon components, search components, text input components, form (text area) components, rich text editor components, image components, hyperlinks, etc.

[0450] Suppose the first device determines that its first position coordinates are located within the first display element of the first window. Then, the first device needs to retrieve the content to be shared from the first display element.

[0451] In one possible implementation, the first device can obtain the content to be shared from the first display element within the first window from the first application. It should be noted that this method can be executed by the operating system of the first device. If executed by the operating system, the operating system obtains the content to be shared from the first display element within the first window from the first application. In other words, in this method, the content to be shared is provided by the first application and is located within the first display element of the first window. As an example, the operating system can send a request to the first application to request the content to be shared from the first display element within the first window. After receiving the request, the first application provides the content to be shared from the first display element within the first window to the operating system. Therefore, the operating system needs to communicate with the first application; for example, the operating system can communicate with the first application through an interface or function call.

[0452] In one specific implementation, a first device (e.g., an operating system) can call a callback function / interface of a first display element to retrieve the content to be shared from the first display element. The callback function of the first display element triggers a first application to provide the shareable content within the first display element to the operating system. In this approach, the first device needs to pre-store the callback function of the first display element.

[0453] As one possible implementation, when the first application opens the first window, it can register a sharing event with the operating system (or it can also be called a send event, content drag-out event, or other names). Optionally, the registered sharing event can be a sharing event for the first display element within the first window. The registered sharing event for the first display element can be understood as an event indicating that "the first display element needs to share content" or an event indicating that "the first display element supports content sharing." In other words, it instructs the operating system that, when the first display element needs to share content, it can obtain the shareable content from the first display element from the first application. This allows the operating system to obtain the shareable content from the first display element after detecting the "the first display element needs to share content" event. The "the first display element needs to share content" event could be an event of a second device approaching the first display element, or it could be another event, without limitation. Optionally, during the registration process, the first application can pass the callback function of the first display element to the operating system, so that the operating system can obtain the shareable content within the first display element through the callback function of the first display element. In short, the operating system can obtain the content to be shared from the first display element from the first application through the callback function of the first display element. Optionally, the operating system can also notify the first application through the callback function of the first display element that an event "requiring the first display element to share content" has been detected. This event could be the second device approaching the first display element, or it could be another event, which is not limited to this.

[0454] Optionally, sharing events can also be registered for other display elements within the first window besides the first display element (e.g., the second display element). The principle is the same and will not be repeated here. Therefore, the first device can store a second correspondence, which is used to record the callback functions corresponding to different display elements, as shown in Table 2 below. When the first device detects which display element the second device is close to, it queries the callback function corresponding to that display element through the second correspondence, and obtains the content to be shared in the display element based on that callback function.

[0455] Table 2: Second Correspondence

[0456] As mentioned earlier, the first application registers a sharing event for the first displayed element with the operating system, and during the registration process, passes the callback function of the first displayed element to the operating system. In one possible implementation, the first application can call a registration function to register the sharing event for the first displayed element. As an example, the registration function can be the `on` function or other functions. Taking the `on` function as an example, the `on` function can be represented as `on(event, callback)`, where `event` represents the event to be registered, such as the event that "the first displayed element needs to share content," such as the knock share event, and `callback` is the callback function of the first displayed element. That is, when the first application calls the `on` function, it passes two parameters to the operating system: one is `event`, and the other is the callback function of the first displayed element.

[0457] It should be noted that the first window contains multiple display elements, and the first application can determine which display elements should register for sharing events and which should not. For example, the first application can determine whether a display element needs to register for a sharing event based on its type. Taking components as an example, such as icon components, search components, text input components, form components, rich text editing components, image components, and hyperlink components, sharing events can be registered.

[0458] In this application, display elements that have registered sharing events can be referred to as display elements that support "drag-out capability," meaning that the content in these display elements can be "dragged out" by the operating system. For example, the operating system can "drag out" the content in a display element through its callback function. For display elements that have not registered sharing events, i.e., display elements that do not support "drag-out capability," the operating system cannot obtain the content to be shared in these display elements through their callback functions.

[0459] Therefore, in this embodiment, after the first device determines that the first position coordinates are located on the first display element, it can determine whether the first display element supports "drag-out capability" (i.e., whether a sharing event has been registered); if the first display element supports "drag-out capability", the callback function of the first display element is called to obtain the content to be shared in the first display element; if the first display element does not support "drag-out capability", the content to be shared in the first display element is obtained through other means, such as taking a screenshot of the display area of ​​the first display element and analyzing the screenshot through image semantic recognition to obtain the content to be shared in the first display element.

[0460] Therefore, regardless of whether the first display element supports "drag-out capability", the first device can obtain the content to be shared in the first display element.

[0461] As mentioned above, for "content sharing at the display element level," the content to be shared is determined by the first application and located within the first display element of the first window. Optionally, the first application can determine that all content in the first display element is content to be shared, or determine that content within the first display element that meets a second condition is content to be shared. The content that meets the second condition includes, but is not limited to: content of user interest, content with a large display area, content displayed in the middle, user-specified content, content pre-configured by the first application, content with high usage / opening frequency, etc. Taking user-specified content as an example, for instance, the first device contains a document application, and the user opens window 1 of the document application. Window 1 contains a text component containing text information, and the user can select a portion of the text information within the text component. When the user selects text information, if the first device detects that the second device is near the text component in window 1, it sends a preview of the selected text information (see Figure 13D below) to the second device. If it receives a confirmation instruction from the second device, it then sends the complete content of the selected text information to the second device.

[0462] As mentioned in the above embodiments, when the first application opens the first window, it registers a sharing event for the first display element within the first window with the operating system. Optionally, there can be multiple registration times. One possible scenario is that the first application registers a sharing event for the first display element within the first window with the operating system in response to opening the first window. Another possible scenario is that after opening the first window, the first application registers a sharing event for the first display element with the operating system in response to a user's operation of specifying content within the first display element. Continuing with the previous document application example, after the document application opens window 1, if it receives an operation from the user specifying content within the text component of window 1 (e.g., the user selecting text information within the text component), it registers a sharing event for the text component in response to this operation. Thus, when the first device detects that the second device is near the text component in window 1, it shares the user-specified content (e.g., the user-selected text information) within the text component with the second device.

[0463] As mentioned earlier, the first device can obtain the content to be shared from the first display element. For example, the first display element can be a component, such as at least one of an icon component, a search component, a text input component, a form component, a rich text editing component, an image component, and a hyperlink component. Examples will be given below for each of these.

[0464] Taking an icon component as the first display element as an example, the icon component can be an application icon component, a document icon component, etc. Taking an application icon component as the first display element, the content to be shared can be the application information of the application corresponding to the application icon component, such as the application's icon, name, description, download address, etc. Taking a document icon component as the first display element, the content to be shared can be the document corresponding to the document icon component. For example, please refer to Figure 13A. A desktop window is displayed on the first display screen of the first device, and the desktop window includes an icon component for document 1. The first device determines that the first position coordinates (X, Y) are located within the icon component of document 1, and then shares document 1 with the second device. For example, the second device displays preview information of document 1. Optionally, the preview information may include the icon, name, format, brief content description, screenshots of the content pages, etc., of document 1.

[0465] Taking an image component as the first display element as an example, the content to be shared can be an image contained within the icon component. For example, referring to Figure 13B, a desktop window and an instant messaging application window A are displayed on the first display screen of the first device. If the first device determines that its first position coordinates (X, Y) are located within the image component in window A, it will share the image within the image component with the second device. For example, the second device displays preview information of the image, such as a thumbnail.

[0466] Taking a search component as the first display element as an example, the content to be shared can be information contained within the search component. For example, referring to Figure 13C, a desktop window and a browser application window A are displayed on the first display screen of the first device. If the first device determines that its first position coordinates are within the search component in window A, it shares the information within the search component (e.g., URL information) with the second device. For example, the second device displays preview information corresponding to the URL information. Optionally, the preview information may include: URL information, a screenshot of the webpage corresponding to the URL information, browser identifiers (e.g., name, icon), etc.

[0467] Taking a text component as the first display element as an example, the content to be shared can be the text information contained in the text component. For example, referring to Figure 13D, the first display screen of the first device shows a desktop window and a document application window A, which includes a text component. The first device determines that the first position coordinates (X, Y) are located within the text component in window A, and then sends the text information within the text component to the second device. Optionally, the first device can send part or all of the text in the text component to the second device. Taking part of the text as an example, the part of the text can be text within a preset range including the first position coordinates, or text pre-selected by the user. For example, in Figure 13D, the user pre-selected text (e.g., the black part), so the first device sends preview information of the text selected by the user to the second device. Optionally, the preview information can be all or part of the text selected by the user, for example, only including the beginning and end of the text selected by the user, excluding the middle part, for example, the middle part is replaced by an ellipsis.

[0468] The third method involves sharing content from the first application corresponding to the first window. This method is called "content sharing at the application level".

[0469] The difference between this method and the first and second methods described above is as follows: In the first method, the first device determines that its first position coordinates are within the first window, then calls the callback function / interface of the first window to retrieve the content to be shared within that window. In the second method, the first device determines that its first position coordinates are within the first display element of the first window, then calls the callback function of the first display element to retrieve the content to be shared within that element. In the third method, after determining that its first position coordinates are within the first window, the first device determines which application corresponds to the first window; if it is the first application, then it retrieves the content to be shared from that application. It should be noted that the content to be shared from the first application may or may not be content within the first window.

[0470] Therefore, the third approach involves the first device determining the content to be shared by the first application to which the first window belongs. One possible implementation is that the first device obtains the content to be shared from the first application. It should be noted that this third approach can be executed by the operating system of the first device. If executed by the operating system, the operating system obtains the content to be shared from the first application. Therefore, in this approach, the content to be shared is determined by the first application; it may or may not be content within the first window. As an example, the operating system of the first device sends a request to the first application to request the content to be shared. After receiving the request, the first application returns the content to be shared to the operating system. Therefore, the operating system needs to communicate with the first application; for example, the operating system can communicate with the first application through an interface or function call.

[0471] In one specific implementation, the first device (e.g., an operating system) can call the callback function / interface of the first application to obtain the content to be shared from the first application. The callback function of the first application is used to trigger the first application to provide the content to be shared. It should be noted that the callback function of the first application is different from the callback functions of the first window and the first displayed element mentioned earlier. In this approach, the first device needs to pre-store the callback function of the first application.

[0472] As one possible implementation, the first application registers a sharing event with the operating system. Optionally, the registered sharing event can be a sharing event specific to the first application. This registered sharing event for the first application can be understood as an event indicating that "the first application needs to share content" or an event indicating that "the first application supports content sharing." In other words, it instructs the operating system that, when the first application needs to share content, it can obtain the content to be shared from the first application. This allows the operating system to obtain the content to be shared from the first application after detecting the "the first application needs to share content" event. The "the first application needs to share content" event could be an event where a second device approaches the window of the first application, or it could be another event, without limitation. Optionally, during the registration process, the first application can pass its callback function to the operating system, allowing the operating system to obtain the content to be shared from the first application through the callback function. In short, the operating system can obtain the content to be shared from the first application through its callback function. Optionally, the operating system may also notify the first application through its callback function that an event indicating "the first application needs to share content" has been detected. This event could be caused by the second device approaching the first application's window, or it could be another event, without limitation. It should be noted that, as mentioned earlier, the first application registers sharing events with the operating system for the first window and for the first displayed element within the first window. To distinguish this from these two types of sharing events, the first application's registration of sharing events with the operating system here can be referred to as: registering ordinary sharing events with the operating system, which are neither window-specific sharing events nor display element-specific sharing events.

[0473] Optionally, taking the first application's registration of a sharing event as an example, other applications (e.g., the second application) can also register sharing events; the principle is the same and will not be repeated. Therefore, the first device can store a third correspondence, which is used to record the callback functions corresponding to different applications, as shown in Table 3 below. When the first device detects which application's window the second device is close to, it queries the callback function corresponding to that application through the third correspondence, and obtains the content to be shared for that application based on the callback function.

[0474] Table 3: Third Correspondence

[0475] As mentioned earlier, the first application registers a sharing event with the operating system, and during the registration process, passes its callback function to the operating system. In one possible implementation, the first application can call a registration function to register the sharing event. As an example, the registration function can be an `on` function or other functions. Taking the `on` function as an example, it can be represented as `on(event, callback)`, where `event` represents the event to be registered, such as a share event or a knock share event, and `callback` is the callback function of the first application.

[0476] Optionally, the first application can register the sharing event with the operating system at multiple times. One possibility is that the first application registers the sharing event in response to opening any window. Another possibility is that the first application registers the sharing event in response to the user's action of specifying content to be shared. Taking the Notes application as an example, if the first device opens window 1 of the Notes application and receives an action from the user specifying content within window 1 (e.g., selecting content to be shared within window 1), then the application registers the sharing event in response to this selection action. Suppose the first device opens window 2 of the Notes application and detects that the second device is near window 2, then the callback function of the Notes application is called to retrieve the content to be shared from the Notes application (e.g., content previously specified by the user in window 1).

[0477] As mentioned above, in the third method, the content to be shared is determined by the first application, which may or may not be content from the first window. Optionally, the content to be shared by the first application includes, but is not limited to: the installation information of the first application, user-specified content in the first application, pre-configured content of the first application, frequently used / opened content in the first application, etc.

[0478] The above provides three implementation methods for step 903 (i.e., the first device determines the content to be shared based on the first window): "content sharing at the window level," "content sharing at the display element level," and "content sharing at the application level." It should be noted that the first device may only be configured with one of these three methods; for example, only the first method, "content sharing at the window level," may be configured. Alternatively, the first device may be configured with any two or more of these three methods; for example, all three methods may be configured: "content sharing at the window level," "content sharing at the display element level," and "content sharing at the application level." In this case, after the first device determines that the first position coordinates are located within the first window, it needs to determine which of the three methods to use. As one possible implementation, assuming the first device determines that the first position coordinates are located within the first display element in the first window, it then determines whether the first display element supports "drag-out capability". If yes, it uses "content sharing at the display element level". If no, it continues to determine whether the first application has registered a sharing event for the first window. If yes, it uses "content sharing at the window level". If the first application has not registered a sharing event for the first window, it determines whether the first application has registered a normal sharing event. If yes, it uses "content sharing at the application level". Otherwise, a prompt message can be output to inform the user that there is no content to share.

[0479] Step 904: The first device sends the content to be shared to the second device.

[0480] It is understood that the first device needs to establish a connection with the second device before step 904. Optionally, the connection can be a short-range wireless communication connection. Exemplary examples of short-range wireless communication connections include, but are not limited to: Bluetooth (e.g., classic Bluetooth or Bluetooth Low Energy (BLE)), SparkLink (e.g., classic SparkLink or SparkLink Low Energy (SLE)), near-field communication (NFC), wireless local area networks (WLAN) (e.g., wireless fidelity (Wi-Fi)), Zigbee, frequency modulation (FM), infrared (IR), etc. As one possible implementation, the first device has not yet established a connection with the second device before detecting the second device's proximity to the first display screen; after detecting the second device's proximity to the first display screen, the first device establishes a connection with the second device in response to the second device's proximity. As another possible implementation, if the first device has already established a connection with the second device before detecting that the second device is close to the first display screen (e.g., manually connected by the user), then the first device does not need to establish a connection again when it detects that the second device is close to the first display screen.

[0481] As mentioned above, the content to be shared may include the first content in the first window and / or the first information used to indicate the first content (e.g., preview information of the first content).

[0482] In one possible implementation, the first device sends content to be shared to the second device, including: sending first information to the second device to indicate the first content; sending the first content to the second device upon receiving a request message from the second device, the request message being used to request the first content; and not sending the first content to the second device if no request message is received from the second device.

[0483] As an example, after receiving first information indicating first content, the second device can display the first information and output a prompt message to indicate whether the user has accepted the first content. For example, as shown in Figures 13A, 13B, 13C, or 13D above, the second device displays a "Confirm" button and a "Reject" button. If the second device receives an operation for the "Confirm" button, it sends a request message to the first device to request the first content. After receiving the request message, the first device sends the first content to the second device. If the second device receives an operation for the "Reject" button, it does not need to send a request to the first device, or it sends a rejection message to the first device so that the first device does not send the first content to the second device. Optionally, the second device can also delete the preview information of the received first content. Therefore, by sending preview information to the second device, it can help the user determine whether the content to be shared is the content the user expects to obtain. If so, the content to be shared is sent to the second device. The amount of information in the preview information is relatively small, so sending preview information has a small impact on power consumption. This method avoids directly sending large amounts of data to be shared, but the content to be shared is not what the user expects, resulting in wasted power consumption.

[0484] As another example, after receiving first information indicating first content, the second device can display the first information (e.g., a preview image). If it detects a first gesture operation related to the first information (e.g., a swipe down operation), it sends a request message to the first device to request the first content. Upon receiving the request message, the first device sends the first content to the second device. If the second device detects a second gesture operation related to the first information (e.g., a swipe up operation), it does not need to send a request to the first device, thus the first device will not send the first content to the second device.

[0485] In the above embodiments, when the first device detects that the second device is approaching the first display screen, it determines the first position coordinates of the approaching second device on the first display screen and determines which window the first position coordinates are located in. If it is located in the first window, it determines the content to be shared based on the first window. In other embodiments, when the first device detects that the second device is approaching the first display screen, it determines the focus window on the first display screen and determines the content to be shared based on the focus window. The scheme of determining the content to be shared based on the focus window has the following two cases:

[0486] In scenario A, the first device does not need to determine the coordinates of the second device's proximity on the first display screen, nor does it need to determine which window that coordinates fall within. It directly determines the content to be shared based on the focused window on the first display screen. In this scenario, regardless of the second device's proximity on the first display screen, the content to be shared is determined based on the focused window on the first display screen.

[0487] In scenario B, the first device determines the coordinates of the first position of the second device on the first display screen, and determines that the first position coordinates are within the first window (wherein, the principle of determining the first window is the same as the principle of step 902 in Figure 9 above). It then determines whether the first window is the focus window. If it is, it determines the content to be shared based on the first window. If not, it switches the first window to the focus window (the principle of switching to the focus window can be found in Figures 14A and 14B below), and then determines the content to be shared based on the focus window.

[0488] The implementation principle of determining the content to be shared based on the focus window is the same as the implementation principle of determining the content to be shared based on the first window (i.e., step 903 in Figure 9 above), and will not be repeated.

[0489] In the above embodiment, the first device determines the content to be shared based on the first window. The first window may be a focused window or a non-focused window. Optionally, if the first window is a non-focused window, the first device can switch the first window to the focused window. For example, referring to Figure 14A(a), the first device determines that the first position coordinates (X, Y) are located within window A, and since window A is a non-focused window, the first device can switch window A to the focused window, as shown in Figure 14A(b). As a possible implementation, the first device can generate a virtual event, which is an event targeting the first window, to switch the first window to the focused window. It should be noted that the virtual event is not an event generated by user input operations and can also be called a simulated event. As an example, the virtual event may be a virtual click event that acts within the first window.

[0490] Next, we will give two specific examples of content sharing at the window level.

[0491] Example 1

[0492] For example, see Figure 14B(a), where windows A and B are displayed on the first device. Both windows A and B are windows for a gallery application. Image A is open in window A. Image B is open in window B. Window A is a non-focus window. When the first device detects that the second device (which may display the desktop or other interfaces, without limitation) is near window A, it sends a preview image (also called a thumbnail) of image A in window A to the second device. Optionally, as shown in Figure 14B(b), the second device can display a receiving animation of the preview image of image A. For example, the preview image of image A is gradually moved from the top of the second device's display screen towards a target position (e.g., the center of the display screen), and the size of the preview image gradually increases during the movement until it reaches the target size. As shown in Figure 14B(c), the preview image of image A has moved to the target position and reached the target size. Optionally, continuing with Figure 14B(b) and Figure 14B(c), since the second device is closer to window A, the first device switches window A from a non-focus window to a focus window, that is, window B is switched to a non-focus window.

[0493] Optionally, as shown in Figure 14B(c), the second device may also display an "Accept" button and a "Reject" button. The user can choose to accept or reject. It should be noted that in Figure 14B(c), the second device displays the "Accept" and "Reject" buttons as an example. Optionally, the second device may not need to display the "Accept" and "Reject" buttons. One possible implementation is that the second device displays a preview image of image A. If a first gesture operation (e.g., a swipe down) is detected on the preview image of image A, representing acceptance, the first device sends a request message for image A to the second device. If the second device detects a second gesture operation (e.g., a swipe up) on the preview image of image A, representing rejection, the first device will not send a request message for image A to the second device.

[0494] In Figure 14B(c), if the second device detects that the user clicks "accept," the second device sends a request message to the first device to request image A. After receiving the request message, the first device sends image A to the second device. Optionally, the first device may terminate (e.g., actively terminate) the connection with the second device after sending image A; or, the second device may terminate (e.g., actively terminate) the connection with the first device after receiving image A, indicating the end of this sharing session.

[0495] Taking the example of the first device interrupting its connection with the second device after sending image A, in practical applications, there might be a situation where the first and second devices share content bidirectionally, meaning the first device shares content with the second device, and the second device also shares content with the first device. In this case, after sending image A, the first device can temporarily maintain its connection with the second device and wait to receive the shared content. Optionally, the first device can interrupt its connection with the second device after receiving the shared content. It's understandable that if the connection between the first and second devices times out, or if the distance is too great, the connection between the two devices will also be lost.

[0496] In Figure 14B(c), if the second device detects that the user clicks "decline," the second device will not send a request message to the first device, so the first device will not send image A to the second device. Optionally, in this case, the second device can actively terminate the connection with the first device, signifying the end of this sharing session.

[0497] Assuming that in Figure 14B(c), the user clicks the confirm button, then the first device sends image A to the second device. After receiving image A, the second device displays image A (e.g., displays image A in full screen). It should be noted that after the first device sends image A to the second device, the connection with the second device is interrupted.

[0498] As shown in Figure 14B(d), when the first device detects that the second device is near window B, it sends a preview of image B in window B to the second device. It should be noted that since the connection between the first and second devices has been broken, in Figure 14B(d), the first device needs to re-establish a connection with the second device and send the preview of image B to the second device through the re-established connection. Optionally, as shown in Figure 14B(e), the second device can display a receiving animation of the preview of image B. For example, the preview of image B gradually moves from the top of the second device's display screen towards the target position (e.g., the center of the display screen), and the size of the preview image gradually increases until it reaches the target size. As shown in Figure 14B(f), the preview of image B moves to the target position and reaches the target size. Optionally, the second device can also display a confirm / reject button. The user can choose to confirm or reject. Assuming that in Figure 14B(f), the user clicks the confirm button, the first device sends image B to the second device. After receiving image B, the second device displays image B (e.g., displays image B in full screen). After sending image B to the second device, the first device can terminate the connection with the second device.

[0499] Example 2

[0500] For example, see Figure 14C(a). Window A and Window B are displayed on the first device. Both Window A and Window B are windows of the gallery application. Image A is open in Window A. Image B is open in Window B. Window A is a non-focus window. When the first device detects that the second device (which may display the desktop or other interfaces, without limitation) is near Window A, it sends a preview image (also called a thumbnail) of Image A in Window A to the second device. Optionally, as shown in Figure 14C(b), the second device can display a receiving animation of the preview image of Image A. The receiving animation will not be described again. As shown in Figure 14C(c), the preview image of Image A moves to the target position and reaches the target size. Optionally, the second device can also display a confirm button and a reject button. Optionally, the second device may not display the confirm button and reject button. In this case, the confirm or reject button can be triggered by swiping up / down on the preview image of Image A. For this part, please refer to Example 1 above.

[0501] In Figure 14C(c), if the user neither clicks the confirm button nor the reject button, the second device will not send a request message to the first device to request image A. Since the first device does not receive the request message, it will not send image A to the second device, thus maintaining the connection. The second device does not detect the user clicking reject, and therefore will not interrupt the connection with the first device; thus, the connection between the first and second devices remains intact. It should be noted that "the first device / second device does not interrupt the connection between the first and second devices" can be understood as the first device / second device not actively interrupting the connection, but if the connection times out or the distance is too great, the connection between the first and second devices may be lost.

[0502] If the connection between the first and second devices remains uninterrupted, as shown in Figure 14C(d), the second device approaches the display screen of the first device again. The first device detects the second device's proximity to window B and, based on the connection, sends a preview of image B in window B to the second device. Optionally, in this case, the second device may not need to display a receiving animation of the preview of image B; for example, as shown in Figure 14C(e), the second device directly switches / replaces the preview of image A with the preview of image B. Optionally, the second device may also display a confirm button and a reject button.

[0503] In other embodiments, to indicate to the user the proximity of the second device on the first display screen, the first device may display indication information on the first display screen indicating the proximity of the second device. As an example, the first device may display indication information at a first coordinate on the first display screen, giving the user the visual effect that the second device is "approaching / aligning" with the first coordinate position. For example, the first device may display a first color at the first coordinate. The first color can be a relatively bright / prominent color, such as red, green, or blue.

[0504] Optionally, the first device displaying indication information at the first position coordinates may include: determining a second region based on the first position coordinates, and displaying indication information within the second region, for example, displaying a first color within the second region. The second region may be an area centered on the first position coordinates with a preset area, such as a rectangular area or a circular area. It should be noted that the second region and the first region mentioned above (i.e., the area on the first display screen where the capacitance changes) may be the same region or different regions. For example, referring to Figure 15(a), if the first device determines the first position coordinates as (X, Y), then based on (X, Y), it determines a second region (e.g., the diagonal area in the figure), and displays the first color within the second region. Therefore, through the first color, the user can know which position on the first display screen the second device has "approached / aligned".

[0505] Optionally, after displaying the indication information on the first display screen, the first device can also cancel the display of the indication information. As one possible implementation, the first device can cancel the display of the indication information when a cancellation condition is detected. Optionally, the cancellation condition may include at least one of the following:

[0506] (1) The second device moves away from the first display screen. Optionally, the second device moving away from the first display screen may include: the distance between the second device and the first display screen is greater than a first preset distance, but less than or equal to a second preset distance. The first preset distance is the distance at which the first device can detect the approach of the second device, as described above. The second preset distance is the upper limit of the distance at which the first device and the second device can maintain a connection; in other words, if the distance exceeds a third preset distance, the first device and the second device cannot maintain a connection.

[0507] (2) The connection between the second device and the first device is broken. Optionally, the connection between the first device and the second device may be broken because the distance between the first device and the second device is too far, or it may be broken manually by the user.

[0508] (3) No information is transmitted between the second device and the first device for more than a first preset time period. In other words, if the first device and the second device do not transmit data for a long time, the display of the indication information will be canceled.

[0509] (4) The display duration of the indication information reaches a second preset duration. For example, the first device starts timing from the time the indication information is displayed, and when the timing reaches the second preset duration, the display of the indication information is canceled. For example, the second preset duration can be 1 second, 2 seconds, etc., and the specific duration is not limited.

[0510] The above lists four examples of cancellation conditions for the instruction information. Optionally, in addition to the four mentioned above, there may be other cancellation conditions, such as the second device remaining stationary for a long time, the second device being flipped (e.g., the display screen facing down), etc., which will not be listed one by one.

[0511] After the first device cancels the display of the indication information, if the second device is detected approaching the first display screen again, the indication information can be displayed again to indicate the approaching position of the second device. For example, in Figure 15(a), if the display duration of the indication information reaches the second preset duration, the display of the indication information is canceled. As shown in Figure 15(b), if the first device detects that the second device is approaching the first display screen again and determines the second position coordinates (X', Y') of the second device approaching the first display screen, then based on the second position coordinates (X', Y'), a third area is determined (for example, the diagonal area in Figure 15(b)), and a second color is displayed in the third area. The second color can be the same as or different from the first color. Similarly, in Figure 15(b), the first device can also cancel the display of the indication information after detecting that the cancellation condition is met.

[0512] In some embodiments, a single proximity of the second device triggers one content sharing session, and a subsequent proximity triggers another. In other embodiments, a single proximity of the second device can trigger multiple content sharing sessions.

[0513] In one possible implementation, after the first device detects that the second device is approaching a first position coordinate on the first display screen, if the first position coordinate is determined to be within a first window, the content to be shared is determined based on the first window. After the second device leaves the first display screen, the position of the second device may change. The first device can detect the position change of the second device, and based on the position change, determine a second position coordinate on the first display screen. The second position coordinate is the mapped position of the second device on the first display screen. If the second position coordinate is within a second window, the content to be shared is determined based on the second window, and the content to be shared is shared with the second device.

[0514] For example, referring to Figure 16A(a), the first device determines that the second device is near a first position coordinate (X, Y) on the first display screen, and determines that the first position coordinate (X, Y) is within window A. Based on window A, it determines the content to be shared (e.g., image A) and sends the preview information of the content to be shared to the second device. As shown in Figure 16A(b), the second device leaves the first display screen. As shown in Figure 16A(c), the second device changes position after leaving the first display screen, for example, the second device moves to the upper left. The first device detects the second device moving to the upper left, and based on the position change of the second device, determines a second position coordinate (X', Y') on the first display screen, as shown in Figure 16A(c). The first device determines that the second position coordinate (X', Y') is within window B, and based on window B, determines the content to be shared (e.g., image B) and sends the preview information of the content to be shared to the second device.

[0515] As mentioned earlier, after the second device leaves the first display screen, the first device can detect the position change of the second device and determine the second position coordinates on the first display screen based on the position change. One possible implementation is that the first device detects the first displacement of the second device and then determines the second displacement based on the first displacement. The first displacement includes a first direction and a first distance, and the second displacement includes a second direction and a second distance. The first direction and the second direction are the same, and the first distance and the second distance are proportional; for example, the first distance is a multiple of the second distance. After determining the second displacement, the second position coordinates are determined based on the first display position and the second displacement. For example, the displacement from the first position coordinates to the second position coordinates is the second displacement. As mentioned earlier, the first device needs to detect the first displacement of the second device. One possible implementation is that the first device acquires an image stream through a camera and determines the first displacement of the second device based on the image stream. Another possible implementation is that the second device detects its own first displacement using a sensor (e.g., a gyroscope, accelerometer, etc.) and then sends the first displacement to the first device.

[0516] It should be noted that in Figure 16A, the second device only approaches the first display screen once. After the second device leaves the first display screen, its position changes, which can trigger the first device to re-determine the content to be shared. In this way, multiple content sharing can be achieved with only one approach.

[0517] In other embodiments, during the process shown in FIG16A, the first device may also display indication information to indicate the proximity position of the second device on the first display screen. It should be noted that in FIG16A, the second device only approaches the first display screen once and then leaves it. After leaving the first display screen, the position of the second device changes, causing a corresponding change in the mapped position of the second device on the first display screen. During this process, the first device may display indication information on the first display screen to indicate the proximity position of the second device and its mapped position on the first display screen after leaving it.

[0518] For example, referring to Figure 16B(a), the first device determines that the second device is near a first position coordinate (X, Y) on the first display screen. Based on the first position coordinate (X, Y), a second region (e.g., a diagonal area) is determined, and instruction information is displayed within the second region. If the first device determines that the first position coordinate (X, Y) is within window A, then based on window A, the information to be shared (e.g., image A) is determined, and a preview of the content to be shared is sent to the second device. As shown in Figure 16B(b), the second device leaves the first display screen, but the instruction information remains displayed. As shown in Figure 16B(c), the second device changes position after leaving the first display screen, for example, the second device moves to the upper left. The first device detects the upper left movement of the second device, and based on the position change of the second device, determines a second position coordinate (X', Y') on the first display screen. Based on the second position coordinate (X', Y'), a third region is determined, and instruction information is displayed within the third region. Therefore, the user can determine which position on the first display screen the second device is mapped to through the instruction information.

[0519] Optionally, in Figure 16B, the first device may cancel the display of the indication information after detecting that the cancellation condition is met. Optionally, the cancellation condition includes, but is not limited to:

[0520] (1) The connection between the first device and the second device is broken.

[0521] (2) No information is transmitted between the first device and the second device for more than a third preset time period. Optionally, the third preset time period may be greater than or equal to the first preset time period mentioned above.

[0522] (3) The display duration of the indication information reaches the fourth preset duration. Optionally, the fourth preset duration may be greater than or equal to the second preset duration mentioned above.

[0523] Optionally, in addition to the three cancellation conditions mentioned above, there may be other cancellation conditions, such as the second device remaining stationary for a long time, the second device being flipped (e.g., the display screen facing down), etc., which will not be listed one by one.

[0524] In the above embodiments, the communication system shown in Figure 1 is used as an example for illustration, with the first device acting as the sender / sharer and the second device as the receiver, i.e., the first device shares content with the second device. Optionally, before sharing content with the second device, the first device may determine whether it is qualified to act as a content sharer.

[0525] In one possible implementation, the user can specify the sharer and / or receiver on the first device and / or the second device. As an example, when the first device detects that the second device is near the first display screen, the first device displays a prompt message to prompt the user to specify the sharer and / or receiver. If the first device is selected as the sharer by the user, it is determined that the first device is the sharer.

[0526] As another possible implementation, if the first device detects that the second device is near a first window on the first display screen, it determines whether the first device itself is the sharer based on the content displayed in the first window. For example, the first device can determine whether there is content to be shared in the first window. The content to be shared can be selected content in the first window, or content that is already opened in the first window. If so, the first device is determined to be the sharer.

[0527] Let's take the example of the content to be shared being the selected content within the first window. For instance, if the first window is a gallery application window containing a list of images, and the user selects all or some of the images within that window, then there is content to be shared within that window—the images selected by the user. Similarly, if the first window is a file manager window containing a list of files, and the user selects all or some of the files within that window, then there is content to be shared within that window—the files selected by the user.

[0528] Let's take the example of content to be shared being content already opened in the first window. For instance, if the first window is a gallery application window, and an image from that application is already open in that window, then there is content to be shared in that window, namely the opened image. As another example, if the first window is a document editing application window, and a document is open in that window, then there is content to be shared in that window, namely the opened document.

[0529] In the above embodiments, the communication system shown in Figure 1 is used as an example, with the first device acting as the sender / sharer and the second device as the receiver. In the following embodiments, the communication system shown in Figure 1 is continued as an example, but the first device acts as the receiver and the second device acts as the sender / sharer. For example, please refer to Figure 17, which is a schematic diagram of another application scenario provided by an embodiment of this application. As shown in Figure 17, the second device approaches the first display screen of the first device and shares content with the first device.

[0530] Next, using Figure 18 as an example, we will explain the process of the second device sharing content with the first device.

[0531] For example, please refer to Figure 18, which is a schematic flowchart of another communication method provided in an embodiment of this application. This method can be applied to the scenario shown in Figure 17. As shown in Figure 18, the flow of this method may include:

[0532] Step 1800: The first device detects that the second device is near the first display screen.

[0533] Step 1801: The first device determines the first position coordinates on the first display screen. The first position coordinates are the proximity position of the second device on the first display screen.

[0534] Step 1802: The first device determines that the first position coordinates are located within the first window.

[0535] It should be noted that the implementation principle of steps 1800 to 1802 is the same as that of steps 900 to 902 in Figure 9 above, and will not be repeated here.

[0536] Step 1803: The first device determines the delivery target based on the first window. The delivery target is the recipient of the shared content from the second device.

[0537] Step 1804: The first device receives the shared content sent by the second device.

[0538] It is understood that the first device needs to establish a connection with the second device before step 1804. Optionally, the connection can be a short-range wireless communication connection. Optionally, step 1804 can occur after step 1803, before step 1803, or before step 1802, or before step 1801.

[0539] Step 1805: The first device provides the shared content of the second device to the delivery recipient.

[0540] Optionally, in this embodiment of the application, step 1803 may include at least one of the following three methods.

[0541] The first method delivers content to the first window; this method is called "window-level content delivery".

[0542] In other words, the first approach involves the first device identifying the first window as the delivery target. In this case, the first device can provide the shared content from the second device to the first window. One possible implementation is that the first device sends the shared content from the second device to the first application (the application to which the first window belongs), and the first application processes the shared content within the first window. It should be noted that the first approach can be executed by the operating system of the first device. If executed by the operating system, the operating system sends the shared content from the second device to the first application, and the first application processes the shared content within the first window. In this approach, the operating system needs to communicate with the first application; for example, the operating system can communicate with the first application through an interface or function call.

[0543] In one specific implementation, the first device (e.g., an operating system) can call the callback function / interface of the first window to send the shared content from the second device to the first application, so that the first application can process the shared content within the first window. It should be noted that the callback function of the first window here differs from the callback function of the first window in step 903 of Figure 9 above. In the former, the callback function of the first window was used to trigger the first application to send feedback of the content to be shared within the first window to the operating system; here, the callback function of the first window is used to pass the shared content from the second device to the first application. In this approach, the operating system of the first device needs to pre-store the callback function of the first window (the callback function used to pass the shared content to the first application).

[0544] As one possible implementation, taking the application to which the first window belongs as an example, when the first application opens the first window, it can register a receiving event with the operating system. Optionally, the registered receiving event can be a receiving event specific to the first window. This registered receiving event specific to the first window can be understood as an event indicating "content needs to be shared with the first window" or an event indicating "the first window supports content reception." In other words, by registering the event, the operating system is instructed to send the shared content to the first application when it needs to share content with the first window. Thus, after detecting the "content needs to be shared with the first window" event, the operating system sends the shared content to the first application, allowing the first application to process the shared content within the first window. The "content needs to be shared with the first window" event could be an event where a second device approaches the first window and shares content with the first device, or it could be other events, without limitation. Optionally, during the registration process, the first application can pass a callback function of the first window, such as callback function a, to the operating system, so that the operating system provides the shared content from the second device to the first application through callback function a, thereby enabling the first application to process the shared content within the first window. Optionally, the operating system may also notify the first application through the callback function of the first window that an event "needing to share content with the first window" has been detected. This event could be that a second device approaches the first window and shares content with the first device, or it could be another event.

[0545] Optionally, if the first application opens a second window, it can also register a receiving event for the second window with the operating system. The principle is the same and will not be repeated. During the registration process, the first application can pass the callback function of the second window, such as callback function b, to the operating system. This allows the operating system to provide the first application with the shared content from the second device through callback function b, enabling the first application to process the shared content within the second window. Therefore, the first device can store a fourth correspondence, which records the callback functions corresponding to different windows, as shown in Table 4 below. When the first device detects which window the second device is near, it queries the callback function corresponding to that window through the fourth correspondence and sends the shared content from the second device to the corresponding application based on that callback function.

[0546] Table 4: Fourth Correspondence

[0547] As mentioned earlier, when the first application opens the first window, it registers the receiving events for the first window with the operating system, and during the registration process, it passes the callback function 'a' of the first window to the operating system. In one possible implementation, the first application can call a registration function to register the receiving events for the first window. As an example, the registration function can be an 'on' function or other functions. Taking the 'on' function as an example, the 'on' function can be represented as 'on(event, callback)', where 'event' represents the event to be registered, such as an event that "needs to share content with the first window", such as a receive event or a knock receive event, and 'callback' is the callback function of the first window.

[0548] In the above method, after the shared content from the second device is provided to the first application, the first application processes the shared content within a first window. Optionally, processing the shared content by the first application within the first window may include at least one of the following: displaying or sending the shared content within the first window. Taking displaying the shared content within the first window as an example, optionally, the first application may display the shared content at a position close to the second device (i.e., at the first coordinate position) within the first window.

[0549] The above explains the principle of the first method (content delivery in the first window dimension). Optionally, the content shared by the second device can include various types of content such as documents, images, and text messages. Several examples will follow.

[0550] Example 1, please refer to Figure 19A. A desktop window is displayed on the first screen of the first device, and the desktop window is identified as the first window (the identification process has been described above and will not be repeated). The first device identifies the desktop window as the delivery target. Therefore, after receiving the shared content from the second device, the first device calls the callback function of the desktop window to provide the shared content to the desktop application, which then processes the shared content within the desktop window. For example, in Figure 19A, the second device shares document 1 with the first device. After receiving document 1, the first device processes document 1 within the desktop window, for example, by displaying the document icon of document 1 within the desktop window. Optionally, as shown in Figure 19A, the desktop application can display the document icon of document 1 at the first position coordinates (X, Y).

[0551] Example 2, see Figure 19B. The first display screen of the first device shows a desktop window and window A of the instant messaging application. The first device determines that window A is the first window (the determination process has been described above and will not be repeated), and determines that window A is the delivery target. Therefore, after receiving the shared content from the second device, the first device can call the callback function of window A to provide the shared content to the instant messaging application, which then processes the shared content within window A. For example, in Figure 19B, the second device shares an image with the first device. After receiving the image, the first device processes the image within window A, for example, by sending the image to a contact, or by entering the image in a text input box and sending the image to the contact after receiving a user's click to send.

[0552] Example 3, please refer to Figure 19C. The first display screen of the first device shows a desktop window, an instant messaging application window A, and a browser window B. Window A is a non-focused window. The first device determines that window A is the first window (the determination process has been described previously and will not be repeated), and determines that the first window is the delivery target. Therefore, after receiving the shared content from the second device, the first device can call the callback function of window A to provide the shared content to the instant messaging application, which then processes the shared content within window A. For example, in Figure 19C, the second device shares an image with the first device. After receiving the image, the first device processes the image within window A, for example, by sending the image to a contact, or by entering the image in a text input box and sending it to the contact after receiving a user's click to send.

[0553] The second method delivers content to the first displayed element within the first window; this method is called "content delivery at the display element level".

[0554] The difference between this method and the first method described above is that in the first method, the first device determines that the first position coordinates are within the first window, thus identifying the first window as the delivery target. In the second method, while the first device determines that the first position coordinates are within the first window, it also needs to determine which display element within the first window the first position coordinates fall into. Assuming it's within the first display element, the first display element is then identified as the delivery target. Therefore, in the second method, the first device needs to determine which display element within the first window the first position coordinates fall into. For the implementation principle of the first device determining which display element the first position coordinates fall into, please refer to the second method in step 903 of Figure 9 above (e.g., the method of querying the control tree).

[0555] After the first device determines that the first location coordinates are within the first display element, if the first display element is determined to be the delivery target, the shared content from the second device can be delivered to the first display element. In one possible implementation, the first device can send the shared content from the second device to a first application, which then processes the shared content within the first display element of the first window. It should be noted that this method can be executed by the operating system of the first device. If executed by the operating system, the operating system sends the shared content from the second device to the first application, which then processes the shared content within the first display element of the first window. Therefore, the operating system needs to communicate with the first application; for example, the operating system can communicate with the first application through an interface or function call.

[0556] In one specific implementation, the first device (e.g., an operating system) can call the callback function / interface of the first display element to send the shared content from the second device to the first application, so that the first application processes the shared content within the first display element. It should be noted that the callback function of the first display element here differs from the callback function of the first display element in step 903 of Figure 9 above. In the previous example, the callback function of the first display element was used to trigger the first application to send the content to be shared within the first display element back to the operating system. Here, the callback function of the first display element is used by the operating system to send the shared content from the second device to the first application, so that the first application processes the shared content within the first display element. In this approach, the first device needs to pre-store the callback function of the first display element.

[0557] As one possible implementation, when the first application opens the first window, it can register a receiving event with the operating system. Optionally, the registered receiving event can be a receiving event for a first display element within the first window. A receiving event for a first display element can be understood as an event indicating "content needs to be shared with the first display element" or an event indicating "the first display element supports content reception." In other words, by registering the event, the operating system is instructed to send the shared content to the first application when it needs to share content with the first display element. Thus, after detecting the "content needs to be shared with the first display element" event, the operating system can provide the shared content to the first application, allowing the first application to process the shared content within the first display element. The "content needs to be shared with the first display element" event could be an event where a second device shares content with the first device near the first display element, or it could be any other event, without limitation. Optionally, during the registration process, the first application can pass the callback function of the first display element to the operating system, so that the operating system can send the shared content from the second device to the first application through the callback function of the first display element. Optionally, the operating system may also notify the first application through the callback function of the first window that an event "needs to share content with the first display element" has been detected. This event could be that a second device approaches the first display element and shares content with the first device, or it could be another event.

[0558] Optionally, events can also be registered for other display elements within the first window besides the first display element (e.g., the second display element). The principle is the same and will not be repeated here. Therefore, the first device can store a fifth correspondence, which records the callback functions corresponding to different display elements, as shown in Table 5 below. When the first device detects which display element the second device is close to, it queries the callback function corresponding to that display element through the fifth correspondence and delivers the shared content of the second device to that display element based on the callback function.

[0559] Table 5: Fifth Correspondence

[0560] As mentioned earlier, the first application registers the receiving events for the first display element with the operating system, and during the registration process, passes the callback function of the first display element to the operating system. In one possible implementation, the first application can call a registration function to register the receiving events for the first display element. As an example, the registration function can be the `on` function or other functions. Taking the `on` function as an example, the `on` function can be represented as `on(event, callback)`, where `event` represents the event to be registered, such as an event that "needs to share content with the first display element," such as a receiving event or a proximity receiving event, and `callback` is the callback function of the first display element.

[0561] It should be noted that the first window contains multiple display elements, and which display elements register to receive events and which do not can be determined by the first application. For example, the first application can determine whether a display element needs to register to receive events based on its type. Taking components as an example, for instance, icon components, search components, text input components, form components, rich text editing components, image components, hyperlink components, etc., event receiving registration is possible.

[0562] In this application, display elements that have registered to receive events can be referred to as display elements that support "drag-and-drop capability," meaning that the content in these display elements can be "dragged in" by the operating system. For example, the operating system can "drag" content (e.g., content shared by a second device) into the display element through the display element's callback function. For display elements that have not registered to receive events, i.e., display elements that do not support "drag-and-drop capability," the operating system cannot "drag" content into these display elements through callback functions.

[0563] Therefore, in this embodiment of the application, after the first device determines that the first position coordinates are located on the first display element, it can determine whether the first display element supports "drag-in capability" (i.e., whether it has registered a receive event); if the first display element supports "drag-in capability", the callback function of the first display element is called to send the shared content of the second device to the first application, so that the first application can process the shared content of the second device within the first display element; if the first display element does not support "drag-in capability", a prompt message can be output to prompt the user that delivery is not possible.

[0564] Therefore, in the second approach, the first application processes the shared content of the second device within the first display element. Optionally, processing the shared content of the second device within the first display element can include at least one of the following: displaying, translating, searching, or sending the shared content of the second device within the first display element. For example, the first display element can be a component, such as at least one of an icon component, a search component, a text input component, a form component, a rich text editing component, an image component, or a hyperlink component. Examples will be provided below.

[0565] Taking an icon component as the first display element as an example, the icon component could be a folder icon component. For example, referring to Figure 20A, a desktop window is displayed on the first screen of the first device, and the desktop window includes an icon component for folder 1. If the first device determines that its first position coordinates (X, Y) are within the icon component of folder 1, it calls the callback function of the icon component of folder 1 to send the shared content (e.g., document 1) from the second device to the file manager, which then stores document 1 in folder 1. Optionally, in Figure 20A, before sending the shared content, the second device can display preview information of the shared content (e.g., document icon, name, format, description, and screenshot of content page for document 1). After receiving confirmation from the user, the second device sends the shared content to the first device.

[0566] Taking a search component as the first display element as an example, as shown in Figure 20B, the first display screen of the first device shows a desktop window and a browser application window A. If the first device determines that its first position coordinates (X, Y) are within the search component of window A, it calls the callback function of the search component to send the shared content (e.g., URL information) from the second device to the browser application. The browser application then processes the shared content within the search component, for example, by opening the webpage corresponding to the URL information. Optionally, in Figure 20B, before sending the shared content, the second device can display a preview of the shared content (e.g., URL information, a screenshot of the webpage corresponding to the URL information, browser identifier, etc.). After receiving confirmation from the user, the second device sends the shared content to the first device.

[0567] Taking a rich text editing component as the first display element as an example, see Figure 20C. The first device's first display screen shows a desktop window and a document editing window A of a document application. If the first device determines that its first position coordinates (X, Y) are within the rich text editing component of window A, it calls the rich text editing component's callback function to send the shared content (e.g., an image) from the second device to the document application. The document application then processes the shared content within window A, for example, by inserting the image into the rich text editing component of window A. Optionally, in Figure 20C, before sending the shared content, the second device can display a preview of the shared content (e.g., a thumbnail). After receiving confirmation from the user, the second device sends the shared content to the first device.

[0568] The third method is to deliver content to the first application corresponding to the first window. This method is called "content delivery at the application level".

[0569] The difference between this method and the first and second methods described above is as follows: In the first method, the first device determines that the first window is the delivery target if it determines that the first location coordinates are within the first window. In the second method, the first device determines that the first display element is the delivery target if it determines that the first location coordinates are within the first display element of the first window. In this third method, the first device determines that the first application corresponding to the first window is the delivery target if it determines that the first location coordinates are within the first window. Therefore, after receiving the shared content from the second device, the first device sends the shared content to the first application, which then processes the shared content. Optionally, the first application may process the shared content within the first window or within another window.

[0570] Therefore, the third approach involves the first device determining the first application to which the first window belongs as the delivery target. One possible implementation is that the first device sends the shared content from the second device to the first application, which then processes the shared content. It should be noted that the first approach can be executed by the operating system of the first device. If executed by the operating system, the operating system sends the shared content from the second device to the first application, which then processes the shared content. In this approach, the operating system needs to communicate with the first application; for example, the operating system can communicate with the first application through an interface or function call.

[0571] In one specific implementation, the first device (e.g., an operating system) can call the callback function / interface of the first application to send the shared content from the second device to the first application, so that the first application can process the shared content. It should be noted that the callback function of the first application here differs from the callback function of the first application in step 903 of Figure 9 above. In the former, the callback function of the first application was used to trigger the first application to send feedback of the content to be shared to the operating system; here, the callback function of the first application is used to pass the shared content from the second device to the first application. In this approach, the operating system of the first device needs to pre-store the callback function of the first application (the callback function used to pass the shared content to the first application).

[0572] As one possible implementation, the first application can register a receiving event with the operating system. Optionally, the registered receiving event can be a receiving event specific to the first application. This registered receiving event for the first application can be understood as an event indicating "content needs to be shared with the first application" or an event indicating "the first application supports content reception." In other words, by registering the event, the operating system is instructing the operating system to send shared content to the first application when it needs to share content. Thus, after detecting the "content needs to be shared with the first application" event, the operating system sends the shared content to the first application. The "content needs to be shared with the first application" event could be an event indicating that a second device is near the window of the first application, or it could be another event, without limitation. Optionally, during the registration process, the first application can pass its own callback function to the operating system, allowing the operating system to provide the shared content from the second device to the first application through the callback function. Optionally, the operating system can also notify the first application through the first application's callback function that the "content needs to be shared with the first application" event has been detected, which could be an event indicating that a second device is near the window of the first application, or it could be another event. It should be noted that, as mentioned earlier, the first application registers receive events with the operating system for the first window and receive events for the first displayed element within the first window. To distinguish this from the two types of receive events, the first application registering receive events with the operating system here can be called: registering ordinary receive events with the operating system, which is neither a receive event for the window nor a receive event for the displayed element.

[0573] Optionally, taking the registration of the first application to receive events as an example, other applications (e.g., the second application) can also register to receive events, with the same principle, and will not be repeated here. Therefore, the first device can store a sixth correspondence, which is used to record the callback functions corresponding to different applications, as shown in Table 6 below. When the first device detects which application's window the second device is close to, it queries the callback function corresponding to that application through the sixth correspondence, and based on the callback function, provides the shared content of the second device to the corresponding application.

[0574] Table 6: Sixth Correspondence

[0575] As mentioned earlier, the first application registers with the operating system to receive events, and during the registration process, it passes the callback function of the first window to the operating system. In one possible implementation, the first application can call a registration function to register for receiving events. As an example, the registration function can be an `on` function or other functions. Taking the `on` function as an example, the `on` function can be represented as `on(event, callback)`, where `event` represents the event to be registered, such as an event that "needs to share content with the first application," such as a receive event or a knock receive event, and `callback` is the callback function of the first application.

[0576] In the above method, after the shared content from the second device is provided to the first application, the first application processes the shared content. Optionally, the first application's processing of the shared content may include: processing the shared content within a first window or another window of the first application, the processing including but not limited to display, sending, searching, translating, and other various processes. Optionally, the first application's processing of the shared content may also include: the first application processing the shared content through a second application, where the second application and the first application are different applications. For example, if the first device detects that the second device is near the desktop window and receives shared content, such as a document, sent by the second device, then the first device processes the document through the application to which the desktop window belongs, i.e., the desktop application. As an example, the desktop application can send the document to a file manager and trigger the file manager to open a window, which displays the document.

[0577] The above provides three implementation methods for step 1803 (i.e., the first device determines the delivery object based on the first window): "content delivery at the window level," "content delivery at the display element level," and "content delivery at the application level." It should be noted that the first device may be configured with only one of these three methods; for example, only the first method, "content delivery at the window level," may be configured. Alternatively, the first device may be configured with two or more of these three methods; for example, "content delivery at the window level," "content delivery at the display element level," and "content delivery at the application level" may be configured. In this case, after the first device determines that the first position coordinates are located within the first window, it needs to determine which of the three methods to use. As one possible implementation, assuming the first device determines that the first position coordinates are located within the first display element in the first window, it then determines whether the first display element supports "drag-and-drop capability". If yes, it uses "content delivery at the display element level". If no, it continues to determine whether the first application has registered a receiving event for the first window. If yes, it uses "content delivery at the window level". If the first application has not registered a receiving event for the first window, it determines whether the first application has registered a normal receiving event. If yes, it uses "content delivery at the application level". Otherwise, it can output a prompt message to inform the user that there is no content to share.

[0578] In the above embodiments, when the first device detects that the second device is approaching the first display screen, it determines the first position coordinates of the approaching second device on the first display screen and determines which window the first position coordinates are located in. If it is located in the first window, the delivery object is determined based on the first window. In other embodiments, when the first device detects that the second device is approaching the first display screen, it determines the focus window on the first display screen and determines the delivery object based on the focus window. The scheme of determining the delivery object based on the focus window has the following two cases:

[0579] In scenario A, the first device does not need to determine the coordinates of the second device's proximity on the first display screen, nor does it need to determine which window that coordinates fall within. It directly determines the delivery target based on the focus window on the first display screen. In this case, regardless of the second device's proximity on the first display screen, the delivery target is determined based on the focus window on the first display screen.

[0580] In scenario B, the first device determines the coordinates of the first position of the second device on the first display screen, and determines that the first position coordinates are within the first window (wherein, the principle of determining the first window is the same as the principle of step 902 in Figure 9 above). Then, it determines whether the first window is the focus window. If it is, the delivery object is determined according to the first window. If not, the first window is switched to the focus window (the principle of switching to the focus window can be found in Figure 8 above), and then the delivery object is determined according to the focus window.

[0581] The implementation principle of determining the delivery object based on the focus window is the same as that of determining the delivery object based on the first window (i.e., step 1803 in Figure 18 above), and will not be repeated here.

[0582] In this embodiment, before the second device sends the shared content to the first device, the second device may display a preview of the shared content. After receiving confirmation from the user, the shared content is sent to the second device. For example, the second device displays a send button and a cancel button. Upon receiving an operation on the send button, the shared content is sent to the second device; upon receiving an operation on the cancel button, the sharing of the content to the second device is canceled.

[0583] As an example, if the shared content is a document, then the preview information of the shared content will be the document's preview information, such as the document's icon, name, format, brief content summary, and screenshots of content pages. For example, please refer to Figure 20A above.

[0584] As another example, if the shared content is a URL, then the preview information of the shared content includes the URL, a screenshot of the corresponding webpage, and browser identification (e.g., name, icon). For example, please refer to Figure 20B above.

[0585] As another example, if the shared content is an image, then the preview information for the shared content is a thumbnail. For example, see Figure 20C above.

[0586] As another example, if the shared content is text information, then the preview information of the shared content is a preview of the text information, for example, only including the beginning and end of the text information, with the middle part replaced by ellipses.

[0587] In the above embodiment, the first device determines the delivery target based on the first window. The first window may be a focus window or a non-focus window. Optionally, if the first window is a non-focus window, the first device can switch the first window to the focus window. The principle of switching the first window to the focus window can be referred to Figures 14A and 14B above, and will not be repeated here.

[0588] Next, we will give two specific examples of content delivery at the window level.

[0589] Example 1

[0590] For example, referring to Figure 21A(a), the second device (mobile phone) displays image A (e.g., full-screen display). The first device (PC) displays window A and window B. When the second device detects proximity to the first device's display screen, it displays a sending interface for image A as shown in Figure 21A(b), which includes a preview of image A. Optionally, continuing with Figure 21A(b), because the second device is near window A, the first device switches window A from a non-focus window to a focus window, i.e., window B is switched to a non-focus window.

[0591] In Figure 21A(b), if the second device detects a third gesture operation (e.g., an up swipe) for a preview of image A, it sends image A to the first device. Optionally, after sending image A, the second device can terminate (e.g., actively terminate) the connection with the first device, or the first device can terminate the connection with the first device after receiving image A.

[0592] Taking the example of the second device interrupting its connection with the first device after sending image A, in practical applications, there might be a situation where the second and first devices share content bidirectionally, meaning the second device shares content with the first device, and the first device also shares content with the second device. In this case, after sending image A, the second device can temporarily maintain its connection with the first device and wait to receive the shared content. Optionally, the second device can interrupt its connection with the first device after receiving the shared content. It's understandable that if the connection between the first and second devices times out, or if the distance is too great, the connection between the first and second devices will also be lost.

[0593] In Figure 21A(b), if the second device detects a fourth gesture operation (e.g., a swipe down) for the preview image of image A, the second device will not send image A to the first device. Optionally, in this case, the second device can disconnect from the first device, signifying the end of the sharing session.

[0594] It should be noted that in Figure 21A(b), if the user triggers an upward swipe operation on the preview image of image A, the second device sends image A to the first device. If the user triggers a downward swipe operation on the preview image of image A, the second device will not send image A to the first device. Optionally, in Figure 21A(b), the second device may also display a confirm button and a reject button. If an operation on the confirm button is received, image A is sent to the first device, and the connection with the first device may be terminated after sending image A. If an operation on the reject button is received, image A will not be sent to the first device, and the connection with the first device may also be terminated.

[0595] Assuming that in Figure 21A(b), the user triggers an upward swipe operation, the second device sends image A to the first device. Optionally, the second device can display a sending animation effect for image A, such as a preview of image A moving towards the top of the second device's screen, gradually shrinking in size until it disappears, as shown in Figure 21A(c). After receiving image A, the first device processes image A through the application to which window A belongs, such as displaying image A in window A, as shown in Figure 21A(d). Optionally, as shown in Figure 21A(d), after sending image A, the second device can exit the image A sending interface, for example, returning to full-screen display of image A. It should be noted that during this process, because the user clicked send, the second device interrupts the connection with the first device after sending image A.

[0596] As shown in Figure 21A(e), the second device approaches the display screen of the first device again. Upon detecting this proximity, the second device displays the image A sending interface again, as shown in Figure 21A(f), which includes a preview of image A. If the user selects to send (e.g., triggers a swipe-up operation), the second device sends image A to the first device. It should be noted that since the connection previously established between the first and second devices has been broken, a new connection needs to be established between the second and first devices, and image A is sent to the first device through this newly established connection. Optionally, the second device can display a sending animation for image A, such as the preview of image A moving towards the top of the second device's display screen and gradually shrinking in size until it disappears, as shown in Figure 21A(g). After receiving image A, the first device processes image A through the application to which window B belongs, for example, displaying image A in window B, as shown in Figure 21A(h). Optionally, as shown in Figure 21A(h), after sending image A, the second device can return to full-screen display of image A.

[0597] Example 2

[0598] For example, referring to Figure 21B(a), the second device (mobile phone) displays image A (e.g., full-screen display). The first device (PC) displays window A and window B. When the second device detects proximity to the first device's display screen, it displays a sending interface for image A as shown in Figure 21B(b), which includes a preview of image A. Optionally, continuing with Figure 21B(b), because the second device is near window A, the first device switches window A from a non-focus window to a focus window, i.e., window B is switched to a non-focus window.

[0599] In Figure 21B(b), the user neither selects to send nor reject (i.e., the user neither performs an up-swipe nor a down-swipe operation), and the second device remains on the sending interface for image A. In this case, the second device will not send image A to the first device, so the second device will not interrupt (e.g., will not actively interrupt) its connection with the first device. It should be noted that if the connection between the first and second devices times out, or if the distance is too great, the connection between the first and second devices will also be lost.

[0600] As shown in Figure 21B(c), with the connection between the first and second devices remaining intact, the second device approaches the display screen of the first device again and moves closer to window B. As shown in Figure 21B(d), the sending interface for image A is still displayed on the second device. If an upward swipe operation is detected, image A is sent to the first device. It should be noted that since the connection between the first and second devices remains intact, the second device can send image A to the first device based on this connection without needing to re-establish it. Optionally, as shown in Figure 21B(e), the second device can display a sending animation effect for image A. After receiving image A, the first device processes image A through the application to which window B belongs, for example, displaying image A within window B, as shown in Figure 21B(f). Optionally, as shown in Figure 21B(f), after sending image A, the second device exits the sending interface for image A, for example, returning to full-screen display of image A.

[0601] In other embodiments, the first device may display indication information on a first display screen, which indicates the proximity of the second device. The display process of the indication information is described above and will not be repeated here. Optionally, the first device may cancel the display of the indication information when it detects that a cancellation condition has been met; the cancellation process of the display information is described above.

[0602] In some embodiments, a content delivery is triggered once when the second device approaches once; a content delivery is triggered again when the second device approaches once more. In other embodiments, multiple content deliveries can be triggered when the second device approaches once.

[0603] In one possible implementation, after the first device detects that the second device is approaching a first position coordinate on the first display screen, if the first position coordinate is determined to be within a first window and the first window is determined to be the recipient, then the shared content of the second device is delivered to the first window. After the second device leaves the first display screen, the position of the second device may change. The first device can detect the change in the position of the second device, and based on the change in the position of the second device, determine a second position coordinate on the first display screen. The second position coordinate is the mapped position of the second device on the first display screen. If the second position coordinate is within a second window and the second window is determined to be the recipient, then the shared content of the second device is delivered to the second window.

[0604] For example, referring to Figure 21C(a), the first device determines that the second device is near a first position coordinate (X, Y) on the first display screen, and the first position coordinate (X, Y) is located within window A. The first device then determines that window A is the recipient of the content shared by the second device, and delivers the shared content (e.g., image A) to window A. Optionally, the second device may display a send button or a cancel button. Upon receiving an operation on the send button, the second device sends the shared content to the first device; otherwise, it does not send the shared content. As shown in Figure 21C(b), the second device leaves the first display screen. As shown in Figure 21C(c), the second device changes position after leaving the first display screen, for example, the second device moves to the upper left. The first device detects that the second device has moved to the upper left, and determines a second position coordinate (X', Y') on the first display screen based on the position change of the second device, as shown in Figure 21C(c). The first device determines that the second position coordinate (X', Y') is located within window B, and determines that window B is the recipient of the content shared by the second device, and delivers the shared content (e.g., image A) to window B.

[0605] The principle behind determining the second position coordinates, as described above, can be found in Figure 14A and will not be repeated here. It should be noted that in Figure 21C, the second device only approaches the first display screen once. After the second device leaves the first display screen, its position changes, triggering a switch in the delivery target. Therefore, in this way, multiple content deliveries can be achieved with only one approach.

[0606] In other embodiments, during the process shown in FIG21C, the first device may also display indication information to indicate the proximity of the second device on the first display screen. For example, referring to FIG21D(a), the first device determines that the second device is close to a first position coordinate (X, Y) on the first display screen, and then determines a second area (e.g., a diagonal area) based on the first position coordinate (X, Y), and displays the indication information within the second area. As shown in FIG21D(b), the second device leaves the first display screen, but the indication information remains displayed. As shown in FIG21D(c), the second device changes position after leaving the first display screen, for example, the second device moves to the upper left. The first device detects that the second device has moved to the upper left, and then determines a second position coordinate (X', Y') on the first display screen based on the position change of the second device, and determines a third area based on the second position coordinate (X', Y'), and displays the indication information within the third area. Therefore, the user can determine which position on the first display screen the shared content of the second device should be delivered to through the indication information.

[0607] In the above embodiments, the communication system shown in Figure 1 is used as an example for illustration, and the first device (e.g., PC) acts as the receiver, and the second device (e.g., mobile phone) acts as the sharer, that is, the second device shares content with the first device. Optionally, before sharing content with the first device, the second device may determine whether it is qualified to act as a content sharer.

[0608] In one possible implementation, the user can specify the sharer and / or receiver on the first device and / or the second device. As an example, when the second device is near the first display screen, the second device displays a prompt message to encourage the user to specify the sharer and / or receiver. If the user specifies the second device as the sharer, then the second device is determined to be the sharer.

[0609] As another possible implementation, the second device can determine whether it is the sharer based on the current display interface. For example, if the second device is currently displaying a window of an application, it is determined to be the sharer; if the second device is currently displaying the desktop, it is determined to be the receiver.

[0610] In the above embodiments, the first device and the second device in the communication system shown in Figure 1 can act as the sharer and the receiver, respectively. If the first device is the sharer, the process shown in Figure 9 above is used; if the first device is the receiver, the process shown in Figure 18 above is used. Optionally, the content sharing between the first device and the second device can be unidirectional or bidirectional. Taking unidirectional sharing as an example, it includes the first device sharing content to the second device or the second device sharing content to the first device. Taking bidirectional sharing as an example, for instance, during the process of the first device sharing content to the second device, the second device also shares content to the first device.

[0611] Please refer to Figure 22, which is another schematic diagram of a communication system provided in an embodiment of this application. The left half of Figure 22 is a structural schematic diagram of the first device, and the right half is a structural schematic diagram of the second device.

[0612] As shown in Figure 22, the first device includes a first application, which can be of various types. The first device also includes a shared Software Development Kit (SDK) for communication between the application (e.g., the first application) and the shared SA. The shared SA includes a sharing / collaboration module and a transmission management module. The sharing / collaboration module is used for application event registration, determining the proximity of the second device on the first display screen, and acquiring content to be shared. The transmission management module is used for data transmission between the first device and other devices; for example, the transmission management module can transmit data with other devices based on a distributed soft bus. The first device also includes a File Explorer (FWK), which includes package management, a Windows Management System (WMS), and an ArkUI. Package management manages various applications on the first device, WMS manages windows, and ArkUI registers drag-in / drag-out events for display elements.

[0613] As shown in Figure 22, the second device includes a sharing SA and a super terminal. The sharing SA includes a transmission management module and a sharing / coordination module. The transmission management module is used to enable data transmission between the second device and other devices. The sharing / coordination module is used to receive shared content. The super terminal is used to accept or reject shared content.

[0614] Please refer to Figure 23, which is a schematic flowchart of a communication method provided in an embodiment of this application. This method can be applied to the communication system shown in Figure 22, where a first device acts as the sender and a second device acts as the receiver. As shown in Figure 23, the process includes:

[0615] Step 2301: The first application in the first device registers a sharing event with the sharing / collaboration module.

[0616] Optionally, the sharing event registered by the first application can be a regular sharing event or a sharing event specific to the first window. For details on regular sharing events and sharing events specific to the first window, please refer to the previous description.

[0617] Step 2302: The first application in the first device registers a content drag-out event for display elements with FWK.

[0618] Optionally, the content drag-out event of the display element, i.e. the sharing event for the display element mentioned above, will not be repeated for the sake of saving space.

[0619] Step 2303: In the first device, FWK detects that the second device is close to the first display screen.

[0620] Optionally, step 2303 is implemented in the same way as step 900 in Figure 9 above, and will not be repeated.

[0621] Step 2304: The FWK in the first device determines the first position coordinates on the first display screen, and the first position coordinates are the proximity position of the second device on the first display screen.

[0622] Optionally, step 2304 is implemented in the same way as step 901 in Figure 9 above, and will not be repeated.

[0623] Step 2305: The FWK in the first device sends the first location coordinates to the sharing / collaboration module.

[0624] Step 2306: The sharing / collaboration module in the first device determines that the first location coordinates are located in the first window.

[0625] Optionally, step 2306 is implemented in the same way as step 902 in Figure 9 above, and will not be repeated.

[0626] Step 2307: The sharing / collaboration module in the first device determines the content to be shared based on the first window.

[0627] Optionally, step 2307 is implemented in the same way as step 903 in Figure 9 above, and will not be repeated.

[0628] Step 2308: The sharing / system module in the first device sends preview information of the content to be shared to the transmission management module.

[0629] Optional information regarding the preview of the content to be shared can be found above and will not be repeated here.

[0630] Step 2309: The transmission management module in the first device sends preview information to the second device.

[0631] Step 2310: The transmission management module in the second device sends preview information to the sharing / system module.

[0632] Step 2311: The sharing / collaboration module in the second device sends preview information to the super terminal.

[0633] Step 2312: The super terminal in the second device receives the user's confirmation operation.

[0634] For example, the super terminal can display a confirm button or a reject button. If it receives a user's operation on the confirm button, it sends a confirm command to the first device.

[0635] Step 2313: The sharing / collaboration module in the second device receives the confirmation instruction.

[0636] Step 2314: The sharing / collaboration module in the second device sends a confirmation command to the transmission management module.

[0637] Step 2315: The transmission management module in the second device sends a confirmation instruction to the first device.

[0638] Step 2316: The transmission module in the first device sends a confirmation command to the sharing / collaboration module.

[0639] Step 2317: The sharing / collaboration module in the first device sends the content to be shared to the second device.

[0640] Please refer to Figure 24, which is a schematic flowchart of another communication method provided in an embodiment of this application. This method can be applied to the communication system shown in Figure 22, where the first device acts as the receiver and the second device acts as the sender. As shown in Figure 24, the process includes:

[0641] Step 2401: The second application in the second device registers a sharing event.

[0642] The principle of the second application registering a sharing event in the second device is the same as that of the first application registering a sharing event in the first device (e.g., registering a normal sharing event), and will not be repeated here.

[0643] Step 2402: The first application in the first device registers to receive events with the sharing / collaboration module.

[0644] Optionally, the receive event registered by the first application can be a normal receive event or a receive event specific to the first window. For information on normal receive events and receive events specific to the first window, please refer to the previous description.

[0645] Step 2403: The first application in the first device registers a drag-in event for the content of the display element with FWK.

[0646] Optionally, the content drag-in event of the display element, i.e. the receiving event for the display element mentioned above, will not be repeated for the sake of saving space.

[0647] Step 2404: In the first device, FWK detects that the second device is close to the first display screen.

[0648] Optionally, step 2404 is implemented in the same way as step 1800 in Figure 18 above, and will not be repeated.

[0649] Step 2405: The FWK in the first device determines the first position coordinates on the first display screen, and the first position coordinates are the proximity position of the second device on the first display screen.

[0650] Optionally, step 2405 is implemented in the same way as step 1801 in Figure 18 above, and will not be repeated.

[0651] Step 2406: The FWK in the first device sends the first location coordinates to the sharing / collaboration module.

[0652] Step 2407: The sharing / collaboration module in the first device determines that the first location coordinates are located in the first window.

[0653] Optionally, step 2407 is implemented in the same way as step 1802 in Figure 18 above, and will not be repeated.

[0654] Step 2408: The sharing / collaboration module in the first device determines the delivery target based on the first window.

[0655] Optionally, step 2408 is implemented in the same way as step 1803 in Figure 18 above, and will not be repeated. Optionally, the delivery object determined by the first device may be the first window, or the first display element within the first window, or the first application to which the first window belongs.

[0656] Step 2409: The collaboration / sharing module in the second device determines the content to be shared.

[0657] Step 2410: The collaboration / sharing module in the second device sends the shared content of the second device to the transmission management module.

[0658] Step 2411: The transmission management module in the second device sends the shared content to the first device.

[0659] Step 2412: The transmission management module in the first device sends the sharing content to the sharing / collaboration module.

[0660] Step 2413: The sharing / collaboration module in the first device sends the shared content from the second device to the first application.

[0661] If the delivery target identified above is the first window, the sharing / collaboration module calls the callback function of the first window to send the shared content from the second device to the first application, so that the first application can process the shared content within the first window. If the delivery target identified above is the first display element within the first window, the sharing / collaboration module calls the callback function of the first display element to send the shared content from the second device to the first application, so that the first application can process the shared content within the first display element. If the delivery target identified above is the first application to which the first window belongs, the sharing / collaboration module calls the callback function of the first application to send the shared content from the second device to the first application, so that the first application can process the shared content.

[0662] In the preceding embodiments of this application, a scheme for an electronic device (such as a PC or tablet, hereinafter referred to as electronic device A) to detect whether a device is approaching (such as touching) its own display screen was described, and the implementation method of detection based on screen parameters (such as capacitance parameters) was mainly described.

[0663] In a practical implementation, electronic device A can first determine that its display screen has been touched based on the detection data from the IMU. After confirming that its display screen has been touched, it increases the frequency of acquiring screen parameters and uses the screen parameters acquired at the increased frequency to detect whether any device is approaching its display screen. The method for detection based on screen parameters is described in detail in the previous embodiments and will not be repeated here.

[0664] It should be noted that electronic device A is a device that detects whether a device is near (e.g., touching) its own display screen, such as a PC or tablet. It can be the second electronic device in the embodiments of Figures 1 to 8, or the first device in the embodiments of Figures 9 to 24. Electronic device B is a device that is near the display screen of the electronic device, such as a mobile phone. It can be the first electronic device in the embodiments of Figures 1 to 8, or the second device in the embodiments of Figures 9 to 24. The screen parameters in the aforementioned embodiments can also be referred to as display screen detection data.

[0665] In a specific implementation, after electronic device A detects that the display screen has been touched via IMU detection data, it acquires first detection data of the display screen at a second frequency, and further determines that a device is approaching the display screen of electronic device A based on the first detection data. The second frequency is higher than the frequency at which the display screen detection data was acquired before the display screen of electronic device A was touched.

[0666] In some examples, the second frequency is the frequency at which electronic device A acquires detection data from the display screen when the integrated circuit (IC) of the display screen is in Active mode.

[0667] In some examples, before the display screen of electronic device A is touched, electronic device A can acquire detection data of the display screen at a first frequency, which is lower than a second frequency. The first frequency is the frequency at which electronic device A acquires detection data of the display screen when the display screen's IC is in half-Idle mode.

[0668] In some examples, before the display screen of electronic device A is touched, electronic device A can acquire detection data of the display screen via a third frequency, which is lower than the second frequency. The third frequency is the frequency at which electronic device A acquires detection data of the display screen when the display screen's IC is in Idle mode.

[0669] In some embodiments, electronic device A may use detection data from the device's IMU (such as the device's acceleration data) to detect that the display screen has been touched.

[0670] This triggers a switch from IDLE or semi-IDLE mode to active mode, which means switching the frequency at which the current detection data of the display screen is acquired (such as the third frequency or the first frequency) to the second frequency.

[0671] Optionally, the process of determining whether the touched object is the display screen can be, for example, by determining whether the touch is made in a direction away from the display screen. For example, as shown in Figure 25, two directions away from the display screen are illustrated by dashed arrows. It should be understood that these directions are merely illustrative and do not limit the actual touch direction. Optionally, if the waveform of the IMU detection data is identified to have specific waveform characteristics, it can be determined that the touched object is the display screen.

[0672] Specifically, touch detection can also be performed using the following process 1: Electronic device A continuously acquires raw three-axis acceleration data from the accelerometer within its IMU, and queues and caches this raw acceleration data for a period of time. Electronic device A extracts features from the queued cache data in real time using a preset algorithm. These features may include the mean, variance, and single-axis zero-crossing rate of the three-axis acceleration at each stage within the feature extraction time period. The feature extraction time period is a preset time period, divided into three segments corresponding to the pre-touch, during-touch, and post-touch stages, respectively. Feature analysis is then performed based on the data from these three stages. Afterward, electronic device A determines whether the calculated features match the characteristics of a touch on the front of the display screen (hereinafter referred to as the preset touch features). If the preset touch features are matched, a touch event is reported, and a command is sent to the TP chip to switch the display screen from Idle mode or semi-IDLE mode to Active mode.

[0673] Among them, electronic device A can perform feature extraction and feature analysis based on rules or machine learning (ML) models to determine whether the display screen has been touched.

[0674] For example, a preset time period of 80ms is used as a sliding window to analyze the acquired raw acceleration data. The step length of this sliding window is, for example, 2ms, to refine the feature extraction process. Thus, while continuously acquiring raw acceleration data through the IMU, electronic device A extracts the raw acceleration data for feature extraction from all the raw acceleration data according to the sliding window and step length. Then, during feature extraction, electronic device A acquires the raw acceleration data corresponding to the sliding window and divides this raw acceleration data into three stages: before touch, during touch, and after touch, at intervals of 20ms, 40ms, and 20ms respectively. Next, it analyzes whether the feature data of each stage meets the corresponding preset threshold (e.g., greater than or equal to the corresponding preset threshold). The analyzed feature data includes, for example, the mean and variance of acceleration along one or more axes (X-axis, Y-axis, Z-axis), and the single-axis zero-crossing rate of the Z-axis, each corresponding to a different preset threshold. The preset thresholds differ for different stages. In this design, the X-axis and Y-axis are parallel to one of the long and short sides of the display screen, respectively; for example, the X-axis is parallel to the long side, and the Y-axis is parallel to the short side. If all feature data meets a preset threshold, the raw acceleration data for that stage can be determined to conform to the preset touch characteristics. Therefore, if the raw acceleration data for all three stages conforms to the preset touch characteristics, a touch event moving away from the display screen can be detected, and the display can be switched from Idle mode or semi-IDLE mode to Active mode. It should be understood that the duration of the sliding window, the step length, and the division of the three stages (before, during, and after the touch) are merely illustrative and do not limit the implementation of the solution.

[0675] Specifically, touch detection can be performed using the following process 2: As shown in Figure 26, based on IMU detection data, it is detected whether there is a touch spike that meets the requirements. If a touch spike that meets the requirements is detected, the IMU detection data is segmented into actions and features are extracted. Based on rules or ML models, it is determined whether the touched object is the device's display screen. If the determination is successful, the touch event is reported, and a command is sent to the TP chip to switch the display screen from Idle mode or semi-IDLE mode to Active mode.

[0676] For example, after detecting a matching touch spike in the IMU data, electronic device A divides the IMU data corresponding to the touch spike into three stages: before touch, during touch, and after touch. Then, it performs feature analysis based on the data from these three stages. Afterward, electronic device A determines whether the calculated features match the characteristics of a touch on the front of the display screen through feature analysis. The specific calculation method is the same as described in process 1 above, and will not be repeated here.

[0677] In this way, electronic device A can determine whether the display screen has been touched based on IMU detection data through various methods.

[0678] For example, electronic device A acquires detection data of its display screen at a third frequency. During the acquisition of detection data at the third frequency, electronic device A detects that its display screen has been touched based on th...

Claims

1. A communication system, the communication system comprising a first electronic device and a second electronic device, characterized in that, The second electronic device is configured to send a first request message when a first condition is met, the first condition including detecting that a device is near the screen of the second electronic device; The first electronic device is configured to receive the first request message and, when a second condition is met, reply to the second electronic device with a first response message, wherein the second condition includes determining that the first electronic device is close to the second electronic device; The second electronic device is also configured to establish a communication link with the first electronic device based on the first response message.

2. The system as described in claim 1, characterized in that, The first condition also includes: the second electronic device is running a first preset application in the foreground.

3. The system as described in claim 2, characterized in that, The first preset application is a file management application, a gallery application, or a document application.

4. The system as described in claim 1, characterized in that, The first request message includes the account logged in on the second electronic device; The second condition also includes: the account logged in on the first electronic device and the account logged in on the second electronic device are the same account.

5. The system as described in claim 1, characterized in that, The second electronic device detects that a device is approaching the screen of the second electronic device, including: The second electronic device determines that a device is approaching the screen of the second electronic device based on the change in the capacitance parameter of the screen.

6. The system according to any one of claims 1-5, characterized in that, The first electronic device determines that it is near the second electronic device, including: The first electronic device determines that it has performed a preset action, and the distance between the first electronic device and the second electronic device is less than a set threshold. The preset action is an action that indicates that the first electronic device moves forward and then stops.

7. The system according to any one of claims 1-6, characterized in that, The second electronic device establishes a communication link with the first electronic device according to the first response message, including: After receiving the first response message, the second electronic device sends a link establishment request message to the first electronic device, which is used to request the establishment of a communication link with the first electronic device.

8. The system according to any one of claims 1-6, characterized in that, The second electronic device detects that a device is approaching the screen of the second electronic device, including: The second electronic device detects that a device is approaching an area on the screen of the second electronic device where content can be shared.

9. The system as described in claim 7, characterized in that, The second electronic device sends a connection establishment request message to the first electronic device, including: When the second electronic device meets the first preset condition, it sends a connection establishment request message to the first electronic device. The first preset condition includes at least one of the following: The first response message carries a first flag bit, which is used to indicate that the first electronic device has content that can be shared with the second electronic device; or the second electronic device has content that can be shared with the first electronic device.

10. The system as claimed in claim 1, characterized in that, The first response message is a link establishment request message, which is used to request the establishment of a communication link with the second electronic device; The second electronic device establishes a communication link with the first electronic device based on the first response message: The second electronic device establishes a communication link with the first electronic device based on the link establishment request message.

11. The system as claimed in claim 10, characterized in that, The second electronic device establishes a communication link with the first electronic device according to the link establishment request message: When the second electronic device meets the second set condition, it establishes a communication link with the first electronic device according to the link establishment request message. The second set condition includes at least one of the following: The first request message carries a second flag, which indicates that the second electronic device has content that can be shared with the first electronic device; or The first electronic device has content that can be shared with the second electronic device.

12. The system according to any one of claims 1-11, characterized in that, The first electronic device is a mobile phone, and the second electronic device is a personal computer, a vehicle terminal, or a tablet.

13. A communication system, the communication system comprising a first electronic device and a second electronic device, characterized in that, The first electronic device is configured to broadcast a second request message when a third condition is met, wherein the third condition includes the first electronic device determining that the first electronic device is near other electronic devices; The second electronic device is configured to receive the second request message and, when a fourth condition is met, reply to the first electronic device with a second response message, the fourth condition including detecting that a device is near the screen of the second electronic device; The first electronic device is further configured to establish a communication link with the second electronic device based on the second response message.

14. The system as described in claim 13, characterized in that, The first electronic device determines that it is near other electronic devices, including: The first electronic device determines that it has touched the screen of the other electronic device.

15. The system as described in claim 14, characterized in that, The first electronic device touching the screen of the other electronic device includes: The first electronic device touches the screen of the other electronic device along a first direction, the angle between the first direction and the first target direction is less than 90 degrees, and / or the angle between the first direction and the second target direction is less than 90 degrees, the first target direction is the direction from the bottom to the top of the first electronic device, and the second target direction is the direction perpendicular to the screen of the first electronic device and away from the screen.

16. The system as described in claim 13, characterized in that, The first electronic device is close to other electronic devices, including: The distance between the first electronic device and the second electronic device is detected to be less than a set threshold.

17. The system as claimed in claim 13, characterized in that, The second electronic device detects that a device is approaching the screen of the second electronic device, including: The second electronic device determines that a device is approaching the screen of the second electronic device based on the change in the capacitance parameter of the screen.

18. The system according to any one of claims 13-17, characterized in that, The fourth condition also includes at least one of the following conditions: The second electronic device is in an unlocked state; The second electronic device determines that the distance between itself and the device that sent the second request message is less than a preset distance.

19. The system according to any one of claims 13-18, characterized in that, When a device is detected approaching the first window of the second electronic device, and the first window includes shareable content, the second response message includes a second flag bit, which is used to indicate that the second electronic device has content that can be shared; The first electronic device is further configured to display a first animation effect when it is determined from the second flag bit that the second electronic device has content to share. The first animation effect is used to indicate that the first electronic device is about to receive the shared content sent by the second electronic device.

20. The system as described in claim 19, characterized in that, The second response message includes the account information logged in by the second electronic device; Specifically, the first electronic device is used to display the first animation when it is determined, based on the second response message, that the account information logged in by the second electronic device is the same as the account information logged in by the first electronic device, and when it is determined that the second electronic device has content that can be shared.

21. The system according to any one of claims 13-20, characterized in that, If the first electronic device meets the third condition and the window displayed by the first electronic device includes shareable content, the second request message includes a first flag bit, which is used to indicate that the first electronic device has content that can be shared. The second electronic device is further configured to, when the fourth condition is met and it is determined according to the first flag that the first electronic device has content to share, preload the second animation effect, and when it is determined that the account logged in by the second electronic device is the same as the account logged in by the first electronic device, play the second animation effect, wherein the second animation effect is used to indicate that the second electronic device is about to receive the shared content sent by the first electronic device.

22. The system according to any one of claims 13-21, characterized in that, The second electronic device is further configured to, upon receiving the second request message and determining that the second electronic device has content to share, preload a third animation effect, and, upon determining that the account logged in by the second electronic device is the same as the account logged in by the first electronic device, play the third animation effect, wherein the third animation effect is used to indicate that the second electronic device is about to send shared content to the first electronic device.

23. The system according to any one of claims 13-22, characterized in that, The second response message is a Wi-Fi action frame.

24. The system as claimed in claim 23, characterized in that, The first electronic device is also used to enable listening to Wi-Fi action frames after determining that the third condition is met.

25. The system according to any one of claims 13-24, characterized in that, The first electronic device is further configured to, upon receiving the second response message, if it determines that the first electronic device has content to share, send a link establishment request message to the second electronic device, the link establishment request message being used to request the establishment of a communication link with the second electronic device.

26. The system as described in claim 20, characterized in that, The first electronic device is further configured to send a connection request message to the second electronic device when it is determined that the account information logged in by the second electronic device is the same as the account information logged in by the first electronic device, and the first electronic device has content to share.

27. The system as claimed in claim 20, characterized in that, Specifically, the first electronic device is used to display a fourth animation effect when it is determined that the account information logged in by the second electronic device is the same as the account information logged in by the first electronic device, and when it is determined that the first electronic device has content to share. The fourth animation effect is used to indicate that the first electronic device is about to send shared content.

28. The system according to any one of claims 13-27, characterized in that, The first electronic device is further configured to send a third response message to the second electronic device after receiving the second response message, the third response message including the account information logged in by the first electronic device; The second electronic device is further configured to, based on the third response message, determine that the account information logged in by the first electronic device is the same as the account information logged in by the second electronic device, and that the second electronic device has content to share, send a link establishment request message to the first electronic device, wherein the link establishment request message is used to request the establishment of a communication link with the first electronic device.

29. The system as described in claim 28, characterized in that, The second electronic device is further configured to, based on the third response message, determine that the account information logged in by the first electronic device is the same as the account information logged in by the second electronic device, and that neither the first electronic device nor the second electronic device has any content to share, display a fifth animation effect, the fifth animation effect being used to indicate that there is no content to share.

30. The system according to any one of claims 13-29, characterized in that, The second request message is a Bluetooth broadcast message; The second electronic device is also configured to increase the Bluetooth signal scanning duty cycle of the second electronic device when a device is detected approaching the screen of the second electronic device.

31. The system as described in claim 28, characterized in that, The third response message is a Wi-Fi action frame; The second electronic device is also used to, upon receiving the second request message, start listening for Wi-Fi action frames.

32. A device connection method, characterized in that, Applied to a first electronic device, the method includes: The first electronic device receives a first request message and, when a second condition is met, replies to the second electronic device with a first response message. The second condition includes determining that the first electronic device is close to the second electronic device. The first request message is sent by the second electronic device when the first condition is met. The first condition includes detecting that a device is close to the screen of the second electronic device. The first electronic device establishes a communication link with the second electronic device.

33. The method as described in claim 32, characterized in that, The second condition also includes: the account logged in on the first electronic device and the account logged in on the second electronic device are the same account.

34. The method as described in claim 32 or 33, characterized in that, The first electronic device determines that it is near the second electronic device, including: The first electronic device determines that it has performed a preset action, and the distance between the first electronic device and the second electronic device is less than a set threshold. The preset action is an action that indicates that the first electronic device moves forward and then stops.

35. A device connection method, characterized in that, Applied to a second electronic device, the method includes: When the second electronic device meets the first condition, it sends a first request message, the first condition including detecting that a device is near the screen of the second electronic device; The second electronic device receives a first response message sent by the first electronic device. The first response message is sent by the first electronic device when it receives the first request message and meets a second condition, the second condition including determining that the first electronic device is close to the second electronic device. The second electronic device establishes a communication link with the first electronic device based on the first response message.

36. The method as described in claim 35, characterized in that, The first condition also includes: the second electronic device is running a first preset application in the foreground.

37. The method as described in claim 35, characterized in that, The second electronic device detects that a device is approaching the screen of the second electronic device, including: The second electronic device determines that a device is approaching the screen of the second electronic device based on the change in the capacitance parameter of the screen.

38. The method according to any one of claims 35-37, characterized in that, The second electronic device establishes a communication link with the first electronic device according to the first response message, including: After receiving the first response message, the second electronic device sends a link establishment request message to the first electronic device, which is used to request the establishment of a communication link with the first electronic device.

39. The method according to any one of claims 35-37, characterized in that, The second electronic device detects that a device is approaching the screen of the second electronic device, including: The second electronic device detects that a device is approaching an area on the screen of the second electronic device where content can be shared.

40. The method as described in claim 38, characterized in that, The second electronic device sends a connection establishment request message to the first electronic device, including: When the second electronic device meets the first preset condition, it sends a connection establishment request message to the first electronic device. The first preset condition includes at least one of the following: The first response message carries a first flag bit, which is used to indicate that the first electronic device has content that can be shared with the second electronic device; or the second electronic device has content that can be shared with the first electronic device.

41. The method as described in claim 35, characterized in that, The first response message is a chain establishment request message; The second electronic device establishes a communication link with the first electronic device according to the first response message, including: The second electronic device establishes a communication link with the first electronic device based on the link establishment request message.

42. The method as described in claim 41, characterized in that, The second electronic device establishes a communication link with the first electronic device according to the link establishment request message, including: When the second electronic device meets the second set condition, it establishes a communication link with the first electronic device according to the link establishment request message. The second set condition includes at least one of the following: The first request message carries a second flag bit, which is used to indicate that the second electronic device has content that can be shared with the first electronic device; or the first electronic device has content that can be shared with the second electronic device.

43. A device connection method, characterized in that, Applied to a first electronic device, the method includes: When the first electronic device meets the third condition, it sends a second request message, the third condition including the first electronic device determining that it is near other electronic devices; The first electronic device receives a second response message, which is a reply from the second electronic device to the first electronic device when a fourth condition is met, the fourth condition including detecting that a device is near the screen of the second electronic device; The first electronic device establishes a communication link with the second electronic device based on the second response message.

44. The method as described in claim 43, characterized in that, The first electronic device determines that it is near other electronic devices, including: The first electronic device determines that it has touched the screen of the other electronic device.

45. The method as described in claim 44, characterized in that, The first electronic device touching the screen of the other electronic device includes: The first electronic device touches the screen of the other electronic device along a first direction, the angle between the first direction and the first target direction is less than 90 degrees, and / or the angle between the first direction and the second target direction is less than 90 degrees, the first target direction is the direction from the bottom to the top of the first electronic device, and the second target direction is the direction perpendicular to the screen of the first electronic device and away from the screen.

46. ​​The method as described in claim 43, characterized in that, The first electronic device is close to other electronic devices, including: The distance between the first electronic device and the second electronic device is detected to be less than a set threshold.

47. The method according to any one of claims 43-46, characterized in that, The second response message includes the account information logged in by the second electronic device; The method further includes: if the first electronic device determines, based on the second response message, that the account information logged in by the second electronic device is the same as the account information logged in by the first electronic device, and determines that the second electronic device has content to share, then the first electronic device displays a first animation effect, wherein the first animation effect is used to indicate that the first electronic device is about to receive the shared content sent by the second electronic device.

48. The method as described in claim 47, characterized in that, The method further includes: If the first electronic device determines that the account information logged in by the second electronic device is the same as the account information logged in by the first electronic device, and the first electronic device has content to share, then the first electronic device sends a connection request message to the second electronic device.

49. The method according to any one of claims 43-48, characterized in that, Before sending the second request message, the method further includes: detecting the proximity of the first display screen of the second electronic device; After establishing the communication link, the method further includes: receiving first shared content sent by the second electronic device through the communication link, wherein the first shared content is determined according to a first window, and the first window is the window on the first display screen in which the first electronic device is close.

50. The method as described in claim 49, characterized in that, The first shared content includes at least one of the following: The first content in the first window; or, First information used to indicate the first content; or... The second information indicated by the first content.

51. The method as described in claim 50, characterized in that, Receiving the first shared content sent by the second electronic device, including: Receive first information sent by the second electronic device to indicate the first content, and display the first information; Upon detecting a user operation that triggers the retrieval of the first content, a request message is sent to the second electronic device, the request message being used to request the first content; Receive the first content sent by the second electronic device.

52. The method as described in claim 50, characterized in that, Receiving the first shared content sent by the second electronic device, including: Receive first information sent by the second electronic device to indicate the first content, and display the first information; If no user operation to trigger the acquisition of the first content is detected, and proximity to the first display screen is detected again, the third information sent by the second electronic device to indicate the second content is received, and the display of the first information is switched to display of the third information; The second content is the content in the second window, and the second window is the window that the first electronic device approaches when it is detected to be near the first display screen again. The second window and the first window belong to the same application or different applications.

53. The method as described in claim 52, characterized in that, In the absence of a detected user action to trigger the retrieval of the first content, the communication link between the second electronic device and the first electronic device remains uninterrupted, and the receipt of third information sent by the second electronic device indicating the second content includes: The third information sent by the second electronic device, which indicates the second content, is received through the communication link.

54. The method as described in claim 53, characterized in that, The first information used to indicate the first content includes: preview information of the first content; The third information used to indicate the second content includes: preview information of the second content.

55. The method as described in claim 54, characterized in that, The preview information of the first content is a preview image of the first content; The preview information for the second content is a preview image of the second content.

56. A device connection method, characterized in that, Applied to a second electronic device, the method includes: The second electronic device receives a second request message, which is broadcast by the first electronic device when a third condition is met. The third condition includes the first electronic device determining that it is near other electronic devices. When the fourth condition is met, the second electronic device replies to the first electronic device with a second response message, the fourth condition including detecting that a device is near the screen of the second electronic device; The second electronic device establishes a communication link with the first electronic device.

57. The method as described in claim 56, characterized in that, The second electronic device detects that a device is approaching the screen of the second electronic device, including: The second electronic device determines that a device is approaching the screen of the second electronic device based on the change in the capacitance parameter of the screen.

58. The method as described in claim 56 or 57, characterized in that, The second request message includes a first flag bit, which is used to identify that the first electronic device has content that can be shared; The method further includes: when the second electronic device satisfies the fourth condition and determines that the first electronic device has content to share according to the first flag bit, it preloads the second animation effect, and when it is determined that the account logged in by the second electronic device is the same as the account logged in by the first electronic device, it plays the second animation effect, wherein the second animation effect is used to indicate that the second electronic device is about to receive the shared content sent by the first electronic device.

59. The method according to any one of claims 56-58, characterized in that, The method further includes: When the second electronic device receives the second request message and determines that it has content to share, it preloads a third animation effect. When it determines that the account logged in by the second electronic device is the same as the account logged in by the first electronic device, it plays the third animation effect. The third animation effect is used to indicate that the second electronic device is about to send shared content to the first electronic device.

60. The method according to any one of claims 56-59, characterized in that, The method further includes: After sending the second response message, the second electronic device receives a third response message sent by the first electronic device, the third response message including the account information logged in by the first electronic device; If the second electronic device determines, based on the third response message, that the account information logged in by the first electronic device is the same as the account information logged in by the second electronic device, and that the second electronic device has content to share, then the second electronic device sends a link establishment request message to the first electronic device. The link establishment request message is used to request the establishment of a communication link with the first electronic device.

61. The method according to any one of claims 56-60, characterized in that, Before replying to the first electronic device with the second response message, the method further includes: detecting that the first electronic device is close to the first display screen of the second electronic device; After establishing the communication link, the following also includes: The first shared content is sent to the first electronic device via the communication link, the first shared content being determined according to the first window; and / or The second shared content sent by the first electronic device is received through the communication link, and the second shared content is processed through the first application to which the first window belongs; The first window is the window on the first display screen where the first electronic device is located.

62. The method as described in claim 61, characterized in that, The first shared content includes at least one of the following: The first content in the first window; or, First information used to indicate the first content; or... The second information indicated by the first content.

63. The method as described in claim 61 or 62, characterized in that, The first window is one of N windows on the first display screen, where N is an integer greater than or equal to 2.

64. The method according to any one of claims 61-63, characterized in that, The first window is a non-focus window.

65. The method as described in claim 62, characterized in that, Sending first shared content to the first electronic device, including: Send first information to the first electronic device to indicate the first content; Upon receiving a request message from the first electronic device, the first content is sent to the first electronic device, wherein the request message is used to request the first content.

66. The method as described in claim 62, characterized in that, Sending first shared content to the first electronic device, including: Send first information to the first electronic device to indicate the first content; If no request message is received from the first electronic device, the first content will not be sent to the first electronic device, wherein the request message is used to request the first content.

67. The method as described in claim 66, characterized in that, The method further includes: The first electronic device was detected to be near the first display screen again; Send a third sharing content to the first electronic device. The third sharing content is determined based on a second window, which is the window that the first electronic device is close to when it is detected to be close to the first display screen again. The second window and the first window belong to the same application or different applications.

68. The method as described in claim 67, characterized in that, If the second electronic device does not receive a request message from the first electronic device, the second electronic device does not interrupt the communication link between the second electronic device and the first electronic device, and the third sharing content is sent through the communication link.

69. The method according to any one of claims 65-68, characterized in that, The first information used to indicate the first content includes: Preview information for the first content.

70. The method as described in claim 69, characterized in that, The preview information for the first content is a preview image of the first content.

71. The method according to any one of claims 61-70, characterized in that, Before sending the first shared content to the first electronic device, the method includes: The first shared content in the first window is obtained from the first application, where the first application is the application to which the first window belongs.

72. The method as described in claim 71, characterized in that, The step of obtaining the first shared content from the first application in the first window includes: The callback function of the first window is invoked, and the callback function is used to trigger the first application to provide the first shareable content in the first window.

73. The method according to any one of claims 61-72, characterized in that, Before sending the first shared content to the first electronic device, the method further includes: Get the first shared content in the first display element, where the first display element is the display element in the first window that the first electronic device is close to.

74. The method as described in claim 73, characterized in that, The step of obtaining the first shared content in the first display element includes: The callback function of the first display element is invoked. The callback function is used to trigger the first application to provide the first shareable content in the first display element. The first application is the application to which the first window belongs.

75. The method according to any one of claims 61-74, characterized in that, The process of processing the second shared content through the first application to which the first window belongs includes: The second shared content is displayed in the first window through the first application.

76. The method according to any one of claims 61-75, characterized in that, After receiving the second shared content sent by the first electronic device, the method further includes: The first electronic device was detected to be near the first display screen again; The system receives the fourth shared content sent by the first electronic device, processes the fourth shared content through the second application to which the third window belongs, and the third window is the window that the first electronic device approaches when it is detected that the first electronic device is approaching the first display screen again. The third window and the first window are either windows of the same application or windows of different applications.

77. The method according to any one of claims 61-76, characterized in that, The process of processing the second shared content through the first application to which the first window belongs includes: Send the second shared content to the first application so that the first application processes the second shared content within the first window.

78. The method as described in claim 77, characterized in that, Sending the second shared content to the first application includes: The callback function of the first window is invoked, and the callback function is used to send the second shared content to the first application.

79. The method according to any one of claims 61-76, characterized in that, The process of processing the second shared content through the first application to which the first window belongs includes: The second shared content is sent to the first application so that the first application processes the second shared content in a first display element within the first window, wherein the first display element is the display element within the first window in which the first electronic device is located.

80. The method as described in claim 79, characterized in that, Sending the second shared content to the first application includes: The callback function of the first display element is invoked, and the callback function is used to send the second shared content to the first application.

81. The method according to any one of claims 61-80, characterized in that, The method further includes: If the first window is not the focus window, then switch the first window to the focus window.

82. The method as described in claim 81, characterized in that, Switching the first window to the focus window includes: A virtual event is generated for the first window, which is used to trigger the first window to switch to the focus window.

83. An electronic device, characterized in that, The electronic device includes a transceiver; a processor; a memory; and one or more computer programs; The one or more computer programs are stored in the one or more memories, and the one or more computer programs include instructions that, when invoked and executed by the one or more processors, cause the electronic device to perform the method described in any one of 32 to 55 or the method described in any one of 56 to 82.