Network detection method, electronic equipment and storage medium
By detecting and reconfiguring the network settings, the problem of the first electronic device being unable to use the shared network was resolved, thus improving the user's online experience.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-08-15
- Publication Date
- 2026-03-10
AI Technical Summary
After the second electronic device shares its network with the first electronic device, the first electronic device cannot use the network of the second electronic device, resulting in the user being unable to access the Internet and affecting the Internet experience.
The first electronic device checks whether the network connection is normal. If it is abnormal, it sends a command to the second electronic device to reset the network configuration. The process is repeated until the connection is restored.
This increases the probability that the first electronic device can access the internet even when the network configuration is abnormal, thus improving the user's internet experience.
Smart Images

Figure CN121644353A_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of electronic technology, and in particular to a network detection method, electronic device, and storage medium. Background Technology
[0002] When a user has multiple electronic devices, the user can establish trust relationships between these devices. If the first electronic device does not have a network available, but the second electronic device does, and the second electronic device has the network sharing capability to provide a shared data network to the first electronic device, the user can share the cellular network or wireless network of the second electronic device with the first electronic device, allowing the first electronic device to use the network of the second electronic device to access the Internet, thereby meeting the network usage needs of the user of the first electronic device.
[0003] However, in some cases, after the cellular or wireless network of the second electronic device is shared with the first electronic device, the first electronic device cannot use the network of the second electronic device, resulting in the user being unable to access the Internet using the first electronic device and affecting the user's Internet experience. Summary of the Invention
[0004] This application provides a network detection method, electronic device, and storage medium, which can reduce the probability of the first electronic device being unable to access the internet after the second electronic device shares the network with the first electronic device, thereby improving the user's internet experience. The technical solution is as follows:
[0005] In a first aspect, embodiments of this application provide a network detection method applied to a first electronic device. The method includes: establishing a network connection between the first electronic device and a second electronic device, wherein the network of the second electronic device is in a normal state; after the first electronic device and the second electronic device establish a network, detecting whether the first electronic device can access the Internet using the network of the second electronic device; if the first electronic device cannot access the Internet, detecting whether the network configuration of the second electronic device is abnormal; if the network configuration of the second electronic device is abnormal, sending a target command to the second electronic device, wherein the target command instructs the second electronic device to reset the network configuration.
[0006] Based on the above technical solution, after the first electronic device connects to the network of the second electronic device, it can promptly detect whether the first electronic device can access the internet using the network of the second electronic device, thus promptly identifying situations where the first electronic device cannot access the internet using the network of the second electronic device. Furthermore, the first electronic device can detect whether the network configuration of the second electronic device is abnormal, and if the network configuration of the second electronic device is abnormal, it can further send a target command to the second electronic device to instruct it to reset its network configuration. Upon receiving the target command, the second electronic device resets its network configuration. Since the second electronic device can restore its network configuration to normal by resetting its network configuration, the first electronic device can then access the internet using the network of the second electronic device. This increases the probability that the first electronic device can access the internet even when the network configuration of the second electronic device is abnormal, thereby improving the user experience.
[0007] In conjunction with the first aspect, in some implementations of the first aspect, after sending the target command to the second electronic device, the method further includes: receiving information indicating that the second electronic device has successfully set its network configuration; and after receiving this information, re-checking whether the first electronic device can access the internet using the network provided by the second electronic device. The second electronic device can inform the first electronic device after setting its network configuration, allowing the first electronic device to re-check its internet access status, thus ensuring that the first electronic device is promptly aware of its internet connection status. If the first electronic device still cannot access the internet, it can continue to check whether the network configuration of the second electronic device is abnormal, and if abnormal, instruct the second electronic device to reset its network configuration. By repeatedly checking and resetting the network configuration, the probability of the first electronic device being able to access the internet can be further increased, thereby improving the user experience.
[0008] Optionally, in some implementations, after receiving information that the second electronic device has successfully set up its network configuration, the first electronic device may wait for a period of time, and after a preset time, re-detect whether the first electronic device can use the network of the second electronic device to access the Internet.
[0009] Combining the first aspect and the aforementioned implementation methods, in some implementations of the first aspect, detecting whether the network configuration of the second electronic device is abnormal includes: detecting whether the proxy address resolution protocol function of the second electronic device is abnormal; if the proxy address resolution protocol function is abnormal, determining that the network configuration of the second electronic device is abnormal; or, if the proxy address resolution protocol function is normal, detecting whether the domain name system forwarding function of the second electronic device is abnormal; if the domain name system forwarding function is abnormal, determining that the network configuration of the second electronic device is abnormal. Thus, by first detecting the proxy address resolution protocol function and then detecting the domain name system forwarding function, if both the proxy address resolution protocol function and the domain name system forwarding function are normal, it indicates that the network configuration of the second electronic device is normal; if either the proxy address resolution protocol function or the domain name system forwarding function is abnormal, it indicates that the network configuration of the second electronic device is abnormal.
[0010] In conjunction with the first aspect and the aforementioned implementation methods, in some implementations of the first aspect, detecting whether the proxy address resolution protocol function of the second electronic device is abnormal includes: sending a first request to the second electronic device, the first request being used to obtain the MAC address of a preset IP address; if a first reply is received from the second electronic device, and the first reply includes the MAC address of the second electronic device, determining that the proxy address resolution protocol function of the second electronic device is normal; or, if no first reply is received from the second electronic device, or if the first reply does not include the MAC address of the second electronic device, determining that the proxy address resolution protocol function of the second electronic device is abnormal, and the target command instructs the second electronic device to reset the proxy address resolution protocol function. Furthermore, the second electronic device can reset the proxy address resolution protocol function.
[0011] In conjunction with the first aspect and the above implementation methods, in some implementation methods of the first aspect, detecting whether the domain name system forwarding function of the second electronic device is abnormal includes: sending a second request to the second electronic device, the second request being used to request the resolution of the domain name of the preset network address; if a second reply is received from the second electronic device, determining that the domain name system forwarding function of the second electronic device is normal; or, if no second reply is received from the second electronic device, determining that the domain name system forwarding function of the second electronic device is abnormal, and the target command instructs the second electronic device to reset the domain name system forwarding function.
[0012] Combining the first aspect and the aforementioned implementation methods, in some implementations of the first aspect, detecting whether the first electronic device can access the internet using the network of the second electronic device includes: detecting whether the first electronic device has a proxy server set up; if the first electronic device has a proxy server set up, detecting whether the proxy server can be connected normally; if the proxy server can be connected normally, or if no proxy server is set up, detecting whether the public network can be connected normally; if the public network can be connected normally, the first electronic device can access the internet using the network of the second electronic device. Many companies may set up proxy servers for information security reasons. When a proxy server is set up, the first electronic device's internet access will be somewhat restricted. Therefore, when detecting whether the first electronic device can access the internet, first check whether a proxy server is set up, and then consider whether the public network can be connected normally. Here, a public IP address has worldwide uniqueness.
[0013] Secondly, this application provides a network detection method applied to a second electronic device. The method includes: establishing a network connection between the second electronic device and a first electronic device, with the second electronic device's network in a normal state; receiving a target command from the first electronic device, the target command instructing the second electronic device to reset its network configuration; and resetting the network configuration according to the target command. Based on the above technical solution, after the first electronic device connects to the network of the second electronic device, if the second electronic device's network configuration is abnormal, the first electronic device sends a target command to the second electronic device to instruct it to reset its network configuration. Upon receiving the target command, the second electronic device resets its network configuration. Since the second electronic device can restore its network configuration to normal by resetting its network configuration, the first electronic device can use the second electronic device's network to access the internet. This increases the probability that the first electronic device can access the internet even when the second electronic device's network configuration is abnormal, thereby improving the user experience.
[0014] In conjunction with the second aspect and the above implementation methods, in some implementations of the second aspect, after reconfiguring the network settings, the method further includes sending a message indicating successful network configuration to the first electronic device. After configuring the network settings, the second electronic device can inform the first electronic device, allowing the first electronic device to re-check its internet access capabilities. This ensures that the first electronic device is promptly aware of its internet connection status.
[0015] In conjunction with the second aspect and the above implementation methods, in some implementations of the second aspect, the method further includes: receiving a first request from a first electronic device, the first request being used to obtain the MAC address of a preset IP address; and, if the proxy address resolution protocol function of the second electronic device is normal, sending a first reply to the first electronic device, the first reply including the MAC address of the second electronic device. Furthermore, the first electronic device can determine whether the proxy address resolution protocol function of the second electronic device is normal based on the first reply.
[0016] In conjunction with the second aspect and the above implementation methods, in some implementations of the second aspect, the method further includes: receiving a second request from the first electronic device, the second request being for requesting the resolution of a domain name of a preset network address; and, if the domain name system forwarding function of the second electronic device is normal, sending a second reply to the first electronic device. Furthermore, the first electronic device can determine whether the domain name system forwarding function of the second electronic device is normal based on the second reply.
[0017] In conjunction with the second aspect and the above implementation methods, in some implementations of the second aspect, the aforementioned target command instructs the second electronic device to reset the proxy address resolution protocol function. According to the target command, the network configuration is reset, including: according to the target command, turning off the switch in the target chip corresponding to the proxy address resolution protocol function. The target chip is a chip in the second electronic device related to network connectivity, such as a WiFi chip.
[0018] In combination with the second aspect and the above implementation methods, in some implementation methods of the second aspect, the above target command instructs the second electronic device to reset the Domain Name System forwarding function and reset the network configuration according to the target command, including: resetting the DNS forwarding rules of the firewall according to the target command.
[0019] Thirdly, embodiments of this application provide an electronic device, including: one or more processors; one or more memories; the memories storing one or more programs, which, when executed by the processors, cause the electronic device to perform any of the possible methods described in the first or second aspect above.
[0020] Fourthly, embodiments of this application provide an apparatus included in an electronic device, which has the function of implementing the behaviors of the electronic device in the above aspects and possible implementations thereof. The functions can be implemented by hardware or by hardware executing corresponding software. The hardware or software includes one or more modules or units corresponding to the above functions. For example, a display module or unit, a detection module or unit, a processing module or unit, etc.
[0021] Fifthly, embodiments of this application provide a computer-readable storage medium storing instructions that, when executed on a computer, cause the computer to perform the methods described in the first or second aspect above.
[0022] In a sixth aspect, embodiments of this application provide a computer program product containing instructions that, when run on a computer, cause the computer to perform the methods described in the first or second aspect above.
[0023] The technical effects achieved by the third, fourth, fifth and sixth aspects mentioned above are similar to the technical effects achieved by the corresponding technical means in the first or second aspects mentioned above, and will not be repeated here. Attached Figure Description
[0024] Figure 1 This illustration shows a schematic diagram of enabling network sharing on a mobile phone according to an embodiment of this application;
[0025] Figure 2 This illustration shows a schematic diagram of enabling network sharing on a PC according to an embodiment of this application;
[0026] Figure 3 This illustration shows a connection scenario provided by an embodiment of this application;
[0027] Figure 4 This illustration shows another connection scenario provided by an embodiment of this application;
[0028] Figure 5 This illustration shows a network sharing architecture diagram for a mobile phone and a PC provided in an embodiment of this application;
[0029] Figure 6 This illustration shows a flowchart of the interaction between a PC and a mobile phone in network sharing, according to an embodiment of this application.
[0030] Figure 7 This illustration shows a schematic diagram of an interface provided in an embodiment of this application;
[0031] Figure 8 A flowchart illustrating a network detection method provided in an embodiment of this application is shown.
[0032] Figure 9 This illustration shows a flowchart of a mobile phone performing self-healing according to an embodiment of this application;
[0033] Figure 10 This illustration shows a schematic diagram of a mobile phone-side software structure provided in an embodiment of this application;
[0034] Figure 11 This illustration shows a structural schematic diagram of an electronic device provided in an embodiment of this application;
[0035] Figure 12 This paper shows a schematic diagram of the structure of a network detection device provided in an embodiment of this application;
[0036] Figure 13 A schematic diagram of the structure of a chip provided in an embodiment of this application is shown. Detailed Implementation
[0037] To make the objectives, technical solutions, and advantages of this application clearer, the embodiments of this application will be described in further detail below with reference to the accompanying drawings. Hereinafter, the terms "first" and "second" are used for descriptive purposes only and should not be construed as indicating or implying relative importance or implicitly specifying the number of indicated technical features. Thus, a feature defined as "first" or "second" may explicitly or implicitly include one or more of that feature. In the description of this embodiment, unless otherwise stated, "a plurality of" means two or more.
[0038] Network sharing service: refers to a second electronic device (with the network sharing capability to provide a shared data network to a first electronic device) sharing its own cellular network or Wi-Fi with a nearby first electronic device, so that the first electronic device can access the Internet, thereby meeting the network usage needs of the users of the first electronic device.
[0039] In other words, if the first electronic device has no available network or a poor network connection, while the second electronic device has an available network, the second electronic device can share its cellular network or Wi-Fi with the first electronic device, allowing the first electronic device to use the second electronic device's network. Of course, the network sharing service can also be used when the user has other needs.
[0040] "Available network" means there is a cellular network or Wi-Fi connection. "No available network" means there is no cellular network and no Wi-Fi connection. Poor network status can also be considered as no available network.
[0041] However, after the first and second electronic devices successfully share the network, the first electronic device may still be unable to access the internet due to some configuration failures or malfunctions, affecting the user's ability to use the first electronic device to access the internet.
[0042] Therefore, this application provides a network detection method. After the first electronic device and the second electronic device successfully share the network, the method detects whether the first electronic device can access the Internet. If the first electronic device cannot access the Internet, the method detects the reason why the first electronic device cannot access the Internet and can further perform self-healing. This reduces the probability of the first electronic device being unable to access the Internet under abnormal circumstances, thereby improving the user experience.
[0043] The first electronic device and the second electronic device provided in this application embodiment can be, but are not limited to, mobile phones, tablet computers (PADs), laptops, personal computers (PCs), large-screen devices (e.g., smart TVs, smart screens), wearable electronic devices, in-vehicle devices, virtual reality devices, and other devices with gateway sharing services.
[0044] The first electronic device and the second electronic device provided in this application embodiment can be the same type of electronic device, such as both being mobile phones. Alternatively, they can be different types of electronic devices, such as the first electronic device being a PC, PAD, in-vehicle device, large screen, etc., and the second electronic device being a mobile phone, etc.
[0045] The following example illustrates a network sharing service scenario where the first electronic device is a PC and the second electronic device is a mobile phone, both located in the same trust ring.
[0046] The trust ring, also known as the trusted device list, consists of devices logged into the same account, such as an Honor account. The first and second electronic devices are already within the same trust ring. Before the second electronic device provides network sharing services to the first electronic device, both devices typically need to have WLAN and Bluetooth enabled, and ensure that network sharing is turned on.
[0047] For example, Figure 1 This diagram illustrates how to enable network sharing on a mobile phone. The phone can display something like... Figure 1 The interface 101 shown in (a) can be a desktop, and it displays an icon 1011 for the settings (application, APP). The phone can detect user actions (such as clicks, voice control, gestures, etc.) applied to the icon 1011 of the settings APP, and in response to the user actions, the phone can display... Figure 1 Interface 102 is shown in (b) above. Interface 102 can display various setting options, such as smart connectivity settings. The phone can detect user actions on the smart connectivity settings and, in response to the user actions, the phone can display, for example... Figure 1 Interface 103 is shown in (c). Interface 103 can display various functions under smart interconnection, such as network sharing. The mobile phone can detect user actions on the network sharing option, and in response to the user actions, the mobile phone can display, as shown in (c). Figure 1 Interface 104 is shown in (d) above. Interface 104 includes a network sharing switch 1041, which the user can turn on to ensure that network sharing is enabled.
[0048] For example, Figure 2 This diagram illustrates how to enable network sharing on a PC. The PC can display something like... Figure 2 Interface 201, shown in (a) above, can be a service management page for the smart interconnection function on a PC. Interface 201 can display network sharing function controls. The PC can detect user actions performed on the network sharing function controls and, in response to the user actions, can display, as shown below. Figure 2 Interface 202 is shown in (b) above. Interface 202 includes a network sharing switch 2021, which the user can turn on to ensure that network sharing is enabled.
[0049] When a PC needs internet access, it can select a second electronic device from a list of trusted devices. In some implementations, the PC can automatically select the second electronic device. For example, if there is an online electronic device in the list that can provide network sharing for the first electronic device, that online electronic device is the second electronic device. If there are multiple online electronic devices in the 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 select the online electronic device with the highest network signal strength value as the second electronic device.
[0050] For example, Figure 3 This diagram illustrates a connection scenario. When the PC has no available network, but the mobile phone is online and has a usable network, the PC can automatically display a pop-up notification when it detects a nearby mobile phone with internet access, allowing the user to choose whether to use the mobile phone's network. Figure 3 As shown, the PC can display a pop-up window 301, which can display a prompt and a connection control 302. For example, the prompt could be: "Recommended to use 'network sharing' from 'mobile phone'". When the user clicks the connection control 302, the PC and mobile phone successfully share the network, and the PC can use the mobile phone's network.
[0051] In other implementations, users can manually select a second electronic device. After entering the trust ring page of any mobile phone, tablet, or computer within the trust ring, users can manually select an online electronic device as the second electronic device.
[0052] For example, Figure 4 This illustrates yet another connection scenario. The phone can display, for example... Figure 4Interface 401, shown in (a) above, is the phone's Trust Ring page. The Trust Ring page displays currently online electronic devices, such as the phone itself, phone A, and PC "Aaa," and also displays device balls 4011, 4012, and 4013 for each device. The user can click on the phone's device ball 4011 in the Trust Ring. In response to the user's click, the phone displays shareable options, allowing the user to drag the network sharing service of device ball 4011 to a tablet or computer, thus sharing the phone's network with the tablet or computer. Figure 4 As shown in interface 402 (b), after dragging the mobile device ball to the PC for network sharing service, a network sharing service icon 4021 will appear above the PC, indicating that the PC is using the network sharing service. Interface 402 may also display a prompt message reminding the user that the device in the trust ring is using the network sharing service.
[0053] The following provides a detailed description of how to use the network sharing service provided in the embodiments of this application.
[0054] Figure 5 This illustration shows a network sharing architecture diagram for a mobile phone and a PC provided in an embodiment of this application.
[0055] Reference Figure 5 The mobile phone side includes: system applications, device management services, network sharing services, device self-discovery and self-organizing network applications (i.e., Magiclink), distributed gateway services, and application network interface modules. The PC (vehicle system or PAD) includes: system applications, device management services, network sharing modules, device self-discovery and self-organizing network applications, distributed gateway modules, and application network interface modules.
[0056] The system application, also known as the control center, provides HyperTerminal network sharing services. These services can notify users of device online status, sharing status, and data usage, and also offer web settings. The PC system application can be called PC Manager.
[0057] The device management service can provide information about devices within the trust ring, including device name, device type, and unique identifier ID number. It can also monitor the online and offline status of devices within the trust ring.
[0058] The network sharing service / module can provide system applications with API calls and other functions. Specifically, the network sharing service can include a basic function module, a traffic statistics module, a maintenance module, a network settings module, and an event notification module. The basic function module provides basic functions such as enabling and disabling network sharing. The traffic statistics module can count the mobile network traffic consumed after network sharing is enabled and synchronize this data with the peer device. The maintenance module can record key process points and report error codes, as well as statistical data such as usage time. For example, it can record the connection establishment process, save the data, and report it to the cloud for subsequent analysis. The network settings module can provide distributed gateway configuration capabilities, as well as the ability to configure the device's gateway and DNS. The event notification module can provide notifications for key events to the upper layer, such as notifications that the network sharing service has been enabled or disabled, notifications that the network sharing service has been abnormally disconnected due to an anomaly, and notifications of consumed traffic.
[0059] Magiclink provides a device self-discovery and self-organizing network feature, allowing devices to be discovered via Bluetooth. It can also create sessions and establish P2P channels. Sessions are used to transmit commands, requests, or notifications to other electronic devices, such as instructing them to enable or disable network sharing services.
[0060] The distributed gateway service is used to configure the network and register network channels when network sharing services are enabled. Network configuration includes configuring Internet Protocol (IP) forwarding, Domain Name System (DNS) forwarding, Network Address Translation (NAT), and Address Resolution Protocol (ARP). After successful configuration, the PC can share the mobile phone's network using the P2P channel to meet the user's internet access needs.
[0061] The PC-side application network interface module includes a peer-to-peer (P2P) interface and a WLAN interface. The mobile phone-side application network interface module includes a P2P interface, a WLAN interface, and a Long Term Evolution (LTE) interface. The application network interface is used for network connections with other electronic devices. Specifically, network data can be transmitted between the PC's P2P interface and the mobile phone's P2P interface. Network data from the PC can be sent to the mobile phone's P2P interface. Upon receiving the network data, the mobile phone's P2P interface forwards it to the WLAN / LTE interface, which then transmits the data to the network.
[0062] Specifically, when a user accesses the internet via a mobile phone on a PC, and the PC requests access to a website (e.g., baidu.com), it needs to send a DNS request to a DNS server to obtain the website's IP address before sending network data. When the PC sends the DNS request, it first needs to obtain the destination MAC address. The PC first sends an ARP request to the mobile phone. In this request message, the source IP address is the PC's P2P IP address, the destination IP address is the mobile phone's P2P IP address, and the source MAC address is the PC's P2P MAC address. Upon receiving the ARP request, the mobile phone replies with its own MAC address. Then, the PC sends the DNS request to the mobile phone's P2P network card, which forwards the DNS request to the mobile phone's WLAN network card. The WLAN network card translates the source IP address into the mobile phone's WLAN IP address and the destination IP address into the DNS server's IP address. It then forwards the DNS request to the mobile phone's DNS server to request the IP address corresponding to the website address. After obtaining the IP address, the mobile phone forwards it back to the PC, thus allowing the PC to obtain the website's IP address.
[0063] After obtaining the IP address of a website, when the PC sends network data to the server corresponding to that website, it first obtains the MAC address corresponding to that IP address. The PC sends an ARP request to the mobile phone. In this request message, the source IP address is the PC's P2P IP address, and the destination address is the website's IP address. After receiving the ARP request, the mobile phone replies to the PC with its P2P MAC address. Thus, the PC believes that the destination MAC address is the mobile phone's P2P MAC address.
[0064] The PC sends network data packets to the phone's P2P network card. In the data packet, the source IP is the P2P's IP address, and the destination IP is the website's IP address; the source MAC address is the PC's P2P MAC address, and the destination MAC address is the phone's P2P MAC address. After receiving the network data packets, the phone's P2P network card forwards them to the phone's WLAN network card. The WLAN network card performs NAT translation, converting the source IP (P2P's IP address) to the phone's WLAN IP address, the source MAC address to the phone's WLAN MAC address, and the destination address to the gateway's MAC address. Then, it sends the network data packets out.
[0065] The DNS forwarding function refers to the mobile phone's P2P network card forwarding DNS requests to the mobile phone's WLAN network card, and the WLAN network card forwarding DNS requests to the mobile phone's DNS server.
[0066] IP forwarding function refers to the mobile phone's P2P network card forwarding data packets to the mobile phone's WLAN network card, and the WLAN network card forwarding the data packets to the gateway.
[0067] NAT translation refers to converting the source IP (P2P IP address) into the IP address of the mobile phone's WLAN, that is, converting the internal private address into the external public address.
[0068] The proxy ARP function refers to: replying to ARP requests that include the IP address of a website address as the MAC address of the mobile phone; it also includes resolving its own IP address, that is, replying to ARP requests that include the IP address of the mobile phone as the MAC address of the mobile phone.
[0069] based on Figure 5 The network sharing architecture shown is Figure 6 This illustrates the interaction process between a PC and a mobile phone in a network sharing scenario. In this scenario, the PC has no available network connection, while the mobile phone does.
[0070] S601, the PC-side HyperTerminal Network Sharing Service, monitors the online / offline status of nearby devices with the same account.
[0071] On the PC side, the system notifies the device management module of device registration and online status of devices within the same ring, allowing the PC to monitor the online / offline status of nearby devices with the same account. Similarly, on the mobile phone side, the system can also register devices and notify the device management module of their online status.
[0072] S602, the PC-side self-discovery and self-organizing network application discovers devices with the same account and sends the discovered device information to the PC-side device management service.
[0073] The PC-side Magiclink broadcasts via Bluetooth. When the phone is close to the PC, the PC-side Magiclink receives a response from the phone-side Magiclink, allowing it to discover the phone. The PC-side Magiclink then sends the phone discovery information to the PC-side device management service.
[0074] Similarly, the mobile phone's SuperTerminal Network Sharing service can also access the device management service to monitor the online / offline status of nearby devices with the same account. When the mobile phone and PC are close together, the mobile phone's Magiclink can discover the PC and then send the PC discovery information to the mobile phone's device management service.
[0075] S603: When the PC-side device management service detects that a device with the same account has come online in the vicinity, it sends a device online notification to the PC-side super terminal network sharing service.
[0076] Upon receiving device discovery information, the device management service authenticates the mobile phone. Successful authentication confirms that a device with the same account is online. The PC-side device management service then sends a device online notification to the PC-side SuperTerminal Network Sharing service, allowing the PC to display the online device on its user interface. Furthermore, the PC-side device management service can also send a device online notification to the PC-side control center. The control center and the SuperTerminal Network Sharing service are the two entry points for the network sharing function.
[0077] Similarly, after discovering a device, the mobile device management service can send a device online notification to the mobile super terminal network sharing service.
[0078] S604, the PC-side SuperTerminal Network Sharing Service requests the mobile phone's status information via a BR long connection.
[0079] When the PC detects that a nearby mobile phone with the same account has come online, the PC's SuperTerminal Network Sharing service can establish a Basic Rate (BR) long connection with the mobile phone's SuperTerminal Network Sharing service. Based on the BR long connection, the PC can exchange network capability information with the mobile phone and obtain the mobile phone's status information, thus allowing the PC to perceive whether the online mobile phone can provide real network sharing capabilities. The mobile phone's status information may include: whether the mobile phone is connected to WiFi, whether cellular data is enabled, whether network sharing is turned on, and whether overheat protection is enabled, etc.
[0080] S605, the PC-side SuperTerminal Network Sharing service determines whether the mobile phone meets the network sharing conditions.
[0081] After obtaining the phone's status information, the PC-side SuperTerminal network sharing service can determine whether the phone meets the network sharing requirements based on this information. Specifically, the phone meets the network sharing requirements if it is connected to Wi-Fi or has cellular data enabled, network sharing is turned on, and overheat protection is not activated. Otherwise, the phone does not meet the network sharing requirements. Only if the network sharing requirements are met can the PC share the phone's network; otherwise, the PC cannot share the phone's network.
[0082] S606: When there is no available network on the PC and the mobile phone meets the network sharing conditions, the PC-side SuperTerminal Network Sharing Service prompts the user to initiate a network sharing connection.
[0083] like Figure 3 As shown, when there is no available network on the PC and the mobile phone meets the network sharing conditions, the PC can display a pop-up window 301, prompting the user to initiate a network sharing connection.
[0084] S607 establishes a network sharing channel between the PC-side SuperTerminal Network Sharing Service and the mobile-side SuperTerminal Network Sharing Service.
[0085] like Figure 3 As shown, users can click the connection control 302, and in response to the user's operation, the PC-side SuperTerminal Network Sharing Service and the mobile-side SuperTerminal Network Sharing Service establish a network sharing channel.
[0086] Specifically, the PC-side HyperTerminal network sharing service updates network status changes to the device management module. This allows the device management module to share these changes with other nearby devices, enabling them to see whether network sharing has begun. Then, the PC-side HyperTerminal network sharing service registers for network sharing service listening. Once the network sharing channel is successfully established, the PC-side HyperTerminal network sharing service receives a success notification.
[0087] Then, the PC-side super terminal network sharing service sends a request to the PC-side network sharing service to enable network sharing, that is, to start (enable) the PC-side network sharing service.
[0088] After initiating the PC-side network sharing service, it calls the interface provided by the PC-side Magiclink to establish a P2P session. Specifically, the PC-side network sharing service sends an open session request and a request to open a P2P channel to the PC-side Magiclink. The PC-side Magiclink then forwards these requests to the mobile-side Magiclink. Finally, the mobile-side Magiclink and the PC-side Magiclink establish a session and a P2P channel.
[0089] Upon receiving a request, the mobile MagicLink initiates a network sharing service during session opening. Once started, the mobile network sharing service sends a broadcast event announcing that the service is now operational. After the mobile device goes live, its SuperTerminal network sharing service continuously listens for this broadcast. Upon detecting the broadcast, the service registers an event listener with the network sharing service, ensuring that it receives a success notification once the network sharing channel is successfully established.
[0090] After the session and P2P channel are successfully established, the PC-side Magiclink sends a message to the PC-side network sharing service indicating successful session and P2P channel establishment. The PC-side network sharing service then sends a message to the PC-side SuperTerminal network sharing service indicating successful session opening and successful P2P channel establishment. Similarly, the mobile-side Magiclink sends a message to the mobile-side network sharing service indicating successful session and P2P channel establishment. The mobile-side network sharing service then sends a message to the mobile-side SuperTerminal network sharing service indicating successful session opening and successful P2P channel establishment.
[0091] Subsequently, the PC-side network sharing service sends a network sharing start command to the mobile-side network sharing service via a P2P channel, according to the session protocol. Upon receiving the network sharing start command, the mobile phone configures network settings such as the mobile-side gateway and DNS forwarding. After completing the configuration, the mobile phone sends a notification to the PC indicating successful gateway configuration.
[0092] Similarly, the PC-side network sharing service configures the PC-side gateway and DNS forwarding, etc. After the PC-side configuration is complete, a notification of successful gateway configuration is sent to the mobile phone. Once both sides are configured, an event notification is sent to the system application: the PC-side network sharing service sends a message indicating successful network sharing channel establishment to the PC-side super terminal network sharing service, and the mobile-side network sharing service sends a message indicating successful network sharing channel establishment to the mobile-side super terminal network sharing service. At this point, the network sharing channel is successfully established, and the PC can access the internet via the mobile phone's network.
[0093] S608, PC-side HyperTerminal network sharing service prompts user that network sharing is in progress.
[0094] After a PC shares the mobile phone's network, it can further notify the user in a timely manner. The PC-side HyperTerminal network sharing service can notify the user that network sharing is in progress. For example, refer to... Figure 7 The PC side can display as follows Figure 7 The interface 700 shown displays a network sharing icon 701 and a pop-up window 702. Pop-up window 702 displays a message, such as: "Using Honor phone's mobile data network." This lets the user know that the PC and phone are sharing the network. Pop-up window 702 also displays the current data usage and the total data usage for the month. The user can click the close button on pop-up window 702 to hide it on the PC. If the user doesn't close pop-up window 702, it can remain displayed for a period of time (e.g., 10 seconds). Similarly, the phone can also notify the user that network sharing is in progress.
[0095] The PC / mobile side's SuperTerminal Network Sharing service can also update the shared network status in the Device Management Service, so that devices in the trust ring can see whether the PC and mobile sides are sharing the network or turning off network sharing.
[0096] S609, PC-side HyperTerminal network sharing service displays traffic consumption information.
[0097] When a PC uses a mobile phone to access the internet, the mobile phone's network sharing service can perform traffic statistics and periodically send traffic statistics update notifications to the mobile phone's Super Terminal Network Sharing service, so that the mobile phone's Super Terminal Network Sharing service can update traffic consumption information.
[0098] The PC-side network sharing service can obtain traffic statistics from the mobile-side network sharing service and periodically send traffic statistics update notifications to the PC-side super terminal network sharing service, so that the PC-side super terminal network sharing service can update traffic consumption information.
[0099] For example, refer to Figure 7During the display of pop-up 702, the PC-side network sharing service can retrieve data usage information from the mobile phone every certain period of time (e.g., 5 seconds). When pop-up 702 is not displayed, the user can click the network sharing icon 701, and in response to the user's action, the PC can re-display pop-up 702. Before re-displaying pop-up 702, the PC-side network sharing service can send a message to the mobile-side network sharing service, requesting to retrieve the data usage consumed by the PC during this connection. The mobile-side network sharing service then calculates the consumed data and sends it to the PC-side network sharing service. The PC-side network sharing service then sends the consumed data to the PC-side HyperTerminal network sharing service, allowing the PC-side HyperTerminal network sharing service to display the PC's data usage for this connection. Furthermore, the PC can cache the data usage consumed in each network sharing session, thus obtaining the monthly data usage data, allowing the PC-side HyperTerminal network sharing service to also display the PC's data usage for the current month.
[0100] S610 cancels network sharing when the mobile phone or PC does not meet the network sharing conditions.
[0101] A mobile phone may fail to meet the network sharing requirements if any of the following occurs: the mobile network connection changes, the user actively cancels sharing, the phone overheats, or the network sharing switch is not turned on. A change in the mobile network connection can mean the phone goes from having a usable network to not having one.
[0102] A PC may fail to meet network sharing conditions if any of the following occurs: a change is detected in the peer's network, the PC's network changes, the PC user actively cancels network sharing, or the PC overheats. A change in the PC's network can mean the PC changes from having no available network to having one. The PC user actively canceling network sharing can do so by clicking "Disconnect" in the 702 pop-up window, or by turning off the network sharing switch.
[0103] If the mobile phone does not meet the network sharing conditions, the mobile-side SuperTerminal network sharing service requests the mobile-side network sharing service to cancel network sharing. The mobile-side network sharing service sends a command to the mobile-side Magiclink to close the session. The mobile-side Magiclink closes the session and, after closing it, sends a message to the mobile-side network sharing service indicating successful session closure. The mobile-side network sharing service then sends a message to the mobile-side SuperTerminal network sharing service indicating successful session closure. Additionally, after receiving the message indicating successful session closure, the mobile-side network sharing service also destroys and restores the previously configured routing settings. After restoration, the mobile-side network sharing service sends a message to the mobile-side SuperTerminal network sharing service indicating successful network sharing cancellation. Upon receiving the command to close the session, the mobile-side Magiclink also sends a command to close the session to the PC-side Magiclink via the P2P channel. The PC-side Magiclink closes the session and, after closing it, sends a message to the PC-side network sharing service indicating successful session closure. Then, the PC-side network sharing service destroys and restores the previously configured routing settings and, after restoration, sends a message to the PC-side SuperTerminal network sharing service indicating that network sharing has been cancelled.
[0104] If the PC does not meet the network sharing conditions, the PC-side SuperTerminal network sharing service requests the PC-side network sharing service to cancel network sharing. The PC-side network sharing service sends a command to the PC-side Magiclink to close the session. The PC-side Magiclink closes the session and, after closing, sends a message to the PC-side network sharing service indicating successful session closure. The PC-side network sharing service then sends a message to the PC-side SuperTerminal network sharing service indicating successful session closure. Additionally, after receiving the message indicating successful session closure, the PC-side network sharing service also destroys and restores the previously configured routing settings. After restoration, the PC-side network sharing service sends a message to the PC-side SuperTerminal network sharing service indicating successful network sharing cancellation. Upon receiving the command to close the session, the PC-side Magiclink also sends a command to close the session to the mobile-side Magiclink via the P2P channel. The mobile-side Magiclink closes the session and, after closing, sends a message to the mobile-side network sharing service indicating successful session closure. Then, the mobile-side network sharing service destroys and restores the previously configured routing settings and, after restoration, sends a message to the mobile-side SuperTerminal network sharing service indicating that network sharing has been cancelled.
[0105] S611, PC disables pop-up notifications and caches traffic statistics.
[0106] After network sharing is successfully cancelled, the pop-up notification for the HyperTerminal network sharing service on the mobile phone side will be turned off. The pop-up notification for the HyperTerminal network sharing service on the PC side will also be turned off. The mobile phone side of the HyperTerminal network sharing service can still update network status changes. Similarly, the PC side of the HyperTerminal network sharing service can also update network status changes. The PC can also cache traffic statistics for easy calculation of total data usage later.
[0107] Because a success message will be displayed to the user after successful network sharing, and the detection process may be time-consuming, the PC can start a separate thread in the background to perform network detection and self-healing after the PC and mobile phone have successfully shared the network and the mobile phone's network is normal. Figure 8 A schematic diagram of a network detection and self-healing process is shown.
[0108] S801: After the PC and mobile phone successfully enable network sharing service and the mobile phone's network is normal, the PC determines whether a proxy server exists.
[0109] Many companies use Virtual Private Networks (VPNs) and internal security software, including proxy servers, to act as firewalls for information security reasons. Therefore, this embodiment first determines whether a proxy server exists in the browser. Specifically, the PC retrieves the proxy server value from the registry and determines its existence based on this value. If a proxy server value is found, it indicates the existence of a proxy server; for example, the proxy server value could be: Software\\Microsoft\\Windows\CurrentVersion\\Internet Settings. If no proxy server value is found, it indicates the absence of a proxy server. If a proxy server exists, proceed to step S802; if no proxy server exists, proceed to step S803.
[0110] S802, determine whether the proxy server is reachable.
[0111] In this embodiment, the PC can obtain the proxy server address and use an Internet Packet Groper (ping) to check the proxy server's connectivity. Specifically, a test data packet is sent to the proxy server's address using the ping command. If a response is received from the proxy server's address after pinging, and the response contains a time field, it indicates that the proxy server is reachable. If no response is received after pinging, it indicates that the proxy server is not reachable, and further checks are performed to determine if the network configuration is abnormal, and self-healing is initiated.
[0112] S803 determines whether the public network is accessible.
[0113] If no proxy server exists, or if the proxy server verification shows connectivity, the PC can further verify the connectivity of the public network. When checking public network connectivity, this can be done by pinging the destination URL or by using the curl command to make an HTTP request to the destination URL.
[0114] When pinging the target URL, you can choose a commonly used and well-known domestic URL (e.g., baidu.com) or the self-developed connectivitycheck.platform.hihonorcloud.com. If the ping is successful, it indicates that the public network is connected. When using the curl command to make an HTTP request, you can choose a commonly used and well-known domestic URL as the target URL. If you receive an HTTP response with a StatusCode of 200, it indicates that the public network is connected. You can also use connectivitycheck.platform.hihonorcloud.com as the target URL. If you receive an HTTP response with a 200 or 204 status code, it indicates that the public network is connected. If any one of these three verification methods succeeds, it means the public network is connected. Once the public network is connected, the network is usable, and the first electronic device can access the internet, the entire testing process ends. During the testing process, the time difference between the request and response can be recorded as an indicator of network quality. If the public network or the proxy server is not connected, further checks are performed to determine if the network configuration is abnormal.
[0115] S804: When the proxy server is not connected, or when the public network is not connected, the PC verifies whether the mobile phone's proxy ARP function is working properly.
[0116] The proxy ARP function refers to allowing a proxy device (in this embodiment, a mobile phone) to respond to ARP requests for IP addresses that are not on the network.
[0117] When sharing a mobile phone's network with a PC, the PC can send an ARP request to the mobile phone to obtain the MAC address corresponding to a preset IP address. If the mobile phone has its ARP proxy enabled, it can process the ARP request even if the destination IP address is not its own IP address, replying with the same MAC address as the mobile phone. This allows the PC to send all network requests with a destination IP address (not the mobile phone's IP address) to the mobile phone, thus enabling the use of the mobile network. It should be understood that the destination IP address is generic and does not refer to a single address.
[0118] When verifying the mobile phone's proxy ARP function on the PC side, the PC can send an ARP request (first request) to the mobile phone. The destination IP address in this ARP request can be the IP address of a commonly used website (such as the IP address of a Baidu server). The PC sends the ARP request message to the mobile phone. If the mobile phone sends a first reply to the PC, and the MAC address is the mobile phone's MAC address, it means that the mobile phone's proxy ARP function is normal. If the mobile phone does not send a first reply, or the MAC address in the first reply is not the mobile phone's MAC address, it means that the mobile phone's proxy ARP function is abnormal, and the PC cannot use the mobile network to access the Internet.
[0119] In S805, when the phone's proxy ARP function malfunctions, the PC sends a command to the phone to reconfigure the proxy ARP function. The phone then receives this command and reconfigures the proxy ARP function.
[0120] When the proxy ARP function on the mobile phone malfunctions, it can self-heal. For details, refer to... Figure 9 The self-healing process can include S901-S904.
[0121] In S901, the PC can send an ARP self-healing command to the mobile phone via a P2P channel, which is a command to reconfigure the proxy ARP function. The mobile phone then receives the ARP self-healing command.
[0122] After receiving the ARP self-healing command, the S902 phone reconfigures the proxy ARP function.
[0123] After the S903 is successfully reconfigured, the phone sends a message to the PC indicating that the proxy ARP function has been successfully configured.
[0124] S904, the PC receives the message that the proxy ARP function has been successfully configured, and then re-checks whether the PC can access the Internet, i.e., executes S801-S803.
[0125] Alternatively, after the PC receives a message indicating that the proxy ARP function has been successfully configured, it will recheck whether the PC can access the Internet after a certain period of time (e.g., an interval of 5 seconds). If the PC can access the Internet, the process ends.
[0126] If the PC cannot access the internet, proceed to step S804. While continuing with S804, if the proxy ARP function is normal in this test, proceed to step S806; if the proxy ARP function is still abnormal in this test, proceed to step S805, repeating the above process until the PC can access the internet. Alternatively, if the proxy ARP function is still abnormal in this test, the self-healing process will stop and the process will end. After each network configuration reset, the PC can record the results of this repair locally.
[0127] S806: When the phone's proxy ARP function is normal, the PC verifies whether the phone's DNS function is normal.
[0128] When verifying the DNS function of a mobile phone on the PC side, the PC can send a DNS request (second request) to the mobile phone to resolve a domain name from a preset network address. This preset network address can be a commonly used website address (e.g., baidu.com). The PC sends the DNS request to the mobile phone, and the mobile phone can query the status code. If the mobile phone replies with a DNS response message to the PC, and the status code in the DNS response message is 0, it indicates that the mobile phone's DNS function is normal. If the mobile phone does not reply with a DNS response message to the PC, or the status code is not 0, it indicates that the mobile phone's DNS function is abnormal.
[0129] S807: When the phone's DNS function malfunctions, the PC sends a command to the phone to reconfigure the DNS function.
[0130] When the DNS function on the mobile phone malfunctions, self-healing can be performed. Similar to the self-healing process of the proxy ARP function, the PC can send a command to the mobile phone to reconfigure the DNS function through a P2P channel. After receiving the command, the mobile phone reconfigures IP forwarding, NAT address translation, and DNS forwarding. After reconfiguring the DNS function, the mobile phone sends a message to the PC indicating that the DNS function has been successfully configured. After receiving the message, the PC checks its internet access again after a certain period of time (e.g., a 5-second interval). If the PC can access the internet, the process ends. If the PC cannot access the internet, steps S804-S807 can be repeated until the PC can access the internet; or the process can end.
[0131] When the phone's DNS function is normal, if there is a proxy server and the proxy server is connected, but you cannot use the public network, that is, you can only access the Internet through the proxy server, this situation is most likely caused by security policies; you can output a prompt to the user, such as: there is a proxy server, and you cannot connect to the public network.
[0132] If there is a proxy server, but the proxy server cannot access the internet normally, you can prompt the user to reconnect to security software (such as VPN) or disable the browser's proxy server.
[0133] If there is no proxy server and public networks cannot be used, but the mobile network configuration is normal, other causes can be further investigated.
[0134] Optionally, in S808, the PC can re-verify whether the proxy server is working properly. In S809, if the proxy server cannot access the internet, the user can be prompted to reconnect to security software (such as a VPN) or disable the browser's proxy server.
[0135] The following explains the process of configuring network settings on a mobile phone. For example, Figure 10 A schematic diagram of a mobile phone-side software architecture is shown. The layered architecture divides the software into several layers, each with a clear role and function. Layers communicate with each other through software interfaces. In some embodiments, the software system can be divided from top to bottom into an application layer, an application framework layer, a native service layer, and a kernel layer.
[0136] The application layer can include system applications, the NetworkSynergyService, Magiclink, distributed gateway AIDL files, and a series of application packages. The NetworkSynergyService includes a network settings module. The NetworkSynergyService can call Magiclink.
[0137] The application framework layer provides application programming interfaces (APIs) and a programming framework for applications in the application layer. The application framework layer includes some predefined functions.
[0138] like Figure 10 As shown, the application framework layer may include system services HnSystemServer, OemNetdService, and Network Management Service.
[0139] The system service HnSystemServer can include the distributed gateway AIDL file and the distributed gateway service. AIDL (Android Interface Definition Language) is a language used to define communication interfaces between applications. In Android development, AIDL files are used to define interfaces for cross-process communication, enabling different application components to communicate with each other.
[0140] The Oem Netd Service is a service provided by Netd, a low-level network daemon in the Android system. It's an extension interface that allows developers to communicate with Netd and control network functions via command line or code. The Oem Netd Service can include a proxy ARP interface and a DNS forwarding interface.
[0141] Network Manager Service can include IP forwarding interfaces and NAT interfaces.
[0142] The application framework layer may also include a window manager, content provider, view system, phone manager, resource manager, notification manager, etc. (not shown in the figure).
[0143] The local service layer may include Netd, which is responsible for implementing functions related to network configuration, operation, management, and querying, such as setting up a firewall, proxying ARP, IP forwarding, Network Address Translation (NAT), and DNS forwarding. DNS forwarding refers to translating a PC's website address into its IP address, while IP forwarding refers to forwarding a PC's IP address into a mobile phone's IP address. NAT (Network Address Translation) translates a mobile phone's IP address into a public IP address.
[0144] The kernel layer is the layer between hardware and software. It can include response modules, Bluetooth drivers, WiFi drivers, etc. The response module is used to reply to the PC's first request after ARP is enabled.
[0145] The hardware layer can include WiFi chips, Bluetooth chips, and the main chip. The WiFi chip has an ARP offload switch, which controls whether the proxy ARP function is enabled.
[0146] When the mobile phone receives the ARP self-healing command through the Magiclink P2P channel, the network sharing service calls the bind function to pass the ARP self-healing configuration command to the distributed gateway service. The distributed gateway service can configure a proxy ARP interface based on the ARP self-healing command and pass the ARP self-healing command to netd through the proxy ARP interface, where the proxy ARP function is reconfigured. Normally, the ARP offload switch is enabled by default, meaning the WiFi chip only handles its own internet access requests, and the proxy ARP function is not active. When reconfiguring the proxy ARP function, netd can call the chip driver interface to disable the ARP offload switch in the WiFi chip. This way, when the mobile phone receives an ARP request packet, it reports it to the main chip (i.e., the processor), which then handles it in the kernel. The kernel's response module can reply with the mobile phone's MAC address to the PC, thus enabling the ARP proxy function to work normally.
[0147] After the mobile phone receives the DNS self-healing command through Magiclink's P2P channel, the network sharing service calls the bind function to pass the DNS self-healing command to the distributed gateway service. The distributed gateway service can then configure the DNS Forward interface based on the DNS self-healing command, and pass the command to netd through the DNS Forward interface. In netd, the DNS forwarding function is reconfigured; specifically, firewall rules can be invoked to reset the DNS forwarding rules, including IP forwarding, NAT address translation, and DNS forwarding.
[0148] In summary, this application embodiment, taking into account the characteristics of PC network sharing services (that is, after successful PC network sharing, accessing the internet requires DNS resolution to obtain the IP address corresponding to the URL, and then the mobile phone's proxy ARP function to resolve the MAC address corresponding to the IP address before data packets can be sent to the mobile phone to achieve internet access logic), selects a bottom-up approach to check network connectivity, i.e., first checking the proxy ARP function and then checking the DNS function. Furthermore, it can self-heal when network configuration is abnormal, thereby reducing the probability of the PC being unable to access the internet under abnormal network configuration conditions. Moreover, since the DNS function requires the proxy ARP function, and the proxy ARP function is not based on the DNS function, bottom-up detection means that if the proxy ARP function is normal, there is no need to consider the proxy ARP function if the DNS function is abnormal. Only one item needs to be checked each time, which can improve the efficiency of detecting network configuration anomalies.
[0149] Figure 11 A schematic diagram of a hardware structure of an electronic device 100 is shown. This electronic device can be a first electronic device or a second electronic device.
[0150] Electronic device 100 may include processor 110, external memory interface 120, internal memory 121, universal serial bus (USB) interface 130, charging management module 140, power management module 141, battery 142, antenna 1, antenna 2, mobile communication module 150, wireless communication module 160, camera 193, display screen 194, etc.
[0151] Processor 110 may include one or more processing units, such as application processors (APs), modem processors, graphics processing units (GPUs), image signal processors (ISPs), controllers, video codecs, digital signal processors (DSPs), baseband processors, and / or neural network processing units (NPUs). These different processing units may be independent devices or integrated into one or more processors.
[0152] The controller can generate operation control signals based on the instruction opcode and timing signals to complete the control of instruction fetching and execution.
[0153] The processor 110 may also include a memory for storing instructions and data. In some embodiments, the memory in the processor 110 is a cache memory. This memory can store instructions or data that the processor 110 has just used or that are used repeatedly. If the processor 110 needs to use the instruction or data again, it can retrieve it directly from the memory. This avoids repeated accesses, reduces the waiting time of the processor 110, and thus improves the efficiency of the system.
[0154] In some embodiments, the processor 110 may include one or more interfaces. Interfaces may include an inter-integrated circuit (I2C) interface, an inter-integrated circuit sound (I2S) interface, a pulse code modulation (PCM) interface, a universal asynchronous receiver / transmitter (UART) interface, a mobile industry processor interface (MIPI), a general-purpose input / output (GPIO) interface, a subscriber identity module (SIM) interface, and / or a universal serial bus (USB) interface, etc.
[0155] The UART interface is a universal serial data bus used for asynchronous communication. This bus can be a bidirectional communication bus. It converts the data to be transmitted between serial and parallel communication. In some embodiments, the UART interface is typically used to connect the processor 110 and the wireless communication module 160. For example, the processor 110 communicates with the Bluetooth module in the wireless communication module 160 via the UART interface to implement Bluetooth functionality.
[0156] The MIPI interface can be used to connect the processor 110 to peripheral devices such as the display screen 194 and the camera 193. The MIPI interface includes a camera serial interface (CSI) and a display serial interface (DSI). In some embodiments, the processor 110 and the camera 193 communicate via the CSI interface to enable the electronic device 100 to capture images. The processor 110 and the display screen 194 communicate via the DSI interface to enable the electronic device 100 to display images.
[0157] It is understood that the interface connection relationships between the modules illustrated in the embodiments of the present invention are merely illustrative and do not constitute a structural limitation on the electronic device 100. In other embodiments of this application, the electronic device 100 may also employ different interface connection methods or combinations of multiple interface connection methods as described in the above embodiments.
[0158] The charging management module 140 receives charging input from a charger, which can be a wireless charger or a wired charger. While charging the battery 142, the charging management module 140 can also supply power to the electronic device via the power management module 141.
[0159] The power management module 141 is used to connect the battery 142, the charging management module 140, and the processor 110. The power management module 141 receives input from the battery 142 and / or the charging management module 140 to power the processor 110, internal memory 121, display 194, camera 193, and wireless communication module 160, etc.
[0160] The wireless communication function of electronic device 100 can be realized through antenna 1, antenna 2, mobile communication module 150, wireless communication module 160, modem processor and baseband processor, etc.
[0161] 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.
[0162] The mobile communication module 150 can provide wireless communication solutions for use on the electronic device 100, including 2-generation wireless telephone technology (2G), 3-generation mobile communication technology (3G), 4-generation mobile communication technology (4G), and 5-generation mobile communication technology (5G).
[0163] The wireless communication module 160 can provide solutions for wireless communication applications on the electronic device 100, including wireless local area networks (WLANs) (such as wireless fidelity (Wi-Fi) networks), Bluetooth (BT), global navigation satellite system (GNSS), frequency modulation (FM), near field communication (NFC), and infrared (IR) technologies. 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, performs frequency modulation and filtering of 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, perform frequency modulation and amplification, and convert them into electromagnetic waves for radiation via antenna 2.
[0164] 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), 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).
[0165] The electronic device 100 implements display functions through a GPU, a display screen 194, and an application processor. The display screen 194 is used to display images, videos, etc. The display screen 194 includes a display panel. In some embodiments, the electronic device 100 may include one or N displays screens 194, where N is a positive integer greater than 1.
[0166] The external storage interface 120 can be used to connect an external memory card, such as a Micro SD card, to expand the storage capacity of the electronic device 100. The external memory card communicates with the processor 110 through the external storage interface 120 to perform data storage functions. For example, music, video, and other files can be saved on the external memory card.
[0167] Internal memory 121 can be used to store computer executable program code, which includes instructions. Internal memory 121 may include a program storage area and a data storage area. The program storage area may store the operating system, at least one application program required for a function (such as sound playback, image playback, etc.), etc. The data storage area may store data created during the use of electronic device 100 (such as audio data, phonebook, etc.). Furthermore, internal memory 121 may include high-speed random access memory, and may also include non-volatile memory, such as at least one disk storage device, flash memory device, universal flash storage (UFS), etc. Processor 110 executes various functional applications and data processing of electronic device 100 by running instructions stored in internal memory 121 and / or instructions stored in memory located in the processor.
[0168] It is understood that the structures illustrated in the embodiments of the present invention do not constitute a specific limitation on the electronic device 100. In other embodiments of this application, the electronic device 100 may include more or fewer components than illustrated, or combine some components, or split some components, or have different component arrangements. The illustrated components may be implemented in hardware, software, or a combination of software and hardware.
[0169] Figure 12 This is a schematic diagram of a network detection device 1200 provided in an embodiment of this application. The network detection device 1200 may be an electronic device as described in this application embodiment, or a chip or chip system within an electronic device. Figure 12 As shown, the network detection device 1200 may include a display unit 1201 and a processing unit 1202. The processing unit 1202 is used to support the network detection device 1200 in performing the aforementioned processing steps.
[0170] In one implementation, the network detection device 1200 further includes a storage unit 1203. The storage unit 1203 and the processing unit 1202 are connected via a line. The storage unit 1203 may include one or more memories, which can be devices in one or more devices or circuits used for storing programs or data. The storage unit 1203 can exist independently and be connected to the processing unit 1202 via a communication bus. Alternatively, the storage unit 1203 can be integrated with the processing unit 1202.
[0171] Storage unit 1203 may store computer-executable instructions for methods in an electronic device, so that processing unit 1202 executes the methods in the above embodiments. Storage unit 1203 may be a register, cache, or random access memory (RAM), or it may be a read-only memory (ROM) or other types of static storage devices that can store static information and instructions.
[0172] Figure 13 This is a schematic diagram of a chip structure provided in an embodiment of this application. Figure 13 As shown, chip 1300 includes one or more (including two) processors 1301, communication lines 1302 and communication interfaces 1303. Optionally, chip 1300 also includes a memory 1304.
[0173] In some implementations, memory 1304 stores elements such as executable modules or data structures, or subsets thereof, or extended sets thereof.
[0174] The methods described in the embodiments of this application can be applied to, or implemented by, processor 1301. Processor 1301 may be an integrated circuit chip with signal processing capabilities. During implementation, each step of the above methods can be completed by integrated logic circuits in the hardware of processor 1301 or by instructions in software form. Processor 1301 may be a general-purpose processor (e.g., a microprocessor or conventional processor), a digital signal processor, an application-specific integrated circuit (ASIC), a field-programmable gate array (FPGA), or other programmable logic devices, discrete gates, transistor logic devices, or discrete hardware components. Processor 1301 can implement or execute the methods, steps, and logic block diagrams disclosed in the embodiments of this application.
[0175] The steps of the method disclosed in the embodiments of this application can be directly implemented by a hardware decoding processor, or implemented by a combination of hardware and software modules in the decoding processor. The software modules can be located in mature storage media in the art, such as random access memory, read-only memory, programmable read-only memory, or electrically erasable programmable read-only memory (EEPROM). This storage medium is located in memory 1304, and processor 1301 reads information from memory 1304 and, in conjunction with its hardware, completes the steps of the above method.
[0176] The processor 1301, memory 1304 and communication interface 1303 can communicate with each other via communication line 1302.
[0177] In the above embodiments, the instructions stored in the memory for execution by the processor can be implemented in the form of a computer program product. This computer program product can be pre-written into the memory, or it can be downloaded and installed into the memory as software.
[0178] This application also provides a computer program product comprising one or more computer instructions. When the computer program instructions are loaded and executed on a computer, all or part of the flow or function according to the embodiments of this application is generated. The computer may be a general-purpose computer, a special-purpose computer, a computer network, or other programmable device. The computer instructions may be stored in a computer-readable storage medium or transmitted from one computer-readable storage medium to another. For example, computer instructions may be transmitted from one website, computer, server, or data center to another website, computer, server, or data center via wired (e.g., coaxial cable, fiber optic, digital subscriber line (DSL)) or wireless (e.g., infrared, wireless, microwave, etc.) means. The computer-readable storage medium may be any available medium that a computer can store or a data storage device such as a server or data center that integrates one or more available media. For example, available media may include magnetic media (e.g., floppy disks, hard disks, or magnetic tapes), optical media (e.g., digital versatile discs (DVDs)), or semiconductor media (e.g., solid-state drives (SSDs)).
[0179] This application provides an electronic device, which includes a processor and a memory. The memory stores a computer program, and the processor executes the computer program to perform the method described above.
[0180] This application provides a chip. The chip includes a processor, which is used to call a computer program in memory to execute the technical solutions in the above embodiments. Its implementation principle and technical effects are similar to those in the related embodiments described above, and will not be repeated here.
[0181] In the embodiments provided in this application, it should be understood that the disclosed devices / electronic devices and methods can be implemented in other ways. For example, the device / electronic device embodiments described above are merely illustrative. For instance, the division of modules or units is only a logical functional division, and in actual implementation, there may be other division methods. For example, multiple units or components may be combined or integrated into another system, or some features may be ignored or not executed. Furthermore, the displayed or discussed mutual couplings or direct couplings or communication connections may be through some interfaces; indirect couplings or communication connections between devices or units may be electrical, mechanical, or other forms. Additionally, the functional units in the various embodiments of this application may be integrated into one processing unit, or each unit may exist physically separately, or two or more units may be integrated into one unit. The integrated units described above can be implemented in hardware or as software functional units.
[0182] This application also provides a computer-readable storage medium storing a computer program that, when executed by a processor, implements the steps described in the various method embodiments above. The computer-readable storage medium stores a computer program or instructions. When executed by a processor, the computer program or instructions implement the methods described above. The methods described in the above embodiments can be implemented wholly or partially by software, hardware, firmware, or any combination thereof. If implemented in software, the functionality can be stored as one or more instructions or code on or transmitted over the computer-readable medium. The computer-readable medium can include computer storage media and communication media, and can also include any medium that can transfer a computer program from one place to another. The storage medium can be any target medium accessible by a computer.
[0183] As one possible design, computer-readable media may include compact disc read-only memory (CD-ROM), RAM, ROM, EEPROM, or other optical disc storage; computer-readable media may include disk storage or other disk storage devices. Furthermore, any connecting cable may also be appropriately referred to as computer-readable media. For example, if software is transmitted from a website, server, or other remote source using coaxial cable, fiber optic cable, twisted pair, DSL, or wireless technologies such as infrared, radio, and microwave, then coaxial cable, fiber optic cable, twisted pair, DSL, or wireless technologies such as infrared, radio, and microwave are included in the definition of media. As used herein, disks and optical discs include optical discs (CD), laser discs, optical discs, DVDs, floppy disks, and Blu-ray discs, where disks typically reproduce data magnetically, while optical discs optically reproduce data using lasers. Combinations of the above should also be included within the scope of computer-readable media.
[0184] This application describes embodiments with reference to flowchart illustrations and / or block diagrams of methods, apparatus (systems), and computer program products according to embodiments of this application. It should be understood that each block of the flowchart illustrations and / or block diagrams, and combinations of blocks in the flowchart illustrations and / or block diagrams, can be implemented by computer program instructions. These computer program instructions can be provided to a processing unit of a general-purpose computer, special-purpose computer, embedded processor, or other programmable data processing apparatus to produce a machine, such that the instructions, which execute via the processing unit of the computer or other programmable data processing apparatus, generate instructions for implementing the flowchart illustrations. Figure 1 One or more processes and / or boxes Figure 1 A device that provides the functions specified in one or more boxes.
[0185] In the foregoing description, specific details such as particular system architectures and techniques have been set forth for illustrative purposes and not for limitation, in order to provide a thorough understanding of the embodiments of this application. However, those skilled in the art will understand that this application can also be implemented in other embodiments without these specific details. In other instances, detailed descriptions of well-known systems, apparatuses, circuits, and methods have been omitted to avoid unnecessary detail that could obscure the description of this application.
[0186] It should be understood that, when used in this application specification and the appended claims, the term "comprising" indicates the presence of the described features, integrals, steps, operations, elements and / or components, but does not exclude the presence or addition of one or more other features, integrals, steps, operations, elements, components and / or a collection thereof.
[0187] It should also be understood that, in the description of this application, unless otherwise stated, " / " means "or", for example, A / B can mean A or B; "and / or" in this document is merely a description of the relationship between related objects, referring to any combination and all possible combinations of one or more of the related listed items, and including these combinations, for example, A and / or B can mean: A alone, A and B together, and B alone.
[0188] As used in this application specification and the appended claims, the term "if" may be interpreted, depending on the context, as "when," "once," "in response to determination," or "in response to detection." Similarly, the phrase "if determined" or "if detected [the described condition or event]" may be interpreted, depending on the context, as meaning "once determined," "in response to determination," "once detected [the described condition or event]," or "in response to detection [the described condition or event]."
[0189] References to "one embodiment" or "some embodiments" as described in this specification mean that one or more embodiments of this application include a specific feature, structure, or characteristic described in connection with that embodiment. Therefore, the phrases "in one embodiment," "in some embodiments," "in other embodiments," "in still other embodiments," etc., appearing in different parts of this specification do not necessarily refer to the same embodiment, but rather mean "one or more, but not all, embodiments," unless otherwise specifically emphasized. The terms "comprising," "including," "having," and variations thereof mean "including but not limited to," unless otherwise specifically emphasized.
[0190] The above-described embodiments are only used to illustrate the technical solutions of this application, and are not intended to limit them. Although this application has been described in detail with reference to the foregoing embodiments, those skilled in the art should understand that modifications can still be made to the technical solutions described in the foregoing embodiments, or equivalent substitutions can be made to some of the technical features. Such modifications or substitutions do not cause the essence of the corresponding technical solutions to deviate from the spirit and scope of the technical solutions of the embodiments of this application, and should all be included within the protection scope of this application.
Claims
1. A network detection method, characterized by, The method applied to a first electronic device comprises: The first electronic device establishes a network connection with a second electronic device, and the network of the second electronic device is in a normal state; After the first electronic device establishes a network connection with the second electronic device, it is detected whether the first electronic device can use the network of the second electronic device to surf the Internet; In the case that the first electronic device cannot surf the Internet, it is detected whether the network configuration of the second electronic device is abnormal; In the case that the network configuration of the second electronic device is abnormal, a target command is sent to the second electronic device, and the target command instructs the second electronic device to reset the network configuration.
2. The method of claim 1, wherein, After sending the target command to the second electronic device, the method further comprises: Receiving information that the second electronic device successfully sets the network configuration; After receiving the information that the second electronic device successfully sets the network configuration, it is re-detected whether the first electronic device can use the network of the second electronic device to surf the Internet.
3. The method according to claim 1 or 2, characterized in that, Detecting whether the network configuration of the second electronic device is abnormal comprises: Detecting whether the proxy address resolution protocol function of the second electronic device is abnormal; In the case that the proxy address resolution protocol function is abnormal, it is determined that the network configuration of the second electronic device is abnormal; or, In the case that the proxy address resolution protocol function is normal, it is detected whether the domain name system forwarding function of the second electronic device is abnormal; In the case that the domain name system forwarding function is abnormal, it is determined that the network configuration of the second electronic device is abnormal.
4. The method of claim 3, wherein, Detecting whether the proxy address resolution protocol function of the second electronic device is abnormal comprises: Sending a first request to the second electronic device, and the first request is used to obtain the MAC address of a preset IP address; In the case that a first reply of the second electronic device is received, and the first reply includes the MAC address of the second electronic device, it is determined that the proxy address resolution protocol function of the second electronic device is normal; or, In the case that the first reply of the second electronic device is not received, or the first reply does not include the MAC address of the second electronic device, it is determined that the proxy address resolution protocol function of the second electronic device is abnormal, and the target command instructs the second electronic device to reset the proxy address resolution protocol function.
5. The method of claim 3, wherein, Detecting whether the domain name system forwarding function of the second electronic device is abnormal comprises: Sending a second request to the second electronic device, and the second request is used to request to resolve the domain name of a preset network address; In the case that a second reply of the second electronic device is received, it is determined that the domain name system forwarding function of the second electronic device is normal; or, In the case that the second reply of the second electronic device is not received, it is determined that the domain name system forwarding function of the second electronic device is abnormal, and the target command instructs the second electronic device to reset the domain name system forwarding function.
6. The method according to any one of claims 1 to 5, characterized in that, The detection of whether the first electronic device can use the network of the second electronic device to surf the Internet comprises: Detecting whether the first electronic device sets a proxy server; In a case where the first electronic device sets a proxy server, it is detected whether the proxy server can be normally connected; In a case where the proxy server can be normally connected, or in a case where the proxy server is not set, it is detected whether a public network can be normally connected; In a case where the public network can be normally connected, the first electronic device can use the network of the second electronic device to surf the Internet.
7. A network detection method, characterized by, The method applied to the second electronic device comprises: The second electronic device establishes a network connection with the first electronic device, and the network of the second electronic device is in a normal state; A target command is received from the first electronic device, and the target command instructs the second electronic device to reset a network configuration; According to the target command, the network configuration is reset.
8. The method of claim 7, wherein, After the network configuration is reset, the method further comprises: Information that the network configuration is successfully set is sent to the first electronic device.
9. The method according to claim 7 or 8, characterized in that, The method further comprises: A first request is received from the first electronic device, and the first request is used to acquire a MAC address of a preset IP address; In a case where a proxy address resolution protocol function of the second electronic device is normal, a first reply is sent to the first electronic device, and the first reply comprises the MAC address of the second electronic device.
10. The method according to claim 7 or 8, characterized in that, The method further comprises: A second request is received from the first electronic device, and the second request is used to request to resolve a domain name of a preset network address; In a case where a domain name system forwarding function of the second electronic device is normal, a second reply is sent to the first electronic device.
11. The method of claim 7, wherein, The target command instructs the second electronic device to reset the proxy address resolution protocol function, and according to the target command, the network configuration is reset, which comprises: According to the target command, a switch corresponding to the proxy address resolution protocol function in a target chip is closed, and the target chip is a chip related to network connection in the second electronic device.
12. The method of claim 7, wherein, The target command instructs the second electronic device to reset the domain name system forwarding function, and according to the target command, the network configuration is reset, which comprises: According to the target command, a DNS forwarding rule of a firewall is reset.
13. An electronic device, comprising: Comprise: One or more processors; one or more memories; The memory stores one or more programs, and when the one or more programs are executed by the processor, the electronic device executes the method in any one of claims 1 to 6, or executes the method in any one of claims 7 to 12.
14. A computer-readable storage medium, characterized in that, The computer readable storage medium stores instructions, and when the instructions are run on the computer, the computer executes the method in any one of claims 1 to 6, or executes the method in any one of claims 7 to 12.
Citation Information
Patent Citations
Network recovery method and device, storage medium and electronic equipment
CN112398689A
Resource access method and terminal device
WO2022143155A1