Wireless network access method and device

By obtaining the operating status of the terminal equipment and the NAT timeout of the wireless network and disconnecting the inefficient wireless network, the problem of increasing power caused by the simultaneous opening of multiple networks is solved, and automatic power optimization and power consumption reduction are achieved.

CN114449686BActive Publication Date: 2024-12-10HUAWEI TECH CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202011212754.5
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2020-11-03
Publication Date
2024-12-10
Estimated Expiration
2040-11-03

AI Technical Summary

Technical Problem

The existing wireless network access method causes the device power consumption to increase when multiple networks are turned on at the same time, and the user's manual management leads to the inability to switch automatically, affecting power optimization.

Method used

By obtaining the operating status of the terminal equipment and the NAT timeout timeout of multiple wireless networks, disconnecting the less efficient wireless network to optimize power consumption, including determining whether to disconnect wireless based on conditions such as traffic usage, working mode, power information and signal strength, etc. network.

Benefits of technology

It realizes that the power consumption of terminal devices is automatically optimized, the power consumption of equipment is reduced, and the equipment usage time is extended without affecting the user experience.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN114449686B_ABST
    Figure CN114449686B_ABST
Patent Text Reader

Abstract

The present application relates to a wireless network access method and device, the method comprising: obtaining the running status of a terminal device, the terminal device being connected to multiple wireless networks at the same time; obtaining NAT timeout durations corresponding to the multiple wireless networks respectively, the NAT timeout durations comprising the longest time for a network link established by the wireless network to remain connected without communication; upon determining that the running status of the terminal device and the NAT timeout durations corresponding to the multiple wireless networks respectively meet preset conditions, disconnecting at least one of the multiple wireless networks, wherein the running status of the terminal device and the NAT timeout durations corresponding to the multiple wireless networks respectively meet the preset conditions including: the terminal device is running in the background, the NAT timeout duration corresponding to a first wireless network among the multiple wireless networks is greater than the NAT timeout duration corresponding to a second wireless network, and the at least one wireless network is the second wireless network.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of wireless communications, and in particular to a wireless network access method and device. Background Art

[0002] At present, most smart terminal devices have wireless network communication functions, and users can choose a variety of wireless network access methods, typically, such as WI-FI hotspot access, 4G network, 5G network, etc. Different wireless network access methods naturally have their own advantages, but opening multiple wireless network access methods at the same time will increase the power consumption of the device, especially for some small smart devices.

[0003] In the related art, wireless network access modes are often manually turned on or off by users, and in many cases, multiple wireless access modes are turned on at the same time and then no longer switched. In this case, turning on multiple wireless network access modes at the same time increases the power consumption of the device. Summary of the invention

[0004] In view of this, a wireless network access method and device are proposed.

[0005] In a first aspect, an embodiment of the present application provides a wireless network access method, including:

[0006] Acquire the running status of a terminal device, wherein the terminal device is connected to multiple wireless networks at the same time;

[0007] Obtaining NAT timeout durations corresponding to the multiple wireless networks respectively, wherein the NAT timeout duration includes a maximum time duration during which a network link established by the wireless network remains connected without communication;

[0008] When it is determined that the operating status of the terminal device and the NAT timeout durations corresponding to the multiple wireless networks respectively meet the preset conditions, at least one of the multiple wireless networks is disconnected, wherein the operating status of the terminal device and the NAT timeout durations corresponding to the multiple wireless networks respectively meet the preset conditions including: the terminal device is running in the background, the NAT timeout duration corresponding to the first wireless network among the multiple wireless networks is greater than the NAT timeout duration corresponding to the second wireless network, and the at least one wireless network is the second wireless network.

[0009] In an embodiment of the present application, at least one of the multiple wireless networks can be disconnected according to the operating state of the terminal device and the NAT timeout duration parameter of the multiple wireless networks accessed in the terminal device. The timeout duration parameter of the wireless network is positively correlated with the time interval for the terminal device to send a heartbeat packet. The longer the timeout duration, the longer the terminal device can use fewer heartbeat packets to maintain a long connection with the server in the same time, and sending fewer heartbeat packets can save the power consumption of the terminal device. On the other hand, the embodiment of the present application also determines whether to disconnect the wireless network in combination with the operating state of the terminal device. Only when the terminal device is in an operating state that meets the preset conditions, can part of the wireless network be disconnected. Therefore, the wireless network access method provided by the embodiment of the present application can optimize the power consumption of the terminal device.

[0010] According to a first possible implementation manner of the first aspect, the operating status includes at least one of the following: traffic usage information of applications in the terminal device, a working mode of the terminal device, power information of the terminal device, and network information of the multiple wireless networks.

[0011] In this embodiment, some operating states related to power optimization of the terminal and disconnection of the wireless network are obtained, so as to more accurately decide whether to disconnect the wireless network.

[0012] According to a second possible implementation manner of the first aspect, the operating state of the terminal device meets the preset condition, and further includes at least one of the following:

[0013] Determining, based on traffic usage information of applications in the terminal device, that an application with a traffic volume greater than a preset traffic volume threshold is running in the terminal device;

[0014] Determining that the terminal device is operating in a low-power operating mode according to the operating mode of the terminal device;

[0015] Determining, based on power information of the terminal device, that the power of the terminal device is less than a preset power threshold;

[0016] The power consumption rate of the terminal device is greater than a preset power consumption rate threshold, or the power consumption rate of the terminal device is greater than a charging speed;

[0017] It is determined according to the network information of the multiple wireless networks that the signal strength of the multiple wireless networks is greater than a preset strength threshold, or it is determined according to the network information of the multiple wireless networks that the signal stability of the multiple wireless networks is greater than a preset stability threshold.

[0018] In this embodiment, when a high-traffic application is running in the terminal, if the wireless network used by the high-traffic application is disconnected, the application may be switched to other wireless networks with traffic restrictions, causing economic losses to the user.

[0019] In this embodiment, when the terminal is running in a low-power working mode, it can be indicated that the terminal needs to perform power optimization to reduce the power consumption rate of the terminal.

[0020] In this embodiment, the power optimization requirement is also taken into consideration, that is, power optimization is enabled in a scenario where the terminal power is small or the power consumption rate is high.

[0021] According to a third possible implementation manner of the first aspect, the NAT timeout durations corresponding to the multiple wireless networks respectively meet the preset conditions, further comprising:

[0022] A difference between a NAT timeout duration corresponding to the first wireless network and a NAT timeout duration corresponding to the second wireless network is greater than a preset time threshold.

[0023] In this embodiment, when the difference between the NAT timeout durations of the wireless networks is large, it means that the power consumed by some wireless networks when sending heartbeat packets is higher than that of other wireless networks. At this time, the power consumption of the terminal needs to be optimized.

[0024] According to a fourth possible implementation manner of the first aspect, disconnecting at least one wireless network among the multiple wireless networks includes:

[0025] An application with a flow rate greater than a preset flow rate threshold is running in the terminal device;

[0026] When the application uses the second wireless network for network communication, the second wireless network is disconnected after the application completes or suspends the service.

[0027] In this embodiment, when it is determined that a high-traffic application is using the second wireless network to be disconnected to perform high-traffic services, the second wireless network can be disconnected after waiting for the application to complete or suspend the high-traffic services, thereby preventing the application from switching to a wireless network with limited traffic, thereby causing economic losses to the user.

[0028] According to a fifth possible implementation manner of the first aspect, disconnecting at least one wireless network among the multiple wireless networks includes:

[0029] An application with a flow rate greater than a preset flow rate threshold is running in the terminal device;

[0030] When the application uses the first wireless network for network communication, the first wireless network does not limit traffic and disconnects the second wireless network.

[0031] In this embodiment, when it is determined that the wireless network after switching does not restrict traffic, this will neither affect the operation of large-traffic applications nor delay the optimization of power consumption.

[0032] According to a sixth possible implementation manner of the first aspect, disconnecting at least one wireless network among the multiple wireless networks includes:

[0033] The terminal sends a notification message in a pop-up window, wherein the notification message includes a message suggesting that the user disconnect from the second wireless network;

[0034] A user input is received, and the second wireless network is disconnected.

[0035] In this embodiment, when the terminal is running in the foreground, a notification message can be displayed to the user in the form of a pop-up window, and a control for closing the target wireless network can be provided.

[0036] According to a seventh possible implementation manner of the first aspect, disconnecting at least one wireless network among the multiple wireless networks includes:

[0037] The second wireless network is disconnected, and the network identifier corresponding to the second wireless network is maintained as being in a state where it is not disconnected.

[0038] In this embodiment, after the wireless network is disconnected, the network identifier of the wireless network can be kept turned on, so that the user does not perceive the disconnection of the wireless network.

[0039] In a second aspect, an embodiment of the present application provides a wireless network access device, characterized in that it includes:

[0040] processor;

[0041] a memory for storing processor-executable instructions;

[0042] The processor is configured to implement the wireless network access method of the first aspect or one or more of the multiple possible implementations of the first aspect when executing the instruction.

[0043] In a third aspect, an embodiment of the present application provides a non-volatile computer-readable storage medium having computer program instructions stored thereon, and when the computer program instructions are executed by a processor, the wireless network access method of the above-mentioned first aspect or one or more of the multiple possible implementation methods of the first aspect is implemented.

[0044] In a fourth aspect, an embodiment of the present application provides a computer program product, comprising a computer-readable code, or a non-volatile computer-readable storage medium carrying a computer-readable code. When the computer-readable code runs in an electronic device, a processor in the electronic device executes the wireless network access method of the first aspect or one or more of the multiple possible implementations of the first aspect.

[0045] These and other aspects of the present application will become more apparent from the following description of the embodiment(s). BRIEF DESCRIPTION OF THE DRAWINGS

[0046] The accompanying drawings, which are incorporated in and constitute a part of the specification, illustrate exemplary embodiments, features, and aspects of the present application and, together with the description, serve to explain the principles of the present application.

[0047] Figure 1 A flow chart of a method for a terminal device to access a wireless network according to an embodiment of the present application is shown.

[0048] Figure 2 A schematic diagram showing a structure in which a terminal device accesses the Internet via a wireless network according to an embodiment of the present application.

[0049] Figure 3 A flow chart of a method for obtaining a NAT timeout duration provided according to an embodiment of the present application is shown.

[0050] Figure 4 A flow chart of a method for disconnecting a wireless network provided according to an embodiment of the present application is shown.

[0051] Figure 5 A user interface diagram provided according to an embodiment of the present application is shown.

[0052] Figure 6 A user interface diagram provided according to an embodiment of the present application is shown.

[0053] Figure 7 A schematic diagram of the structure of a terminal device according to an embodiment of the present application is shown.

[0054] Figure 8 A software structure block diagram of a terminal device according to an embodiment of the present application is shown. DETAILED DESCRIPTION

[0055] Various exemplary embodiments, features and aspects of the present application will be described in detail below with reference to the accompanying drawings. The same reference numerals in the accompanying drawings represent elements with the same or similar functions. Although various aspects of the embodiments are shown in the accompanying drawings, the drawings are not necessarily drawn to scale unless otherwise specified.

[0056] It should be noted that in the embodiments of the present application, "at least one" refers to one or more, and more refers to two or more. Unless otherwise defined, all technical and scientific terms used in this document have the same meaning as those commonly understood by technicians in the technical field of the present application. The terms used in the specification of this application are only for the purpose of describing specific embodiments and are not intended to limit the present application. It should be understood that in this application, unless otherwise specified, " / " means or. For example, A / B can mean A or B. "And / or" in this application is merely a way to describe the association relationship of associated objects, indicating that three relationships can exist.

[0057] It should be noted that, in the embodiments of the present application, words such as "first" and "second" are only used for the purpose of distinguishing descriptions, and cannot be understood as indicating or implying relative importance, nor can they be understood as indicating or implying order. Features defined as "first" and "second" may explicitly or implicitly include one or more of the features. In the description of the embodiments of the present application, words such as "exemplary" or "for example" are used to indicate examples, illustrations or explanations. Any embodiment or design described as "exemplary" or "for example" in the embodiments of the present application should not be interpreted as being more preferred or more advantageous than other embodiments or designs. Specifically, the use of words such as "exemplary" or "for example" is intended to present related concepts in a concrete way.

[0058] In addition, in order to better illustrate the present application, numerous specific details are provided in the following specific embodiments. It should be understood by those skilled in the art that the present application can also be implemented without certain specific details. In some examples, methods, means, components and circuits well known to those skilled in the art are not described in detail in order to highlight the subject matter of the present application.

[0059] In order to facilitate those skilled in the art to understand the technical solution provided by the embodiments of the present application, the technical environment in which the technical solution is implemented is first described below.

[0060] Terminal devices need to have a public IP address to access the Internet, and the public IP address is unique in the global Internet. Because the number of public IP addresses is limited and is currently in a serious shortage, network operators can provide users with intranet IPs and allow multiple terminal devices in the intranet to share a public IP through the Network Address Translation (NAT) protocol. Therefore, the main function of the NAT protocol is to map the intranet IP address of the terminal device to the external IP address so that the terminal device can access the Internet. However, the number of terminal devices served by the same network operator is huge. In order to reduce the link load of the gateway and save channel resources, the network operator makes the following settings: If the communication network link of the terminal device does not communicate for a period of time, the network link communication of the terminal device will be disconnected, and the mapping relationship between the intranet IP address and the external IP address will also be deleted. In this way, the network operator can provide the intranet IP address to other users.

[0061] However, many terminal device applications need to maintain a long connection with the background server to obtain messages pushed by the background server. For example, even if the mobile phone is in the off-screen state, the user still needs to receive messages from applications such as WeChat. Based on this, a TCP long connection can be established between the terminal device and the server, and the heartbeat mechanism can be used to maintain the validity of the TCP long connection. In the heartbeat mechanism, the terminal device can send a custom message to the server at intervals, which can also be called a heartbeat packet. After receiving the heartbeat packet, the server can also return a custom message to the terminal device, and this process can also be called a heartbeat response. As described above, the network operator sets the network link communication of the terminal device to be disconnected if the communication network link of the terminal device does not communicate for a period of time, and this time period can be called the NAT timeout period. Based on this, the interval at which the terminal device sends a heartbeat packet to the server can be set to be slightly less than the NAT timeout period, and has a positive correlation with the NAT timeout period.

[0062] In order to maintain the connection with the backend server, the application in the terminal device needs to send heartbeat packets to the backend server for a long time and receive replies from the backend server. The communication between the application and its backend server may use multiple wireless networks, and the use of multiple wireless networks requires different communication modules in the terminal device to run simultaneously, which generates more power consumption.

[0063] The application scenario environment of the embodiment of the present application is described below in combination with actual application scenarios.

[0064] When users use smart terminal devices (such as smart phones and smart wearable devices), in order to ensure that the terminal devices are continuously connected to the Internet, they often turn on multiple wireless network access methods at the same time, such as turning on cellular networks and wireless fidelity (Wireless Fidelity, Wi-Fi) networks at the same time. Based on the above description of the technical environment, even if the terminal device is in the off-screen state, the terminal device still needs to continuously send heartbeat packets to the server to maintain a long connection with the server. Sending heartbeat packets and receiving reply messages from the server consume power. Therefore, users find that even when the smart terminal devices are not in use, the power consumption of the smart terminal devices is still very large. For some smart wearable devices with small power storage, such as smart bracelets, smart watches, smart glasses, etc., this part of the power consumption cannot be ignored.

[0065] Based on the actual technical requirements similar to those described above, the wireless network access method provided by the present application can obtain the NAT timeout durations corresponding to the various wireless network access methods, and disconnect a portion of the wireless network according to the NAT timeout durations. In this way, the terminal device can maintain a long connection with the server by sending fewer heartbeat packets, and sending fewer heartbeat packets can consume less power.

[0066] The technical solution provided in the embodiments of the present application can be applied to terminal devices that can access multiple wireless networks, and the terminal devices may include smart phones, computers (including laptops, desktop computers), tablet electronic devices (such as tablet computers, e-readers), personal digital assistants (PDAs), wearable electronic devices (such as smart bracelets, smart watches, smart glasses), smart home appliances (sweeping robots, TVs, virtual reality devices, air conditioners, refrigerators, lamps, projectors, speakers, etc.). The wireless networks include wireless local area networks (WLAN), wireless wide area networks (WWAN), wireless metropolitan area networks (WMAN) and wireless personal area networks (WPAN). Among them, WLAN may include networks that provide wireless communication access functions within a short range, such as Wi-Fi networks. WWAN may include wireless communication networks provided based on mobile communication infrastructure, such as 2G / 3G / 4G / 5G wireless networks. WMAN allows access users to access wireless networks in fixed places, which connect multiple fixed places in a city or region. WPAN is a wireless network that allows a user to connect his / her portable device to a short-range wireless network through a communication device. This application does not limit the types of terminal devices and wireless networks.

[0067] An embodiment of the present application provides a wireless network access method, specifically, as follows: Figure 1 As shown, the wireless network access method may include:

[0068] S101: Acquire the operating status of a terminal device, wherein the terminal device is simultaneously connected to multiple wireless networks.

[0069] The method of the embodiment of the present application can be applied to a terminal device that simultaneously accesses multiple wireless networks, and the multiple wireless networks may include two or more wireless networks. Figure 2 A schematic diagram is shown in which terminal device 101 communicates with server 104, server 105, and server 106 using wireless network 102 and wireless network 103.

[0070] In the embodiment of the present application, the running state of the application in the terminal device is associated with whether it is necessary to disconnect at least one of the wireless networks. The running state may include at least one of the following: whether the terminal device is running in the foreground or the background, the traffic usage information of the application in the terminal device, the working mode of the terminal device, the power information of the terminal device, and the network information of the multiple wireless networks.

[0071] In one embodiment of the present application, status information of whether the terminal device is running in the foreground or the background can be obtained. For a terminal device with a display screen, the terminal device running in the background may include the terminal device being in a screen-off state, and running in the foreground may include being in a screen-on state. The screen-off of the terminal device may refer to a scenario in which the graphics card in the terminal device does not draw a user interface. Of course, in the screen-off scenario, the terminal device or an application in the terminal device may run in the background, such as playing music and sleep monitoring. Of course, in other embodiments, the terminal device running in the background may also include that there is no application running in the terminal device, etc., and this application does not limit this.

[0072] The traffic usage information of the application in the terminal device may include the speed at which the application consumes traffic and the wireless network to which it is connected. In some examples, a video application in the terminal device is using the Wi-Fi network to download videos with a download speed of 2M / s, and a photo application in the terminal device is using the Wi-Fi network to synchronize photos, videos and other materials with an upload speed of 810k / s. It should be noted that the traffic of each application in the terminal device can be determined through the traffic statistics component in the terminal device, so as to determine the applications in the terminal device whose traffic is greater than a preset traffic threshold. For example, in the Android operating system, the traffic statistics of the terminal device and each application in the terminal device can be performed through the TrafficStats class.

[0073] The working mode of the terminal device may include one of a plurality of working modes preset by the terminal device, for example, the working mode may include flight mode, low power mode, normal mode, etc. In the preset working mode, the terminal device may operate according to preset operating parameters. Of course, for different terminal devices, the preset working modes are different, which is not limited here.

[0074] The power information of the terminal device may include at least one of the power value, power consumption speed, whether the terminal device is charging, charging speed, battery capacity of the terminal device, etc. The power information may be obtained from a battery management module in the terminal device.

[0075] The network information of the multiple wireless networks may include signal information, function information, etc. of the multiple wireless networks. The signal information may also include signal strength, signal stability, etc. Signal stability may also include parameters such as signal noise, retry rate, disconnection rate, etc. The function information may include whether the wireless network is associated with a necessary function in the terminal device, etc.

[0076] It should be noted that the operating status is not limited to the above examples. Any status information related to the optimization of terminal device power consumption and the disconnection of the wireless network falls within the scope of protection of this application. Technical personnel in the relevant field may make other changes based on the technical essence of this application, but as long as the functions and effects achieved are the same or similar to those of this application, they should be covered within the scope of protection of this application.

[0077] S103: Obtain NAT timeout durations corresponding to the multiple wireless networks respectively, where the NAT timeout duration includes a maximum duration during which a network link established by the wireless network remains connected without communication.

[0078] In the embodiment of the present application, the NAT timeout duration may include the maximum duration for which the network link established by the wireless network remains connected when no communication occurs, that is, when the network link established by the wireless network does not communicate for a duration greater than the NAT timeout duration, the wireless network is disconnected. In this embodiment, the network link not communicating may include the network link not transmitting data.

[0079] In one embodiment of the present application, the NAT timeout duration can be obtained by sending a heartbeat packet to the server. Figure 3The flowchart of the method for obtaining the NAT timeout duration of a wireless network is shown. After determining which wireless network is used to establish a network link with a server, an initial value of the NAT timeout duration can be obtained, and the initial value can be set to 30s, 35s, 40s, etc. Then, the terminal device can send a heartbeat packet to the server through the network link and start a timer, and the timing duration is the initial value. When the timer expires, it can be determined whether the network link is disconnected. When the network link is disconnected, it means that the set initial value is too high. Therefore, the wireless network can be used again to send a heartbeat packet to the server, and the timer can be started. The timing duration is reduced by 10s based on the initial value. Of course, 10s is only a reference value and is not limited here. Otherwise, when the network link remains connected, it means that the set initial value is too low. Therefore, the wireless network can be used again to send a heartbeat packet to the server, and the timer can be started. The timing duration is increased by 10s based on the initial value. In this way, the above process can be repeated until the network link remains connected for multiple times under the same timing duration, and the timing duration can be used as the NAT timeout duration. The method for determining the NAT timeout duration provided in this embodiment can be applied to wireless signals with large differences between different areas or unstable signals.

[0080] Of course, in other embodiments, the NAT timeout duration can also be obtained from the wireless network operator, for example, the NAT timeout duration of a certain operator is 4 minutes. In addition, the NAT timeout duration of the historical record can also be obtained according to the user log in the terminal device. This application does not limit the method for obtaining the NAT timeout duration.

[0081] S105: When it is determined that the running status of the terminal device and the NAT timeout durations corresponding to the multiple wireless networks respectively meet the preset conditions, disconnect at least one of the multiple wireless networks, wherein the running status of the terminal device and the NAT timeout durations corresponding to the multiple wireless networks respectively meet the preset conditions include: the terminal device is running in the background, the NAT timeout duration corresponding to the first wireless network among the multiple wireless networks is greater than the NAT timeout duration corresponding to the second wireless network, and the at least one wireless network is the second wireless network.

[0082] In one embodiment of the present application, determining that the operating status of the terminal device and the NAT timeout durations corresponding to the multiple wireless networks respectively meet preset conditions includes: judging whether the operating status of the terminal device and the NAT timeout durations corresponding to the multiple wireless networks respectively meet preset conditions.

[0083] In an embodiment of the present application, the preset condition may include a condition for shutting down at least one of the multiple wireless networks. According to the above description of the technical environment, the time interval for the terminal device to send a heartbeat packet is positively correlated with the NAT timeout period. The longer the NAT timeout period, the longer the time interval for sending a heartbeat packet. In one example, the NAT timeout period corresponding to the Wi-Fi network is 20s, and the NAT timeout period corresponding to the 4G cellular mobile network is 35s. It can be seen that the time interval for sending a heartbeat packet using the Wi-Fi network is less than the time interval for sending a heartbeat packet using the 4G cellular mobile network. In other words, in the same time, the terminal device can send fewer heartbeat packets using the 4G cellular mobile network to maintain a long connection with the server. Based on this, in one embodiment of the present application, for the NAT timeout period, the judgment of whether the NAT timeout periods corresponding to the multiple wireless networks respectively meet the preset conditions includes:

[0084] It is determined whether a difference between the NAT timeout durations corresponding to the multiple wireless networks is greater than a preset duration threshold.

[0085] In an embodiment of the present application, when the difference between the NAT timeout durations of multiple wireless networks is greater than a preset time threshold, at least one of the multiple wireless networks is disconnected. For example, in the above example, the NAT timeout durations corresponding to the Wi-Fi network and the 4G cellular mobile network are 20s and 35s respectively, and the difference between the two is large, so it is necessary to disconnect the Wi-Fi network with the shorter timeout duration. On the contrary, if the NAT timeout durations of the two wireless networks are both 25s, then the power consumption generated by the terminal device is the same regardless of which wireless network it communicates with. In an embodiment of the present application, the preset time threshold can be set to 3s, 4s, 5s, etc.

[0086] The corresponding preset conditions are described below according to the different operating states provided by S101.

[0087] In one embodiment of the present application, for the running status including whether the terminal device is running in the background, the determining whether the running status of the terminal device meets the preset condition may include:

[0088] Determine whether the terminal device is running in the background.

[0089] In this embodiment, in order to make the operation of disconnecting the wireless network imperceptible to the user, it can be set to disconnect the network when the terminal device is running in the background. In one example, at least one wireless network can be disconnected when the terminal device is in a screen-off state.

[0090] In one embodiment of the present application, if the running state includes traffic usage information of an application in a terminal device, determining whether the running state of the terminal device meets a preset condition includes:

[0091] Determine whether an application with a flow rate greater than a preset flow rate threshold is running in the terminal device based on the flow rate usage information of the application in the terminal device.

[0092] In actual scenarios, different wireless networks have different billing methods. Generally, Wi-Fi networks have unlimited traffic, while 4G / 5G cellular mobile networks often need to limit traffic. Of course, it is also necessary to select the type of traffic package according to the user. Some package types need to limit traffic, and some do not need to limit traffic. According to the traffic information of the application in the terminal device, it can be determined whether there is an application in the terminal device with a traffic greater than the preset traffic threshold. For example, before determining to disconnect the Wi-Fi network, it is determined that some applications in the terminal device use the traffic of the Wi-Fi network greater than the preset traffic threshold. The preset traffic threshold can be set to 200k / s, 300k / s, 500k / s, etc. In some examples, there are some video applications in the terminal device that are downloading videos, photo applications that are synchronizing photos or videos, etc., and these applications need to consume a large amount of traffic. In the case where the above-mentioned types of applications exist and the applications rely on the wireless network communication to be disconnected, if the wireless network is suddenly disconnected, it is very likely to switch to other wireless networks with traffic restrictions, causing economic losses to users.

[0093] In one embodiment of the present application, if the running state includes traffic usage information of an application in a terminal device, the determining whether the running state of the terminal device meets a preset condition includes:

[0094] Determining whether an application with a flow rate greater than a preset flow rate threshold is running in the terminal device according to flow rate usage information of the application in the terminal device;

[0095] When it is determined that an application with a flow rate greater than the preset flow rate threshold is running in the terminal device, it is determined whether a wireless network used by the application has flow rate restrictions.

[0096] In the embodiment of the present application, when it is determined that a large-flow application is running in the terminal device, it can also be determined whether the switched wireless network limits the flow. When it is determined that the switched wireless network does not need to limit the flow, the wireless network can be closed. For example, according to the NAT timeout duration, it is determined to disconnect the Wi-Fi network, but it is monitored that there are many large-flow applications running in the terminal device. According to the settings of the terminal device, when the Wi-Fi network is disconnected, the terminal device automatically switches to the 4G cellular mobile network. In this regard, it can be determined whether the 4G cellular mobile network needs to limit the flow. When the 4G cellular mobile network does not limit the flow, the Wi-Fi network can be disconnected immediately, and there is no need to wait until the large-flow application is completed before disconnecting the Wi-Fi network. In this way, it does not affect the operation of the large-flow application, nor does it need to postpone the optimization of power consumption. In the embodiment of the present application, the terminal device can obtain the user's cellular mobile network information from the cellular mobile network operator, for example, it is obtained that the user has purchased an unlimited flow package. In this way, closing the wireless network with a shorter NAT timeout duration allows the terminal device to switch to other wireless networks without causing economic losses to the user.

[0097] In one embodiment of the present application, if the running state includes traffic usage information of an application in a terminal device, determining whether the running state of the terminal device meets a preset condition includes:

[0098] Determine whether the terminal device is operating in a low-power operating mode according to the operating mode of the terminal device.

[0099] In the embodiment of the present application, when the terminal device is operating in a low-power working mode, it can be indicated that the terminal device needs to perform power optimization to reduce the power consumption rate of the terminal device.

[0100] In one embodiment of the present application, if the running state includes traffic usage information of an application in a terminal device, the determining whether the running state of the terminal device meets a preset condition includes:

[0101] The determining whether the operating state of the terminal device meets a preset condition includes:

[0102] Determine whether the power level of the terminal device is less than a preset power threshold according to the power level information of the terminal device;

[0103] Or, the power consumption rate of the terminal device is greater than a preset power consumption threshold;

[0104] Or, the power consumption rate of the terminal device is greater than the charging speed.

[0105] In the embodiment of the present application, the demand for power optimization is also taken into consideration, that is, power optimization is enabled in a scenario where the power of the terminal device is low or the power consumption rate is high.

[0106] In one embodiment of the present application, when the operating status includes network information of the multiple wireless networks, determining whether the operating status of the terminal device meets a preset condition includes:

[0107] It is determined whether the multiple wireless networks are associated with necessary functions of the terminal device according to the network information of the multiple wireless networks.

[0108] In an embodiment of the present application, when the wireless network is associated with a necessary function in a terminal device, if the wireless network is disconnected, the necessary function cannot be implemented in the terminal device. The necessary function may include a function that is indispensable in a terminal device. For example, for children's watches, the 4G cellular mobile network is generally associated with the call function under normal use. Once the 4G cellular mobile network is disconnected, the call function of the children's watch will also be turned off. The call function is a basic function of the children's watch. Once it is turned off, no calls can be received. For children's watches, the connected cellular mobile network is associated with the call function of the watch. If the cellular mobile network of the watch is disconnected, the call function of the watch cannot be used.

[0109] In one embodiment of the present application, when the operating status includes network information of the multiple wireless networks, determining whether the operating status of the terminal device meets a preset condition includes:

[0110] It is determined according to the network information of the multiple wireless networks whether the signal strengths of the multiple wireless networks are greater than a preset strength threshold, or whether the signal stability is greater than a preset stability threshold.

[0111] In actual applications, different wireless networks consume power at different speeds. For example, for 4G cellular mobile networks, communication with base stations requires sending and receiving signals, and the hardware consumes power very quickly. Especially in an environment with poor signals, the device will expand the search range and enhance the transmission signal, and the power consumption will further increase. The Wi-Fi network sends and receives signals through a wireless router, and is in a relatively stable environment, so the power consumption rate may be lower. For some smart terminal devices with simple functions, there may not be software or hardware conditions for counting the power consumption of each wireless network. For example, for the above-mentioned children's watch, this type of smart terminal device can only obtain some simple network parameters of the wireless network, such as signal strength. Since the signal strength of the wireless network is negatively correlated with the power consumption rate, the stronger the signal strength, the slower the power consumption rate of the corresponding wireless network; conversely, the weaker the signal strength, the faster the power consumption rate of the corresponding wireless network. Based on this, the signal strength and / or signal stability of the wireless network that remains connected can be used as a condition for further determining whether a wireless network needs to be closed.

[0112] It should be noted that the implementation of S105 is not limited to the above embodiments, and may also include any combination of the above embodiments, which is not limited in this application. For example, it is determined whether the terminal device is running in the background and the traffic usage information of the application in the terminal device determines whether an application with a traffic greater than a preset traffic threshold is running in the terminal device.

[0113] In one embodiment of the present application, when it is determined that the operating state of the terminal device and the NAT timeout durations respectively corresponding to the multiple wireless networks meet preset conditions, disconnecting at least one of the multiple wireless networks includes:

[0114] When it is determined that the terminal device is running in the background and the difference between the NAT timeout durations corresponding to the multiple wireless networks is greater than a preset duration threshold, at least one of the multiple wireless networks is disconnected.

[0115] In an embodiment of the present application, when the terminal device is running in the background and there is a large difference between the NAT timeout durations corresponding to the wireless networks, at least one wireless network can be disconnected. Figure 4 An application scenario of this embodiment is shown. In the scenario, the terminal device is connected to three wireless networks: Wi-Fi network, 4G cellular mobile network, and 5G cellular mobile network. After the screen is turned off, the terminal device can obtain the NAT timeout duration of the Wi-Fi network, 4G cellular mobile network, and 5G cellular mobile network, respectively. Figure 4As shown in the figure, the NAT timeout durations of the three wireless networks are 28s, 40s, and 45s respectively. According to the NAT timeout duration, the terminal device disconnects the Wi-Fi network and the 4G cellular mobile network. In addition, when the terminal device switches from the screen-off state to the screen-on state, the wireless network that was disconnected in the screen-off state can be reconnected, so that the user is unaware of the disconnection of the wireless network. Figure 4 As shown, after the terminal device turns on the screen, such as after the alarm clock is turned on, the terminal device connects to the Wi-Fi network and the 4G cellular mobile network again. It can be seen that the user has no perception of this process.

[0116] In one embodiment of the present application, when it is determined that the operating state of the terminal device and the NAT timeout durations respectively corresponding to the multiple wireless networks meet preset conditions, disconnecting at least one of the multiple wireless networks includes:

[0117] Determine at least one target wireless network to be disconnected according to the NAT timeout duration;

[0118] When it is determined that an application with a flow rate greater than a preset flow rate threshold is running in the terminal device and the application communicates using the target wireless network, the target wireless network is disconnected after the application completes or suspends the high-flow service.

[0119] In one example of the present application, based on the connection of the Wi-Fi network and the 4G cellular mobile network in the terminal device, it is determined that the NAT timeout of the Wi-Fi network is shorter than that of the 4G cellular mobile network, and the Wi-Fi network can be used as the target wireless network to be disconnected. However, it is found that there are video applications and photo applications in the terminal device that use the Wi-Fi network for large-volume data transmission. Based on this, the Wi-Fi network can be disconnected after determining that the video cache and photo synchronization in the terminal device application are completed. In another embodiment, the application with large traffic consumption can also be suspended, and it can be set to continue to complete the unfinished work in the application when the disconnected wireless network is reconnected.

[0120] In one embodiment of the present application, when it is determined that the operating state of the terminal device and the NAT timeout durations respectively corresponding to the multiple wireless networks meet preset conditions, disconnecting at least one of the multiple wireless networks includes:

[0121] Determine at least one first wireless network to be disconnected and at least one second wireless network to be retained according to the NAT timeout duration;

[0122] When it is determined that an application with a flow rate greater than a preset flow rate threshold is running in the terminal device, the application communicates using the target wireless network, and the second wireless network does not restrict the flow rate, the first wireless network is disconnected.

[0123] In an example of the present application, based on the connection of the Wi-Fi network and the 4G cellular mobile network in the terminal device, it is determined that the NAT timeout of the Wi-Fi network is shorter than that of the 4G cellular mobile network. The Wi-Fi network can be used as the first wireless network to be disconnected, and the 4G cellular mobile network can be used as the retained second wireless network. However, it is found that video applications and photo applications in the terminal device are using the Wi-Fi network for large-volume data transmission, so it can be determined whether the 4G cellular mobile network limits traffic. If the 4G cellular mobile network does not limit traffic, the Wi-Fi network can be disconnected.

[0124] In one embodiment of the present application, when it is determined that the operating state of the terminal device and the NAT timeout durations respectively corresponding to the multiple wireless networks meet preset conditions, disconnecting at least one of the multiple wireless networks includes:

[0125] When it is determined that the terminal device is running in a low-power working mode and the difference between the NAT timeout durations corresponding to the multiple wireless networks is greater than a preset time threshold, at least one of the multiple wireless networks is disconnected.

[0126] In the embodiment of the present application, in the low power working mode, the total power of the terminal device is less than the preset power, and power optimization is required, and at least one wireless network can be disconnected. The low power working mode can be switched by the user or automatically switched by the terminal device after monitoring the total power of the device, which is not limited here.

[0127] In one embodiment of the present application, when it is determined that the operating state of the terminal device and the NAT timeout durations respectively corresponding to the multiple wireless networks meet preset conditions, disconnecting at least one of the multiple wireless networks includes:

[0128] When it is determined that the difference between the NAT timeout durations corresponding to the multiple wireless networks is greater than a preset time threshold and at least one of the following conditions is met, disconnecting at least one of the multiple wireless networks:

[0129] The power level of the terminal device is less than a preset power threshold;

[0130] The power consumption rate of the terminal device is greater than a preset power consumption threshold;

[0131] The power consumption rate of the terminal device is greater than the charging rate.

[0132] In an embodiment of the present application, when the power in the terminal device is small or the power consumption rate is fast or the power consumption rate is greater than the charging speed, it can be determined that the terminal device needs to be optimized for power, so power can be saved by disconnecting at least one wireless network.

[0133] In one embodiment of the present application, when it is determined that the operating state of the terminal device and the NAT timeout durations respectively corresponding to the multiple wireless networks meet preset conditions, disconnecting at least one of the multiple wireless networks includes:

[0134] Determine at least one target wireless network to be disconnected according to the NAT timeout duration;

[0135] If it is determined that the target wireless network is not associated with the necessary functions of the terminal device, the target wireless network is disconnected.

[0136] In an embodiment of the present application, when it is determined that the target wireless network does not have the necessary functions of the associated terminal device, the wireless network is disconnected. Otherwise, the connection of the wireless network can be maintained. For example, based on the comparison of the NAT timeout duration, it is determined to disconnect the 4G cellular mobile network in the children's watch, but it is detected that the 4G cellular mobile network is associated with the call function in the children's watch, so the connection of the 4G cellular mobile network can continue to be maintained.

[0137] In one embodiment of the present application, when it is determined that the operating state of the terminal device and the NAT timeout durations respectively corresponding to the multiple wireless networks meet preset conditions, disconnecting at least one of the multiple wireless networks includes:

[0138] Determine at least one first wireless network to be disconnected and at least one second wireless network to be retained according to the NAT timeout duration;

[0139] When determining whether the signal strength of the second wireless network is greater than a preset strength threshold and / or whether the signal stability is greater than a preset stability threshold, disconnecting the first wireless network.

[0140] In an example of the present application, based on the connection of the Wi-Fi network and the 4G cellular mobile network in the terminal device, it is determined that the NAT timeout of the Wi-Fi network is shorter than that of the 4G cellular mobile network. The Wi-Fi network can be used as the first wireless network to be disconnected, and the 4G cellular mobile network can be used as the retained second wireless network. If the signal strength of the 4G cellular mobile network is greater than the preset strength threshold, the Wi-Fi network can be turned off. On the contrary, if the signal strength of the 4G cellular mobile network is relatively weak and less than the preset strength threshold, the Wi-Fi network can be retained.

[0141] Furthermore, in another embodiment, the wireless network can consume less power when the signal strength and stability are relatively high. Based on this, the signal stability of the second wireless network can also be obtained to determine whether the signal stability is greater than a preset stability threshold. Based on this, when it is determined that the signal strength of the second wireless network is greater than the preset strength threshold and the signal stability is greater than the preset stability threshold, the first wireless network is disconnected. Among them, the signal stability can be determined based on at least one of the network parameters such as signal noise, retry rate, disconnection rate, etc., which is not limited here.

[0142] In one embodiment of the present application, when it is determined that the operating state of the terminal device and the NAT timeout durations respectively corresponding to the multiple wireless networks meet preset conditions, disconnecting at least one of the multiple wireless networks may include:

[0143] When it is determined that the terminal device is running in the foreground and the difference between the NAT timeout durations corresponding to the multiple wireless networks is greater than a preset time threshold, sending a notification message, wherein the notification message includes a target wireless network that recommends the user to disconnect;

[0144] An operation of disconnecting the target wireless network from a user is received, and the target wireless network is disconnected.

[0145] In actual application scenarios, users use certain terminal devices for a long time, especially smart phones, and keep the terminal devices running in the foreground for a long time every day. Based on this, in an embodiment of the present application, the power consumption of the terminal device can also be optimized according to the NAT timeout duration of the multiple wireless networks when the terminal device is running in the foreground. In this case, after determining the wireless network to be disconnected, a notification message can be sent to the user, and the notification message includes a target wireless network that is recommended for the user to disconnect. The user can choose to shut down the target wireless network according to the notification message.

[0146] In some examples, the notification message may be displayed in a pop-up window. Figure 5 As shown, during the user's use of the instant messaging application, the terminal device 400 determines that the Wi-Fi network consumes too much power according to the technical solutions provided in the above embodiments, and recommends that the user turn off the Wi-Fi network. Therefore, a pop-up window 401 is set in the user interface, and the corresponding notification message is displayed in the pop-up window 401. Of course, a control 403 can also be set in the pop-up window 401. After the user performs a preset operation on the control 403, the user interface can jump to Figure 6The wireless network setting interface shown in the figure, in which the user can close the corresponding wireless network. In other embodiments, after the user determines to disconnect the wireless network through the control, the terminal device can close the corresponding wireless network in the background to simplify the user's operation.

[0147] In one embodiment of the present application, when it is determined that the operating state of the terminal device and the NAT timeout durations respectively corresponding to the multiple wireless networks meet preset conditions, disconnecting at least one of the multiple wireless networks includes:

[0148] When it is determined that the terminal device is running in the foreground and the difference between the NAT timeout durations corresponding to the multiple wireless networks is greater than a preset duration threshold, at least one of the multiple wireless networks is disconnected and the network identifier of the at least one wireless network is kept in the on state.

[0149] In actual application scenarios, the user's perception of whether the wireless network in the terminal device is turned on is the state of the network identification of the wireless network. The wireless network has two different states when it is turned on and when it is disconnected, such as whether there is an icon in the menu bar, the icon color is different, whether the icon is lit, etc. In one embodiment of the present application, in order to make the user unaware of the disconnection of the wireless network, it can be set to keep the network identification state of the wireless network as the network identification state when it is turned on after the wireless network is disconnected.

[0150] Disconnecting at least one of the multiple wireless networks described in various embodiments of the present application may include disconnecting a wireless network with a shorter NAT timeout period, or retaining only the wireless network with the longest NAT timeout period and disconnecting all remaining wireless networks, or retaining the wireless network with the longest NAT timeout period. Disconnecting at least one of the remaining wireless networks may include any disconnection method determined by the NAT timeout period, and the present application does not impose any limitation on this.

[0151] It should be noted that the implementation based on S105 is not limited to the above embodiment, and the implementation based on S107 is certainly not limited to the above embodiment. In one example, when it is determined that the operating state of the terminal device and the NAT timeout durations corresponding to the multiple wireless networks meet the preset conditions, disconnecting at least one of the multiple wireless networks may also include:

[0152] In the case where it is determined that the terminal device is running in the background, determining at least one target wireless network to be disconnected according to the NAT timeout duration;

[0153] When it is determined that an application with a flow rate greater than a preset flow rate threshold is running in the terminal device and the application communicates using the target wireless network, the target wireless network is disconnected after the application completes or suspends the high-flow service.

[0154] Figure 7 The following is a schematic diagram showing the structure of a terminal device according to an embodiment of the present application. Taking a mobile phone as an example, Figure 7 A schematic structural diagram of a mobile phone 200 is shown.

[0155] The mobile phone 200 may include a processor 210, an external memory interface 220, an internal memory 221, a USB interface 230, a charging management module 240, a power management module 241, a battery 242, an antenna 1, an antenna 2, a mobile communication module 251, a wireless communication module 252, an audio module 270, a speaker 270A, a receiver 270B, a microphone 270C, an earphone interface 270D, a sensor module 280, a button 290, a motor 291, an indicator 292, a camera 293, a display screen 294, and a SIM card interface 295, etc. The sensor module 280 may include a gyroscope sensor 280A, an acceleration sensor 280B, a proximity light sensor 280G, a fingerprint sensor 280H, and a touch sensor 280K (of course, the mobile phone 200 may also include other sensors, such as a temperature sensor, a pressure sensor, a distance sensor, a magnetic sensor, an ambient light sensor, an air pressure sensor, a bone conduction sensor, etc., which are not shown in the figure).

[0156] It is to be understood that the structure illustrated in the embodiment of the present application does not constitute a specific limitation on the mobile phone 200. In other embodiments of the present application, the mobile phone 200 may include more or fewer components than shown in the figure, or combine some components, or split some components, or arrange the components differently. The components shown in the figure may be implemented in hardware, software, or a combination of software and hardware.

[0157] The processor 210 may include one or more processing units, for example: the processor 210 may include an application processor (application processor, AP), a modem processor, a graphics processor (graphics processing unit, GPU), an image signal processor (image signal processor, ISP), a controller, a memory, a video codec, a digital signal processor (digital signal processor, DSP), a baseband processor, and / or a neural network processor (Neural-network Processing Unit, NPU), etc. Among them, different processing units can be independent devices or integrated in one or more processors. Among them, the controller can be the nerve center and command center of the mobile phone 200. The controller can generate an operation control signal according to the instruction opcode and the timing signal to complete the control of fetching and executing instructions.

[0158] The processor 210 may also be provided with a memory for storing instructions and data. In some embodiments, the memory in the processor 210 is a cache memory. The memory may store instructions or data that the processor 210 has just used or cyclically used. If the processor 210 needs to use the instruction or data again, it may be directly called from the memory. This avoids repeated access, reduces the waiting time of the processor 210, and thus improves the efficiency of the system.

[0159] The processor 210 can run the wireless network access method provided in the embodiment of the present application to optimize the power consumption of the wireless network. The processor 210 can include different devices. For example, when a CPU and a GPU are integrated, the CPU and the GPU can cooperate to execute the wireless network access method provided in the embodiment of the present application. For example, part of the algorithm in the wireless network access method is executed by the CPU, and another part of the algorithm is executed by the GPU to obtain faster processing efficiency.

[0160] The display screen 294 is used to display images, videos, etc. The display screen 294 includes a display panel. The display panel can be a liquid crystal display (LCD), an organic light-emitting diode (OLED), an active-matrix organic light-emitting diode or an active-matrix organic light-emitting diode (AMOLED), a flexible light-emitting diode (FLED), Miniled, MicroLed, Micro-oLed, a quantum dot light-emitting diode (QLED), etc. In some embodiments, the mobile phone 200 may include 1 or N display screens 294, where N is a positive integer greater than 1. The display screen 294 can be used to display information input by a user or information provided to a user and various graphical user interfaces (GUI). For example, the display 294 can display photos, videos, web pages, or files, etc. For another example, the display 294 can display a graphical user interface. Among them, the graphical user interface includes a status bar, a hidden navigation bar, a time and weather widget, and application icons, such as a browser icon. The status bar includes the operator name (such as China Mobile), the mobile network (such as 4G), the time, and the remaining power. The navigation bar includes a back key icon, a home key icon, and a forward key icon. In addition, it can be understood that in some embodiments, the status bar may also include a Bluetooth icon, a Wi-Fi icon, an external device icon, etc. It can also be understood that in other embodiments, the graphical user interface may also include a Dock bar, and the Dock bar may include commonly used application icons, etc. When the processor 210 detects a touch event of a user's finger (or a stylus, etc.) for a certain application icon, in response to the touch event, the user interface of the application corresponding to the application icon is opened, and the user interface of the application is displayed on the display 294.

[0161] In the embodiment of the present application, the display screen 294 may be an integrated flexible display screen, or a spliced ​​display screen consisting of two rigid screens and a flexible screen located between the two rigid screens.

[0162] After the processor 210 runs the wireless network access method provided in the embodiment of the present application, the terminal device can establish a connection with other terminal devices through antenna 1, antenna 2 or USB interface, and transmit data according to the wireless network access method provided in the embodiment of the present application and control the display screen 294 to display the corresponding graphical user interface.

[0163] The camera 293 (a front camera or a rear camera, or one camera can be used as both a front camera and a rear camera) is used to capture still images or videos. Generally, the camera 293 may include a photosensitive element such as a lens group and an image sensor, wherein the lens group includes a plurality of lenses (convex lenses or concave lenses) for collecting light signals reflected by the object to be photographed and transmitting the collected light signals to the image sensor. The image sensor generates an original image of the object to be photographed based on the light signal.

[0164] The internal memory 221 can be used to store computer executable program codes, which include instructions. The processor 210 executes various functional applications and data processing of the mobile phone 200 by running the instructions stored in the internal memory 221. The internal memory 221 may include a program storage area and a data storage area. Among them, the program storage area may store codes of operating systems, applications (such as camera applications, WeChat applications, etc.), etc. The data storage area may store data created during the use of the mobile phone 200 (such as images, videos, etc. collected by the camera application), etc.

[0165] The internal memory 221 may also store one or more computer programs 1310 corresponding to the wireless network access method provided in the embodiment of the present application. The one or more computer programs 1304 are stored in the above-mentioned memory 221 and are configured to be executed by the one or more processors 210. The one or more computer programs 1310 include instructions, and the above-mentioned instructions can be used to execute the various steps in the corresponding embodiments such as S105.

[0166] In addition, the internal memory 221 may include a high-speed random access memory and may also include a non-volatile memory, such as at least one disk storage device, a flash memory device, a universal flash storage (UFS), etc.

[0167] Of course, the code of the wireless network access method provided in the embodiment of the present application can also be stored in an external memory. In this case, the processor 210 can run the code of the wireless network access method stored in the external memory through the external memory interface 220.

[0168] The functions of the sensor module 280 are described below.

[0169] The gyroscope sensor 280A can be used to determine the motion posture of the mobile phone 200. In some embodiments, the angular velocity of the mobile phone 200 around three axes (i.e., x, y, and z axes) can be determined by the gyroscope sensor 280A. That is, the gyroscope sensor 280A can be used to detect the current motion state of the mobile phone 200, such as shaking or stillness.

[0170] When the display screen in the embodiment of the present application is a foldable screen, the gyroscope sensor 280A can be used to detect the folding or unfolding operation acting on the display screen 294. The gyroscope sensor 280A can report the detected folding operation or unfolding operation as an event to the processor 210 to determine the folded state or unfolded state of the display screen 294.

[0171] The acceleration sensor 280B can detect the magnitude of the acceleration of the mobile phone 200 in all directions (generally three axes). That is, the gyroscope sensor 280A can be used to detect the current motion state of the mobile phone 200, such as shaking or stillness. When the display screen in the embodiment of the present application is a foldable screen, the acceleration sensor 280B can be used to detect the folding or unfolding operation acting on the display screen 294. The acceleration sensor 280B can report the detected folding operation or unfolding operation as an event to the processor 210 to determine the folding state or unfolding state of the display screen 294.

[0172] The proximity light sensor 280G may include, for example, a light emitting diode (LED) and a light detector, such as a photodiode. The light emitting diode may be an infrared light emitting diode. The mobile phone emits infrared light outward through the light emitting diode. The mobile phone uses a photodiode to detect infrared reflected light from nearby objects. When sufficient reflected light is detected, it can be determined that there is an object near the mobile phone. When insufficient reflected light is detected, the mobile phone can determine that there is no object near the mobile phone. When the display screen in the embodiment of the present application is a foldable screen, the proximity light sensor 280G can be set on the first screen of the foldable display screen 294, and the proximity light sensor 280G can detect the size of the folding angle or unfolding angle between the first screen and the second screen based on the optical path difference of the infrared signal.

[0173] The gyroscope sensor 280A (or the acceleration sensor 280B) can send the detected motion state information (such as angular velocity) to the processor 210. The processor 210 determines whether the current state is handheld or tripod based on the motion state information (for example, when the angular velocity is not 0, it means that the mobile phone 200 is in the handheld state).

[0174] The fingerprint sensor 280H is used to collect fingerprints. The mobile phone 200 can use the collected fingerprint characteristics to achieve fingerprint unlocking, access application locks, fingerprint photography, fingerprint call answering, etc.

[0175] The touch sensor 280K is also called a "touch panel". The touch sensor 280K can be set on the display screen 294, and the touch sensor 280K and the display screen 294 form a touch screen, also called a "touch screen". The touch sensor 280K is used to detect touch operations acting on or near it. The touch sensor can pass the detected touch operation to the application processor to determine the type of touch event. Visual output related to the touch operation can be provided through the display screen 294. In other embodiments, the touch sensor 280K can also be set on the surface of the mobile phone 200, which is different from the position of the display screen 294.

[0176] Exemplarily, the display screen 294 of the mobile phone 200 displays a main interface, which includes icons of multiple applications (such as a camera application, a WeChat application, etc.). The user clicks the icon of the camera application in the main interface through the touch sensor 280K, triggering the processor 210 to start the camera application and turn on the camera 293. The display screen 294 displays the interface of the camera application, such as a viewfinder interface.

[0177] The wireless communication function of the mobile phone 200 can be realized through the antenna 1, the antenna 2, the mobile communication module 251, the wireless communication module 252, the modem processor and the baseband processor.

[0178] Antenna 1 and antenna 2 are used to transmit and receive electromagnetic wave signals. Each antenna in mobile phone 200 can be used to cover a single or multiple communication frequency bands. Different antennas can also be reused to improve the utilization of antennas. For example, antenna 1 can be reused as a diversity antenna for a wireless local area network. In some other embodiments, the antenna can be used in combination with a tuning switch.

[0179] The mobile communication module 251 can provide solutions for wireless communications including 2G / 3G / 4G / 5G applied to the mobile phone 200. The mobile communication module 251 may include at least one filter, a switch, a power amplifier, a low noise amplifier (LNA), etc. The mobile communication module 251 can receive electromagnetic waves from the antenna 1, and filter, amplify, and process the received electromagnetic waves, and transmit them to the modulation and demodulation processor for demodulation. The mobile communication module 251 can also amplify the signal modulated by the modulation and demodulation processor, and convert it into electromagnetic waves for radiation through the antenna 1. In some embodiments, at least some of the functional modules of the mobile communication module 251 can be set in the processor 210. In some embodiments, at least some of the functional modules of the mobile communication module 251 can be set in the same device as at least some of the modules of the processor 210. In an embodiment of the present application, the mobile communication module 251 can also be used to interact with other terminal devices for information.

[0180] The modem processor may include a modulator and a demodulator. Among them, the modulator is used to modulate the low-frequency baseband signal to be sent into a medium-high frequency signal. The demodulator is used to demodulate the received electromagnetic wave signal into a low-frequency baseband signal. The demodulator then transmits the demodulated low-frequency baseband signal to the baseband processor for processing. After the low-frequency baseband signal is processed by the baseband processor, it is passed to the application processor. The application processor outputs a sound signal through an audio device (not limited to a speaker 270A, a receiver 270B, etc.), or displays an image or video through a display screen 294. In some embodiments, the modem processor may be an independent device. In other embodiments, the modem processor may be independent of the processor 210 and be set in the same device as the mobile communication module 251 or other functional modules.

[0181] The wireless communication module 252 can provide wireless communication solutions including wireless local area networks (WLAN) (such as wireless fidelity (Wi-Fi) networks), bluetooth (BT), global navigation satellite system (GNSS), frequency modulation (FM), near field communication (NFC), infrared (IR), etc., which are applied to the mobile phone 200. The wireless communication module 252 can be one or more devices integrating at least one communication processing module. The wireless communication module 252 receives electromagnetic waves via the antenna 2, modulates the frequency of the electromagnetic wave signal and filters it, and sends the processed signal to the processor 210. The wireless communication module 252 can also receive the signal to be sent from the processor 210, modulate the frequency of it, amplify it, and convert it into electromagnetic waves for radiation through the antenna 2. In the embodiment of the present application, the wireless communication module 252 is used to transmit data between other terminal devices under the control of the processor 210. For example, when the processor 210 runs the ... method provided in the embodiment of the present application, the processor can control the wireless communication module 252 to send a judgment request to other terminal devices, and can also receive the judgment result made by other terminal devices based on the above judgment request. The judgment result indicates whether the data to be transmitted can be transmitted to other terminal devices, and then controls the display screen 294 to display the judgment result, providing intuitive visual feedback to the user, avoiding erroneous operations and repeated operations, and improving operation efficiency.

[0182] In addition, the mobile phone 200 can implement audio functions through the audio module 270, the speaker 270A, the receiver 270B, the microphone 270C, the headphone interface 270D, and the application processor. For example, music playback, recording, etc. The mobile phone 200 can receive the key 290 input and generate key signal input related to the user settings and function control of the mobile phone 200. The mobile phone 200 can use the motor 291 to generate a vibration prompt (such as an incoming call vibration prompt). The indicator 292 in the mobile phone 200 can be an indicator light, which can be used to indicate the charging status, power changes, and can also be used to indicate messages, missed calls, notifications, etc. The SIM card interface 295 in the mobile phone 200 is used to connect the SIM card. The SIM card can be inserted into the SIM card interface 295, or pulled out from the SIM card interface 295, to achieve contact and separation with the mobile phone 200.

[0183] It should be understood that in actual applications, the mobile phone 200 may include Figure 7 The embodiments of the present application are not limited to the more or fewer components shown. The illustrated mobile phone 200 is only an example, and the mobile phone 200 may have more or fewer components than those shown in the figure, may combine two or more components, or may have different component configurations. The various components shown in the figure may be implemented in hardware, software, or a combination of hardware and software including one or more signal processing and / or application specific integrated circuits.

[0184] The software system of the terminal device can adopt a layered architecture, an event-driven architecture, a micro-core architecture, a micro-service architecture, or a cloud architecture. The embodiment of the present application takes the Android system of the layered architecture as an example to exemplify the software structure of the terminal device.

[0185] Figure 8 It is a software structure block diagram of the terminal device of an embodiment of the present application.

[0186] The layered architecture divides the software into several layers, each with clear roles and division of labor. The layers communicate with each other through software interfaces. In some embodiments, the Android system is divided into four layers, from top to bottom: the application layer, the application framework layer, the Android runtime and system library, and the kernel layer.

[0187] The application layer can include a series of application packages.

[0188] like Figure 8 As shown, the application package may include applications such as phone, camera, gallery, calendar, call, map, navigation, WLAN, Bluetooth, music, video, short message, etc.

[0189] The application framework layer provides an application programming interface (API) and a programming framework for the applications in the application layer. The application framework layer includes some predefined functions.

[0190] like Figure 8 As shown, the application framework layer may include a window manager, a content provider, a view system, a phone manager, a resource manager, a notification manager, and the like.

[0191] The window manager is used to manage window programs. The window manager can obtain the size of the display screen, determine whether there is a status bar, lock the screen, capture the screen, etc. The window manager can also be used to display the pop-up window in S105 and keep the wireless network icon in the open state.

[0192] Content providers are used to store and retrieve data and make it accessible to applications. The data may include videos, images, audio, calls made and received, browsing history and bookmarks, phone books, etc.

[0193] The view system includes visual controls, such as controls for displaying text, controls for displaying images, etc. The view system can be used to build applications. A display interface can be composed of one or more views. For example, a display interface including a text notification icon can include a view for displaying text and a view for displaying images.

[0194] The phone manager is used to provide communication functions for terminal devices, such as the management of call status (including answering, hanging up, etc.).

[0195] The resource manager provides various resources for applications, such as localized strings, icons, images, layout files, video files, and so on.

[0196] The notification manager enables applications to display notification information in the status bar. It can be used to convey notification-type messages and can disappear automatically after a short stay without user interaction. For example, the notification manager is used to notify download completion, message reminders, etc. The notification manager can also be a notification that appears in the system top status bar in the form of a chart or scroll bar text, such as notifications of applications running in the background, or a notification that appears on the screen in the form of a dialog window. For example, a text message is displayed in the status bar, a prompt sound is emitted, the terminal device vibrates, the indicator light flashes, etc.

[0197] Android Runtime includes core libraries and virtual machines. Android runtime is responsible for scheduling and management of the Android system.

[0198] The core library consists of two parts: one part is the function that needs to be called by the Java language, and the other part is the Android core library.

[0199] The application layer and the application framework layer run in a virtual machine. The virtual machine executes the Java files of the application layer and the application framework layer as binary files. The virtual machine is used to perform functions such as object life cycle management, stack management, thread management, security and exception management, and garbage collection.

[0200] The system library may include multiple functional modules, such as surface manager, media library, 3D graphics processing library (such as OpenGL ES), 2D graphics engine (such as SGL), etc.

[0201] The surface manager is used to manage the display subsystem and provide the fusion of 2D and 3D layers for multiple applications.

[0202] The media library supports playback and recording of a variety of commonly used audio and video formats, as well as static image files, etc. The media library can support a variety of audio and video encoding formats, such as: MPEG4, H.264, MP3, AAC, AMR, JPG, PNG, etc.

[0203] The 3D graphics processing library is used to implement 3D graphics drawing, image rendering, synthesis, and layer processing, etc. The 2D graphics engine is a drawing engine for 2D drawing. In an embodiment of the present application, when the terminal is in a screen-off state, the 3D graphics processing library and the 2D graphics engine both stop drawing graphics.

[0204] The kernel layer is the layer between hardware and software. The kernel layer contains at least display driver, camera driver, audio driver, and sensor driver.

[0205] An embodiment of the present application provides a wireless network access device, comprising: a processor and a memory for storing processor-executable instructions; wherein the processor is configured to implement the above method when executing the instructions.

[0206] An embodiment of the present application provides a non-volatile computer-readable storage medium on which computer program instructions are stored. When the computer program instructions are executed by a processor, the above method is implemented.

[0207] An embodiment of the present application provides a computer program product, including a computer-readable code, or a non-volatile computer-readable storage medium carrying the computer-readable code. When the computer-readable code runs in a processor of an electronic device, the processor in the electronic device executes the above method.

[0208] A computer-readable storage medium may be a tangible device that can hold and store instructions used by an instruction execution device. A computer-readable storage medium may be, for example, but not limited to, an electrical storage device, a magnetic storage device, an optical storage device, an electromagnetic storage device, a semiconductor storage device, or any suitable combination of the foregoing. More specific examples of computer-readable storage media (a non-exhaustive list) include: a portable computer disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), a static random access memory (SRAM), a portable compact disc read-only memory (CD-ROM), a digital versatile disc (DVD), a memory stick, a floppy disk, a mechanical encoding device, such as a punch card or a raised structure in a groove on which instructions are stored, and any suitable combination of the foregoing.

[0209] The computer-readable program instructions or codes described herein may be downloaded from a computer-readable storage medium to each computing / processing device, or downloaded to an external computer or external storage device via a network, such as the Internet, a local area network, a wide area network, and / or a wireless network. The network may include copper transmission cables, optical fiber transmission, wireless transmission, routers, firewalls, switches, gateway computers, and / or edge servers 107. The network adapter card or network interface in each computing / processing device receives the computer-readable program instructions from the network and forwards the computer-readable program instructions for storage in a computer-readable storage medium in each computing / processing device.

[0210] The computer program instructions for performing the operations of the present application may be assembler instructions, instruction set architecture (ISA) instructions, machine instructions, machine-dependent instructions, microcode, firmware instructions, state setting data, or source code or object code written in any combination of one or more programming languages, including object-oriented programming languages ​​such as Smalltalk, C++, etc., and conventional procedural programming languages ​​such as "C" language or similar programming languages. The computer-readable program instructions may be executed entirely on the user's computer, partially on the user's computer, as a separate software package, partially on the user's computer and partially on a remote computer, or entirely on a remote computer or server 107. In the case of a remote computer, the remote computer may be connected to the user's computer via any type of network, including a local area network (LAN) or a wide area network (WAN), or may be connected to an external computer (e.g., via the Internet using an Internet service provider). In some embodiments, by utilizing the state information of computer-readable program instructions to personalize an electronic circuit, such as a programmable logic circuit, a field-programmable gate array (FPGA) or a programmable logic array (PLA), the electronic circuit can execute the computer-readable program instructions to implement various aspects of the present application.

[0211] Various aspects of the present application are described herein with reference to the flowcharts and / or block diagrams of the methods, devices (systems) and computer program products according to the embodiments of the present application. It should be understood that each box in the flowchart and / or block diagram and the combination of each box in the flowchart and / or block diagram can be implemented by computer-readable program instructions.

[0212] These computer-readable program instructions can be provided to a processor of a general-purpose computer, a special-purpose computer, or other programmable data processing device, thereby producing a machine, so that when these instructions are executed by the processor of the computer or other programmable data processing device, a device that implements the functions / actions specified in one or more boxes in the flowchart and / or block diagram is generated. These computer-readable program instructions can also be stored in a computer-readable storage medium, and these instructions cause the computer, programmable data processing device, and / or other equipment to work in a specific manner, so that the computer-readable medium storing the instructions includes a manufactured product, which includes instructions for implementing various aspects of the functions / actions specified in one or more boxes in the flowchart and / or block diagram.

[0213] Computer-readable program instructions may also be loaded onto a computer, other programmable data processing apparatus, or other device so that a series of operating steps are performed on the computer, other programmable data processing apparatus, or other device to produce a computer-implemented process, thereby causing the instructions executed on the computer, other programmable data processing apparatus, or other device to implement the functions / actions specified in one or more boxes in the flowchart and / or block diagram.

[0214] The flow chart and block diagram in the accompanying drawings show the possible architecture, function and operation of the device, system, method and computer program product according to multiple embodiments of the present application. In this regard, each square frame in the flow chart or block diagram can represent a part of a module, program segment or instruction, and a part of the module, program segment or instruction includes one or more executable instructions for realizing the logical function of the specification. In some alternative implementations, the functions marked in the square frame can also occur in a sequence different from that marked in the accompanying drawings. For example, two continuous square frames can actually be executed substantially in parallel, and they can also be executed in reverse order sometimes, depending on the functions involved.

[0215] It should also be noted that each box in the block diagram and / or flowchart, and the combination of boxes in the block diagram and / or flowchart, can be implemented by hardware (such as a circuit or ASIC (Application Specific Integrated Circuit)) that performs the corresponding function or action, or can be implemented by a combination of hardware and software, such as firmware.

[0216] Although the present invention is described herein in conjunction with various embodiments, in the process of implementing the claimed invention, those skilled in the art may understand and implement other variations of the disclosed embodiments by viewing the drawings, the disclosure, and the appended claims. In the claims, the word "comprising" does not exclude other components or steps, and "one" or "an" does not exclude multiple situations. A single processor or other unit may implement several functions listed in the claims. Certain measures are recorded in different dependent claims, but this does not mean that these measures cannot be combined to produce good results.

[0217] The embodiments of the present application have been described above, and the above description is exemplary, not exhaustive, and is not limited to the disclosed embodiments. Many modifications and changes will be apparent to those of ordinary skill in the art without departing from the scope and spirit of the described embodiments. The selection of terms used herein is intended to best explain the principles of the embodiments, practical applications, or improvements to the technology in the market, or to enable other persons of ordinary skill in the art to understand the embodiments disclosed herein.

Claims

1. A wireless network access method, characterized in that: include: Acquiring an operating status of a terminal device, wherein the terminal device is simultaneously connected to multiple wireless networks; Obtaining NAT timeout durations corresponding to the multiple wireless networks respectively, wherein the NAT timeout duration includes a maximum time duration during which a network link established by the wireless network remains connected without communication; When it is determined that the running status of the terminal device and the NAT timeout durations respectively corresponding to the multiple wireless networks meet the preset conditions, at least one of the multiple wireless networks is disconnected, wherein the running status of the terminal device and the NAT timeout durations respectively corresponding to the multiple wireless networks meet the preset conditions including: the terminal device is running in the background, the NAT timeout duration corresponding to the first wireless network among the multiple wireless networks is greater than the NAT timeout duration corresponding to the second wireless network, and the at least one wireless network is the second wireless network.

2. The method according to claim 1, characterized in that The running status includes at least one of the following: traffic usage information of applications in the terminal device, a working mode of the terminal device, power information of the terminal device, and network information of the multiple wireless networks.

3. The method according to claim 2, characterized in that The operating status of the terminal device meets the preset conditions, and also includes at least one of the following: Determining, based on traffic usage information of applications in the terminal device, that an application with a traffic volume greater than a preset traffic volume threshold is running in the terminal device; Determining that the terminal device is operating in a low-power operating mode according to the operating mode of the terminal device; Determining, based on power information of the terminal device, that the power of the terminal device is less than a preset power threshold; The power consumption rate of the terminal device is greater than a preset power consumption rate threshold, or the power consumption rate of the terminal device is greater than a charging speed; It is determined according to the network information of the multiple wireless networks that the signal strength of the multiple wireless networks is greater than a preset strength threshold, or it is determined according to the network information of the multiple wireless networks that the signal stability of the multiple wireless networks is greater than a preset stability threshold.

4. The method according to claim 1, characterized in that: The NAT timeout durations corresponding to the multiple wireless networks meet the preset conditions, and further include: A difference between a NAT timeout duration corresponding to the first wireless network and a NAT timeout duration corresponding to the second wireless network is greater than a preset time threshold.

5. The method according to claim 3, characterized in that: The disconnecting at least one of the plurality of wireless networks comprises: An application with a flow rate greater than a preset flow rate threshold is running in the terminal device; When the application uses the second wireless network for network communication, the second wireless network is disconnected after the application completes or suspends the service.

6. The method according to claim 3, characterized in that The disconnecting at least one of the plurality of wireless networks comprises: An application with a flow rate greater than a preset flow rate threshold is running in the terminal device; When the application uses the first wireless network for network communication, the first wireless network does not limit traffic and disconnects the second wireless network.

7. The method according to claim 1, characterized in that The disconnecting at least one of the plurality of wireless networks comprises: The terminal sends a notification message in a pop-up window, wherein the notification message includes a message suggesting that the user disconnect from the second wireless network; A user input is received, and the second wireless network is disconnected.

8. The method according to claim 1, characterized in that The disconnecting at least one of the plurality of wireless networks comprises: The second wireless network is disconnected, and the network identifier corresponding to the second wireless network is maintained in a state where it is not disconnected.

9. A wireless network access device, characterized in that: include: processor; a memory for storing processor-executable instructions; Wherein, the processor is configured to implement the method according to any one of claims 1 to 8 when executing the instructions.

10. A non-volatile computer-readable storage medium having computer program instructions stored thereon, characterized in that: When the computer program instructions are executed by a processor, the method according to any one of claims 1 to 8 is implemented.

11. A computer program product comprising computer readable code, or a non-volatile computer readable storage medium carrying computer readable code, characterized in that: When the computer readable code runs in a processor of an electronic device, the processor in the electronic device executes the method according to any one of claims 1 to 8.