Methods, devices, and storage media for predicting network congestion

By detecting the strength of wireless network signals and matching them with lag fences, network lag can be predicted and switched to cellular networks in advance, solving the problem of network lag when users leave the wireless network coverage area, improving the internet experience and saving data.

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

Patent Information

Application Number
CN202210014982.4
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2022-01-07
Publication Date
2025-10-28
Estimated Expiration
2042-01-07

AI Technical Summary

Technical Problem

When users leave the wireless network coverage area, the network signal of their electronic devices gradually weakens, causing network lag and affecting the internet browsing experience.

Method used

By detecting whether the current wireless network signal strength is below a threshold, network list information is obtained and matched with a pre-generated lag fence. If the match is successful, the data stream is switched to the cellular network to prevent network lag.

Benefits of technology

Switching to cellular network in advance avoids lag when the wireless network signal is weak, improves the user's internet experience, and reduces the data consumption of switching cellular network data streams.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN116471619B_ABST
    Figure CN116471619B_ABST
Patent Text Reader

Abstract

This application provides a method, device, and storage medium for predicting network lag. The method includes: after an electronic device connects to a current wireless network, detecting whether the signal strength of the current wireless network is lower than a threshold; if the signal strength is lower than the threshold, obtaining current network list information, which includes the network identifier and signal strength of the currently scanned wireless network; matching the current network list information with a lag fence for the current wireless network; and if the match is successful, switching the data stream carried by the current wireless network to the cellular network. This solution uses lag fences to predict whether the current wireless network will experience lag, thereby switching the data stream from the current wireless network to the cellular network before lag occurs, avoiding lag problems when the wireless network signal is weak, and improving the user experience.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the field of wireless network technology, and in particular to a method, device and storage medium for predicting network lag. Background Technology

[0002] In areas with wireless network coverage, electronic devices provide internet access to users by connecting to the wireless network. When users leave the coverage area, the wireless network signal received by the electronic devices gradually weakens until the connection is lost. A weakened wireless network signal can cause buffering or stuttering when users browse the internet. Summary of the Invention

[0003] This application provides a method, device, and storage medium for predicting network lag, in order to solve the problem of network lag when users leave the wireless network coverage area.

[0004] To achieve the above objectives, this application provides the following technical solution:

[0005] The first aspect of this application provides a method for predicting network lag, including:

[0006] After an electronic device connects to the current wireless network, it is detected whether the signal strength of the current wireless network is lower than the threshold of the current wireless network.

[0007] If the signal strength of the current wireless network is lower than the threshold, obtain the current network list information, which includes the network identifier and signal strength of the currently scanned wireless network;

[0008] Match the current network list information with the current wireless network's lag fence;

[0009] If the current network list information and the lag fence match successfully, the data stream carried by the current wireless network will be switched to the cellular network.

[0010] The beneficial effect of this embodiment is that it uses lag fences to predict whether the current wireless network will lag, and then switches the data stream carried by the current wireless network to the cellular network before lag occurs, so that users can have a smoother experience when browsing the Internet.

[0011] In some optional embodiments, it also includes:

[0012] When the electronic device accesses the current wireless network, network list information is collected in real time. The collected network list information includes the network identifier and signal strength of the wireless network scanned during the collection.

[0013] The lag fence and threshold of the current wireless network are determined based on the network list information collected within a preset time period.

[0014] Specifically, in this embodiment, after the electronic device connects to the current wireless network, it can scan the wireless network in real time. After each scan, it records the network identifiers and corresponding signal strengths of several wireless networks detected in this scan as a network list information. Then, it uses one or more network list information collected within a preset time period to determine the lag fence and threshold.

[0015] For a detailed implementation of this embodiment, please refer to [link / reference]. Figure 8 The steps S01 to S06 shown, and Figure 10 The steps S01 to B03 are shown.

[0016] In some optional embodiments, the preset time period is a first preset duration before the electronic device and the current wireless network disconnect.

[0017] For example, the first preset duration can be 30 seconds. That is, in this embodiment, the electronic device can use the network list information collected within 30 seconds before the current wireless network is disconnected to determine the lag fence and threshold of the current wireless network.

[0018] In some optional embodiments, the preset time period is a second preset duration before the electronic device determines that the network quality of the current wireless network is poor.

[0019] For example, the second preset duration can be 2 seconds. That is, in this embodiment, the electronic device can use the network list information collected within 2 seconds before the current wireless network quality is detected to determine the current wireless network's lag fence and threshold.

[0020] Network quality can be evaluated based on indicators such as the transmission rate and packet loss rate of the wireless network. The higher the transmission rate and the lower the packet loss rate, the better the network quality, and vice versa.

[0021] The beneficial effects of this embodiment are as follows:

[0022] By utilizing the lag fence defined in this embodiment, electronic devices can detect in advance that the quality of the current wireless network will deteriorate, and then complete the data stream switch before the quality of the current wireless network deteriorates, thereby further improving the user experience.

[0023] In some optional embodiments, the current wireless network lag fence includes the average signal strength of each wireless network in the network list information collected within the preset time period;

[0024] The average signal strength of the wireless network is the average of multiple signal strengths of the wireless network collected in the network list information within the preset time period.

[0025] In some optional embodiments, the threshold of the current wireless network is the average of multiple signal strengths corresponding to the current wireless network in the network list information collected within the preset time period.

[0026] In some optional embodiments, matching the current network list information with the lag fence of the current wireless network includes:

[0027] Calculate the signal strength deviation of the wireless networks in the current network list information. The signal strength deviation of the wireless network is the difference between the average signal strength of the wireless networks in the lag fence and the signal strength of the wireless networks in the current network list information.

[0028] Determine the proportion of wireless networks whose signal strength deviation is within a preset deviation range in the current network list information;

[0029] If the ratio is greater than a preset ratio threshold, it is determined that the current network list information and the lag fence are successfully matched.

[0030] If the ratio is less than or equal to the ratio threshold, it is determined that the current network list information and the lag fence fail to match.

[0031] In some optional embodiments, before obtaining the current network list information, the method further includes:

[0032] Determine whether the signal strength of the current wireless network continues to decrease within a third preset time period before the signal strength of the current wireless network falls below the threshold of the current wireless network;

[0033] If the signal strength of the current wireless network continues to decrease within the third preset time period, the step of obtaining the current network list information is executed.

[0034] The specific value of the third preset duration depends on actual needs, and this embodiment does not limit it.

[0035] As an example, the third preset duration can be 5 seconds. That is, in this embodiment, when the electronic device detects that the signal strength of the current wireless network is lower than the threshold, it further determines whether the signal strength has been continuously decreasing within 5 seconds before the signal strength falls below the threshold. Only after determining that the signal strength has been continuously decreasing within the previous 5 seconds will the subsequent steps be executed.

[0036] The beneficial effects of this embodiment are as follows:

[0037] To avoid misjudgments in situations such as wireless router malfunctions and electronic devices entering enclosed spaces, the accuracy of the stuttering prediction method in this embodiment is improved.

[0038] In some optional embodiments, switching the data stream carried by the current wireless network to the cellular network includes:

[0039] Switch the data stream of the foreground application currently carried by the wireless network to the cellular network.

[0040] As an example, when an electronic device needs to switch data streams, with a video application running in the foreground and a chat application running in the background, the electronic device can switch only the data stream of the video application to the cellular network, while the data stream of the chat application is still transmitted by the current wireless network.

[0041] The beneficial effects of this embodiment are as follows:

[0042] The lag of background applications is generally not perceived by users, so keeping the data stream of background applications on the current wireless network will not have an adverse impact on the user experience. At the same time, this embodiment can reduce the data stream carried by the cellular network, thereby reducing the data consumption of electronic devices and saving communication costs.

[0043] A second aspect of this application provides an electronic device, including a memory and one or more processors;

[0044] The memory is used to store computer programs;

[0045] The one or more processors are used to execute the computer program, specifically to implement the network lag prediction method provided in any of the first aspects of this application.

[0046] A third aspect of this application provides a computer storage medium for storing a computer program, which, when executed, is specifically used to implement the network lag prediction method provided in any one of the first aspects of this application.

[0047] This application provides a method, device, and storage medium for predicting network lag. The method includes: after an electronic device connects to a current wireless network, detecting whether the signal strength of the current wireless network is lower than a threshold; if the signal strength is lower than the threshold, obtaining current network list information, which includes the network identifier and signal strength of the currently scanned wireless network; matching the current network list information with a lag fence for the current wireless network; and if the match is successful, switching the data stream carried by the current wireless network to the cellular network. This solution uses lag fences to predict whether the current wireless network will experience lag, thereby switching the data stream from the current wireless network to the cellular network before lag occurs, avoiding lag problems when the wireless network signal is weak, and improving the user experience. Attached Figure Description

[0048] Figure 1 This is a schematic diagram of the structure of an electronic device provided in an embodiment of this application;

[0049] Figure 2 This is a schematic diagram illustrating how the signal strength of a wireless network decreases as an electronic device moves, as provided in an embodiment of this application.

[0050] Figure 3 A schematic diagram of a network lag interface provided for an embodiment of this application;

[0051] Figure 4 A schematic diagram of an interface for pre-switching to a cellular network, provided as an embodiment of this application;

[0052] Figure 5 A schematic diagram illustrating the switching of data streams in an electronic device, as provided in an embodiment of this application;

[0053] Figure 6 A schematic diagram of a WLAN interface provided in an embodiment of this application;

[0054] Figure 7 A schematic diagram of the software framework of an electronic device provided in an embodiment of this application;

[0055] Figure 8 A timing diagram of a network lag prediction method provided in an embodiment of this application;

[0056] Figure 9 This is a schematic diagram illustrating the data stream information reported by a traffic reporting component to a traffic sensing component, provided in an embodiment of this application.

[0057] Figure 10 A timing diagram of another method for predicting network lag provided in an embodiment of this application;

[0058] Figure 11 A flowchart illustrating a method for predicting network lag as provided in this application embodiment. Detailed Implementation

[0059] The technical solutions of the embodiments of this application will be clearly and completely described below with reference to the accompanying drawings. The terminology used in the following embodiments is for the purpose of describing specific embodiments only and is not intended to be a limitation of this application. As used in the specification and appended claims of this application, the singular expressions "a," "an," "the," "the," "the," and "this" are intended to also include expressions such as "one or more," unless the context clearly indicates otherwise. It should also be understood that in the embodiments of this application, "one or more" refers to one, two, or more; "and / or" describes the relationship between related objects, indicating that three relationships may exist; for example, A and / or B can represent: A alone, A and B simultaneously, or B alone, where A and B can be singular or plural. The character " / " generally indicates that the preceding and following related objects are in an "or" relationship.

[0060] This application provides an electronic device 100, which may specifically be a mobile phone, tablet computer, or other such device.

[0061] like Figure 1 As shown, the electronic device 100 may include: a processor 110, an external memory 120, an internal memory (also called "RAM") 121, a universal serial bus (USB) interface 130, a charging management module 140, a power management module 141, a battery 142, an antenna 1, an antenna 2, a mobile communication module 150, a wireless communication module 160, an audio module 170, a speaker 170A, a receiver 170B, a microphone 170C, a headphone jack 170D, a sensor module 180, buttons 190, a motor 191, an indicator 192, a camera 193, a display screen 194, and a subscriber identification module (SIM) card interface 195, etc. The sensor module 180 may include a pressure sensor 180A, a gyroscope sensor 180B, a barometric pressure sensor 180C, a magnetic sensor 180D, an accelerometer sensor 180E, a distance sensor 180F, a proximity sensor 180G, a fingerprint sensor 180H, a temperature sensor 180J, a touch sensor 180K, an ambient light sensor 180L, a bone conduction sensor 180M, etc.

[0062] Processor 110 may include one or more processing units, such as application processor (AP), communication processor (CP, also known as modem), graphics processing unit (GPU), etc.

[0063] Electronic devices equipped with wireless network cards (such as mobile phones) can establish a communication connection with a wireless router through the wireless network card, thereby accessing the wireless network provided by the wireless router. They can also establish a communication connection with a base station through a data service network card, thereby accessing the network provided by the base station. In this embodiment, the network provided by the wireless router can be called a wireless network or Wi-Fi, and the network provided by the base station can be called a cellular network.

[0064] Understandably, the strength of the wireless network signal received by electronic devices and wireless routers is affected by the distance between them. The farther apart they are, the weaker the wireless network signal will be. When the distance between the electronic device and the wireless router exceeds a certain range, the electronic device will no longer receive the wireless network signal emitted by the wireless router, and the electronic device will disconnect from the wireless router and leave the wireless network provided by the wireless router.

[0065] See Figure 2 This diagram illustrates how the signal strength of a wireless network decreases as an electronic device moves, according to an embodiment of this application. When a user is in a room with a wireless router, their mobile phone connects to the wireless network provided by the router. As the user leaves the room, the distance between the user's mobile phone and the wireless router gradually increases, and the strength of the wireless network signal received by the mobile phone gradually decreases with increasing distance until the mobile phone disconnects from the wireless router.

[0066] See Figure 3 This is a schematic diagram of an interface illustrating network lag, provided in an embodiment of this application. When a user uses their mobile phone in an area with wireless network (e.g., Wi-Fi) coverage, such as in a room with a wireless router, the phone can access the wireless network and provide internet access to the user. Figure 3 For example, (1) after a mobile phone connects to the Wi-Fi provided by a wireless router, it can play network videos via Wi-Fi.

[0067] When a user leaves the area covered by the wireless network, such as moving from the room where the wireless router is located to the outdoors, the wireless network signal received by the mobile phone from the wireless router will gradually weaken. However, the mobile phone will still provide Internet access through the wireless network until it loses its connection to the wireless network due to being too far away from the wireless router. Only then will the mobile phone switch to the cellular network and continue to provide Internet access using cellular mobile data traffic.

[0068] During this process, when the Wi-Fi signal is weak, the phone will experience lag when connecting to the internet via Wi-Fi. Figure 3 For example, in case (2), when the Wi-Fi signal received by the mobile phone is weak, the network video will take a long time to load and cannot be played smoothly.

[0069] To address the aforementioned problems, this application provides a method for predicting network lag. By implementing the method of this embodiment, mobile devices such as mobile phones can switch to cellular networks in advance when they are far from a wireless router, thereby avoiding lag caused by continuing to use a weak wireless network.

[0070] For example, please participate Figure 4 This is a schematic diagram of the interface for pre-switching to a cellular network provided in an embodiment of this application. Figure 4 As shown in (1), when the mobile phone is in the Wi-Fi coverage area, the Wi-Fi signal is strong. At this time, the mobile phone provides Internet access services through Wi-Fi, such as playing online videos through Wi-Fi.

[0071] like Figure 4 As shown in (2), when the mobile phone moves away from the wireless router as the user leaves the Wi-Fi coverage area, the mobile phone switches to the cellular network before the Wi-Fi signal becomes too weak and stops, thus avoiding the problem of wireless network lag.

[0072] See Figure 5 This is a schematic diagram of an electronic device switching data streams according to an embodiment of this application.

[0073] When a mobile phone accesses the internet via Wi-Fi, applications running on the phone can establish a connection with a server through the wireless network card. Data flow between the application and the server is transmitted through the phone's wireless network card and the wireless router. Figure 5 For example, in case (1), the mobile phone runs a video application A and a chat application B. Data stream A is generated between video application A and server A, and data stream B is generated between chat application B and server B. Both data stream A and data stream B are transmitted through a wireless network card and a wireless router.

[0074] In this embodiment, the data sequence transmitted between two electronic devices is referred to as a data stream. In practical applications, depending on the application scenario, the data stream can be a video stream, audio stream, download stream, session stream, etc.

[0075] like Figure 2 As shown, the strength of the wireless network signal received by the mobile phone decreases as the phone moves further away from the wireless router. Therefore, while the mobile phone is accessing the internet through the wireless router, it can detect in real time whether the strength of the received wireless network signal is lower than a preset threshold. If the detected wireless network signal strength is lower than the threshold, the mobile phone can collect the current network list information and match the collected network list information with the pre-generated wireless network lag fence.

[0076] If the current network list information matches the lag warning, the phone predicts that the currently accessed wireless network will experience lag, and therefore switches from wireless internet access to cellular internet access. Specifically, the phone can switch the data stream originally transmitted via the wireless network card to the data service network card that provides cellular network capabilities.

[0077] by Figure 5 For example, in case (2), when the mobile phone predicts that the wireless network will lag, the mobile phone will switch the data stream A and data stream B that were originally transmitted through the wireless network card to the data service network card, so that data stream A and data stream B are transmitted through the data service network card and the base station. Thus, the mobile phone switches from wireless network internet access to cellular network internet access.

[0078] It needs to be explained that, Figure 5 This is merely an example of switching data streams provided in this application. In practical applications, electronic devices such as mobile phones can switch all one or more data streams transmitted by a wireless network card to a data service network card. These one or more data streams can be generated by one or more applications, and are not limited to... Figure 5 Data streams A and B are shown.

[0079] In some alternative embodiments, when the mobile phone predicts that the currently accessed wireless network will experience lag, it can switch only the data stream generated by the application currently running in the foreground, without switching the data stream of the application running in the background.

[0080] For example, when a user is watching a video using a video application (which is running in the foreground) and simultaneously a chat application is running in the background, if the phone predicts that the currently connected wireless network will experience lag, the phone can switch only the video application's data stream from the wireless network card to the data service network card, while the chat application's data stream continues to be transmitted through the wireless network card.

[0081] The advantage of doing this is that the data traffic consumed by the data service network card usually generates additional communication costs, and the lag of background applications is usually not perceived by users. Therefore, by only switching the data stream of the foreground application, the data traffic consumed by the data service network card can be reduced and communication costs can be saved while ensuring a smooth online experience.

[0082] The network list information mentioned above may include the network identifier and signal strength of one or more wireless networks scanned by the electronic device.

[0083] See Figure 6 Electronic devices can discover one or more currently accessible wireless networks by scanning. These scanned wireless networks can then be used to... Figure 6 The list shown is displayed in the Wireless Local Area Network (WLAN) interface, where WiFi-100 is the wireless network currently connected to the electronic device, and WiFi-200 to WiFi-400 represent other accessible wireless networks discovered by the electronic device through scanning. Figure 6 Taking the wireless networks scanned in the image as an example, the network list information mentioned above can include the network identifiers and signal strengths of the four wireless networks from WiFi-100 to WiFi-400.

[0084] In this embodiment, a lag fence can be understood as signal strength information of a wireless network scanned when a wireless network accessed by an electronic device experiences lag. For example, a lag fence may include the signal strength of one or more wireless networks scanned when a wireless network accessed by an electronic device experiences lag, or it may include the average signal strength of these wireless networks.

[0085] By matching network list information with lag fences, it is possible to determine whether the network list information currently collected by the electronic device is similar to the lag fence, thereby predicting whether the electronic device will experience lag.

[0086] For example, an electronic device may consider a period of time before a wireless network is disconnected (e.g., 5 seconds before disconnection) or a period of time before poor network quality is detected (e.g., 2 seconds before poor network quality is detected) as the time when lag occurs, and determine the network identifiers of one or more wireless networks scanned during this period, as well as the average signal strength of these wireless networks during this period, as a lag fence.

[0087] The technical implementation details of the network lag prediction method of this application are explained below.

[0088] See Figure 7 This is a schematic diagram of the software architecture of an electronic device provided in an embodiment of this application. Figure 7Only some layers and components related to the embodiments of this application are shown. In actual applications, more may be included. Figure 7 The hierarchy and components are not shown in the diagram. Of course, it may also include only... Figure 7 Some of the components shown.

[0089] The software system of an electronic device may include an application layer, a service layer, a policy layer, and a kernel layer.

[0090] The application layer can include one or more applications of the electronic device, such as video, navigation, and WLAN. WLAN provides users with the ability to connect to wireless networks. Users can enable or disable the wireless network function of their electronic devices and select the wireless network to connect to.

[0091] The service layer can include path management components, application-level policy management components, and lag fence components. The lag fence component can be further subdivided into fence data acquisition components, lag fence generation components, fence database components, and lag prediction components.

[0092] The path management component stores paths for multiple network channels, allowing you to request or close any network channel. It can also detect changes in the status of any network channel and assess its quality.

[0093] Application-level policy management components are used to enable data stream switching. For example, when it is predicted that the wireless network will become slow, a data stream switching is initiated to switch the data stream carried by the wireless network to the cellular network.

[0094] The lag fence component is used to generate lag fences and to predict whether lag will occur when electronic devices access a wireless network based on the lag fences.

[0095] In some embodiments, the lag fence component can be specifically divided into a fence data acquisition component, a fence database component, a lag fence generation component, and a lag prediction component. The fence data acquisition component is used to collect network list information; the fence database component is used to store the collected network list information and the generated lag fences; the lag fence generation component is used to process the collected network list information to generate lag fences; and the lag prediction component is used to detect whether the signal strength of the wireless network is below a threshold, and when the signal strength is below the threshold, it triggers the fence data acquisition component to collect network list information, and predicts whether the wireless network will experience lag based on the network list information and the lag fences stored in the fence database component.

[0096] The strategy layer may include flow-level policy management components, quality of experience (QoE) assessment components, and traffic awareness components.

[0097] The flow-level policy management component is used to issue flow switching commands to the kernel after a data flow switching is initiated, so as to trigger the kernel to switch the data flow to another network.

[0098] The QoE assessment component is used to evaluate the quality of the network currently used by an electronic device, and to report a poor network quality notification to the lag fence component when a poor network quality is detected. For example, when an electronic device connects to a wireless network, the QoE assessment component can obtain the data transmission rate of the electronic device on that wireless network in real time. When the data transmission rate is found to be lower than a set rate threshold, the component considers the wireless network to be of poor quality and then reports a poor network quality notification to the lag fence component.

[0099] The traffic-aware component is used to store information related to data streams. For example, the information related to a data stream may include the data stream's identifier, data transmission rate, message type, and the identifier of the network carrying the data stream.

[0100] The kernel layer can include policy enforcement components and traffic reporting components.

[0101] The policy enforcement component is used to perform network switching. For example, in response to a stream switching command, the policy enforcement component switches the data stream originally carried by the wireless network to the cellular network.

[0102] The traffic reporting component is used to collect data stream information and report the collected data stream information to the traffic awareness component.

[0103] As another embodiment of this application, in the above embodiments, one component can be split into two or more components, and two or more components at the same level can be merged into the same component.

[0104] For example Figure 7 The mid-path management component and the application-level policy management component can be merged into a single decision center component.

[0105] The network lag prediction method of this application is explained below in conjunction with the above software architecture. Please refer to [link / reference]. Figure 8 This is a timing diagram of a network lag prediction method provided in an embodiment of this application.

[0106] Once the WLAN function of an electronic device is enabled, the WLAN application can scan for available wireless networks in real time. When an available wireless network is found, the WLAN application will automatically register with that wireless network. If the wireless network has a registration password, the WLAN application can register with that wireless network using the registration password entered by the user or the registration password saved during previous registration.

[0107] After the WLAN application successfully registers with a wireless network, the WLAN application executes step S01, detects the access to the wireless network, and then executes step S02 to send a wireless network access notification to the lag fence component.

[0108] In some embodiments, the WLAN application can send a wireless network access notification to the aforementioned fence data acquisition component, which can then forward the wireless network access notification to the lag prediction component. Alternatively, the WLAN application can send the wireless network access notification to both the fence data acquisition component and the lag prediction component.

[0109] The aforementioned wireless network access notification may carry the network identifier of the wireless network accessed by the WLAN application.

[0110] For example, the network identifier of a wireless network can be the Basic Service Set Identifier (Bssid) of that wireless network.

[0111] S03, continuously collect network list information.

[0112] As before, step S03 can be continuously executed by the fence data acquisition component before the electronic device disconnects from the wireless network, and the acquired network list information can be stored in the fence database component.

[0113] The implementation of step S03 can be that the fence data acquisition component uses the wireless network card of the electronic device to scan for accessible wireless networks. After each scan is completed, the fence data acquisition component obtains the network identifier (e.g., BSSID) and signal strength of one or more wireless networks scanned in this scan from the wireless network card, and determines these network identifiers, signal strengths and the timestamp of this scan as a network list information.

[0114] The network list information can include the network identifier and signal strength of each wireless network scanned by the wireless network card.

[0115] Alternatively, when the wireless network card scans for a large number of wireless networks, the network list information can include the network identifiers and signal strengths of some of these wireless networks. For example, if the wireless network card scans for the currently accessed wireless network and 10 other accessible wireless networks, the network list information can include the network identifier and signal strength of the currently accessed wireless network, as well as the network identifiers and signal strengths of the top 5 strongest wireless networks among the other 10 accessible wireless networks. The advantage of this approach is that it reduces the data size of each network list entry, thus saving storage space on electronic devices. Furthermore, reducing the number of wireless networks in the network list information also reduces the number of wireless networks in the lag fence, thereby shortening the time it takes for the lag fence component to match the network list information with the lag fence, and improving prediction efficiency.

[0116] The network list information collected by the fence data acquisition component can be stored in the fence database component in various forms. For example, a piece of network list information can be represented in the following form:

[0117]

[0118]

[0119] The network list information above can be denoted as Network List Information 1. Here, `timestamp` represents the timestamp when the fence data acquisition component collected this information, or it can be considered the timestamp of a single scan performed by the wireless network card. `BSID` represents the network identifier of the scanned wireless network. The first `BSID` is the network identifier of the wireless network currently connected to the electronic device, and `BSID_list` represents the list of accessible wireless networks. The `RSSI` following `BSID` indicates the signal strength of the corresponding wireless network at the time of the scan. For example, in the above network list information, the signal strength of the wireless network corresponding to 6c:16:32:17:3c:95 at the time of the scan was -74dBm.

[0120] The fence data acquisition component can execute step S03 immediately after the electronic device connects to the wireless network, i.e., after receiving the wireless network access notification.

[0121] Once a user enters a specific location (e.g., a room), they generally don't leave quickly. Electronic devices are less likely to disconnect from the wireless network within a short period (e.g., within 10 minutes) after initial access. Therefore, the network list information collected during this period is less likely to be used to determine the faulty fence. Thus, the fence data acquisition component can execute step S03 after the device has been connected to the wireless network for a certain period. This reduces the time the electronic device spends scanning the wireless network in real time, thereby lowering its power consumption.

[0122] For example, after a user enters a room, the WLAN application accesses the wireless network named WiFi-100 provided by the router in the room, and then sends a wireless network access notification to the fence data acquisition component. After receiving the notification, the fence data acquisition component starts timing. When the timing reaches 10 minutes, the WLAN application still has not sent a wireless network disconnection notification to the fence data acquisition component, which means that the electronic device is still connected to the WiFi-100 wireless network. Therefore, the fence data acquisition component starts to execute step S03 to collect network list information in real time.

[0123] In some alternative embodiments, the lag fence component typically uses network list information collected within a recent period, such as network list information collected within the last 30 seconds, when determining the lag fence and threshold. Therefore, the fence data acquisition component can continuously clean up older data stored in the fence database component while acquiring network list information. This has the advantage of saving storage space on the electronic device.

[0124] For example, if the lag fence component uses network list information from the last 30 seconds to determine the lag fence and threshold, then every time the fence data acquisition component collects a network list entry and stores it in the fence database component, it can delete the corresponding network list entry with a timestamp more than 30 seconds ago from the fence database component. For instance, when the fence data acquisition component stores a network list entry at time T0, it can delete the network list entry with a timestamp more than T0-30 seconds ago from the fence database component.

[0125] When an electronic device disconnects from the wireless network, the WLAN executes step S04, detecting the wireless network disconnection, and step S05, sending a wireless network disconnection notification. Specifically, the wireless network disconnection notification in step S05 is sent by the WLAN application to the lag fence component, which can be sent to the fence data acquisition component and the lag fence generation component. This triggers the fence data acquisition component to stop collecting network list information and the lag fence generation component to execute step S06.

[0126] Wireless network disconnection notifications can carry the network identifier of the disconnected wireless network.

[0127] When electronic devices and wireless routers are too far apart or there are too many obstacles in between, the strength of the wireless network signal received by the electronic device will be significantly reduced, and the electronic device may disconnect from the wireless network as a result. The electronic device may also disconnect from the current wireless network because the WLAN function is disabled, or because the user manually switches to another wireless network.

[0128] Disabling WLAN and switching the accessed wireless network both require user intervention within the WLAN application. Therefore, the WLAN application can identify whether the disconnection is due to WLAN being disabled or switching wireless networks after detecting a disconnection. If the disconnection is caused by WLAN being disabled or switching wireless networks, the WLAN application can choose not to send a wireless network disconnection notification to the lag fence component to avoid inaccurate lag fence determination.

[0129] Furthermore, when an electronic device switches from one wireless network to another in response to a user's action, the WLAN application can send a notification to the lag fence component indicating access to the other wireless network, enabling the lag fence component to collect network list information and determine the lag fence of the other wireless network.

[0130] by Figure 6 For example, if the electronic device is currently connected to WiFi-100, the user can view the available wireless networks in the WLAN application and then select to connect to WiFi-200. In this case, the WLAN application can send a wireless network access notification instead of sending a notification to the lag fence component to disconnect WiFi-100, and the notification will carry the network identifier of WiFi-200.

[0131] S06, determine the lag fence and threshold based on the network list information.

[0132] In practical applications, step S06 can be executed by the lag fence component, or specifically by the aforementioned lag fence generation component.

[0133] In step S06, the lag fence generation component can process the network list information collected within a first preset time period before the wireless network is disconnected, thereby determining the lag fence and threshold corresponding to the wireless network that has just been disconnected.

[0134] The length of the first preset duration can be set according to actual needs. For example, the first preset duration can be 30 seconds, that is, the lag fence component can determine the lag fence and threshold based on the network list information collected within 30 seconds before disconnection.

[0135] In other words, in this embodiment, the lag fence generation component considers the period before the electronic device and the wireless network disconnect as the time when the wireless network lags, and then determines the lag fence and threshold based on the network list information during this period.

[0136] In some optional embodiments, after each time the lag fence generation component performs step S06, if the lag fence and threshold for the same wireless network are already stored in the fence database component, the new lag fence and threshold determined this time can replace the old lag fence and threshold in the database.

[0137] by Figure 6 The wireless network shown is an example. Every day when a user leaves home, their mobile phone disconnects from the home wireless network WiFi-100. On the first day of disconnection, the lag fence generation component in the phone executes step S06 to determine the lag fence and threshold corresponding to WiFi-100, and stores the lag fence and threshold corresponding to WiFi-100 in the fence database component. On the second day of disconnection, the lag fence generation component executes step S06 again to determine the new lag fence and threshold corresponding to WiFi-100, and then replaces the lag fence and threshold corresponding to WiFi-100 determined on the previous day in the database with the newly determined lag fence and threshold.

[0138] The advantage of doing this is that electronic devices can quickly update the lag fence corresponding to the wireless network, thereby improving the accuracy of subsequent lag prediction results.

[0139] In some optional embodiments, the process of determining the lag fence and threshold shown in steps S03 to S06 can be performed if the accessed wireless network does not have a corresponding lag fence and threshold. If the electronic device has already obtained the corresponding lag fence and threshold for a wireless network, the electronic device may not perform the process of determining the lag fence and threshold shown in steps S03 to S06 when accessing and disconnecting the wireless network.

[0140] by Figure 6 The wireless network shown is an example. When the mobile phone first connects to WiFi-100 and disconnects from WiFi-100 after a period of time (e.g., 20 minutes), the lag fence generation component can determine and save the lag fence and threshold corresponding to WiFi-100 through the aforementioned steps S03 to S06. After that, when the mobile phone connects to WiFi-100 again, since the lag fence and threshold corresponding to WiFi-100 already exist, the lag fence generation component does not need to perform the process of determining the lag fence and threshold shown in steps S03 to S06.

[0141] The advantage of doing this is that it reduces the scanning of wireless networks by electronic devices, thereby reducing the power consumption of electronic devices.

[0142] The lag fence generation component can use a variety of algorithms to process the collected network list information. This embodiment does not limit the specific algorithm used.

[0143] As an example, the lag fence generation component can generate lag fences as follows:

[0144] First, the network list information collected within 30 seconds before the disconnection is retrieved from the fence database component. As mentioned earlier, each network list information has a corresponding timestamp, so the lag fence generation component directly reads the network list information with timestamps from the fence database component within 30 seconds before the disconnection.

[0145] Then, the average signal strength of each wireless network in the read network list information is calculated in the 30 seconds before disconnection.

[0146] As before, a network list contains the signal strength of multiple scanned wireless networks. Correspondingly, from multiple network list information, we can obtain multiple signal strengths of a wireless network during multiple scans. Using multiple signal strengths, we can calculate the average signal strength of the wireless network.

[0147] As an example, the network list information for the 30 seconds prior to disconnection may include the aforementioned network list information 1, as well as the following network list information 2:

[0148]

[0149] Based on network list information 1 and 2, the signal strengths of wireless network 6c:16:32:17:3c:95 during the two scans were -70dBm and -74dBm respectively, with a corresponding average signal strength of -72dBm; the signal strengths of wireless network 6c:16:32:17:3c:51 were -54dBm and -52dBm respectively, with a corresponding average signal strength of -53dBm; and the signal strengths of wireless network 6c:17:32:27:2c:92 were -61dBm and -63dBm respectively, with a corresponding average signal strength of -62dBm.

[0150] Finally, the average signal strength of multiple wireless networks is used to determine the lag fence corresponding to the disconnected wireless network.

[0151] After obtaining the average signal strength of each wireless network, the network identifier and the average signal strength of each wireless network can be directly combined into a lag fence.

[0152] A lag fence corresponding to a wireless network can be represented in various ways, and this embodiment does not limit the specific form of the lag fence.

[0153] Continuing with the previous example, after the electronic device disconnects from the wireless network 6c:16:32:17:3c:95, the lag fence generated by the lag fence generation component can be as follows:

[0154]

[0155] Here, timestamp represents the timestamp by which the lag fence generation component determines this lag fence, the first bssid is the network identifier of the wireless network corresponding to this lag fence, bssid_list is a list of wireless networks included in this lag fence, which contains the network identifiers of one or more wireless networks, and rssi after each network identifier represents the average signal strength of the wireless network corresponding to that network identifier.

[0156] It should be noted that the above-described lag fence and algorithm for determining the lag fence are merely a simple example provided for ease of understanding. In other optional embodiments, depending on the algorithm used to determine the lag fence, the obtained lag fence may include other values ​​that reflect the signal strength of the wireless network within the corresponding time period, excluding the average signal strength of the wireless network, although the average signal strength may also be included.

[0157] The lag fence generation component can also use various methods to determine the threshold corresponding to the wireless network. This embodiment does not limit the specific method of determining the threshold.

[0158] As an example, the lag fence generation component can determine the threshold of a wireless network in the following way:

[0159] The lag fence generation component reads network list information collected within a certain period before the disconnection, uses this network list information to calculate the average signal strength of the disconnected wireless network before the disconnection, and determines the calculation result as the threshold of the wireless network.

[0160] For example, when the lag fence generation component receives a notification that wireless network 6c:16:32:17:3c:95 has been disconnected, it obtains network list information collected within 5 seconds before the disconnection, obtains the signal strength of one or more wireless networks 6c:16:32:17:3c:95 from this network list information, calculates the average signal strength of 6c:16:32:17:3c:95 within 5 seconds before the disconnection using these signal strengths, and determines the calculation result as the threshold corresponding to 6c:16:32:17:3c:95.

[0161] When the electronic device reconnects to the wireless network, the WLAN executes step S07, detects the connection to the wireless network, and executes step S08 for the lag fence component, sending a wireless network access notification. For specific implementations of steps S07 and S08, please refer to steps S01 and S02.

[0162] S09, detect whether the signal strength is lower than the threshold.

[0163] If the signal strength is detected to be lower than the threshold, proceed to step S10. If the signal strength is detected to be not lower than the threshold, proceed to step S09 again until the signal strength is detected to be lower than the threshold or the electronic device disconnects from the wireless network.

[0164] Step S09 is executed by the stuttering fence component. In practical applications, step S09 can specifically be executed by the stuttering prediction component within the stuttering fence component.

[0165] It can be understood that the threshold in step S09 is the threshold corresponding to the wireless network currently connected to the electronic device. For example, if the threshold corresponding to wireless network 6c:16:32:17:3c:95 is -75dBm, and the threshold corresponding to wireless network 6c:16:32:17:3c:51 is -55dBm, if the electronic device connects to wireless network 6c:16:32:17:3c:95, the stuttering prediction component detects in real time whether the signal strength is lower than -75dBm; if the electronic device connects to wireless network 6c:16:32:17:3c:51, the stuttering prediction component detects in real time whether the signal strength is lower than -55dBm.

[0166] Optionally, step S09 can be executed immediately after the electronic device connects to the wireless network, or it can be executed some time after the electronic device has been connected to the wireless network, for example, 10 minutes after connecting to the wireless network. Executing step S09 some time after the electronic device has been connected to the wireless network can reduce the power consumption of the electronic device.

[0167] In some optional embodiments, after detecting that the signal strength is below the threshold, it can first be determined whether there is a lag fence corresponding to the wireless network. If it is determined that there is a lag fence corresponding to the wireless network, then step S10 is executed. If it is determined that there is no lag fence corresponding to the wireless network, then the method ends, that is, steps S10 to S12 are not executed.

[0168] In some alternative embodiments, a signal strength below the threshold in the wireless network may also be caused by factors such as a malfunction of the wireless router providing the wireless network or an electronic device entering an enclosed space. To avoid misjudging that the electronic device is far from the wireless router in the above situations, the following judgment can be further performed when the signal strength is detected to be below the threshold:

[0169] It determines whether the signal strength of the wireless network continues to decline within a third preset time period before the signal strength is detected to be below a threshold. For example, the third preset time period can be 5 seconds, meaning it can determine whether the signal strength of the wireless network continues to decline within 5 seconds before the signal strength falls below the threshold.

[0170] See Figure 2 As shown in the curve, when an electronic device moves away from the wireless router, the signal strength of the wireless network received by the electronic device gradually decreases. Therefore, the signal strength of the wireless network continues to decline for a period of time before it is detected that the signal strength is below the threshold.

[0171] Conversely, if a wireless router malfunctions or an electronic device enters a confined space, the signal strength will suddenly drop significantly when the malfunction occurs or the device enters a confined space. In this case, the signal strength will remain constant for a period of time before suddenly dropping below the threshold, rather than continuing to decline.

[0172] In summary, by determining whether the signal strength of the wireless network has been continuously decreasing over a recent period, the accuracy of the stuttering prediction results of this method can be improved.

[0173] S10, retrieve the current network list information.

[0174] In practical applications, step S10 can be performed by the stutter prediction component in the stutter fence component.

[0175] In step S10, the stuttering prediction component can obtain network list information in various ways, and this embodiment does not limit the specific acquisition method.

[0176] As an example, if step S10 needs to be executed, and the fence data acquisition component is collecting network list information in real time, the lag prediction component can directly read the latest network list information collected by the fence data acquisition component from the fence database component, and determine the latest network list information as the current network list information.

[0177] As another example, if the fence data acquisition component does not collect network list information in real time when step S10 needs to be performed, the lag prediction component can send a data acquisition command to the fence data acquisition component. After receiving the command, the fence data acquisition component uses the wireless network card of the electronic device to perform a scan, and then feeds back the network list information obtained from the scan to the lag prediction component.

[0178] S11, using network list information and lag fence matching.

[0179] In practical applications, step S11 can be executed by the stuttering fence component or by the stuttering prediction component within the stuttering fence component.

[0180] The network list information mentioned in step S11 is the current network list information obtained in step S10. The aforementioned lag fence is the lag fence corresponding to the wireless network currently accessed by the electronic device. The lag prediction component can compare the network identifier of the currently accessed wireless network with the network identifiers of multiple wireless networks corresponding to lag fences stored in the fence database component to find the lag fence corresponding to the currently accessed wireless network.

[0181] If the network list information and the lag fence match successfully, proceed to step S12. If the network list information and the lag fence fail to match, you can return to step S09.

[0182] Depending on the specific form of the lag fence, the lag prediction component in step S11 can use different methods to match the network list information and the lag fence. This embodiment does not limit the specific matching method.

[0183] For example, the stuttering prediction component can match network list information and stuttering fences as follows:

[0184] The signal strength of wireless networks in the network list is compared with the average signal strength of the same wireless network in the lag fence. The difference between the two is determined to be within a preset deviation range. After this comparison is performed for each wireless network in the network list, the proportion of wireless networks with differences within the deviation range among all wireless networks in the network list is determined to be greater than a set percentage threshold. If the proportion exceeds the percentage threshold, the network list and lag fence are considered a successful match; otherwise, the match is considered unsuccessful.

[0185] The difference between the signal strength of the wireless network in the current network list information and the signal strength of the same wireless network in the lag fence can be recorded as the signal strength deviation of the wireless network.

[0186] As an example, when the lag prediction component detects that the signal strength of the currently accessed wireless network 6c:16:32:17:3c:95 is below a threshold, the lag prediction component obtains the current network list information and reads the lag fence corresponding to 6c:16:32:17:3c:95 from the fence database component. In the obtained network list information, the signal strength of wireless network 6c:16:32:17:3c:95 is -75dBm, the signal strength of wireless network 6c:16:32:17:3c:51 is -55dBm, and the signal strength of wireless network 6c:17:32:27:2c:92 is -65dBm. The preset deviation range is 5dBm. After comparing the current signal strength of these three wireless networks with the average signal strength of the corresponding signals in the aforementioned lag fence, it was found that the signal strengths of 6c:16:32:17:3c:95, 6c:16:32:17:3c:51, and 6c:17:32:27:2c:92 all deviate from the average signal strength of the corresponding signals in the lag fence within the deviation range. In other words, the proportion of wireless networks with differences within the deviation range is 100%. Assuming the aforementioned proportion threshold is 80%, it can be found that the proportion of wireless networks with differences within the deviation range is greater than the proportion threshold. Therefore, it is determined that the network list information and the lag fence are successfully matched.

[0187] It is understood that the above deviation range and ratio threshold are just examples provided in this embodiment. In actual applications, the deviation range and ratio threshold can be set according to specific circumstances and are not limited to the above values.

[0188] After confirming a successful match between the network list information and the lag fence, the lag prediction component executes step S12 on the path management component, sending wireless network lag prediction information. This information informs the path management component that lag is about to occur on the wireless network currently accessed by the electronic device.

[0189] Through the process of predicting wireless network lag shown in S07 to S12, electronic devices can use the signal strength of the accessed wireless network and pre-generated lag fences to predict when the wireless network may lag as the electronic device moves away from the wireless router, thereby taking corresponding measures in advance and helping to alleviate the problem of wireless network lag when the signal strength is low.

[0190] As previously stated, the path management component can request to activate or deactivate specific network channels of an electronic device, such as requesting to activate or deactivate a wireless network, or requesting to activate or deactivate a cellular network. Therefore, when the path management component receives wireless network lag prediction information, it can execute step S13 to request activation of the cellular network, thereby activating the cellular network of the electronic device. Once activated, the cellular network of the electronic device is in an available state.

[0191] It should be noted that the cellular network of the electronic device may or may not be activated before executing step S13. If it is determined that the cellular network is activated before executing S13, step S13 can be skipped.

[0192] After the cellular network is successfully activated, the path management component executes step S14 to notify the policy management component that the cellular network has been successfully activated.

[0193] After confirming successful cellular network activation, the policy management component executes step S15, reads relevant information about the data stream, and step S16, sends a stream switching command.

[0194] In this embodiment, the policy management component can be regarded as Figure 4 The combination of the channel-level policy management component and the flow-level policy management component shown can be implemented in practice. In this case, the path management component can send a notification of successful cellular network activation to the channel-level policy management component located at the same layer. The channel-level policy management component then forwards the notification to the flow-level policy management component at the policy layer, causing the flow-level policy management component to execute step S15, read relevant information about the data flow, and step S16, send a flow switching command.

[0195] In step S15, the flow-level policy management component can read relevant information about the data stream from the flow-aware component at the same layer. In practical applications, the flow-level policy management component can read the data stream identifier of each data stream currently generated by the electronic device from the flow-aware component.

[0196] In some optional embodiments, multiple data streams generated by an electronic device may be partially carried by a wireless network and partially carried by a cellular network. Therefore, in step S15, the relevant information of the data stream may also include the identifier of the network carrying the data stream, so that the flow-level policy management component can determine the data stream identifier of the data stream carried by the wireless network based on the relevant information of the data stream.

[0197] In some optional embodiments, when the flow-level policy management component reads relevant information about the data flow from the traffic-aware component, the traffic-aware component may also determine the data flow carried by the wireless network based on the relevant information of the reported data flow, and then send only the data flow identifiers of these data flows carried by the wireless network when sending information to the flow-level policy management component.

[0198] The flow-aware component can obtain relevant information about the data flow through the following steps:

[0199] The traffic reporting component executes step A01 to report relevant information about the data stream to the traffic sensing component. After receiving the reported relevant information about the data stream, the traffic sensing component executes step A02 to store the relevant information about the data stream.

[0200] The traffic reporting component can continuously execute step A01 when the electronic device generates a data stream, or the traffic reporting component can continuously execute step A01 when the electronic device accesses the wireless network. In the latter case, the WLAN application can send a notification of access to the wireless network to the traffic reporting component when the electronic device accesses the wireless network, so as to trigger the traffic reporting component to execute step A01.

[0201] The traffic reporting component can obtain relevant information about the data stream in a variety of ways, and this embodiment does not limit the specific acquisition method.

[0202] For example, the traffic reporting component can pre-register one or more packet listening hooks to obtain relevant information about the data stream and report it to the traffic awareness component.

[0203] In step S16, the flow-level policy management component issues a flow switching command to the policy execution component of the kernel. The flow switching command may include the data flow identifier of the data flow that needs to be switched to the cellular network, thereby instructing the policy execution component to switch the corresponding data flow to the cellular network.

[0204] After receiving the stream switching command, the policy execution component executes step S17 to switch the data stream to the cellular network.

[0205] by Figure 5 Taking (1) as an example, after receiving the notification of successful cellular network activation, the policy management component executes step S15, reads the data stream identifiers of data stream A and data stream B transmitted via the wireless network on the mobile phone from the traffic awareness component, and then executes step S16, sending the flow switching command carrying the data stream identifiers of data stream A and data stream B to the policy execution component. After receiving the flow switching command, the policy execution component, as follows... Figure 5 As shown in (2), data streams A and B are switched from the wireless network card to the data service network card. Thus, data streams A and B are changed from being transmitted through the wireless network to being transmitted through the cellular network.

[0206] In some optional embodiments, the relevant information of the data stream may also include the application identifier of the application to which each data stream belongs. After reading the relevant information of the data stream, the policy management component determines the data stream belonging to the foreground application among multiple data streams based on the application identifier. Then, the flow switching command only carries the data stream identifier of the data stream belonging to the foreground application, so that the policy execution component switches only the data stream of the foreground application to the cellular network.

[0207] Still with Figure 5For example, the policy management component discovers that data stream A belongs to the foreground video application A and data stream B belongs to the background chat application B based on the relevant information of the data stream. Therefore, the issued stream switching command can carry only the data stream identifier of data stream A, so that the policy execution component can switch data stream A to the cellular network.

[0208] Through the data stream switching process described in steps S13 to S17, the electronic device can switch the data stream transmitted by the wireless network to the cellular network in advance when it anticipates that the currently accessed wireless network will experience lag. This avoids the wireless network lag interfering with the network applications running on the electronic device, thereby improving the user experience when the electronic device is far away from the wireless router.

[0209] In some optional embodiments, after completing step S17, the WLAN application can either actively disconnect from the current wireless network or continue to maintain the connection with the current wireless network until the signal strength of the wireless network is too low and the connection is automatically disconnected.

[0210] In some optional embodiments, the process of the electronic device determining the lag fence as shown in steps S01 to S06, and the process of the electronic device predicting whether the wireless network is lag-free as shown in steps S07 to S12, can be executed simultaneously.

[0211] For example, after the WLAN notification indicates access to the wireless network, on the one hand, the fence data acquisition component collects network list information in real time and stores the collected wireless network information into the fence database component, and on the other hand, the lag prediction component detects in real time whether the signal strength of the wireless network is lower than the threshold.

[0212] When the stuttering prediction component detects that the signal strength of the wireless network is lower than the threshold and determines that there is a stuttering fence corresponding to the currently accessed wireless network, the stuttering prediction component executes steps S10 and S11 to predict whether the wireless network will stutter.

[0213] When the stuttering prediction component predicts that the wireless network will experience stuttering, the path management component, policy management component, and policy execution component sequentially execute steps S13 to S17 to switch the data stream of the wireless network to the cellular network.

[0214] During steps S09 to S17, and after the data stream switch is completed, the electronic device remains connected to the wireless network. Therefore, the fence data acquisition component can continue to execute step S03 during the above process until the WLAN notifies the wireless network that it has disconnected. After the wireless network disconnects, the lag fence generation component executes step S06 to determine a new lag fence and threshold.

[0215] In the above embodiments, the traffic reporting component obtains the application's data stream information by registering a message listening hook and reports the data stream information to the traffic awareness component. The technical implementation details of this process are described below.

[0216] The electronic device system contains a Netfilter component, which can be used to obtain the data stream of an application corresponding to a specific application identifier. The traffic reporting component can call the Netfilter component to obtain the data stream packets of a specific application (such as the application market in the aforementioned example). In practice, the data stream information reported by the traffic reporting component to the traffic awareness component can include the data stream packets and statistical information. See [link to relevant documentation] for details. Figure 9 Description of the illustrated embodiment.

[0217] See Figure 9 The traffic reporting component can pre-register packet listening hooks (e.g., the nf_hook hook function).

[0218] After the traffic reporting component calls the Netfilter component, the Netfilter component reports the data stream packets. After receiving the data stream packets reported by the Netfilter component, the traffic reporting component calls the pre-registered nf_hook hook function.

[0219] The nf_hook hook function performs the following operations on the received data stream packets: packet parsing, flow table lookup, and packet analysis.

[0220] When parsing a message, you can check if it contains an application identifier and its four-tuple (or five-tuple) to obtain the parsing result. If an application identifier exists, the application corresponding to the message can be determined. A four-tuple includes the source IP, destination IP, source port, and destination port; a five-tuple includes the source IP, destination IP, source port, destination port, and protocol number. In other words, the message's four-tuple or five-tuple contains some of the aforementioned flow characteristics (such as the message's protocol and port). Additionally, the message itself can also carry some flow characteristics.

[0221] After parsing, the flow table is queried based on the parsing results, and the flow table statistics are updated. The flow table stores the identification information of data flows in each application, as well as the statistical information of each data flow. The statistical information of each flow includes: the number of packets received from that data flow, the total number of bytes, the number of error packets, etc.

[0222] In practical applications, the statistical information for each stream can also include other information, such as the size of the received data packets and the download rate of the corresponding data stream determined by the timestamp.

[0223] Of course, if the identifier or related statistical information of a certain data flow does not exist in the flow table, the identifier and related statistical information of the data flow can be added to the flow table.

[0224] After looking up and updating the flow table information, the packets can be analyzed. For example, packets can be filtered to obtain all or part of the packets.

[0225] As an example, this filtering process could be filtering heartbeat packets from a data stream. After filtering, the heartbeat packets of that data stream are obtained. This filtering process could involve pre-setting certain characteristics and retaining packets that meet those characteristics. That is, packets that meet certain pre-set characteristics are the filtered packets.

[0226] The heartbeat packet is a message that exists in the data stream at regular time intervals. The heartbeat packet has a fixed characteristic (e.g., 0x64 or 0x65) at a fixed position (e.g., the 6th byte). Because the heartbeat packet exists at regular intervals, the delay can be calculated based on it (e.g., the total time elapsed from when the mobile phone sends a heartbeat request message to the server until the mobile phone receives the heartbeat response message from the server).

[0227] The above example uses filtering heartbeat packets as an illustration. In practical applications, filtering can also be used to obtain data packets that meet other characteristics.

[0228] As another example, filtering conditions could also include: retaining messages from a specific application, so that after filtering, only messages from the data stream of that specific application are obtained. For example, if the currently running application is an app store, then when performing message analysis, messages from the app store's data stream can be retained.

[0229] After the above processing, the filtered packets are stored in the SKB queue.

[0230] The strategies for reporting data stream messages stored in the SKB queue include: immediate reporting and periodic reporting.

[0231] If the reporting is not immediate, a specific thread in the traffic reporting component will promptly check the queue and report the packets in the queue to the traffic awareness component.

[0232] If the reporting is periodic, a timer is set in the traffic reporting component. Based on the timer setting, the packets in the SKB queue are checked at certain intervals, and some or all of the packets in the queue are reported to the traffic awareness component.

[0233] Of course, in practical applications, some packets in the data stream stored in the SKB queue need to be reported immediately, while others need to be reported periodically. Following the same principle, a specific thread in the traffic reporting component checks the queue regularly and reports the packets that need immediate reporting to the traffic awareness component. The traffic reporting component also has a timer set up to periodically check the packets in the SKB queue and report the packets that need periodic reporting to the traffic awareness component.

[0234] exist Figure 8 In the illustrated embodiment, the lag fencing component determines a lag fence and a corresponding threshold after the electronic device disconnects from the wireless network. Alternatively, in some optional embodiments, the lag fencing component may also determine a lag fence and a threshold when poor wireless network quality is detected.

[0235] See Figure 10 This is a timing diagram of a network lag prediction method provided in another embodiment of this application.

[0236] In this embodiment, the specific implementation methods of steps S01 to S05, steps S07 to S17, and steps A01 and A02 are all the same as those in this embodiment. Figure 8 The specific implementation methods for the corresponding steps in the illustrated embodiments are consistent and will not be repeated here.

[0237] This embodiment and Figure 8 The difference between the embodiments shown is that:

[0238] After the electronic device connects to the wireless network, the QoE evaluation component continuously executes step B01 to detect the quality of the wireless network. When the QoE evaluation component determines that the quality of the wireless network is poor, it executes step B02 to send a poor network quality notification to the lag fence component, thereby informing the lag fence component that the current wireless network is experiencing lag. In response to the notification from the QoE evaluation component, the lag fence component executes step B03 to determine the lag fence and threshold based on the network list information.

[0239] In step B01, the QoE evaluation component obtains relevant information about the data stream carried by the wireless network from the traffic-aware component. Based on the obtained data stream information, it determines one or more indicators reflecting the quality of the wireless network, such as the wireless network's transmission rate and packet loss rate. The quality of the wireless network is determined by the levels of these indicators. This embodiment does not limit the indicators used to detect network quality.

[0240] As an example, the QoE evaluation component obtains the transmission rate of one or more data streams carried by the wireless network from the traffic-aware component, determines the sum of the transmission rates of these data streams as the transmission rate of the wireless network, and then determines whether the transmission rate of the wireless network is greater than a specific transmission rate threshold. If the transmission rate of the wireless network is greater than the transmission rate threshold, the wireless network is determined to be of good quality; if the transmission rate of the wireless network is not greater than the transmission rate threshold, the wireless network is determined to be of poor quality.

[0241] As another example, the QoE evaluation component obtains the number of packet losses for one or more data streams carried by the wireless network from the traffic-aware component, determines the total number of packet losses for the wireless network as the total number of packet losses for the wireless network, and then determines whether the total number of packet losses for the wireless network is greater than a specific packet loss threshold. If the total number of packet losses for the wireless network is not greater than the packet loss threshold, the wireless network is determined to be of good quality; if the total number of packet losses for the wireless network is greater than the packet loss threshold, the wireless network is determined to be of poor quality.

[0242] Of course, in other examples, the QoE evaluation component can also combine transmission rate and packet loss to determine the quality of the wireless network.

[0243] In step B02, the QoE evaluation component can specifically send a poor network quality notification to the lag fence generation component, thereby triggering the lag fence generation component to execute step B03. Specifically, the notification sent by the QoE evaluation component can be a QoEBad message. Upon receiving this message, the lag fence generation component can determine that the currently accessed wireless network is experiencing lag.

[0244] In practical applications, step B03 can be executed by the lag fence component, or by the lag fence generation component within the lag fence component.

[0245] When the lag fence generation component executes B03, it can read the network list information collected within the second preset time period before receiving the poor network quality notification from the fence database component, and determine the lag fence and threshold based on the read network list information.

[0246] The specific value of the second preset duration depends on the actual application, and this embodiment does not limit it. For example, the second preset duration can be 2 seconds.

[0247] In other words, in this embodiment, the lag fence generation component considers the period before the poor quality of the wireless network is detected as the time when the wireless network lags, and then determines the lag fence and threshold based on the network list information during this period.

[0248] For example, if the lag fence generation component receives a poor network quality notification at time T0, the lag fence generation component reads the network list information with the corresponding timestamp within 2 seconds before receiving the poor network quality notification from the fence database component, that is, the network list information with the timestamp between T0-2 seconds and T0. Based on this network list information, the lag fence and threshold are determined.

[0249] The difference between step B03 and the aforementioned step S06 is that in step B03, the lag fence generation component determines the lag fence and threshold based on the network list information within a certain period of time before receiving the poor network quality notification, while in step S06, the lag fence generation component determines the lag fence and threshold based on the network list information within a certain period of time before the wireless network is disconnected. That is, the time periods to which the network list information used in the two steps belong are different.

[0250] The method for determining the lag fence and threshold based on the network list information in step B03 can be the same as in the aforementioned step S06, and will not be described in detail here.

[0251] Optionally, in this embodiment, after receiving a poor network quality notification and executing step B03, the lag fence component can stop collecting network list information without waiting for the wireless network connection to be disconnected. This reduces the power consumption of electronic devices. In this case, the WLAN application does not need to execute steps S04 and S05.

[0252] I understand. Figure 8 The illustrated embodiments and Figure 10 The illustrated embodiments can be combined into a single embodiment. That is, the lag fence component can determine a lag fence and threshold both when poor quality of the wireless network is detected and after the electronic device disconnects from the wireless network.

[0253] In some optional embodiments, if the lag fence component receives a notification of poor network quality during the connection to the wireless network, the lag fence component determines the lag fence and threshold in accordance with step B03. If the lag fence component does not receive a notification of poor network quality during the connection to the wireless network, the lag fence component determines the lag fence and threshold in accordance with step S06 after the wireless network is disconnected.

[0254] According to the above Figure 8 and Figure 10 The illustrated embodiment provides a method for predicting network lag, applicable to electronic devices with WLAN functionality, such as smartphones and tablets. Please refer to... Figure 11 The flowchart below illustrates a method for predicting network lag, as provided in an embodiment of this application.

[0255] After connecting to the wireless network, proceed to step S1101.

[0256] S1101, Detect whether the signal strength of the currently accessed wireless network is lower than the threshold.

[0257] If the signal strength of the currently accessed wireless network is lower than the threshold, proceed to step S1102. If the signal strength of the currently accessed wireless network is not lower than the threshold, proceed to step S1101 again, until the signal strength of the currently accessed wireless network is detected to be lower than the threshold or the electronic device disconnects from the wireless network.

[0258] The specific implementation of step S1101 can be found in steps S07 to S09 above, and will not be repeated here.

[0259] S1102, Obtain the current network list information.

[0260] The current network list information includes the network identifier and signal strength of one or more accessible wireless networks currently scanned.

[0261] The specific implementation of step S1102 can be found in the aforementioned step S10, and will not be repeated here.

[0262] S1103 matches the current network list information with the lag fence of the currently accessed wireless network.

[0263] If the current network list information matches the lag fence of the currently accessed wireless network, proceed to step S1104. If the current network list information fails to match the lag fence of the currently accessed wireless network, return to step S1101.

[0264] In this embodiment of the application, the lag fence may include the signal strength information of the wireless network scanned when the currently accessed wireless network experiences lag.

[0265] The threshold mentioned in step S1101 and the lag fence mentioned in step S1103 can both be obtained when the electronic device accesses the wireless network once.

[0266] For a detailed implementation of step S1103, please refer to [link / reference]. Figure 8 and Figure 10 Step S11 in the illustrated embodiment will not be repeated here.

[0267] S1104, switch the data stream carried by the currently accessed wireless network to the activated cellular network.

[0268] In step S1104, the electronic device can determine the data stream identifier of the data stream carried by the currently accessed wireless network, thereby switching the corresponding data stream to the activated cellular network.

[0269] For a detailed implementation of step S1104, please refer to [link / reference]. Figure 8 and Figure 10 Steps S12 to S17, as well as steps A01 and A02, in the illustrated embodiment will not be described again here.

[0270] The beneficial effect of this solution is that electronic devices can predict whether the currently accessed wireless network will experience lag based on pre-obtained thresholds and lag fences, and switch the data stream from the wireless network to the cellular network when lag is predicted, thereby avoiding the reduction of the user's online experience due to wireless network lag.

[0271] Electronic devices can obtain a lag fence and threshold corresponding to a wireless network in the following ways:

[0272] When electronic devices connect to a wireless network, network list information is continuously collected;

[0273] For a detailed implementation of this step, please refer to steps S01 to S03 above.

[0274] When an electronic device disconnects from the wireless network, or when the electronic device detects poor quality of the wireless network, the corresponding lag fence and threshold for the wireless network are determined based on the collected network list information.

[0275] For a detailed implementation method of this step, please refer to [link / reference]. Figure 8 Steps S04 to S06 of the illustrated embodiment, or see [link to embodiment]. Figure 10 Steps B01 to B03 of the illustrated embodiment.

[0276] This application provides an electronic device, including a memory and one or more processors.

[0277] Memory is used to store computer programs.

[0278] One or more processors are used to execute computer programs, specifically to implement the network lag prediction method provided in any embodiment of this application.

[0279] This application also provides a computer storage medium for storing a computer program, which, when executed, is specifically used to implement the network lag prediction method provided in any embodiment of this application.

[0280] 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.

[0281] The "multiple" mentioned in the embodiments of this application refers to two or more. It should be noted that in the description of the embodiments of this application, terms such as "first" and "second" are used only for the purpose of distinguishing descriptions and should not be construed as indicating or implying relative importance, nor should they be construed as indicating or implying order.

Claims

1. A method for predicting network lag, characterized in that, include: After an electronic device connects to the current wireless network, it is detected whether the signal strength of the current wireless network is lower than the threshold of the current wireless network. The threshold of the current wireless network is the average value of multiple signal strengths collected within a preset time period corresponding to the current wireless network. If the signal strength of the current wireless network is lower than the threshold, obtain the current network list information, which includes the network identifier and signal strength of the currently scanned wireless network; Match the current network list information with the current wireless network's lag fence; If the current network list information and the lag fence match successfully, the data stream carried by the current wireless network will be switched to the cellular network.

2. The method according to claim 1, characterized in that, Also includes: When the electronic device accesses the current wireless network, network list information is collected in real time. The collected network list information includes the network identifier and signal strength of the wireless network scanned during the collection. The lag fence and threshold of the current wireless network are determined based on the network list information collected within a preset time period.

3. The method according to claim 2, characterized in that, The preset time period is the first preset duration before the electronic device and the current wireless network disconnect.

4. The method according to claim 2, characterized in that, The preset time period is a second preset duration before the electronic device determines that the network quality of the current wireless network is poor.

5. The method according to any one of claims 2 to 4, characterized in that, The current wireless network lag fence includes the average signal strength of each wireless network in the network list information collected within the preset time period. The average signal strength of the wireless network is the average of multiple signal strengths of the wireless network collected in the network list information within the preset time period.

6. The method according to claim 5, characterized in that, The step of matching the current network list information with the current wireless network's lag fence includes: Calculate the signal strength deviation of the wireless networks in the current network list information. The signal strength deviation of the wireless network is the difference between the average signal strength of the wireless networks in the lag fence and the signal strength of the wireless networks in the current network list information. Determine the proportion of wireless networks whose signal strength deviation is within a preset deviation range in the current network list information; If the ratio is greater than a preset ratio threshold, it is determined that the current network list information and the lag fence are successfully matched; If the ratio is less than or equal to the ratio threshold, it is determined that the current network list information and the lag fence fail to match.

7. The method according to any one of claims 1 to 6, characterized in that, Before obtaining the current network list information, the process also includes: Determine whether the signal strength of the current wireless network continues to decrease within a third preset time period before the signal strength of the current wireless network falls below the threshold of the current wireless network; If the signal strength of the current wireless network continues to decrease within the third preset time period, the step of obtaining the current network list information is executed.

8. The method according to any one of claims 1 to 6, characterized in that, Switching the data stream carried by the current wireless network to the cellular network includes: Switch the data stream of the foreground application currently carried by the wireless network to the cellular network.

9. An electronic device, characterized in that, Includes memory and one or more processors; The memory is used to store computer programs; The one or more processors are used to execute the computer program, specifically to implement the network lag prediction method as described in any one of claims 1 to 8.

10. A computer storage medium for storing a computer program, which, when executed, is specifically used to implement the network lag prediction method as described in any one of claims 1 to 8.

Citation Information

Patent Citations

  • Network switching method, electronic equipment and readable medium

    CN115002850A