Network sharing method and electronic device
Through the use of virtual network card interception and trusted device list, the network sharing service of the second electronic device is automatically triggered, which solves the problem of untimely network sharing in the existing technology and improves the user experience.
Patent Information
- Application Number
- CN202310691856.7
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2023-06-12
- Publication Date
- 2024-09-20
- Estimated Expiration
- 2043-06-12
AI Technical Summary
In the existing technology, the second electronic device cannot automatically identify when the user of the first electronic device needs network sharing, resulting in untimely network sharing and affecting the user experience.
Intercept the Internet access request of the first electronic device through the virtual network card, search the trusted device list, and send a network sharing request to the second electronic device, automatically triggering it to start the network sharing service, ensuring that the first electronic device obtains a network connection in a timely manner.
It realizes real-time network sharing of the first electronic device, improves user experience, and avoids manual operation delays and unnecessary network sharing service startup problems.
Smart Images

Figure CN117715050B
Abstract
Description
Technical Field
[0001] The present application relates to the field of terminal technology, and in particular to a network sharing method and electronic device. Background Art
[0002] The network sharing service refers to the second electronic device sharing its own cellular network or Wi-Fi with the surrounding first electronic devices, so that the first electronic devices have the ability to access the Internet to meet the network usage needs of the users of the first electronic devices.
[0003] To implement the network sharing service, the user often connects the second electronic device to a cellular network or Wi-Fi, manually turns on the shared network service of the second electronic device, and then enables the second electronic device to start network sharing with the first electronic device.
[0004] However, this method requires the user of the second electronic device to manually open the network sharing operation. However, since the second electronic device cannot identify when the user of the first electronic device needs to use the network, this will cause the first electronic device to open the network sharing in time, resulting in a poor user experience. Summary of the invention
[0005] The purpose of this application is to provide a network sharing method and electronic device to enhance user experience.
[0006] In a first aspect, the present application provides a network sharing method, the method comprising:
[0007] When the virtual network card intercepts the Internet access request of the first electronic device, a device search is performed to obtain a list of trusted devices; the virtual network card is pre-registered by the first electronic device and is used to intercept Internet access requests when the first electronic device has no available network; a second electronic device that can provide network sharing is determined from the trusted device list, and a network sharing request is sent to the second electronic device to share the network of the second electronic device to access the Internet, and the network sharing request is used to enable the second electronic device to start the network sharing service. In this implementation method, the first electronic device automatically triggers the second electronic device to start the network sharing service, and the second electronic device does not need to actively start the network sharing service, so the real-time performance is high, and timely network sharing can be achieved for the user of the first electronic device, thereby improving the user experience.
[0008] In one feasible method, first obtain an Internet access request and detect the current available network status. If the current available network status is no available network, trigger the virtual network card to intercept the Internet access request; when the virtual network card intercepts the Internet access request of the first electronic device, perform a device search to obtain a list of trusted devices. In this way, when the first electronic device has no available network, it triggers the second electronic device to open network sharing and share its own network with the second electronic device. When the first electronic device has an available network, the network of the first electronic device itself is used to meet the Internet access demand.
[0009] In another achievable manner, a device search is performed to add surrounding devices that meet the following conditions into the trusted device list: the same network sharing service account as the first electronic device is logged in, WLAN is turned on, and Bluetooth is turned on. At this time, when the first electronic device and the second electronic device are performing collaborative services, the network sharing service can be directly triggered.
[0010] Optionally, a p2p physical channel is created with a second electronic device; a default gateway is configured, and a network sharing request is sent to the second electronic device through the p2p physical channel, wherein the network sharing request is also used to enable the second electronic device to configure a proxy gateway; and the network of the second electronic device is shared through the default gateway.
[0011] Optionally, when there are multiple online electronic devices that can provide network sharing in the trusted device list, the network signal strength values of the multiple online electronic devices are obtained; the maximum network signal strength value is selected from the network signal strength values of the multiple online electronic devices, and the online electronic device corresponding to the maximum network signal strength value is used as the second electronic device. In this way, the signal strength of the network is improved during network sharing.
[0012] Optionally, after the virtual network card intercepts the network logoff request of the first electronic device, it sends a network sharing disconnection request to the second electronic device to disconnect the shared network with the second electronic device. The network sharing disconnection request is used to disconnect the second electronic device from the network sharing service.
[0013] Alternatively, when the virtual network card intercepts and does not receive an Internet access request from the first electronic device within a preset time period, it sends a network sharing disconnection request to the second electronic device to disconnect the shared network with the second electronic device. The network sharing disconnection request is used to disconnect the second electronic device from the network sharing service.
[0014] In this way, the network sharing service can be automatically turned off to improve the user experience.
[0015] In a second aspect, an embodiment of the present application provides a network sharing method, the method comprising:
[0016] After receiving the network sharing request sent by the first electronic device, the second electronic device starts the network sharing service and shares its own network with the first electronic device; the network sharing request is sent by the first electronic device after determining from the trusted device list that the second electronic device can provide network sharing, and the trusted device list is obtained by searching for devices after the virtual network card of the first electronic device intercepts the Internet access request of the first electronic device, and the virtual network card is pre-registered by the first electronic device and is used to intercept Internet access requests when the first electronic device has no available network.
[0017] In this implementation, the first electronic device automatically triggers the second electronic device to start the network sharing service, and the second electronic device does not need to actively start the network sharing service. Therefore, the real-time performance is high, and the user of the first electronic device can achieve timely network sharing, thereby improving the user experience.
[0018] In one achievable method, upon receiving a network sharing request sent by a first electronic device through a p2p physical channel, the second electronic device starts a network sharing service and configures a proxy gateway. The p2p physical channel is a physical channel created by the first electronic device and the second electronic device; through the proxy gateway, the second electronic device shares its own network with the first electronic device.
[0019] In one achievable approach,
[0020] After receiving the disconnection network sharing request sent by the first electronic device, the shared network with the first electronic device is disconnected. The disconnection network sharing request is sent by the virtual network card of the first electronic device after intercepting the network disconnection request, and is used to disconnect the network sharing service.
[0021] In one achievable approach,
[0022] After receiving a disconnection request from the first electronic device, the shared network with the first electronic device is disconnected. The disconnection of the network sharing service is sent after the virtual network card of the first electronic device fails to intercept the network disconnection request within a preset time period, and is used to disconnect the network sharing service. In a third aspect, the present application provides an electronic device, the electronic device includes a memory and a processor, the memory is coupled to the processor; the memory stores a program, and when the program is executed by the processor, the electronic device executes any one of the methods in the first aspect or the second aspect. BRIEF DESCRIPTION OF THE DRAWINGS
[0023] Figure 1 This is a schematic diagram of the application scenarios for currently implementing network sharing services;
[0024] Figure 2 A schematic diagram of an application scenario for implementing a network sharing service is provided for an embodiment of the present application;
[0025] Figure 3 An interactive diagram of a network sharing method provided in an embodiment of the present application;
[0026] Figure 4 A schematic diagram of implementing manual selection of a second electronic device provided in an embodiment of the present application;
[0027] Figure 5 A usage scenario diagram for a network sharing service;
[0028] Figure 6 A schematic diagram of a network sharing method provided in an embodiment of the present application;
[0029] Figure 7 A schematic diagram for prompting a user to share a mobile phone network;
[0030] Figure 8 A schematic diagram of the hardware structure of an electronic device provided in an embodiment of the present application;
[0031] Fig. 9 A schematic diagram of the software structure of an electronic device provided in an embodiment of the present application. DETAILED DESCRIPTION
[0032] First, the professional terms involved in the embodiments of the present application are introduced:
[0033] Network sharing service: refers to the second electronic device sharing its own cellular network or Wi-Fi with the surrounding first electronic devices, so that the first electronic devices have the ability to access the Internet, thereby meeting the network usage needs of the users of the first electronic devices.
[0034] The implementation of Wi-Fi is taken as an example for explanation.
[0035] See also Figure 1 , which is a schematic diagram of the application scenarios for currently implementing network sharing services.
[0036] Figure 1 (a) of FIG. 1 illustrates a first electronic device 1001 and a second electronic device 1002 , wherein the second electronic device 1002 is connected to Wi-Fi.
[0037] Figure 1 (b) shows that the user manually clicks the shared network application (Application, App) button of the second electronic device 1002 to start the network sharing operation. When the user clicks the Internet App button of the first electronic device 1001 to generate an Internet access request, the first electronic device 1001 cannot access the Internet because there is no available network. And the second electronic device 1002 cannot recognize the Internet access request of the user of the first electronic device 1001.
[0038] Figure 1 (c) in the figure illustrates that after the user manually clicks the shared network App button of the first electronic device 1001, the first electronic device 1001 is selected on the second electronic device 1002 for network sharing, so that the second electronic device 1002 shares its own Wi-Fi with the first electronic device 1001, allowing the first electronic device 1001 to access the Internet.
[0039] Figure 1 (d) in FIG. 1 illustrates that the first electronic device 1001 shares the Wi-Fi network of the second electronic device 1002 so that it can use the network.
[0040] However, this method requires the user of the second electronic device to manually turn on the network sharing. And because the second electronic device cannot automatically identify when the user of the first electronic device needs to use the network, it can only rely on the user to manually turn on the network sharing service of the first electronic device when he wants to go online to achieve network sharing. This will cause the first electronic device to not turn on the network sharing service in time, resulting in a poor user experience. In some scenarios, because the second electronic device does not turn on the network sharing service for the first electronic device in time, it may even cause the first electronic device to be unable to use the network.
[0041] Based on this, an embodiment of the present application provides a method for network sharing. When the first electronic device has no available network, the first electronic device intercepts the Internet access request using a pre-registered virtual network card, performs a device search to obtain a list of trusted devices, and obtains the second electronic device from the list of trusted devices. The first electronic device sends a network sharing request to the second electronic device. After the second electronic device receives the network sharing request, it turns on the network sharing service, so that the first electronic device shares the network of the second electronic device, thereby enabling the first electronic device to meet the user's Internet access needs. In this implementation method, the first electronic device automatically triggers the second electronic device to turn on the network sharing service, and the second electronic device does not need to actively turn on the network sharing service. Therefore, the real-time performance is high, and timely network sharing can be achieved for the user of the first electronic device, thereby improving the user experience.
[0042] See also Figure 2 , which is a schematic diagram of an application scenario for implementing a network sharing service in an embodiment of the present application.
[0043] Figure 2 (a) of FIG. 1 illustrates the operation interfaces of the first electronic device 2001 and the second electronic device 2002 .
[0044] Among them, the second electronic device 2002 is connected to Wi-Fi, and the first electronic device 2001 has no available network.
[0045] The Bluetooth of the first electronic device 2001 and the second electronic device 2002 are both turned on, and the shared network service is not turned on.
[0046] Internet App Figure 2 (b) shows that when the user performs an opening operation on the Internet App of the first electronic device, since the first electronic device 2001 has no available network, that is, cannot access the Internet, a pop-up message will appear. Figure 2 The trust circle shown in (c).
[0047] Figure 2 The trust ring illustrated in (c) is also called a trusted device list identifier, and the device identifiers in the trust ring are used to represent online electronic devices in the trusted device list that can provide network sharing. Figure 2 (c) shows the device identifier 2002a of the second electronic device 2002 and the device identifier 2001a of the first electronic device 2001, as well as other device identifiers that can provide a shared network.
[0048] When the user clicks the device identification 2002a of the second electronic device on the trust ring, or the user drags the device identification 2002a of the second electronic device to the device identification 2001a of the first electronic device 2001, the network sharing service is automatically triggered, and the network sharing service is obtained. Figure 2 The result shown in (d) is that the shared network of the first electronic device 2001 and the shared network of the second electronic device 2002 are opened.
[0049] Final Implementation Figure 1 The first electronic device illustrated in (d) shares the Wi-Fi network of the second electronic device so that it can use the network.
[0050] At this time, the first electronic device obtains the user's Internet access request and can start the network sharing service of the first electronic device and the second electronic device. This process does not require the user of the second electronic device to manually start the network sharing, nor does it require the second electronic device to identify when the user of the first electronic device uses the network, and it does not require the user of the first electronic device to manually start the network sharing, thus avoiding the technical problem of the first electronic device not starting the network sharing in time and improving the user experience.
[0051] The network sharing method provided in the embodiment of the present application is introduced in detail below.
[0052] See also Figure 3 , is an interactive diagram of a network sharing method provided in an embodiment of the present application. The method specifically includes:
[0053] S301: The first electronic device obtains a user's request to access the Internet.
[0054] The Internet access request is used to indicate that the user of the first electronic device has an Internet access demand. The first electronic device may obtain the user's Internet access request only once when the Internet access App of the first electronic device is opened, or may continuously obtain the Internet access request after the Internet access App of the first electronic device is opened. This application does not limit the method of obtaining the Internet access request.
[0055] The opening operation can be a contact operation of clicking the Internet App button, or a non-contact operation of opening the Internet App button by eye movement, language, or gesture. This application does not limit the specific form of the opening operation.
[0056] S302: The first electronic device monitors the current available network status.
[0057] A connectivity manager (CM) of the first electronic device may monitor a current available network status of the first electronic device.
[0058] The current available network status includes available network and no available network. Available network means there is a cellular network or Wi-Fi connection. No available network means there is no cellular network and Wi-Fi is not connected.
[0059] Specifically: when CM detects that the first electronic device has a cellular network or Wi-Fi connection, the first electronic device has an available network and can use its own cellular network or Wi-Fi connection to meet the user's Internet access needs. When CM detects that the first electronic device does not have a cellular network and does not have a Wi-Fi connection, the first electronic device has no available network and cannot use its own network to meet the user's Internet access needs.
[0060] S303: If the current available network status is no available network, the virtual network card intercepts the Internet access request.
[0061] A virtual network card is a software-simulated network card, which is used to simulate a real network card capable of accessing the Internet through software. It is pre-registered by the first electronic device. When the first electronic device has no available network, it intercepts Internet access requests and obtains the Internet access intention of the user of the first electronic device.
[0062] Optionally, each time the first electronic device is powered on, it first creates a virtual network card and registers the virtual network card with the CM, so as to intercept Internet access requests and obtain the user's Internet access intention when the first electronic device has no available network.
[0063] Optionally, when the electronic device is turned off, the virtual network card is cleared to prevent the last network sharing service from affecting the next network sharing service.
[0064] S304: The first electronic device performs a device search to obtain a trusted device list.
[0065] The trusted device list contains at least one online electronic device that can provide network sharing for the first electronic device.
[0066] In one practicable manner, the online electronic devices in the trusted device list may be devices around the first electronic device that meet the following conditions: the same network sharing service account as the first electronic device is logged in, WLAN is turned on, and Bluetooth is turned on. It is understandable that the devices in the trusted device list are devices that can perform multi-device collaboration with the first electronic device.
[0067] At this time, after the virtual network card intercepts the Internet access request, the first electronic device searches for devices and obtains a list of trusted devices. Specifically, the device manager of the first electronic device monitors the devices around the first electronic device and includes devices that have the same network sharing service account as the first electronic device, have WLAN turned on, and have Bluetooth turned on in the list of trusted devices. Optionally, the list of trusted devices can be displayed on the screen display interface of the first electronic device, such as Figure 2 The display method shown.
[0068] In another achievable manner, the online electronic devices in the trusted device list may be devices around the first electronic device that meet the following conditions: WLAN is turned on and the personal hotspot is turned on.
[0069] At this time, after the virtual network card intercepts the Internet access request, the device manager of the first electronic device will monitor the devices around the first electronic device, and add the devices that meet the requirements of WLAN being turned on and personal hotspot being turned on to the trusted device list.
[0070] The devices around the first electronic device refer to devices whose distances from the first electronic device are within a preset distance range.
[0071] S305: The first electronic device obtains the second electronic device from the trusted device list, and sends a network sharing request to the second electronic device.
[0072] There are many ways to obtain the second electronic device from the trusted device list.
[0073] The first method: automatically acquiring the second electronic device.
[0074] When there is an online electronic device in the trusted device list that can provide network sharing for the first electronic device, the online electronic device is the second electronic device.
[0075] When there are multiple online electronic devices in the trusted device list that can provide network sharing for the first electronic device, the first electronic device can automatically obtain the network signal strength values of the multiple online electronic devices and use the online electronic device corresponding to the maximum network signal strength value as the second electronic device.
[0076] The second method: manually selecting the second electronic device.
[0077] When the trusted device list is displayed on the screen display interface of the first electronic device, the user can manually select an online electronic device as the second electronic device on the screen display interface. For example, the user selects the online electronic device on the screen display interface that he clicks as the second electronic device.
[0078] Example description: See Figure 4 , is a schematic diagram of an implementation of manually selecting a second electronic device provided in an embodiment of the present application. Figure 4 (a) illustrates a multi-device collaborative display interface, with the device identifier 4001a of 4001 at the center of the collaborative display interface, and the first mobile phone identifier 4002a, the second mobile phone identifier 4003a and the third mobile phone identifier 4004a corresponding to the surrounding online electronic devices, the first mobile phone 4002 (Wi-Fi connection), the second mobile phone 4003 (cellular network) and the third mobile phone 4004 (cellular network). That is, the trusted device list includes three online electronic devices, namely the first mobile phone 4002, the second mobile phone 4003, and the third mobile phone 4004. When the user drags the first mobile phone identifier 4002a to, or clicks the first mobile phone identifier 4002a in the multi-device collaborative display interface, and determines that the second electronic device is the first mobile phone, pc4001 shares the network of the first mobile phone, and (b) illustrates that the first electronic device 4001 shares the Wi-Fi connection of the first mobile phone 4002.
[0079] In addition, the embodiment of the present application may also obtain the second electronic device from the trusted device list in other ways, and the embodiment of the present application does not specifically limit the way of obtaining the second electronic device.
[0080] After the first electronic device obtains the second electronic device from the trusted device list, the first electronic device sends a network sharing request to the second electronic device. The network sharing request is used to enable the second electronic device to start a network sharing service.
[0081] In the embodiment of the present application, the first electronic device may send a network sharing request to the second electronic device in a variety of ways.
[0082] For example, the first electronic device and the second electronic device have a preset physical channel, and the first electronic device sends a network sharing request to the second electronic device through the preset physical channel. The preset physical channel may be a physical channel saved by the first electronic device when the first electronic device last shared the network with the second electronic device.
[0083] For another example: when the virtual network card intercepts an Internet access request, the virtual network card opens the network sharing service of the first electronic device, and the first network sharing service calls the communication module to create a p2p physical channel and session protocol with the communication module of the second electronic device. The first electronic device sends a network sharing request to the second electronic device through the p2p physical channel according to the session protocol.
[0084] This application does not limit the specific sending method.
[0085] S306: The second electronic device receives the network sharing request and shares its own network with the first electronic device.
[0086] After receiving the network sharing request sent by the first electronic device, the second electronic device shares its own network with the first electronic device. Exemplary description: the network of the second electronic device is Wi-Fi, and the second electronic device shares its own Wi-Fi with the second electronic device.
[0087] Optionally, after receiving the network sharing request, the second electronic device opens its own network sharing service. The network sharing service of the first electronic device is connected to the network sharing service of the second electronic device, and shares its own network with the first electronic device.
[0088] Optionally, when the second electronic device receives the network sharing request, the first electronic device configures a default gateway and a domain name resolution system (Domain Name System, DNS). In the embodiment of the present application, the default gateway refers to the gateway designated by the first electronic device by default, which is used to receive network data packets and process network data packets when the first electronic device has no available gateway. DNS refers to the mapping of domain names to the IP addresses of the second electronic device.
[0089] After receiving the network sharing request, the second electronic device opens its own network sharing service and configures a proxy gateway, which includes its own IP forwarding, its own DNS forwarding, Network Address Translation (NAT), Address Resolution Protocol (ARP) proxy and traffic statistics.
[0090] The first electronic device receives a network data packet corresponding to an Internet access request through a default gateway, and forwards the network data packet to a proxy gateway, which forwards the network data packet to a second electronic device, so that the first electronic device shares the network of the second electronic device.
[0091] The embodiment of the present application provides a network sharing method, and as long as the first electronic device obtains the user's Internet access request, the network sharing service of the first electronic device and the second electronic device can be enabled. This process does not require the user of the second electronic device to manually enable the network sharing, nor does it require the second electronic device to identify when the user of the first electronic device uses the network, and it does not require the user of the first electronic device to manually enable the network sharing, thereby avoiding the technical problem of the first electronic device not enabling the network sharing in time and improving the user experience.
[0092] Optionally, an embodiment of the present application also provides a network sharing method for logging off the network.
[0093] In one practicable manner, when the virtual network card of the first electronic device intercepts the network logout request of the first electronic device, it sends a disconnection network sharing request to the second electronic device to disconnect the shared network with the second electronic device. The disconnection network sharing request is used to disconnect the second electronic device from the network sharing service.
[0094] The offline request of the first electronic device can be obtained in various ways, such as the offline request generated by closing an Internet-access App, or the offline request generated by the first electronic device triggered by the second electronic device wanting to close a network sharing service.
[0095] In another achievable manner, when the virtual network card of the first electronic device intercepts and does not receive the Internet access request of the first electronic device within a preset time period, a disconnection network sharing request is sent to the second electronic device to disconnect the shared network with the second electronic device. The disconnection network sharing request is used to disconnect the second electronic device from the network sharing service.
[0096] The first electronic device and the second electronic device provided in the embodiment of the present application may be, but are not limited to, mobile phones, tablet computers, laptop computers, personal computers, large-screen devices (for example, smart TVs, smart screens), wearable electronic devices, vehicle-mounted devices, virtual reality devices, and other devices with gateway sharing services.
[0097] The first electronic device and the second electronic device provided in the embodiment of the present application can be electronic devices of the same type, for example, both the first electronic device and the second electronic device are mobile phones, or they can be electronic devices of different types, for example, the first electronic device is a tablet computer or a laptop computer, and the second electronic device is a mobile phone, etc.
[0098] The network sharing method provided in the embodiment of the present application is illustrated below by taking the first electronic device as a tablet computer (Personal Access Device, PAD) or a personal computer (Personal Computer, PC) and the second electronic device as a mobile phone as an example.
[0099] See also Figure 5 , is a usage scenario diagram of a network sharing service, specifically including:
[0100] PC or PAD, and mobile phone all include: upper-layer services, page settings (also known as prompt settings), device manager, network sharing services, communication modules (also known as MagicLink in the figure), distributed gateway servers (also known as DistributeGatewayService in the figure), and application network interface modules (not shown in the figure).
[0101] Among them, the upper layer services are used to integrate application services on electronic devices, such as Internet access services.
[0102] Settings is used to monitor the opening and closing of multiple applications on the page.
[0103] The device manager is used to monitor the online and offline status of devices in the trusted device list.
[0104] The network sharing service is used to provide the upper-layer business call interface, such as opening the network sharing service interface, closing the network sharing service interface, and other functional interfaces. It also triggers MagicLink to create a p2p physical connection, triggers DistributeGatewayService to configure the gateway and DNS, and registers the network channel.
[0105] MagicLink is used to create a session protocol and a p2p physical channel. When DistributeGatewayService configures the gateway and DNS and registers the p2p physical channel, the PC / PAD can use the p2p physical channel to share the mobile phone's network to meet the user's Internet access needs.
[0106] The session channel is used to transmit commands, requests or notifications to other electronic devices, notify other electronic devices to turn on or off network sharing services, etc.
[0107] DistributeGatewayService is used to configure the gateway and DNS settings and register the network channel when the network sharing service is turned on. The gateway can be a proxy gateway or a device default gateway. The proxy gateway includes IP forwarding, DNS forwarding, Network Address Translation (NAT), Address Resolution Protocol (ARP) proxy and traffic statistics.
[0108] The application network interface is used to provide network connection with other electronic devices, such as P2P physical connection with other electronic devices.
[0109] The implementation is as follows:
[0110] First, turn on Bluetooth and WLAN on the PC or PAD and the mobile phone, and log in to the same network sharing service account. The PC / PAD currently has no available network.
[0111] Second, when the device manager of the PC / PAD detects that a mobile phone that can provide network sharing is online nearby, it prompts the user to share the mobile network.
[0112] Third, when the user clicks on the shared network, the PC / PAD calls the magicLink interface to create a session and a p2p physical channel.
[0113] Fourth, PC / PAD calls DistributeGatewayService to configure the default gateway, set up DNS and register the p2p physical channel.
[0114] Fifth, when the PC / PAD calls DistributeGatewayService, it initiates a network sharing request to the mobile phone.
[0115] Sixth, after receiving the network sharing request, the mobile phone opens its own network sharing service and triggers the DistributeGatewayService to configure the proxy gateway.
[0116] Seventh, after the configuration is completed, a p2p physical connection is established between the p2p network card of the PC / PAD and the p2p proxy network card of the mobile phone, that is, the network data packets are forwarded to the p2p proxy network card on the mobile phone side through the p2p network card. The p2p proxy network card does not have the function of Internet access, and forwards the network data packets to a network with Internet access, such as a cellular network, or Wi-Fi, to share the network of the mobile phone.
[0117] See also Figure 6 , is a schematic diagram of a network sharing method provided in an embodiment of the present application, wherein the method is Figure 5 Based on the application scenario shown, the method specifically includes:
[0118] On the PC or PAD side (hereinafter referred to as PC / PAD for convenience), perform the following steps:
[0119] S61: Registration.
[0120] When the PC / PAD is turned on, a virtual network card is created in advance and registered with the network connection manager (ConnectivityManager, CM). The CM is used to monitor whether there is an available network at present.
[0121] The specific registration method is: PC / PAD registers the virtual network card to CM through Telephony. Telephony is used to provide communication functions for PC / PAD. For example, management of call status (including connected, hung up, etc.). Telephony is connected to cellular channels, WLAN channels, etc., and communicates based on the cellular network generated by the cellular channel or the Wi-Fi generated by the WLAN channel.
[0122] CM monitors the Telephony data network to detect whether there is an available network.
[0123] S62: The Internet access App sends an Internet access request of the PC / PAD to the CM.
[0124] When a user opens any Internet access App on a PC / PAD, the Internet access App will generate an Internet access request for the PC / PAD and send it to the CM.
[0125] CM receives Internet access requests and performs network monitoring to determine whether there is currently an available network. The specific monitoring method is as follows:
[0126] CM monitors Telephony's data network. When Telephony's data network is a cellular network or Wi-Fi, it means that the PC / PAD currently has an available network. When Telephony's data network does not have a cellular network or Wi-Fi, the PC / PAD currently has no available network. At this time, CM sends the Internet access request to the virtual network card through Telephony. That is, the virtual network card intercepts the user's Internet access request.
[0127] S63: The virtual network card sends a request to automatically open the network sharing to the network sharing service.
[0128] After the virtual network card intercepts the user's Internet access request, it sends a message to the network sharing service to automatically open the network sharing service. After the network sharing service of the PC / PAD is opened, the existing network sharing service is triggered to perform network sharing.
[0129] S64: Determine that the second electronic device is a mobile phone.
[0130] The second electronic device that can provide network sharing is determined to be a mobile phone from the trusted device list.
[0131] The online electronic devices in the trusted device list may be devices around the first electronic device that meet the following conditions: the same network sharing service account as the first electronic device is logged in, WLAN is turned on, and Bluetooth is turned on. It is understandable that the devices in the trusted device list refer to devices that can perform multi-device collaboration with the first electronic device. The devices around the first electronic device refer to devices that are within a preset distance range from the first electronic device.
[0132] The specific process of determining the mobile phone from the trusted device list is as in step S306 and will not be discussed here.
[0133] After determining the second electronic device, the PC / PAD prompts the user to share the mobile phone network, so that the user can choose whether to execute the shared mobile phone network service. Figure 7 , is a schematic diagram of prompting a user to share a mobile phone network. , A "Share Mobile Phone Network" prompt box is displayed on the PC / PAD screen display interface, and the prompt box also includes a "Confirm" button and a "Don't Share" button. When the user selects the "Confirm" button, the network sharing between the PC / PAD and the mobile phone is executed.
[0134] S65: Create a P2P physical channel.
[0135] The network sharing service of PC / PAD calls the communication module and uses the communication module of the mobile phone to create a p2p physical channel and session protocol. PC / PAD sends a network sharing request to the mobile phone through the p2p physical channel according to the session protocol.
[0136] In this embodiment, the p2p physical channel is used to establish a p2p physical connection through the p2p network card of the PC / PAD and the p2p proxy network card of the mobile phone. That is, the network data packet of the PC / PAD is received by the p2p network card and forwarded to the p2p proxy network card, and the p2p proxy network card forwards the network data packet to a network that can access the Internet.
[0137] Optionally, when the user clicks on the shared network in the prompt that the user can share the mobile phone network, the network sharing service of the PC / PAD calls the communication module and uses the communication module of the mobile phone to create a p2p physical channel and session protocol. The PC / PAD sends a network sharing request to the mobile phone through the p2p physical channel according to the session protocol.
[0138] S66: Bind the P2P physical channel to the CM.
[0139] After the PC / PAD creates the p2p physical channel, it is bound to the CM. The CM can forward the network data packets required for the Internet access request to the p2p network card through Telephony, and send them to the second electronic device through the p2p network card and the p2p physical channel to share the network of the second electronic device.
[0140] S67: The PC / PAD sends a notification to the mobile phone to start network sharing.
[0141] In the embodiment of the present application, when the PC / PAD sends a notification to the mobile phone to open network sharing, the PC / PAD configures the default network and DNS on the device.
[0142] Perform the following steps on the mobile phone:
[0143] S68: Configure the proxy gateway.
[0144] After receiving the notification of opening network sharing sent by the PC / PAD, the network sharing service of the mobile phone opens the network sharing service.
[0145] After opening the network sharing service, trigger the p2p proxy to configure the proxy gateway.
[0146] After the p2p proxy configures the proxy gateway, it forwards the traffic to the cellular network (which can also be Wi-Fi), and the cellular network forwards the traffic to the cloud to perform network sharing.
[0147] In this way, when the PC / PAD shares the network of the mobile phone, after the virtual network card intercepts the Internet access request of the PC / PAD, it can trigger the PC / PAD to open the network sharing service and trigger the mobile phone to open the network sharing service, so that the PC / PAD shares the network of the mobile phone. At this time, the user does not need to manually open the network sharing operation on the mobile phone side, nor does the user need to manually open the network sharing operation on the PC / PAD side, which improves the user experience.
[0148] The hardware structure and software structure of the first electronic device and the second electronic device are introduced below.
[0149] First, a hardware structure diagram of an electronic device is described. The electronic device can be either a first electronic device or a second electronic device.
[0150] See also Figure 8 , is a schematic diagram of the hardware structure of the electronic device provided in an embodiment of the present application.
[0151] like Figure 8 As described above, the electronic device 100 may include a processor 110 , an antenna 1 , an antenna 2 , a mobile communication module 150 , a wireless communication module 160 , and a display screen 194 .
[0152] It is to be understood that the structure illustrated in the embodiment of the present invention does not constitute a specific limitation on the electronic device 100. In other embodiments of the present application, the electronic device 100 may include more or fewer components than shown in the figure, or combine some components, or separate some components, or arrange the components differently. The components shown in the figure may be implemented in hardware, software, or a combination of software and hardware.
[0153] The processor 110 may include one or more processing units, for example, the processor 110 may include an application processor (AP), a modem processor, a graphics processor (GPU), an image signal processor (ISP), a controller, a video codec, a digital signal processor (DSP), a baseband processor, and / or a neural-network processing unit (NPU), etc. Different processing units may be independent devices or integrated into one or more processors.
[0154] The wireless communication module 160 can provide wireless communication solutions including wireless local area networks (WLAN) (Wi-Fi network), Bluetooth (BT), global navigation satellite system (GNSS), frequency modulation (FM), near field communication (NFC), infrared (IR), etc., which are applied to the electronic device 100. The wireless communication module 160 can be one or more devices integrating at least one communication processing module. The wireless communication module 160 receives electromagnetic waves via the antenna 2, modulates the frequency of the electromagnetic wave signal and performs filtering, and sends the processed signal to the processor 110. The wireless communication module 160 can also receive the signal to be sent from the processor 110, modulate the frequency of the signal, amplify it, and convert it into electromagnetic waves for radiation through the antenna 2.
[0155] In some embodiments, the antenna 1 of the electronic device 100 is coupled to the mobile communication module 150, and the antenna 2 is coupled to the wireless communication module 160, so that the electronic device 100 can communicate with the network and other devices through wireless communication technology. The wireless communication technology may include global system for mobile communications (GSM), general packet radio service (GPRS), code division multiple access (CDMA), wideband code division multiple access (WCDMA), time-division code division multiple access (TD-SCDMA), long term evolution (LTE), BT, GNSS, WLAN, NFC, FM, and / or IR technology. The GNSS may include a global positioning system (GPS), a global navigation satellite system (GLONASS), a Beidou navigation satellite system (BDS), a quasi-zenith satellite system (QZSS) and / or a satellite based augmentation system (SBAS).
[0156] The electronic device 100 implements the display function through a GPU, a display screen 194, and an application processor. The GPU is a microprocessor for image processing, which connects the display screen 194 and the application processor. The GPU is used to perform mathematical and geometric calculations for graphics rendering. The processor 110 may include one or more GPUs that execute program instructions to generate or change display information.
[0157] The display screen 194 is used to display images, videos, etc. The display screen 194 includes a display panel. The display panel can be a liquid crystal display (LCD), an organic light-emitting diode (OLED), an active-matrix organic light-emitting diode or an active-matrix organic light-emitting diode (AMOLED), a flexible light-emitting diode (FLED), Miniled, MicroLed, Micro-oLed, a quantum dot light-emitting diode (QLED), etc. In some embodiments, the electronic device 100 may include 1 or N display screens 194, where N is a positive integer greater than 1.
[0158] See also Fig. 9 , is a schematic diagram of the software structure of the electronic device provided in an embodiment of the present application.
[0159] Fig. 9 It is a software architecture block diagram of the electronic device 100 according to an embodiment of the present application.
[0160] The layered architecture divides the software into several layers, each with clear roles and division of labor. The layers communicate with each other through software interfaces. In some embodiments, the Android system is divided into four layers, from top to bottom: the application layer, the application framework layer, the Android runtime and system library, and the kernel layer.
[0161] The application layer includes network sharing services, Internet apps, etc.
[0162] In the embodiment of the present application, when the user clicks on the open operation on the Internet App, an Internet access request is generated, and the virtual network card intercepts the Internet access request and triggers the network sharing service to automatically open. Or the network sharing service receives a notification of opening the network sharing service sent by other electronic devices and automatically opens the network sharing service.
[0163] like Fig. 9 As shown, the application framework layer may include CM, content provider, view system, Telephony, resource manager, notification manager, etc.
[0164] CM is responsible for monitoring the network connection status and issuing broadcast notifications when the connection status changes. CM is also used to try to connect to other networks after the network connection fails, and to provide application interfaces for application layer services so that application layer services can obtain network status information, etc. In the embodiment of the present application, CM is used to provide application interfaces for upper-layer business apps and enable upper-layer business apps to obtain network status information. It is also used to monitor the currently available networks of electronic devices.
[0165] Content providers are used to store and retrieve data and make it accessible to applications. The data may include videos, images, audio, calls made and received, browsing history and bookmarks, phone books, etc.
[0166] The view system includes visual controls, such as controls for displaying text, controls for displaying images, etc. The view system can be used to build applications. A display interface can be composed of one or more views. For example, a display interface including a text notification icon can include a view for displaying text and a view for displaying images.
[0167] Telephony is used to provide communication functions of the electronic device 100, such as management of call status (including connecting, hanging up, etc.).
[0168] The resource manager provides various resources for applications, such as localized strings, icons, images, layout files, video files, and so on.
[0169] The notification manager enables applications to display notification information in the status bar. It can be used to convey notification-type messages and can disappear automatically after a short stay without user interaction. For example, the notification manager is used to notify download completion, message reminders, etc. The notification manager can also be a notification that appears in the system top status bar in the form of a chart or scroll bar text, such as notifications of applications running in the background, or a notification that appears on the screen in the form of a dialog window. For example, a text message is displayed in the status bar, a prompt sound is emitted, an electronic device vibrates, an indicator light flashes, etc.
[0170] Android Runtime includes core libraries and virtual machines. Android runtime is responsible for scheduling and management of the Android system.
[0171] The core library consists of two parts: one part is the function that needs to be called by the Java language, and the other part is the Android core library.
[0172] The application layer and the application framework layer run in a virtual machine. The virtual machine executes the Java files of the application layer and the application framework layer as binary files. The virtual machine is used to perform functions such as object life cycle management, stack management, thread management, security and exception management, and garbage collection.
[0173] The system library may include multiple functional modules, such as surface manager, media library, 3D graphics processing library (such as OpenGL ES), 2D graphics engine (such as SGL), etc.
[0174] The surface manager is used to manage the display subsystem and provide the fusion of 2D and 3D layers for multiple applications.
[0175] The media library supports playback and recording of a variety of commonly used audio and video formats, as well as static image files, etc. The media library can support a variety of audio and video encoding formats, such as: MPEG4, H.264, MP3, AAC, AMR, JPG, PNG, etc.
[0176] The 3D graphics processing library is used to implement 3D graphics drawing, image rendering, compositing, and layer processing.
[0177] A 2D graphics engine is a drawing engine for 2D drawings.
[0178] The kernel layer is the layer between hardware and software. The kernel layer contains at least display driver, camera driver, audio driver, and sensor driver.
[0179] The descriptions of the processes or structures corresponding to the above-mentioned figures have different emphases. For parts that are not described in detail in a certain process or structure, please refer to the relevant descriptions of other processes or structures.
[0180] The above is only a specific implementation of the present application, but the protection scope of the present application is not limited thereto. Any changes or substitutions within the technical scope disclosed in the present application should be included in the protection scope of the present application. Therefore, the protection scope of the present application should be based on the protection scope of the claims.
Claims
1. A network sharing method, characterized in that: The method comprises: When the virtual network card intercepts the Internet access request of the first electronic device, a device search is performed to obtain a trusted device list; the virtual network card is pre-registered by the first electronic device and is used to intercept the Internet access request when the first electronic device has no available network; The first electronic device determines a second electronic device that can provide network sharing from the trusted device list, configures a default gateway, and sends a network sharing request to the second electronic device; the network sharing request is used to enable the second electronic device to configure a proxy gateway and enable the second electronic device to start a network sharing service; the default gateway is used to receive a network data packet corresponding to the Internet access request, and send the network data packet to the second electronic device through the proxy gateway; The network of the second electronic device is shared through the default gateway to access the Internet.
2. The method according to claim 1, characterized in that: When the virtual network card intercepts the Internet access request of the first electronic device, a device search is performed to obtain a trusted device list, specifically including: Obtaining the Internet access request and monitoring the current available network status; If the current available network status is no available network, triggering the virtual network card to intercept the Internet access request; After the virtual network card intercepts the Internet access request of the first electronic device, a device search is performed to obtain a trusted device list.
3. The method according to claim 1 or 2, characterized in that: The device search to obtain a trusted device list includes: Perform a device search and add surrounding devices that meet the following conditions to the trusted device list: The same network sharing service account as the first electronic device is logged in, WLAN is turned on, and Bluetooth is turned on.
4. The method according to any one of claims 1 to 3, characterized in that: The sending a network sharing request to the second electronic device comprises: establishing a p2p physical channel with the second electronic device; The network sharing request is sent to the second electronic device through the p2p physical channel.
5. The method according to claim 1, characterized in that: The step of determining the second electronic device that can provide network sharing from the trusted device list includes: When there are multiple online electronic devices that can provide network sharing in the trusted device list, obtaining network signal strength values of the multiple online electronic devices; A maximum network signal strength value is selected from the network signal strength values of the plurality of online electronic devices, and the online electronic device corresponding to the maximum network signal strength value is used as the second electronic device.
6. The method according to any one of claims 1 to 5, characterized in that: The method further comprises: When the virtual network card intercepts the network logoff request of the first electronic device, it sends a network sharing disconnection request to the second electronic device to disconnect the shared network with the second electronic device. The network sharing disconnection request is used to disconnect the second electronic device from the network sharing service.
7. The method according to any one of claims 1 to 5, characterized in that: The method further comprises: When the virtual network card intercepts and fails to receive the Internet access request of the first electronic device within a preset time period, a network sharing disconnection request is sent to the second electronic device to disconnect the shared network with the second electronic device. The network sharing disconnection request is used to disconnect the second electronic device from the network sharing service.
8. A network sharing method, characterized in that: The method comprises: After receiving the network sharing request sent by the first electronic device, the second electronic device starts the network sharing service and configures the proxy gateway; shares its own network with the first electronic device through the proxy gateway; the proxy gateway is used to receive the network data packet sent by the first electronic device and forward the network data packet to the second electronic device; The network sharing request is sent by the first electronic device after determining from a trusted device list that the second electronic device can provide network sharing. The trusted device list is obtained by device search after the virtual network card of the first electronic device intercepts the Internet access request of the first electronic device. The virtual network card is pre-registered by the first electronic device and is used to intercept the Internet access request when the first electronic device has no available network.
9. The method according to claim 8, characterized in that: After receiving the network sharing request sent by the first electronic device, the second electronic device starts the network sharing service and configures the proxy gateway, including: After receiving the network sharing request sent by the first electronic device through the p2p physical channel, the second electronic device starts the network sharing service; the p2p physical channel is a physical channel between the first electronic device and the second electronic device created by the first electronic device.
10. The method according to claim 8 or 9, characterized in that: The method further comprises: After receiving the network sharing disconnection request sent by the first electronic device, the shared network with the first electronic device is disconnected. The network sharing disconnection request is sent by the virtual network card of the first electronic device after intercepting the network disconnection request, and is used to disconnect the network sharing service.
11. The method according to claim 8 or 9, characterized in that: The method further comprises: After receiving the network sharing disconnection request sent by the first electronic device, the shared network with the first electronic device is disconnected. The network sharing disconnection request is sent by the virtual network card of the first electronic device after failing to intercept the network disconnection request within a preset time period, and is used to disconnect the network sharing service.
12. An electronic device, characterized in that: The electronic device comprises a memory and a processor, wherein the memory is coupled to the processor; The memory stores a program, and when the program is executed by the processor, the electronic device executes the method according to any one of claims 1 to 7 or 8 to 11.
