Method for reducing power consumption and electronic equipment

By detecting abnormal conditions in the Wi-Fi connection and shutting down the Wi-Fi module, the high power consumption problem caused by non-standard router design was solved, achieving low power consumption and long battery life for electronic devices.

CN114697932BActive Publication Date: 2024-11-29HUAWEI TECH CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202011632891.4
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2020-12-31
Publication Date
2024-11-29
Estimated Expiration
2040-12-31

AI Technical Summary

Technical Problem

Due to non-standard router design, the Wi-Fi module is frequently woken up or works for extended periods, resulting in high power consumption for mobile phones and other electronic devices and affecting battery life.

Method used

By detecting specific packet counts, preset flag errors, connection dropouts, and packet transmission cycles in the Wi-Fi connection, it can determine whether the Wi-Fi module is experiencing high power consumption due to router design flaws. If the conditions are met, the Wi-Fi module will be shut down, and data transmission will be handled through the mobile network module instead.

Benefits of technology

It effectively reduces the power consumption of the Wi-Fi module, extends the standby time of electronic devices, and reduces the overall power consumption of the device.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN114697932B_ABST
    Figure CN114697932B_ABST
Patent Text Reader

Abstract

A method for reducing power consumption and an electronic device, relating to the field of terminal technology. The power consumption of an electronic device can be reduced. The method includes: establishing a Wi-Fi connection with a second electronic device through a Wi-Fi module; if it is determined that a first condition is met, performing power saving processing on the Wi-Fi module; the first condition includes any one or more of the following: the number of first messages received through the Wi-Fi connection in a first time period is greater than or equal to a first threshold; the number of times a preset identification position of a second message received through the Wi-Fi connection in a second time period is incorrect is greater than or equal to a second threshold; the number of times the Wi-Fi connection is disconnected or the number of times the Wi-Fi connection is established in a third time period is greater than or equal to a third threshold; the sending period of a third message received through the Wi-Fi connection is inaccurate; the working duration of the Wi-Fi module is greater than or equal to a preset duration threshold, and the number of messages sent and / or received through the Wi-Fi connection is less than or equal to the first preset number threshold.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of terminal technology, and in particular to a method for reducing power consumption and an electronic device. Background Art

[0002] Due to lower charges and faster speeds, Wi-Fi has become the preferred way for many users to surf the Internet. For example, when a user uses a mobile phone to connect to Wi-Fi, the mobile phone may consume high power. For example, since the design of routers from different manufacturers does not adopt a unified standard, the performance of routers varies. When a mobile phone is connected to certain routers, the Wi-Fi chip of the mobile phone may be frequently awakened, causing the Wi-Fi chip to not be powered off for a long time, resulting in serious power consumption. From the commercial data, the power consumption of mobile phone Wi-Fi chips caused by routers has become the primary power consumption problem. Summary of the invention

[0003] The present application provides a method for reducing power consumption and an electronic device, which can reduce the power consumption of a Wi-Fi module in the electronic device, thereby helping to extend the standby time of the electronic device.

[0004] In order to achieve the above objectives, the embodiments of the present application provide the following technical solutions:

[0005] In a first aspect, a method for reducing power consumption is provided, which is applied to a first electronic device, wherein the first electronic device has a Wi-Fi module and a mobile network module, and the method comprises: the first electronic device establishes a Wi-Fi connection with a second electronic device through the Wi-Fi module, and the first electronic device interacts with the second electronic device through the Wi-Fi connection; if the first electronic device detects that the first electronic device meets a first condition, the first electronic device performs power saving processing on the Wi-Fi module.

[0006] The first condition includes any one or more of the following:

[0007] Item 1: the number of first messages received by the first electronic device from the second electronic device through the Wi-Fi connection within a first time period is greater than or equal to a first threshold;

[0008] Item 2: within a second time period, the number of times that the preset flag position of the second message received by the first electronic device from the second electronic device through the Wi-Fi connection is incorrect is greater than or equal to a second threshold;

[0009] Item 3: The number of Wi-Fi connection disconnections or the number of Wi-Fi connection establishments within a third time period is greater than or equal to a third threshold;

[0010] Item 4: During a fourth time period, a sending period of a third message received by the first electronic device from the second electronic device through the Wi-Fi connection is inaccurate;

[0011] Item 5: In a fifth time period, the working duration of the Wi-Fi module is greater than or equal to a preset duration threshold, and the number of fourth messages received by the first electronic device from the second electronic device through the Wi-Fi connection is less than or equal to a first preset number threshold;

[0012] Item 6: During a sixth time period, the operating duration of the Wi-Fi module is greater than or equal to a preset duration threshold, and during the operating duration, the number of fifth messages sent by the first electronic device to the second electronic device through the Wi-Fi connection is less than or equal to a second preset number threshold;

[0013] The first message is a message used to detect Wi-Fi anomalies according to the number of messages; the second message is a message used to detect Wi-Fi anomalies according to the setting of a preset flag bit of the message; the third message is a message used to detect Wi-Fi anomalies according to the sending period of the message;

[0014] The preset identification bit is used to indicate whether there is a service message to be sent by the second electronic device to the first electronic device.

[0015] When the first electronic device detects the first condition, which means that the Wi-Fi consumes a lot of power, the first electronic device disconnects the Wi-Fi connection, thereby avoiding the problem of high power consumption of the first electronic device connected to the second electronic device via Wi-Fi due to improper design of the second electronic device.

[0016] In one possible design, the first message, the second message, and the third message are all non-business messages; the first message includes any one or more of the following: a unicast message, a multicast message, a Beacon message, a rekey message, a renew message, and a router advertisement RA message; the second message includes a Beacon message; the preset identification bit of the second message includes a traffic indication map TIM bit; the correctly set preset identification bit is used to indicate the existence of a business message to be sent by the second electronic device to the first electronic device; the third message includes a Beacon message.

[0017] In one possible design, a sending period of the third message is inaccurate, including that a sending period of the second electronic device sending the third message is not aligned with a receiving period of the first electronic device receiving the third message.

[0018] In one possible design, determining that a preset flag bit of the second message is incorrectly set includes: the first electronic device receives the second message from the second electronic device, and a preset flag bit of the second message is set;

[0019] The first electronic device sends an empty frame to the second electronic device, where the empty frame is used to request a service message from the second electronic device;

[0020] If no service message is received from the second electronic device within the seventh time period, the first electronic device determines that the preset identification position of the second message is incorrect.

[0021] In one possible design, determining that the sending period of the third message is inaccurate includes: if, within a fourth time period, a reception rate of the third message received from the second electronic device is less than or equal to a reception threshold, then determining by the first electronic device that the sending period of the third message is inaccurate;

[0022] The reception rate of the third messages is a ratio of the number of third messages actually received to the number of third messages that should be received.

[0023] In one possible design, the first time period includes multiple first periodic time periods; the first electronic device detects that the number of first messages received from the second electronic device through the Wi-Fi connection within the first time period reaches a first threshold, including:

[0024] If the number of first messages detected by the first electronic device reaches a first threshold value within a preset number of consecutive first cycle time periods, it is determined that the number of first messages received from the second electronic device via the Wi-Fi connection within the first time period reaches the first threshold value.

[0025] In one possible design, the third time period includes multiple second period time periods; the first electronic device detects that the number of Wi-Fi connection disconnections or the number of Wi-Fi connection establishments reaches a third threshold within the third time period, including:

[0026] If the first electronic device detects that the number of Wi-Fi connection disconnections reaches a third threshold value within a preset number of consecutive second cycle time periods;

[0027] Or, if the first electronic device detects that the number of Wi-Fi connection establishments reaches a third threshold value within a preset number of consecutive second cycle time periods;

[0028] It is determined that the number of Wi-Fi connection disconnections or the number of Wi-Fi connection establishments detected within the third time period reaches a third threshold.

[0029] In one possible design, the second time period includes a plurality of third periodic time periods; the first electronic device detects within the second time period that a number of times that a preset identification position of a second message received from the second electronic device through the Wi-Fi connection is incorrect reaches a second threshold, including:

[0030] If the number of times the first electronic device detects that the preset identification position of the second message is incorrect reaches a second threshold value within a preset number of consecutive third cycle time periods, it is determined that the number of times the preset identification position of the second message received from the second electronic device via the Wi-Fi connection is incorrectly detected within the second time period reaches the second threshold value.

[0031] It should be noted that in some scenarios, in the second time period, the second electronic device may set the preset identification position of the second message incorrectly in some third cycle time periods, which may be an accidental setting error. The accidental setting error usually does not or has a very small probability of causing high power consumption of the first electronic device. Therefore, this accidental setting error is not determined as a factor causing high power consumption of the Wi-Fi module in this application. Only when the number of errors in the preset identification position of the second message is high in a plurality of consecutive third cycle time periods, it is likely that the second electronic device is not designed in a standardized manner, resulting in frequent setting errors in each third cycle time period, and this situation will be regarded as a factor causing high power consumption of the Wi-Fi module. It can be seen that the first electronic device can exclude the possibility of accidental setting errors by detecting whether frequent setting errors are set in a plurality of consecutive third cycle time periods, and then more accurately determine whether the high power consumption of the Wi-Fi module is caused by factors such as the irregular design of the second electronic device. When it is determined that the high power consumption of the Wi-Fi module is caused by factors such as the irregular design of the second electronic device, the first electronic device turns off the Wi-Fi module to reduce the power consumption of the whole machine.

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

[0033] After the Wi-Fi module enters the dormant state, if the first electronic device has a service message to be sent, the first electronic device sends the service message to be sent through the mobile network connection established by the mobile network module. In this way, the first electronic device can still send the service message, which can ensure that the service of the first electronic device is not affected.

[0034] In one possible design, before the first electronic device controls the Wi-Fi module to enter a sleep state, the method further includes:

[0035] The first electronic device displays a first interface, where the first interface is used to prompt the user whether to disconnect the Wi-Fi connection;

[0036] The first electronic device performs power saving processing on the Wi-Fi module, including: in response to a first instruction input by a user on a first interface, the first electronic device performs power saving processing on the Wi-Fi module and disconnects the Wi-Fi connection; the first instruction is used to instruct to disconnect the Wi-Fi connection.

[0037] In one possible design, before the first electronic device controls the Wi-Fi module to enter a sleep state, the method further includes:

[0038] The first electronic device displays a second interface, where the second interface is used to prompt the user whether to switch the network connection from the Wi-Fi connection to the mobile network connection;

[0039] The first electronic device performs power saving processing on the Wi-Fi module, including: in response to a second instruction input by a user on a second interface, the first electronic device performs power saving processing on the Wi-Fi module and switches the network connection to a mobile network connection; the second instruction is used to instruct the network connection to be switched to a mobile network connection.

[0040] In one possible design, the first electronic device receives an instruction from a user to turn on a first function, or turns on the first function when the first electronic device determines that it is in a first preset scenario; wherein the first function is a function of reducing the power consumption of the first electronic device; the first preset scenario includes: the battery level of the first electronic device is lower than a preset value, the number of applications turned on by the first electronic device is greater than a preset number, the first electronic device turns on a preset application, the current time is within a first preset time period, the screen of the first electronic device is off for longer than a preset time, the first electronic device maintains a network connection when set to sleep, and the first electronic device does not detect any one or more of the ongoing services.

[0041] In one possible design, after the Wi-Fi module enters the sleep state, the method further includes:

[0042] If the first electronic device detects that it is in the second preset scenario, the Wi-Fi module is awakened, and a Wi-Fi connection with the second electronic device is re-established through the Wi-Fi module.

[0043] The second preset scenario includes any one or more of the following combinations: the first electronic device is charging, the first electronic device is moving, the screen-on time of the first electronic device reaches a fourth threshold, the number of applications opened by the first electronic device is less than or equal to a preset number, the current time is within a preset time period, the first electronic device detects that a business is in progress, and the traffic of the mobile network reaches a fifth threshold after the Wi-Fi connection is disconnected.

[0044] Through this method, the first electronic device can wake up the Wi-Fi module in time to provide Internet access services to the user.

[0045] In one possible design, the second electronic device includes any one of a wireless router and a CPE.

[0046] In one possible design, the first electronic device performs power saving processing on the Wi-Fi module, including: the first electronic device controls the Wi-Fi module to enter a sleep state.

[0047] In a second aspect, a terminal is provided, comprising: a processor, a memory, a touch screen, a Wi-Fi module and a Bluetooth module, wherein the memory, the touch screen, the Wi-Fi module and the Bluetooth module are coupled to the processor, the memory is used to store computer program codes, and the computer program codes include computer instructions. When the processor reads the computer instructions from the memory, the terminal executes the method in the above aspects and any possible implementation thereof.

[0048] In a third aspect, an electronic device is provided, comprising: a processor, a memory, a Wi-Fi module and a Bluetooth module, wherein the memory, the Wi-Fi module and the Bluetooth module are coupled to the processor, the memory is used to store computer program code, and the computer program code comprises computer instructions. When the processor reads the computer instructions from the memory, the electronic device executes a method as in the above aspect and any possible implementation thereof.

[0049] In a fourth aspect, a device is provided, which is included in a terminal, and has the function of implementing the terminal behavior in any of the above aspects and possible implementation methods. The function can be implemented by hardware, or by hardware executing corresponding software. The hardware or software includes at least one module or unit corresponding to the above function. For example, a communication module or unit, a control module or unit, etc.

[0050] In a fifth aspect, a device is provided, which is included in an electronic device, and the device has the function of implementing the electronic device behavior in any of the above aspects and possible implementation methods. The function can be implemented by hardware, or by hardware executing corresponding software. The hardware or software includes at least one module or unit corresponding to the above function. For example, a communication module or unit, a control module or unit, etc.

[0051] In a sixth aspect, a computer-readable storage medium is provided, comprising computer instructions. When the computer instructions are executed on a terminal, the terminal executes a method as in the above aspect and any possible implementation thereof.

[0052] In the seventh aspect, a computer-readable storage medium is provided, comprising computer instructions. When the computer instructions are executed on an electronic device, the electronic device executes a method as in the above aspect and any possible implementation thereof.

[0053] In an eighth aspect, a computer program product is provided. When the computer program product is run on a computer, the computer is enabled to execute the method in the above aspects and any possible implementation thereof.

[0054] In the ninth aspect, a chip system is provided, including a processor. When the processor executes instructions, the processor executes the method in the above aspects and any possible implementation thereof. BRIEF DESCRIPTION OF THE DRAWINGS

[0055] Figure 1 A schematic diagram of the structure of a communication system provided in an embodiment of the present application;

[0056] Figure 2A A schematic diagram of a terminal structure provided in an embodiment of the present application Figure 1 ;

[0057] Figure 2B A second structural diagram of a terminal provided in an embodiment of the present application;

[0058] Figure 3A Schematic diagram of user interfaces of some terminals provided in embodiments of the present application;

[0059] Figure 3B Schematic diagram of user interfaces of some terminals provided in embodiments of the present application;

[0060] Figure 3C Schematic diagram of user interfaces of some terminals provided in embodiments of the present application;

[0061] Figure 4 A flowchart of a method for reducing power consumption provided in an embodiment of the present application;

[0062] Figure 5A A schematic diagram of a method for detecting high power consumption of Wi-Fi provided in an embodiment of the present application Figure 1 ;

[0063] Figure 5B A schematic diagram of a scenario for detecting the number of first messages provided in an embodiment of the present application;

[0064] Figure 5C A schematic diagram of a scenario for detecting an erroneous setting of a preset flag bit of a second message provided in an embodiment of the present application;

[0065] Figure 5D Scenario diagram of detecting Wi-Fi disconnection anomalies provided in the embodiment of the present application Figure 1 ;

[0066] Figure 5E Schematic diagram 2 of a scenario for detecting Wi-Fi disconnection anomalies provided in an embodiment of the present application;

[0067] Fig. 5F A schematic diagram of a scenario for detecting an inaccurate sending period of a third message provided in an embodiment of the present application;

[0068] Figure 5G Schematic diagram of a scenario in which a Wi-Fi abnormality is detected and power is not turned off according to an embodiment of the present application Figure 1 ;

[0069] Figure 5H Schematic diagram 2 of a scenario in which abnormal Wi-Fi is detected and power is not turned off provided in an embodiment of the present application;

[0070] Figure 6 Schematic diagram of user interfaces of some terminals provided in embodiments of the present application;

[0071] Figure 7 A schematic diagram of a third message cycle provided in an embodiment of the present application;

[0072] Figure 8 An exemplary application scenario 1 of the method for reducing power consumption provided in an embodiment of the present application;

[0073] Fig. 9 Exemplary application scenario 2 of the method for reducing power consumption provided in the embodiment of the present application;

[0074] Fig.10 A schematic diagram of the structure of a chip system provided in an embodiment of the present application. DETAILED DESCRIPTION

[0075] In the embodiments of the present application, words such as "exemplary" or "for example" are used to indicate examples, illustrations or descriptions. 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 specific way.

[0076] In the following, the terms "first" and "second" are used for descriptive purposes only and are not to be understood as indicating or implying relative importance or implicitly indicating the number of the indicated technical features. Thus, a feature defined as "first" or "second" may explicitly or implicitly include one or more of the features. In the description of the embodiments of the present application, unless otherwise specified, "plurality" means two or more.

[0077] When users use the terminal, they often need to access the Internet. In some examples, if a modem is configured, the terminal can use wireless communication connection methods such as 2G / 3G / 4G / 5G to establish a communication connection with the second electronic device via a mobile communication network to obtain corresponding services. Alternatively, when a wireless LAN module is configured, the terminal can also use a wireless LAN (such as a Wi-Fi network) connection method through the configured wireless LAN module (such as a Wi-Fi module) to establish a communication connection with the second electronic device via the Internet or a mobile communication network (or mobile network, mobile data network, etc.). For example, the terminal uses Wi-Fi technology to establish a communication connection with a wireless router, access the Internet through the wireless router, and interact with the second electronic device.

[0078] Since Wi-Fi has lower charges and faster speeds, users usually give priority to using Wi-Fi to surf the Internet. It can be seen that the power consumption of the Wi-Fi module is one of the important indicators that affect the battery life of the terminal. At present, some solutions have been adopted to reduce the power consumption of the Wi-Fi module. For example, after the terminal turns on Wi-Fi, the Wi-Fi module of the terminal will automatically scan nearby Wi-Fi signals at the set time interval. By setting a longer time interval, the scanning frequency of the Wi-Fi module is reduced to reduce the power consumption of the Wi-Fi module. For another example, when there is no data transmission on the terminal, the Wi-Fi module is controlled to enter a dormant state. When there is data transmission, the Wi-Fi module is awakened and continues to work.

[0079] The applicant believes that even if the scanning frequency of the Wi-Fi module is reduced or the Wi-Fi module is controlled to enter a dormant state, the battery life will be improved to a certain extent. However, due to the non-standard design specifications of the access point (AP) of the router, the Wi-Fi module of the terminal connected to such a router will still be frequently awakened from the dormant state or the Wi-Fi module will work for a long time, and the power consumption of the terminal is relatively high. For example, different routers may set different sending frequencies for a specific message, resulting in different awakening frequencies of the Wi-Fi modules of terminals connected to different routers, and the power consumption of the Wi-Fi modules of the terminals is also different. Among them, the Wi-Fi module of the terminal connected to some routers may have higher power consumption. Or, due to problems with the router settings, the Wi-Fi module of the terminal cannot sleep for a long time after being awakened, and the Wi-Fi module also has high power consumption. In an embodiment of the present application, the power consumption state of the Wi-Fi module of the terminal connected to the router can be detected. Specifically, when the terminal detects that the number of first messages reaches a first threshold value in a first time period, and / or, the number of preset identification position errors of the second message reaches a second threshold value in a second time period, and / or, the number of Wi-Fi connection disconnections or the number of Wi-Fi connection establishments reaches a third threshold value in a third time period, and / or, in a fourth time period, the sending period of the third message received from the second electronic device through the Wi-Fi connection is inaccurate, and / or, in a fifth time period, the working time of the Wi-Fi module is too long. The number of fourth messages received by the first electronic device from the second electronic device through the Wi-Fi connection during the working time is less than or equal to the first preset number threshold; and / or, in the sixth time period, the working time of the Wi-Fi module is greater than or equal to the preset time threshold and the number of fifth messages sent by the first electronic device to the second electronic device through the Wi-Fi connection during the working time is less than or equal to the second preset number threshold, indicating that the terminal consumes more power due to the Wi-Fi connection, and the power consumption is likely to be caused by the non-standard design of the router connected to the terminal through Wi-Fi. Then, the terminal turns off the Wi-Fi module to reduce the high power consumption caused by the Wi-Fi module, reduce the power consumption of the terminal as a whole, and extend the battery life of the terminal.

[0080] like Figure 1 , which is a schematic diagram of the structure of a communication system provided in an embodiment of the present application. The communication system includes a first electronic device 100 and a second electronic device 200. Various applications can be installed and run on the first electronic device 100 to provide users with rich functions. Generally, the first electronic device 100 can access the Internet or a mobile communication network through the second electronic device 200 to communicate with the servers corresponding to each application.

[0081] Exemplarily, the first electronic device 100 in the present application can be a mobile phone, a tablet computer, a personal computer (PC), a personal digital assistant (PDA), a smart watch, a netbook, a wearable electronic device, an augmented reality (AR) device, a virtual reality (VR) device, a vehicle-mounted device, a smart car, a smart speaker, a robot, etc. The present application does not impose any special restrictions on the specific form of the first electronic device.

[0082] Figure 2A The schematic diagram of the structure of the first electronic device 100 is shown. The first electronic device 100 may include a processor 110, an external memory interface 120, an internal memory 121, a universal serial bus (USB) interface 130, a charging management module 140, a power management module 141, a battery 142, an antenna 1, an antenna 2, a mobile communication module 150, a wireless communication module 160, an audio module 170, a speaker 170A, a receiver 170B, a microphone 170C, an earphone interface 170D, a sensor module 180, a button 190, a motor 191, an indicator 192, a camera 193, a display screen 194, and a subscriber identification module (SIM) card interface 195, etc. The sensor module 180 may include a pressure sensor, a gyroscope sensor, an air pressure sensor, a magnetic sensor, an acceleration sensor, a distance sensor, a proximity light sensor, a fingerprint sensor, a temperature sensor, a touch sensor, an ambient light sensor (which can detect the brightness of ambient light), a bone conduction sensor, etc.

[0083] It is to be understood that the structure illustrated in the embodiment of the present invention does not constitute a specific limitation on the first electronic device 100. In other embodiments of the present application, the first electronic device 100 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.

[0084] The processor 110 may include one or more processing units, for example, the processor 110 may include an application processor (AP), a modem processor, a graphics processor (GPU), an image signal processor (ISP), a controller, a video codec, a digital signal processor (DSP), a baseband processor, and / or a neural-network processing unit (NPU), etc. Different processing units may be independent devices or integrated into one or more processors.

[0085] The controller can generate operation control signals according to the instruction operation code and timing signal to complete the control of instruction fetching and execution.

[0086] The processor 110 may also be provided with a memory for storing instructions and data. In some embodiments, the memory in the processor 110 is a cache memory. The memory may store instructions or data that the processor 110 has just used or cyclically used. If the processor 110 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 110, and thus improves the efficiency of the system.

[0087] In some embodiments, the processor 110 may include one or more interfaces. The interface may include an inter-integrated circuit (I2C) interface, an inter-integrated circuit sound (I2S) interface, a pulse code modulation (PCM) interface, a universal asynchronous receiver / transmitter (UART) interface, a mobile industry processor interface (MIPI), a general-purpose input / output (GPIO) interface, a subscriber identity module (SIM) interface, and / or a universal serial bus (USB) interface, etc.

[0088] The I2C interface is a bidirectional synchronous serial bus, including a serial data line (SDA) and a serial clock line (SCL). In some embodiments, the processor 110 may include multiple groups of I2C buses. The processor 110 may be coupled to a touch sensor, a charger, a flash, a camera 193, etc. through different I2C bus interfaces. For example: the processor 110 may be coupled to a touch sensor through an I2C interface, so that the processor 110 communicates with the touch sensor through the I2C bus interface to realize the touch function of the first electronic device 100.

[0089] The I2S interface can be used for audio communication. In some embodiments, the processor 110 can include multiple I2S buses. The processor 110 can be coupled to the audio module 170 via the I2S bus to achieve communication between the processor 110 and the audio module 170. In some embodiments, the audio module 170 can transmit an audio signal to the wireless communication module 160 via the I2S interface to achieve the function of answering a call through a Bluetooth headset.

[0090] The PCM interface can also be used for audio communication, sampling, quantizing and encoding analog signals. In some embodiments, the audio module 170 and the wireless communication module 160 can be coupled via a PCM bus interface. In some embodiments, the audio module 170 can also transmit audio signals to the wireless communication module 160 via the PCM interface to implement the function of answering calls via a Bluetooth headset. Both the I2S interface and the PCM interface can be used for audio communication.

[0091] The UART interface is a universal serial data bus for asynchronous communication. The bus can be a bidirectional communication bus. It converts the data to be transmitted between serial communication and parallel communication. In some embodiments, the UART interface is generally used to connect the processor 110 and the wireless communication module 160. For example, the processor 110 communicates with the Bluetooth module in the wireless communication module 160 through the UART interface to implement the Bluetooth function. In some embodiments, the audio module 170 can transmit an audio signal to the wireless communication module 160 through the UART interface to implement the function of playing music through a Bluetooth headset.

[0092] The MIPI interface can be used to connect the processor 110 with peripheral devices such as the display screen 194 and the camera 193. The MIPI interface includes a camera serial interface (CSI), a display serial interface (DSI), etc. In some embodiments, the processor 110 and the camera 193 communicate via the CSI interface to implement the shooting function of the first electronic device 100. The processor 110 and the display screen 194 communicate via the DSI interface to implement the display function of the first electronic device 100.

[0093] The GPIO interface can be configured by software. The GPIO interface can be configured as a control signal or as a data signal. In some embodiments, the GPIO interface can be used to connect the processor 110 with the camera 193, the display 194, the wireless communication module 160, the audio module 170, the sensor module 180, etc. The GPIO interface can also be configured as an I2C interface, an I2S interface, a UART interface, a MIPI interface, etc.

[0094] The USB interface 130 is an interface that complies with the USB standard specification, and specifically can be a Mini USB interface, a Micro USB interface, a USB Type C interface, etc. The USB interface 130 can be used to connect a charger to charge the first electronic device 100, and can also be used to transmit data between the first electronic device 100 and a peripheral device. It can also be used to connect headphones to play audio through the headphones. The interface can also be used to connect other terminals, such as AR devices, etc.

[0095] It is understandable that the interface connection relationship between the modules illustrated in the embodiment of the present application is only a schematic illustration and does not constitute a structural limitation on the first electronic device 100. In other embodiments of the present application, the first electronic device 100 may also adopt different interface connection methods in the above embodiments, or a combination of multiple interface connection methods.

[0096] The charging management module 140 is used to receive charging input from a charger. The charger may be a wireless charger or a wired charger. In some wired charging embodiments, the charging management module 140 may receive charging input from a wired charger through the USB interface 130. In some wireless charging embodiments, the charging management module 140 may receive wireless charging input through a wireless charging coil of the first electronic device 100. While the charging management module 140 is charging the battery 142, it may also power the first electronic device 100 through the power management module 141.

[0097] The power management module 141 is used to connect the battery 142, the charging management module 140 and the processor 110. The power management module 141 receives input from the battery 142 and / or the charging management module 140, and supplies power to the processor 110, the internal memory 121, the display screen 194, the camera 193, and the wireless communication module 160. The power management module 141 can also be used to monitor parameters such as battery capacity, battery cycle number, battery health status (leakage, impedance), etc. In some other embodiments, the power management module 141 can also be set in the processor 110. In other embodiments, the power management module 141 and the charging management module 140 can also be set in the same device.

[0098] The wireless communication function of the first electronic device 100 can be implemented through the antenna 1, the antenna 2, the mobile communication module 150, the wireless communication module 160, the modem processor and the baseband processor.

[0099] Antenna 1 and antenna 2 are used to transmit and receive electromagnetic wave signals. Each antenna in the first electronic device 100 can be used to cover a single or multiple communication frequency bands. Different antennas can also be reused to improve the utilization of the 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.

[0100] The mobile communication module 150 can provide solutions for wireless communications including 2G / 3G / 4G / 5G applied to the first electronic device 100. The mobile communication module 150 may include at least one filter, a switch, a power amplifier, a low noise amplifier (LNA), etc. The mobile communication module 150 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 150 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 150 can be set in the processor 110. In some embodiments, at least some of the functional modules of the mobile communication module 150 can be set in the same device as at least some of the modules of the processor 110.

[0101] 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 170A, a receiver 170B, etc.), or displays an image or video through a display screen 194. In some embodiments, the modem processor may be an independent device. In other embodiments, the modem processor may be independent of the processor 110 and be set in the same device as the mobile communication module 150 or other functional modules.

[0102] The wireless communication module 160 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., applied on the first electronic device 100. The wireless communication module 160 can be one or more devices integrating at least one communication processing module. The wireless communication module 160 receives electromagnetic waves via the antenna 2, modulates the frequency of the electromagnetic wave signal and filters it, and sends the processed signal to the processor 110. The wireless communication module 160 can also receive the signal to be sent from the processor 110, modulate the frequency of it, amplify it, and convert it into electromagnetic waves for radiation through the antenna 2.

[0103] In some embodiments of the present application, the processor 110 detects the power consumption state of the Wi-Fi. Specifically, when a first condition is detected, the WLAN module (such as the Wi-Fi module) in the wireless communication module may be instructed to power off. The first condition includes:

[0104] The number of first messages detected in the first time period reaches a first threshold and / or the number of second messages detected in the second time period with preset flag bit errors reaches a second threshold.

[0105] The first condition also includes: and / or the number of times that Wi-Fi disconnection and / or connection is detected within a third time period reaches a third threshold.

[0106] When the WLAN module is powered off, the processor 110 can instruct the mobile network connection (4G network connection) established through the mobile communication module (such as the 4G network module) to access the Internet. When it is determined that the first electronic device 100 is in the second preset scene, the processor 110 wakes up the WLAN module, establishes a WLAN connection between the first electronic device 100 and the second electronic device 200, and interacts with the second electronic device 200 through the WLAN connection. In other words, when the Wi-Fi of the first electronic device 100 consumes more power, the first electronic device 100 controls the WLAN module to power off, thereby reducing the power consumption of the WLAN module and reducing the overall power consumption of the first electronic device 100.

[0107] In some embodiments, the antenna 1 of the first electronic device 100 is coupled to the mobile communication module 150, and the antenna 2 is coupled to the wireless communication module 160, so that the first electronic device 100 can communicate with the network and other devices through wireless communication technology. The wireless communication technology may include global system for mobile communications (GSM), general packet radio service (GPRS), code division multiple access (CDMA), wideband code division multiple access (WCDMA), time-division code division multiple access (TD-SCDMA), long term evolution (LTE), BT, GNSS, WLAN, NFC, FM, and / or IR technology, etc. GNSS may include the global positioning system (GPS), the global navigation satellite system (GLONASS), the Beidou navigation satellite system (BDS), the quasi-zenith satellite system (QZSS) and / or the satellite based augmentation system (SBAS).

[0108] The first electronic device 100 implements a display function through a GPU, a display screen 194, and an application processor. The GPU is a microprocessor for image processing, which connects the display screen 194 and the application processor. The GPU is used to perform mathematical and geometric calculations for graphics rendering. The processor 110 may include one or more GPUs that execute program instructions to generate or change display information.

[0109] The display screen 194 is used to display images, videos, etc. The display screen 194 includes a display panel. The display panel can be a liquid crystal display (LCD), an organic light-emitting diode (OLED), an active-matrix organic light-emitting diode or an active-matrix organic light-emitting diode (AMOLED), a flexible light-emitting diode (FLED), Miniled, MicroLed, Micro-oLed, a quantum dot light-emitting diode (QLED), etc. In some embodiments, the first electronic device 100 may include 1 or N display screens 194, where N is a positive integer greater than 1.

[0110] The first electronic device 100 can implement a shooting function through an ISP, a camera 193, a video codec, a GPU, a display screen 194, and an application processor.

[0111] ISP is used to process the data fed back by camera 193. For example, when taking a photo, the shutter is opened, and the light is transmitted to the camera photosensitive element through the lens. The light signal is converted into an electrical signal, and the camera photosensitive element transmits the electrical signal to ISP for processing and converts it into an image visible to the naked eye. ISP can also perform algorithm optimization on the noise, brightness, and skin color of the image. ISP can also optimize the exposure, color temperature and other parameters of the shooting scene. In some embodiments, ISP can be set in camera 193.

[0112] The camera 193 is used to capture still images or videos. The object generates an optical image through the lens and projects it onto the photosensitive element. The photosensitive element can be a charge coupled device (CCD) or a complementary metal-oxide-semiconductor (CMOS) phototransistor. The photosensitive element converts the optical signal into an electrical signal, and then passes the electrical signal to the ISP to be converted into a digital image signal. The ISP outputs the digital image signal to the DSP for processing. The DSP converts the digital image signal into an image signal in a standard RGB, YUV or other format. In some embodiments, the first electronic device 100 may include 1 or N cameras 193, where N is a positive integer greater than 1.

[0113] The digital signal processor is used to process digital signals, and can process not only digital image signals but also other digital signals. For example, when the first electronic device 100 selects a frequency point, the digital signal processor is used to perform Fourier transform on the frequency point energy.

[0114] The video codec is used to compress or decompress digital video. The first electronic device 100 may support one or more video codecs. In this way, the first electronic device 100 can play or record videos in multiple coding formats, such as moving picture experts group (MPEG) 1, MPEG2, MPEG3, MPEG4, etc.

[0115] The NPU is a neural network (NN) computing processor that quickly processes input information by drawing on the structure of biological neural networks, such as the transmission mode between neurons in the human brain, and can also continuously self-learn. The NPU can realize applications such as intelligent cognition of the first electronic device 100, such as image recognition, face recognition, voice recognition, text understanding, etc.

[0116] The external memory interface 120 can be used to connect an external memory card, such as a Micro SD card, to expand the storage capacity of the first electronic device 100. The external memory card communicates with the processor 110 through the external memory interface 120 to implement a data storage function, such as storing music, video and other files in the external memory card.

[0117] The internal memory 121 can be used to store computer executable program codes, and the executable program codes include instructions. The internal memory 121 may include a program storage area and a data storage area. Among them, the program storage area may store an operating system, an application required for at least one function (such as a sound playback function, an image playback function, etc.), etc. The data storage area may store data created during the use of the first electronic device 100 (such as audio data, a phone book, etc.), etc. In addition, the internal memory 121 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. The processor 110 executes various functional applications and data processing of the first electronic device 100 by running instructions stored in the internal memory 121, and / or instructions stored in a memory provided in the processor.

[0118] The first electronic device 100 can implement audio functions such as music playing and recording through the audio module 170, the speaker 170A, the receiver 170B, the microphone 170C, the headphone interface 170D, and the application processor.

[0119] The audio module 170 is used to convert digital audio information into analog audio signal output, and is also used to convert analog audio input into digital audio signals. The audio module 170 can also be used to encode and decode audio signals. In some embodiments, the audio module 170 can be arranged in the processor 110, or some functional modules of the audio module 170 can be arranged in the processor 110.

[0120] The speaker 170A, also called a "speaker", is used to convert an audio electrical signal into a sound signal. The first electronic device 100 can listen to music or listen to a hands-free call through the speaker 170A.

[0121] The receiver 170B, also called a "earpiece", is used to convert audio electrical signals into sound signals. When the first electronic device 100 receives a call or voice message, the voice can be received by placing the receiver 170B close to the human ear.

[0122] Microphone 170C, also called "microphone" or "microphone", is used to convert sound signals into electrical signals. When making a call or sending a voice message, the user can speak by approaching the microphone 170C with his mouth to input the sound signal into the microphone 170C. The first electronic device 100 can be provided with at least one microphone 170C. In other embodiments, the first electronic device 100 can be provided with two microphones 170C, which can not only collect sound signals but also realize noise reduction function. In other embodiments, the first electronic device 100 can also be provided with three, four or more microphones 170C to collect sound signals, reduce noise, identify the sound source, realize directional recording function, etc.

[0123] The earphone interface 170D is used to connect a wired earphone and can be a USB interface 130, or a 3.5 mm open mobile terminal platform (OMTP) standard interface or a cellular telecommunications industry association of the USA (CTIA) standard interface.

[0124] The key 190 includes a power key, a volume key, etc. The key 190 may be a mechanical key or a touch key. The first electronic device 100 may receive key input and generate key signal input related to user settings and function control of the first electronic device 100.

[0125] Motor 191 can generate vibration prompts. Motor 191 can be used for incoming call vibration prompts, and can also be used for touch vibration feedback. For example, touch operations acting on different applications (such as taking pictures, audio playback, etc.) can correspond to different vibration feedback effects. For touch operations acting on different areas of the display screen 194, motor 191 can also correspond to different vibration feedback effects. Different application scenarios (for example: time reminders, receiving messages, alarm clocks, games, etc.) can also correspond to different vibration feedback effects. The touch vibration feedback effect can also support customization.

[0126] Indicator 192 may be an indicator light, which may be used to indicate charging status, power changes, messages, missed calls, notifications, etc.

[0127] The SIM card interface 195 is used to connect a SIM card. The SIM card can be connected to and separated from the first electronic device 100 by inserting it into the SIM card interface 195 or pulling it out from the SIM card interface 195. The first electronic device 100 can support 1 or N SIM card interfaces, where N is a positive integer greater than 1. The SIM card interface 195 can support Nano SIM cards, Micro SIM cards, SIM cards, and the like. Multiple cards can be inserted into the same SIM card interface 195 at the same time. The types of the multiple cards can be the same or different. The SIM card interface 195 can also be compatible with different types of SIM cards. The SIM card interface 195 can also be compatible with external memory cards. The first electronic device 100 interacts with the network through the SIM card to implement functions such as calls and data communications. In some embodiments, the first electronic device 100 uses an eSIM, i.e., an embedded SIM card. The eSIM card can be embedded in the first electronic device 100 and cannot be separated from the first electronic device 100.

[0128] The software system of the first electronic device 100 may 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 invention takes the Android system of the layered architecture as an example to exemplify the software structure of the first electronic device 100.

[0129] Figure 2B It is a software structure block diagram of the first electronic device 100 according to an embodiment of the present invention.

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

[0131] like Figure 2B As shown, the application layer may include a series of application packages, including applications pre-installed before the first electronic device 100 leaves the factory, or applications installed by the user through, for example, an application market or other means after the first electronic device 100 leaves the factory. These applications include, but are not limited to, camera, gallery, calendar, call, map, navigation, WLAN, Bluetooth, music, video, short message, browser, WeChat, Taobao, Alipay and other applications (only some are shown in the figure). Among them, most of these applications require Internet access, such as navigation, browser, WeChat, Taobao, Alipay, etc.

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

[0133] like Figure 2B 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. 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, and the like. The content provider is used to store and obtain data and make the data accessible to the application. The data may include video, images, audio, calls made and received, browsing history and bookmarks, phone books, and the like. The view system includes visual controls, such as controls for displaying text, controls for displaying pictures, and the like. The view system can be used to build applications. The display interface may be composed of one or more views. For example, a display interface including a text message notification icon may include a view for displaying text and a view for displaying pictures. The phone manager is used to provide the communication function of the first electronic device 100. For example, the management of call status (including connecting, hanging up, etc.). The resource manager provides various resources for the application, such as localized strings, icons, pictures, layout files, video files, and the like. The notification manager enables the application to display notification information in the status bar, which can be used to convey notification-type messages and can automatically disappear 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 an icon or scroll bar text, such as a notification of an application 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 prompted in the status bar, a prompt sound is emitted, the first electronic device 100 vibrates, an indicator light flashes, etc.

[0134] In some embodiments of the present application, the application framework layer may further include a first module, which is used to query the number of first messages from the Wi-Fi module once every timing period, and / or query the number of errors in the preset identification position in the second message, and / or query the reception rate of the third message, and / or query the number of fourth messages received, and / or query the number of fifth messages sent, and / or query the working time of the Wi-Fi module, and determine whether to control the Wi-Fi module to power off accordingly. The first message, the second message, and the third message are all non-business messages. Among them, if the Wi-Fi module of the first electronic device 100 frequently receives a certain type of first message within a certain period of time, high power consumption will be generated due to the frequent awakening of the Wi-Fi module. In order to reduce the power consumption of the entire device of the first electronic device 100, the first module can control the Wi-Fi module to power off through the Wi-Fi driver of the kernel layer. Similarly, if the Wi-Fi module of the first electronic device 100 frequently receives a second message with an error in the preset identification position within a certain period of time, high power consumption will also be generated due to the inability of the Wi-Fi module to sleep for a long time after being awakened. The first module can also control the Wi-Fi module to power off through the Wi-Fi driver at the kernel layer.

[0135] The application framework layer also includes a second module and a third module. Among them, the second module is used to detect Wi-Fi disconnection or connection events. Taking the second module detecting a Wi-Fi disconnection event as an example, it sends a broadcast in response to the detected Wi-Fi disconnection event. The third module (which may be a broadcast receiver) can monitor the broadcast from the second module. As a possible implementation method, the third module determines whether the number of Wi-Fi disconnections or connections reaches a third threshold based on the monitored broadcast. After determining that the number of Wi-Fi disconnections or connections reaches the third threshold, it means that Wi-Fi is frequently disconnected and reconnected, resulting in serious power consumption of the Wi-Fi module of the first electronic device. The third module can control the Wi-Fi module to power off through the Wi-Fi driver of the kernel layer.

[0136] In the embodiment of the present application, an established Wi-Fi connection is disconnected and then a Wi-Fi connection is re-established, which may be referred to as a Wi-Fi disconnection and reconnection.

[0137] The first module, the second module, and the third module are used as examples to illustrate some operations of the framework layer. In other embodiments, two or three of the above three modules may be integrated. In the embodiment of the present application, there is no restriction on the specific module settings in the framework layer and the operations performed by each module.

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

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

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

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

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

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

[0144] The 3D graphics processing library is used to implement 3D graphics drawing, image rendering, compositing, and layer processing.

[0145] A 2D graphics engine is a drawing engine for 2D drawings.

[0146] The kernel layer is a layer between hardware and software. The kernel layer includes at least a display driver, a camera driver, an audio driver, and a sensor driver. In an embodiment of the present application, the kernel layer includes a WLAN driver (such as a Wi-Fi driver) and a mobile network driver.

[0147] The second electronic device 200 in the present application is a device that can provide a wireless Internet access function for the first electronic device 100, such as a wireless router, a customer premises equipment (CPE), etc.

[0148] It should be noted that the structure of the second electronic device 200 can also refer to Figure 2A The structure of the first electronic device 100 may include the second electronic device 200. Figure 2A The structures shown may have more or fewer components, or combine some components, or separate some components, or arrange the components differently. The components shown may be implemented in hardware, software, or a combination of software and hardware.

[0149] For example, when the second electronic device 200 is a router, the second electronic device 200 may include a processor, a memory, a wireless communication module, an antenna, a power module, and an Internet access module for connecting to the Internet. The wireless communication module includes a Wi-Fi module. The Wi-Fi module can be used to establish a Wi-Fi connection with the first electronic device 100. In this way, the first electronic device 100 can use the Internet access module of the second electronic device 200 to access the Internet.

[0150] For other content, please refer to Figure 2A The description of the relevant structure in the first electronic device 100 is not repeated here.

[0151] The technical solutions involved in the following embodiments can all be implemented in the first electronic device 100 having the above hardware architecture and software architecture.

[0152] The following takes the first electronic device as an example Figure 1 The first electronic device 100 and the second electronic device are Figure 1 Taking the second electronic device 200 as an example, the technical solution provided in the embodiment of the present application is described in detail in conjunction with the accompanying drawings.

[0153] In some embodiments, the first electronic device may be defaulted to always turn on the first function. The first function is a function of reducing the power consumption of the first electronic device. The first electronic device may be defaulted to always use the method provided in the embodiment of the present application to reduce the power consumption of the first electronic device. For example, when a mobile phone is connected to a router in a place such as an airport via Wi-Fi and the user does not carry a charger, the user may need to always turn on the function of reducing power consumption.

[0154] Alternatively, the first electronic device adopts the method provided by the embodiment of the present application in the first preset scenario to reduce the power consumption of the first electronic device. The first preset scenario may include but is not limited to the following single scenario or a combination of multiple scenarios: the power of the first electronic device is less than the preset value (for example, the power is less than 20%), the number of applications opened by the first electronic device is greater than the preset number (for example, 5), the first electronic device opens a preset application (for example, a specific application is a high-power consumption application, such as an instant messaging application), the current time is within the first preset time period (for example, 0 o'clock to 6 o'clock), the first electronic device turns off the screen for more than a preset time (for example, 20 minutes), the first electronic device maintains a network connection when set to sleep, the first electronic device does not detect an ongoing business, no ongoing business is detected within the preset time period, and the ambient light brightness is less than or equal to the preset brightness.

[0155] The first preset time period may be a time period during which there is little or no interaction between the user and the first electronic device, such as a time period during which the user sets the first electronic device to enter a sleep mode, or other time periods.

[0156] The first electronic device does not detect that there is any service in progress, for example, but not limited to, it does not detect that a video application, voice application, navigation application, or music player application is running.

[0157] For maintaining network connection during sleep, the first electronic device may be provided with a switch, and when the switch is turned on, it indicates that the first electronic device is set to always maintain network connection. Figure 3A As shown in (1), in response to the user clicking the setting icon 301, the first electronic device displays Figure 3A The setting interface shown in (2) includes a battery setting control 302. In response to the user selecting (such as clicking) the setting control 302, the first electronic device displays Figure 3A The battery setting interface shown in (3) includes a switch 303. When the switch is turned on, the first electronic device always maintains a network connection when it is in sleep mode. For example, the first electronic device can also remain connected to the network when the screen is off, and the application of the first electronic device can obtain online data. When the switch is turned off, the first electronic device is disconnected from the network when it is in sleep mode. For example, the first electronic device is disconnected from the network after detecting that the screen is off for a period of time. In this case, some application connections may be disconnected. In some examples, when the screen of the first electronic device is on, the user can manually refresh the function in the application to obtain network data sent by the network side during the network disconnection period.

[0158] It can be understood that the switch 303 can be turned on manually by the user, or can be turned on by default by the first electronic device.

[0159] Alternatively, in some other examples, a switch may be provided in the first electronic device, and the user may manually turn on or off the function of reducing the power consumption of the first electronic device provided in the embodiment of the present application through the switch. Figure 3B As shown in (1) and (2) of 3B, a switch control 304 may be provided in the setting page of the "settings" application, for the user to manually turn on or off the function of reducing the power consumption of the first electronic device. Figure 3C As shown in (1), in response to a user's operation on the setting application 301, such as a click operation, the first electronic device displays Figure 3C In response to a user's operation such as clicking on the WLAN switch in the setting interface, the first electronic device displays a Figure 3CThe WLAN setting interface shown in (3) includes a switch 305, which can be used to turn on or off the power consumption reduction function of the embodiment of the present application.

[0160] Of course, you can also Figure 3A The battery setting interface setting switch 308 shown in (3) is used to turn on or off the power consumption reduction function of the embodiment of the present application. The embodiment of the present application does not limit which interface the switch is set on, and the specific display content of the setting interface.

[0161] like Figure 4 FIG. 1 is a flow chart of a method for reducing power consumption of a first electronic device provided in an embodiment of the present application, which is specifically as follows:

[0162] S401: A first electronic device establishes a Wi-Fi connection with a second electronic device through a Wi-Fi module, and interacts with the second electronic device through the Wi-Fi connection.

[0163] In some embodiments, when the first electronic device automatically turns on the function of reducing power consumption or the user manually turns on the function of reducing power consumption, the first electronic device can automatically turn on or prompt the user to turn on the Wi-Fi function and mobile network function of the first electronic device, and establish a Wi-Fi connection with the second electronic device.

[0164] In some embodiments, when the first electronic device turns on the Wi-Fi function, the user may be asked whether to turn on the power consumption reduction function. If the user chooses to turn on the power consumption reduction function, the mobile network function of the first electronic device may be automatically turned on or prompted to be turned on. Of course, the mobile network function may not be turned on temporarily. In some examples, when the Wi-Fi function is turned on, the Wi-Fi icon may be displayed in the status bar of the first electronic device, such as Figure 3C When the mobile network function is turned on, the first electronic device displays the mobile network icon in the status bar, such as Figure 3C The mobile network icon 307 shown in (3) .

[0165] In some other embodiments, when the first electronic device turns on the Wi-Fi function and the mobile network function at the same time, it can also automatically turn on the power consumption reduction function, or ask the user whether to turn on the power consumption reduction function.

[0166] If the first electronic device is establishing a Wi-Fi connection with the second electronic device for the first time, the user needs to select the Wi-Fi name corresponding to the second electronic device, enter the password, etc., or scan a QR code or other methods to establish a Wi-Fi connection between the first electronic device and the second electronic device. If the first electronic device is not establishing a Wi-Fi connection with the second electronic device for the first time, and the first electronic device has saved information such as the Wi-Fi name and password corresponding to the second electronic device, the first electronic device can automatically establish a Wi-Fi connection with the second electronic device.

[0167] Optionally, the first electronic device can establish a mobile network connection while establishing a Wi-Fi connection. In this way, the first electronic device has both a Wi-Fi connection and a mobile network connection (such as a 4G network connection) so that it can quickly switch to the mobile network when the Wi-Fi signal is poor or the Wi-Fi fails.

[0168] It should be noted that, in some examples, after a Wi-Fi connection is established between the first electronic device and the second electronic device, the first electronic device may preferentially use the Wi-Fi connection to access the Internet. During this process, the mobile network connection may be automatically disconnected because no message has been transmitted for a period of time. In this case, the mobile network module of the first electronic device may be in a dormant state. In other examples, when the first electronic device transmits messages via the Wi-Fi connection, the first electronic device may also maintain a mobile network connection.

[0169] S402: If the first electronic device determines that the first condition is met, it performs power saving processing on the Wi-Fi module.

[0170] The first condition includes any one or more of the following:

[0171] Item 1: detecting that the number of first messages received from the second electronic device reaches a first threshold within a first time period;

[0172] Item 2: The first electronic device detects within a second time period that the number of preset identification bit errors in the second message received from the second electronic device reaches a second threshold;

[0173] Item 3: The first electronic device detects that the number of Wi-Fi connection disconnections or the number of Wi-Fi connection establishments within a third time period reaches a third threshold;

[0174] Item 4: During a fourth time period, a sending period of a third message received from the second electronic device through the Wi-Fi connection is inaccurate.

[0175] Item 5: In a fifth time period, the working duration of the Wi-Fi module is greater than or equal to a preset duration threshold, and the number of fourth messages received by the first electronic device from the second electronic device through the Wi-Fi connection is less than or equal to a first preset number threshold;

[0176] Item 6: Within a sixth time period, the operating duration of the Wi-Fi module is greater than or equal to a preset duration threshold, and the number of fifth messages sent by the first electronic device to the second electronic device through the Wi-Fi connection is less than or equal to a second preset number threshold.

[0177] Among them, the first message, the second message, and the third message are all non-business messages. The first message is a message used by the first electronic device to detect Wi-Fi anomalies based on the number of its messages. That is, the first electronic device detects Wi-Fi anomalies based on the abnormal number of first messages received from the Wi-Fi connection. The second message is a message used by the first electronic device to detect Wi-Fi anomalies based on the abnormal position of a preset identification bit. That is, the first electronic device detects Wi-Fi anomalies based on the abnormal setting of the preset identification bit of the second message.

[0178] The abnormal quantity refers to the quantity exceeding the first threshold. For example, the quantity may be greater than or equal to the first threshold. The following will explain what the abnormal quantity means in conjunction with a specific solution.

[0179] Non-service messages are relative to service messages. Service messages refer to user data messages, and non-service messages are messages other than user data messages. Exemplarily, non-service messages may refer to some control messages, such as messages used to measure network connectivity. The specific types of the first non-service message and the second non-service message will be given in the following embodiments.

[0180] It should be noted that the first electronic device performs power saving processing on the Wi-Fi module, which can be understood as controlling the Wi-Fi module to power off, or can be understood as disconnecting the Wi-Fi connection and controlling the Wi-Fi module (for example Figure 1The wireless communication module 160 shown in the figure includes a Wi-Fi chip) that enters a dormant state. It can also be understood that the Wi-Fi module is in a low-power working mode. In the low-power working mode, most of the functions of the Wi-Fi module will suspend work to reduce the power consumption of the entire Wi-Fi module. For example, the Wi-Fi module enters a dormant state including the Wi-Fi module being in sleep mode and deep sleep mode. Among them, the sleep mode refers to that the system operating clock of the mobile first electronic device remains unchanged, the WiFi module can be awakened by a serial port or a network data packet, and the GPIO (General Purpose Input Output) port maintains output. Deep sleep mode means that the system operating clock of the mobile first electronic device is reduced to half, and can be awakened by a serial port or a network data packet, the GPIO port maintains output, and the wake-up response time is slightly longer than the Sleep mode.

[0181] In some scenarios, when the second electronic device frequently sends first messages unrelated to the service to the first electronic device through a Wi-Fi connection, it will frequently wake up the Wi-Fi module of the first electronic device, increase the power consumption of the Wi-Fi module, and thereby increase the power consumption of the first electronic device.

[0182] Optionally, the first message includes but is not limited to one or more of the following: a unicast message, a multicast message, a rekey message, a renew message, and a router advertisement (RA) message.

[0183] Among them, unicast messages are messages transmitted between senders and receivers in unicast communication. Unicast communication refers to point-to-point communication between two entities, where both the sender and the receiver are uniquely determined. The sender and the receiver are configured with unicast addresses. For example, in an IPv4 network, IP addresses from 0.0.0.0 to 223.255.255.255 are unicast addresses.

[0184] Because a certain configuration or design of the second electronic device (such as a router) is not standardized, it may frequently send unicast messages such as Internet Control Message Protocol (ICMP) messages to the first electronic device, that is, frequently ping the first electronic device. The ICMP message can be used to indicate one or more of whether the network is connected, whether the host is reachable, and whether the route is available. In this way, the second electronic device frequently pings the first electronic device, causing the Wi-Fi module of the first electronic device to be frequently awakened, resulting in high power consumption. For example, for a 4000mA mobile phone, frequent ping messages will result in approximately 30% power consumption in 6 hours at night.

[0185] Multicast message: refers to the message transmitted between the sender and the receiver in multicast communication. Multicast communication refers to the efficient sending of data to multiple receivers at the same time by using multicast addresses. Multicast messages include but are not limited to aggregated media access control service data unit (aggregated mac service data unit, AMSDU) and aggregated media access control protocol data unit (aggregated mac protocol data unit, AMPDU).

[0186] Similar to the frequent sending of unicast messages, the frequent sending of service-irrelevant multicast messages by the second electronic device will also frequently wake up the Wi-Fi module of the first electronic device, resulting in high power consumption of the first electronic device in standby mode.

[0187] Rekey message: usually used to specify broadcast multicast key updates. Generally, the second electronic device sends rekey messages at specified time intervals to update the broadcast multicast keys. Among them, the update time interval can be configured by the second electronic device. When the second electronic device is not designed in a standardized manner or configured unreasonably, the update time interval may be set very short, resulting in the second electronic device frequently sending rekey messages. Accordingly, the first electronic device is also frequently awakened.

[0188] Renew message: Usually used by the first electronic device to update the IP address assigned by the dynamic host configuration protocol (DHCP). Like the rekey frame, the second electronic device will set an update period for the IP address. When the update period is set very short, the second electronic device will frequently send a renew message to wake up the first electronic device.

[0189] It should be noted that when the first message is a unicast message, or a multicast message, or a rekey message, or a renew message, the number of first messages received by the first electronic device within the first time period reaches a first threshold, which means that the number of first messages is greater than or equal to the first threshold.

[0190] With respect to the above scenario, considering that the second electronic device frequently sends first messages that are not related to business to the first electronic device, which may cause high power consumption of the first electronic device, in an embodiment of the present application, when the first electronic device detects that the number of first messages reaches a first threshold within a first time period, that is, the second electronic device frequently sends non-business first messages to the first electronic device, the first electronic device controls the Wi-Fi module to power off to avoid high power consumption of the Wi-Fi module.

[0191] Among them, the first threshold can be set flexibly. For example, according to big data statistics or experimental tests, the number of first messages received by the Wi-Fi module in the first time period is obtained to what value, and the power consumption of the Wi-Fi module has a greater impact on the battery life of the first electronic device, then this value is set as the first threshold. Moreover, since different first messages may have different degrees of influence on the power consumption of the Wi-Fi module, the first thresholds of different first messages may be the same or different. For example, the first threshold of the rekey message and the first threshold of the renew message may be the same or different.

[0192] Exemplarily, take setting a first threshold corresponding to a certain type of unicast message (such as an ICMP message) as an example. You can experimentally simulate a scenario in which a router sends ICMP messages to a first electronic device at different frequencies, and measure the power consumption of the first electronic device when the mobile network is turned on, or measure the power consumption of the first electronic device when the WiFi network is turned on. Table 1 is an exemplary measurement result. It can be seen that when the frequency of the router sending ICMP messages is greater than or equal to 1 times / second, the power consumption of using Wi-Fi to surf the Internet is greater than the power consumption of using a mobile network to surf the Internet. Therefore, power consumption can be reduced by turning off Wi-Fi.

[0193] Table 1

[0194]

[0195] It can be understood that when the frequency of sending ICMP per second is obtained, the frequency of sending ICMP in the first time period can be obtained. For example, if an ICMP message is sent once per second, the Wi-Fi power consumption is large, and when ICMP is sent 10 times in 10 seconds, the Wi-Fi power consumption is large. By analogy, the first threshold corresponding to the ICMP message in the above first time period can be obtained.

[0196] It should be noted that, within the first time period, the first electronic device may detect that the number of a first message reaches a first threshold. This means that the second electronic device has a problem with the setting of the first message, which may cause high power consumption of the first electronic device. The first electronic device may also detect that the number of multiple first messages reaches their respective first thresholds. This means that the second electronic device has a problem with the setting of multiple first messages.

[0197] For example, in the first time period, it is detected that only the number of received rekey messages is greater than the first threshold corresponding to the rekey messages. For another example, in the first time period, it is detected that the number of received rekey messages is greater than the first threshold corresponding to the rekey messages, and the number of received renew messages is greater than the first threshold corresponding to the renew messages.

[0198] The first time period can be set flexibly. The first time period is set to be short, which helps the first electronic device to query the status of the Wi-Fi connection in time, that is, to find the setting problem of the second electronic device in time, so as to control the power off of the Wi-Fi module in time. The first time period is set to be long, which helps to reduce the workload of the first electronic device and is easy to implement.

[0199] The following describes an implementation method for the first electronic device to determine the number of first messages received within the first time period:

[0200] Mode 1, the number of first messages received by the first electronic device in the first time period reaches the first threshold, which means that the number of first messages received by the first electronic device in a preset number of consecutive (for example, 5 consecutive) sub-time periods in the first time period reaches a certain threshold. Figure 5A (1), after receiving the message, the Wi-Fi module of the first electronic device parses the message to distinguish different message types. Optionally, the Wi-Fi module can mark different types of messages differently. And, the number of first messages received in each type of message is counted. The framework layer sets a timer with a timing period of T. The first module of the framework layer queries the Wi-Fi module once every timing period T to query the number of first messages received within the timing period T. If the result of a certain query is that the number of first messages reaches a preset threshold, the number of first messages is called abnormal, and an abnormality is recorded, that is, the number of abnormalities is increased by one, and it is determined whether the total number of abnormalities reaches the preset number. If the total number of abnormalities of a certain type of first message reaches the preset number, the first flag of the first message of this type is set to indicate that the number of first messages of this type received in consecutive preset (for example, 5) subdivided time periods of the first time period reaches the threshold value x. That is, the first time period includes multiple first cycle time periods, and the duration of each first cycle time period is the timing period T. When the number of first messages detected in a preset number of consecutive (for example, 5 consecutive) first cycle time periods reaches (is greater than or equal to) the preset threshold, 5 abnormalities are recorded, and it is determined that the number of first messages detected in the entire first time period reaches the first threshold. Accordingly, the first flag is set.

[0201] On the contrary, when the total number of abnormalities of a certain type of first message does not reach the preset number, the number of first messages will continue to be queried when the timing cycle arrives. When the result of a certain query is that the number of first messages does not reach the threshold x, the number of abnormalities is reset to zero, and the timing cycle is waited for to arrive again to query the number of first messages.

[0202] Here, setting the first flag may refer to setting the first flag to a preset value, such as 1. Of course, the preset value is not limited to 1.

[0203] In the embodiment of the present application, the timing period can be flexibly set, for example, to 5 minutes.

[0204] For example, see Figure 5A (2) shows the method flow of the framework layer querying the number of several first messages through the Wi-Fi module. The specific implementation can be found in Figure 5A The process shown in (1). Figure 5A In (2), when the first flag corresponding to a certain type of first message (such as a rekey message) is set, it is deemed that the first electronic device detects that the number of first messages of this type received within the first time period reaches a first threshold.

[0205] For example, Figure 5B As shown in (1), the first module of the framework layer queries the number of first messages every time period T. For example, Figure 5B As shown in (2), the threshold is 2, the preset number is 5, and when the first module arrives at the first T, it is found that the number of first messages received in the first T is 4, which exceeds the threshold 2, indicating that the second electronic device frequently sends the first message within the timing period T, then the first module increases the number of exceptions by one, and the number of exceptions is 1 at this time. When the second T arrives, the total number of first messages is 6, minus the number of first messages in the previous T, which is 4, and the number of first messages received in the second timing period T is 2. By analogy, the first module then queries the Wi-Fi module for the number of first messages every T, and after each query, the number of exceptions is increased by one. When the first module determines that the number of exceptions of a certain type of first message reaches the preset 5 times, it is determined that the second electronic device frequently sends the first message of this type that is irrelevant to the business during the entire first time period, and it can control the Wi-Fi module to power off through the Wi-Fi driver of the kernel layer to reduce the impact of the power consumption of the Wi-Fi module on the battery life of the first electronic device.

[0206] For example, Figure 5B As shown in (3), the first module queries the number of the first message for the third time, and the query result of the number of the first message is 1, then the number of exceptions is cleared. When the next timing cycle arrives, the number of exceptions will be recalculated.

[0207] Method 2: The first module of the framework layer queries the number of first messages received from the Wi-Fi module every first time period. As long as it is determined that the number of first messages received in the first time period is greater than or equal to the first threshold, the first module of the framework layer can control the Wi-Fi module to power off through the Wi-Fi driver of the kernel layer. For example, the first time period is 25 minutes, the first message is an ICMP message, and the first threshold is 100. Then, when the first electronic device is set to receive 100 ICMP messages within 25 minutes, it can control the Wi-Fi module to power off. Among them, there is no limit on the number of first messages received in a subdivided time period within 30 minutes. For example, in the first 20 minutes, the first electronic device only receives 10 first messages, and in the next 5 minutes, the first electronic device receives 90 first messages. It can also be that 4 first messages are received per minute within 25 minutes. Figure 5A , Figure 5B Different from the implementation shown in the figure, in this implementation, it is not required that each sub-period (such as Figure 5B The number of first messages in each T) reaches a certain threshold.

[0208] In some other scenarios, the first electronic device detects that the number of first messages does not reach the first threshold value within the first time period. That is, within the first time period, the second electronic device does not frequently send service-irrelevant messages to the first electronic device. However, there is still a situation where the Wi-Fi module of the first electronic device is woken up by mistake.

[0209] For example, before the second electronic device sends data (i.e., a business message) to the first electronic device, it first sends a second message to the first electronic device to inform the first electronic device that the second electronic device will have data to send to the first electronic device, so that the first electronic device can make corresponding reception preparations. As a possible implementation method, the second message includes a preset identification bit, and the preset identification bit is used to indicate whether there is data (i.e., a business message) to be sent by the second electronic device to the first electronic device. The correctly set preset identification bit is used to indicate that there is data to be sent by the second electronic device to the first electronic device. Normally, after the first electronic device receives the second message from the second electronic device, if it is found that the preset identification bit is set, it means that the second electronic device will send data to the first electronic device, then the first electronic device wakes up Wi-Fi to wait for receiving data from the second electronic device.

[0210] However, in some cases, the preset identification bit may be incorrectly set. For example, when the second electronic device sends the second message (non-business message), the preset identification bit in the second message is incorrectly set by the second electronic device. Then, after receiving the second message, the Wi-Fi module of the first electronic device parses the second message, obtains the preset identification bit in the second message, and finds that the preset identification bit is set. The first electronic device mistakenly believes that the second electronic device will send data to itself, then the Wi-Fi module of the first electronic device will continue to work for a period of time to wait for the data from the second electronic device to arrive. But in fact, the preset identification bit is incorrectly set by the second electronic device, that is, the second electronic device does not need to send data to the first electronic device. In this way, after responding to the incorrectly set preset identification bit, the Wi-Fi module of the first electronic device has been in a working state, waiting for data to arrive, and cannot sleep, resulting in higher power consumption.

[0211] Wherein, the second message is a message for detecting Wi-Fi anomalies according to the setting of the preset identification bit of the message. The second message is, for example, but not limited to, a Beacon message. The preset identification bit is, for example, but not limited to, a traffic indication map (TIM). Usually, when the second electronic device has data to send to the first electronic device, the TIM bit corresponding to the first electronic device is set in the Beacon message (that is, the TIM bit is set to a preset value). For example, the TIM bit is set to any value in the value 1-5. After the first electronic device receives the Beacon message and learns that the TIM corresponding to itself in the Beacon message is set, it believes that the second electronic device has data to send to itself, and will control the Wi-Fi module to be in a working state (that is, in an awake state) and wait for data, resulting in a longer working time of the Wi-Fi module. The Wi-Fi module waits for a certain time according to a preset sleep strategy. For example, the preset sleep strategy is that after the first electronic device wakes up the Wi-Fi module, the Wi-Fi module maintains a working state for 200ms and then enters sleep, resulting in a high power consumption of the Wi-Fi module.

[0212] In addition, the TIM bit of many types of second electronic devices may be set incorrectly, and the TIM bit may be set even if there is no data to be sent (for example, the TIM bit is set to 1), causing the Wi-Fi module to wait for a long time for data that will not actually arrive after being awakened, and the Wi-Fi module cannot sleep or can only sleep for a short time, resulting in high power consumption.

[0213] Taking into account that the incorrect setting of the preset identification bit of the second message may cause high power consumption of the Wi-Fi module, in an embodiment of the present application, when the first electronic device detects that the preset identification bit of the second message (such as the TIM of the Beacon message) is incorrect, the first electronic device controls the Wi-Fi module to power off.

[0214] As a possible implementation, the first electronic device determines that the preset identification position of the second message is wrong, which can be specifically implemented as follows: the Wi-Fi module of the first electronic device receives the second message, and after parsing to obtain the preset identification position, it finds that the preset identification position is in place, then it believes that the second electronic device has a business message to send to itself. The first electronic device sends an empty (null) frame (a data frame) to the second electronic device to request the second electronic device to send data to itself. In addition, the first electronic device waits for data from the second electronic device to arrive. However, within a period of time (i.e., the seventh time period), the Wi-Fi module does not receive data (i.e., business message) from the second electronic device, then the Wi-Fi module determines that the preset identification position is incorrectly set, and the second electronic device does not send data to the first electronic device. That is, within a period of time since the second message is received, the first electronic device does not detect the business message received from the second electronic device through the Wi-Fi connection, then the first electronic device determines that the preset identification position of the second message is wrong.

[0215] Optionally, the Wi-Fi module may record the situation where the preset flag bit is incorrectly set, so that the subsequent framework layer can query the number of preset flag bit errors from the Wi-Fi module.

[0216] Optionally, if the number of times the first electronic device detects that the preset identification position of the second message is wrong reaches a certain threshold (such as threshold r) within a preset number of consecutive third periodic time periods, it is determined that the number of times the preset identification position of the second message received from the second electronic device via the Wi-Fi connection is wrong within the second time period reaches the second threshold. The first electronic device can set a timing period (i.e., the duration of the third periodic time period) to detect the number of preset identification position errors every timing period. Figure 5A As shown in (3), whenever the timing period T6 arrives, the first module of the framework layer queries the number of TIM setting errors from the Wi-Fi module. When the number of TIM setting errors reaches the threshold value 6, the number of exceptions increases by one, otherwise, if the number of TIM setting errors does not reach the threshold value 6, the number of exceptions is cleared. If the number of exceptions reaches a preset number of times, such as 6 times, it means that the number of TIM setting errors in each timing period T within 6 consecutive timing periods T (i.e., within the second time period) has reached the threshold value 6. Then, the first module sets the first flag corresponding to the TIM setting error to indicate that the first electronic device detects that the number of TIM setting errors within the second time period has reached the second threshold.

[0217] For example, see Figure 5CThe number of times that the TIM is incorrectly set within the time T is greater than or equal to the threshold is called an abnormality. When a preset number of consecutive abnormalities (for example, 5 times) is detected, it indicates that the Wi-Fi is abnormal, and the first flag corresponding to the TIM error setting is set to indicate that the first electronic device detects that the number of times the TIM is incorrectly set within the second time period is large (reaching the second threshold).

[0218] It should be noted that, in the embodiment of the present application, every two sub-time periods in the first cycle time period, the second cycle time period, and the third cycle time period may be the same or different.

[0219] In other scenarios, when the second electronic device disconnects the Wi-Fi connection with the first electronic device, the Wi-Fi module of the first electronic device will try to reestablish the Wi-Fi connection with the second electronic device. Considering that when the second electronic device has certain settings, such as a blacklist mechanism, the first electronic device connected to Wi-Fi may be frequently kicked off. Each time the Wi-Fi connection is disconnected, the Wi-Fi module of the first electronic device immediately tries to reconnect to the second electronic device. Such repeated disconnection of the Wi-Fi connection and connection of the Wi-Fi connection causes the first electronic device to be unable to sleep or the sleep time is very short, causing the first electronic device to consume a lot of power. In addition, when the Wi-Fi is disconnected, the mobile network module (such as a modem module) usually sends network status information to the second electronic device, so that the second electronic device is aware of the Wi-Fi disconnection status. The modem module consumes a lot of power, such as 20%.

[0220] Considering that a large number of Wi-Fi disconnections causes high power consumption in the first electronic device, in some other embodiments of the present application, the first electronic device may detect the number of Wi-Fi disconnections and / or the number of Wi-Fi connections in the third time period, that is, the first electronic device may only detect the number of Wi-Fi disconnections, or only detect the number of Wi-Fi connections, or detect the number of Wi-Fi disconnections and the number of Wi-Fi connections. When the first electronic device detects that the number of Wi-Fi disconnections or connections reaches the third threshold in the third time period, it means that the Wi-Fi module is likely to be frequently awakened. Then, in order to avoid the high power consumption of the Wi-Fi module reducing the overall battery life of the first electronic device, the first electronic device controls the Wi-Fi module to power off.

[0221] Usually, when the network status changes, such as when Wi-Fi is disconnected or connected, the Android system will generate a broadcast. Based on this mechanism, as a possible implementation method, the first electronic device can judge the number of Wi-Fi disconnections and / or connections by monitoring the broadcast generated by the system for Wi-Fi disconnection or connection. Specifically, the framework layer is provided with a second module and a third module, and the second module is used to detect a Wi-Fi disconnection event and generate a broadcast for the Wi-Fi disconnection event. It is also used to detect Wi-Fi connection events and generate broadcasts for Wi-Fi connection events. The third module is used to monitor broadcasts generated for Wi-Fi disconnection and / or connection, and calculate the number of Wi-Fi disconnections and / or connections. When it is determined that the number of Wi-Fi disconnections and / or connections within the third time period reaches a third threshold, the third module can control the Wi-Fi module to power off through the Wi-Fi driver of the kernel layer.

[0222] As a possible implementation, determining whether the number of Wi-Fi disconnections and / or connections within the third time period reaches the third threshold may be implemented as follows: the third module calculates the number of Wi-Fi disconnections and / or connections once every timing period. Figure 5A As shown in (5), when Wi-Fi is disconnected or connected, the second module of the framework layer can detect the event of Wi-Fi disconnection or connection and send a broadcast. Correspondingly, the third module of the framework layer can monitor the broadcast of the second module. Every timing period, the third module can calculate the number of Wi-Fi disconnections or connections based on the number of broadcasts received within the timing period. That is, if the first electronic device detects that the number of Wi-Fi connection disconnections reaches a certain threshold (such as threshold y) within a continuous preset number of second cycle time periods (timing period), or if the first electronic device detects that the number of Wi-Fi connection establishments reaches a certain threshold (such as threshold z) within a continuous preset number of second cycle time periods, it is determined that the number of Wi-Fi connection disconnections or the number of Wi-Fi connection establishments detected within the third time period reaches the third threshold.

[0223] For example, see Figure 5D, taking the first electronic device only calculating the number of Wi-Fi disconnections, the timing period is 5 minutes, and the threshold of the number of Wi-Fi disconnections within 5 minutes is 8 times as an example, the third module calculates the number of Wi-Fi disconnections every 5 minutes. When the calculated number of broadcasts triggered by the Wi-Fi connection event received within 5 minutes is 10, it means that the Wi-Fi has been disconnected 10 times (greater than the threshold) within the 5 minutes, and the number of abnormalities is increased by one; conversely, when the calculated number of broadcasts triggered by the Wi-Fi connection event received within 5 minutes is 6, it means that the Wi-Fi has been disconnected 6 times (less than the threshold) within the 5 minutes, and the number of abnormalities is cleared. When the accumulated number of abnormalities reaches the preset number (for example, 5 times), it means that the number of Wi-Fi disconnections within 5 consecutive 5 minutes (i.e., within the third time period) exceeds a certain threshold, then the third module sets the first flag corresponding to the Wi-Fi disconnection.

[0224] As another possible implementation, determining whether the number of Wi-Fi disconnections and / or connections within a third time period reaches a third threshold can be implemented as follows: when a broadcast of a Wi-Fi disconnection or connection is received, the third module (such as a broadcast receiver at the framework layer) calculates the time difference (or time interval interval) between two adjacent disconnections or connections, and accumulates a preset number of time differences. By determining whether the sum (totalinterval) of a continuous preset number (such as 5) of time differences is less than or equal to a time threshold such as 5 minutes, it is determined whether the number of Wi-Fi disconnections and / or connections within the third time period reaches the third threshold (i.e., Wi-Fi disconnection abnormality within the third time period). If the sum of a preset number (such as 5) of time differences is less than or equal to a time threshold such as 5 minutes, it means that there are at least 5 disconnections within 5 minutes. This situation is regarded as a Wi-Fi disconnection abnormality within the third time period (i.e., 5 minutes). As a possible implementation, the first electronic device maintains an array, which stores the time differences of the most recent preset number of times, such as 5 times. For example, see Figure 5E In (1), after receiving the Wi-Fi disconnection broadcast, the third module calculates the time interval (also called the time difference) between the current Wi-Fi disconnection and the previous Wi-Fi disconnection, and accumulates 5 consecutive time intervals. When the sum of time interval 1-time interval 5, that is, the total time interval is less than or equal to 5 minutes, it means that at least 5 abnormal Wi-Fi disconnections occurred within 5 minutes. Then the third module can determine that the Wi-Fi disconnection is abnormal within 5 minutes (that is, the third time period). For another example, see Figure 5EIn (2), after receiving the Wi-Fi connection broadcast, the third module calculates the time interval between the current Wi-Fi connection and the previous Wi-Fi connection, and accumulates 5 consecutive time intervals. When the cumulative sum of time interval 1-time interval 5, that is, the total time interval is less than or equal to 5 minutes, it means that at least 5 abnormal Wi-Fi disconnections have occurred within 5 minutes. The third module can determine that the abnormal Wi-Fi disconnection occurred within 5 minutes (that is, the third time period).

[0225] In some other embodiments, the first condition may also be that the transmission period of the third message received from the second electronic device through the Wi-Fi connection is inaccurate. The third message is a message used to detect Wi-Fi anomalies according to the transmission period of its message. The third message may be, for example, but not limited to, a Beacon message in a non-business message.

[0226] Beacon message: that is, a beacon message. The Beacon message sent by the second electronic device is mainly used to announce the existence of the second electronic device network and wake up the first electronic device. Specifically, the second electronic device periodically broadcasts Beacon messages (for example, in the case of association, the AP can send a Beacon message every 100ms) so that the first electronic device can be informed of the existence of the network where the second electronic device is located, so that the first electronic device can adjust the parameters necessary to join the network. In addition, the Beacon message carries a TIM bit, and the TIM bit notifies the first electronic device whether it has data to send to the first electronic device.

[0227] Usually, the first electronic device detects Beacon messages by scanning, specifically, detecting Beacon messages at several set moments. When the second electronic device is not designed in a standardized manner, it is difficult to align the timestamps between the first electronic device and the second electronic device, resulting in the misalignment of the sending period of the second electronic device sending the third message and the receiving period of the first electronic device receiving the third message. Figure 7 As shown in the interaction sequence diagram in the upper part, when the timestamps between the first electronic device and the second electronic device are aligned, the second electronic device sends a Beacon message at a certain sending timing, and the first electronic device receives the Beacon message at the corresponding receiving timing. Usually, the first electronic device can successfully receive the Beacon message. Figure 7As shown in the interaction timing diagram in the lower part, when the timestamps between the first electronic device and the second electronic device are not aligned, the second electronic device sends a Beacon message at a certain sending time. Since the receiving time of the first electronic device is separated from the sending time of the second electronic device by a time interval t', the first electronic device is usually unable to or has difficulty in successfully receiving the Beacon message. It can be seen that when the sending period of the Beacon message sent by the second electronic device is inaccurate, it cannot be aligned with the timestamp of the first electronic device, resulting in the first electronic device being unable to receive the Beacon message at several set times, or only being able to receive the Beacon message at certain times, and there are still many Beacon messages that cannot be received. For example Figure 7 As shown in the interaction sequence diagram in the lower part, the second electronic device sends three Beacon messages, and the first electronic device only receives two of the Beacon messages at corresponding reception times.

[0228] In this way, when the Beacon message sending cycle is inaccurate, once the Wi-Fi module of the first electronic device wakes up, it will remain awake and wait because it cannot receive the Beacon message in time, until it receives the Beacon message and the TIM is not set (for example, TIM is 0), then it will go into sleep. It can be seen that due to the non-standard design of the second electronic device and the inaccurate sending cycle of the Beacon message, the Wi-Fi module of the first electronic device will not be powered off for a long time, and the power consumption will be large.

[0229] In the embodiment of the present application, the first electronic device can determine whether the Wi-Fi of the second electronic device is abnormal by detecting whether the sending period of the third message such as the Beacon message is accurate.

[0230] As a possible implementation method, the first electronic device determines that the sending period of the third message is inaccurate, including: if within a fourth time period, the reception rate of the third message received from the second electronic device is less than or equal to a reception threshold, then the first electronic device determines that the sending period of the third message is inaccurate.

[0231] The fourth time period includes multiple fourth period time periods; the first electronic device detects that the sending period of the third message received from the second electronic device through the Wi-Fi connection is inaccurate within the fourth time period, including:

[0232] If the first electronic device detects that the reception rate of the third message reaches the message threshold within a continuous preset number of fourth cycle time periods, it is determined that the sending period of the third message received from the second electronic device via the Wi-Fi connection within the fourth time period is inaccurate.

[0233] The ratio of the number of Beacon messages actually received to the number of Beacon messages that should be received can be defined, that is, the number of Beacon messages actually received divided by the number of Beacon messages that should be received, which is recorded as the Beacon reception rate.

[0234] The first electronic device detects that the reception rate of Beacon messages is less than or equal to a certain threshold, which means that the first electronic device only receives a small portion of Beacon messages. This also means that after the Wi-Fi module is awakened, it is likely that the Beacon message will not be received in time, causing the Wi-Fi module to be awake and waiting for the Beacon message to arrive. Therefore, the Wi-Fi module works for a long time and power consumption increases. Exemplarily, the threshold corresponding to the Beacon reception rate can be 60%. In an embodiment of the present application, when the first electronic device detects that the Beacon reception rate reaches 60%, the Wi-Fi module can be subjected to power saving processing.

[0235] Take the third message as a Beacon message as an example. Figure 5A (4) in the figure shows the process of the first electronic device detecting whether the sending period of the Beacon message is accurate. The Wi-Fi module counts the reception rate of the Beacon message. The framework layer sets a timer with a timing period of T1. The first module of the framework layer queries the Wi-Fi module for the reception rate of Beacon in the T1 period every timing period T1 (or queries the number of Beacon messages actually received, and calculates the reception rate based on the actual number of receptions and the number to be received). If the query result in a certain T1 period is that the reception rate of the Beacon message reaches the threshold value 1, the sending period of the Beacon message in the T1 period is called abnormal, and an abnormality is recorded once, that is, the number of abnormalities is increased by one, and it is judged whether the total number of abnormalities reaches the preset number. If the query result in a certain T1 period is that the reception rate of the Beacon message does not reach the threshold value 1, the number of abnormalities is cleared to 0, and waits for the next timing period T1 to arrive, queries the Wi-Fi module for the reception rate of the Beacon message, and judges the relationship between the reception rate of the Beacon message and the threshold value 1.

[0236] Next, if Figure 5A As shown in (4), when the query result in a certain T1 time period is that the reception rate of the Beacon message reaches a threshold value of 1 (the number of abnormalities plus one), if the total number of abnormalities reaches a preset number, the first flag corresponding to the abnormality in the sending cycle of the Beacon message is set to indicate that the sending cycle of the Beacon message in the fourth time period is abnormal, that is, the sending cycle of the Beacon message in consecutive preset (for example, 5) sub-time periods T1 of the fourth time period (i.e., the fourth cycle time period) is abnormal.

[0237] For example, see Fig. 5FThe first module queries or calculates the reception rate of Beacon messages every 5 minutes. When the reception rate of Beacon messages within 5 minutes is less than or equal to the threshold, it is called an abnormality. When 5 abnormalities occur continuously, it is determined that the transmission cycle of Beacon messages in the fourth time period (i.e. 25 minutes) is inaccurate.

[0238] In some other embodiments, the first condition may also be that within a fifth time period, the operating duration of the Wi-Fi module is greater than or equal to a preset duration threshold, and the number of fourth messages received by the first electronic device from the second electronic device through the Wi-Fi connection is less than or equal to a first preset number threshold; within a sixth time period, the operating duration of the Wi-Fi module is greater than or equal to the preset duration threshold, and the number of fifth messages sent by the first electronic device to the second electronic device through the Wi-Fi connection is less than or equal to a second preset number threshold.

[0239] The fourth message may be a non-service message (such as a control message) or a service message. The fifth message may be a service message or a non-service message.

[0240] Normally, the Wi-Fi module is in working state in order to be able to send and receive messages (including business messages and non-business messages) in time. For example, when more messages need to be sent and received, the Wi-Fi module may need to be in working state for a long time in order to send and receive messages normally. However, the applicant noted that in some scenarios, although the Wi-Fi module works for a long time, the number of messages sent and received is small. This means that the Wi-Fi module may be abnormal. For example, when the state machine of the Wi-Fi module is abnormal, it may cause the Wi-Fi module to be unable to power off. In this way, even if there are no or very few messages to be sent and received, the Wi-Fi module will always be in working state, resulting in high power consumption. This phenomenon can be referred to as the Wi-Fi module abnormally not being powered off. In order to avoid this phenomenon, in an embodiment of the present application, when it is detected that the Wi-Fi module has a long working time (greater than or equal to a threshold) and the number of messages received / sent by the Wi-Fi module is small (less than or equal to a certain threshold), the Wi-Fi module is subjected to power saving processing.

[0241] As a possible implementation manner, within the fifth time period, the first electronic device determines that the working duration of the Wi-Fi module is greater than or equal to a preset duration threshold, and the number of fourth messages received by the first electronic device from the second electronic device through the Wi-Fi connection is less than or equal to a first preset number threshold, including:

[0242] If, within a preset number of consecutive fifth cycle time periods, the operating duration of the Wi-Fi module is greater than or equal to a certain threshold (for example, threshold t), and the number of received fourth messages is less than or equal to a certain threshold (for example, threshold s), it is determined that within the fifth time period, the first electronic device determines that the operating duration of the Wi-Fi module is greater than or equal to the preset duration threshold, and the number of fourth messages received by the first electronic device from the second electronic device through the Wi-Fi connection is less than or equal to the first preset number threshold.

[0243] The fourth message may be any message that the first electronic device can receive from the second electronic device via a Wi-Fi connection. Figure 5A (6) shows the process of the first electronic device detecting whether the Wi-Fi module is not powered off due to an abnormality. The Wi-Fi module counts the number of fourth message received and the working time of the Wi-Fi module. The first module of the framework layer queries the Wi-Fi module for the number of fourth message received and the working time of the Wi-Fi module in the T7 period every timing period T7 (i.e., the fifth cycle time period). If the query result in a certain T7 period is that the number of fourth message received is less than or equal to the threshold u, and the working time of the Wi-Fi module is greater than or equal to the threshold t, then the Wi-Fi module is abnormally powered off in the T7 period, and an abnormality is recorded, that is, the number of abnormalities is increased by one, and it is determined whether the total number of abnormalities reaches the preset number. If the number of received fourth messages of the query result within a certain T7 period is greater than the threshold value u, or the working time of the Wi-Fi module is less than the threshold value t, the number of abnormal times is cleared to 0, and the next timing period T7 is waited for to arrive, and the number of received fourth messages and the working time of the Wi-Fi module are queried from the Wi-Fi module, and the relationship between the number of received fourth messages and the threshold value u is determined, and the relationship between the working time of the Wi-Fi module and the threshold value t is determined.

[0244] Next, if Figure 5A As shown in (6), if the query result in a certain T7 time period is that the number of received fourth messages is less than or equal to the threshold u, and the working time of the Wi-Fi module is greater than or equal to the threshold t (the number of abnormalities plus one), if the total number of abnormalities reaches the preset number, the first flag corresponding to the abnormal non-power-off of the Wi-Fi module is set to indicate that the Wi-Fi module is not powered off due to the abnormality in the fifth time period.

[0245] For example, see Figure 5G, the first module of the framework layer queries the Wi-Fi module every 5 minutes (i.e., the fifth period) to determine how many messages are received within the 5 minutes and the working time of the Wi-Fi module within the 5 minutes (marked with shadows). When the working time of the Wi-Fi module is greater than or equal to the threshold t and the number of messages received is less than or equal to the threshold within 5 minutes, it is called an abnormality. When 5 abnormalities occur consecutively, it is determined that the Wi-Fi module has an abnormality within the fifth period (i.e., 25 minutes), resulting in a long period of power failure, and the first flag corresponding to the abnormal power failure of the Wi-Fi module is set.

[0246] As a possible implementation, in the sixth time period, the working duration of the Wi-Fi module is greater than or equal to the preset duration threshold, and the number of fifth messages sent by the first electronic device to the second electronic device through the Wi-Fi connection is less than or equal to the second preset number threshold, including: if in a consecutive preset number of sixth cycle time periods, the working duration of the Wi-Fi module is greater than or equal to a certain threshold (such as threshold v), and the number of fifth messages sent is less than or equal to a certain threshold (such as threshold w), then it is determined that in the sixth time period, the first electronic device determines that in the sixth time period, the working duration of the Wi-Fi module is greater than or equal to the preset duration threshold, and the number of fifth messages sent by the first electronic device to the second electronic device through the Wi-Fi connection is less than or equal to the second preset number threshold. The flowchart corresponding to this process can be found in Figure 5A As shown in (7), the specific implementation of the corresponding steps can be found in Figure 5A In (6).

[0247] In other embodiments, when determining whether the Wi-Fi module is abnormal and does not power off, the first electronic device may detect both the number of received messages and the number of sent messages. Figure 5H When the first electronic device detects that the working time of the Wi-Fi module is long and the number of sent messages and the number of received messages are small within a period of time, it means that the Wi-Fi module may not be powered off for a long time due to an abnormality. The first electronic device can control the Wi-Fi module to power off so as to reduce the power consumption of the whole device.

[0248] In the embodiment of the present application, the first electronic device can detect any one or more of the following states: in the first time period, the number of first messages detected reaches a first threshold; in the third time period, the number of Wi-Fi disconnections and / or connections detected reaches a third threshold; in the second time period, the number of preset identification position errors of the second message detected reaches a second threshold; in the fourth time period, the transmission period of the third message received by the first electronic device from the second electronic device through the Wi-Fi connection is inaccurate; in the fifth time period, the working time of the Wi-Fi module is greater than or equal to the preset time threshold, and the number of fourth messages received by the first electronic device from the second electronic device through the Wi-Fi connection is less than or equal to the first preset number threshold; in the sixth time period, the working time of the Wi-Fi module is greater than or equal to the preset time threshold, and within the working time, the number of fifth messages sent by the first electronic device to the second electronic device through the Wi-Fi connection is less than or equal to the second preset number threshold. These states can all be called Wi-Fi high power consumption states, or Wi-Fi power consumption exceeding the threshold, or Wi-Fi abnormalities. Exemplarily, if the first electronic device detects that any of the following first flags are set, it indicates that the Wi-Fi power consumption exceeds the threshold. Figure 5A The first flag corresponding to the abnormal Beacon message sending period shown in (4), or Figure 5A (2) a first identifier corresponding to a certain type of multicast message, a first identifier corresponding to a certain type of unicast message, a first identifier corresponding to a rekey message, a first identifier corresponding to a renew message, or Figure 5A The first flag corresponding to the TIM setting error shown in (3), or Figure 5A The first identifier corresponding to the Wi-Fi disconnection event shown in (5).

[0249] When the first electronic device detects that the Wi-Fi power consumption exceeds a threshold, it can control the Wi-Fi module to power off, so that the Wi-Fi module is no longer frequently awakened, or the Wi-Fi module is prevented from not being powered off for a long time after being awakened.

[0250] In some embodiments, after detecting that the Wi-Fi power consumption exceeds a threshold, the terminal may further detect whether there is any business in progress. If it is determined that no business is in progress, the Wi-Fi module may be powered off to avoid the impact of the Wi-Fi module power off on the business.

[0251] In some embodiments, in certain first preset scenarios mentioned above, for example, when a high power consumption state of Wi-Fi is detected when the screen of the first electronic device is turned off, the first electronic device may automatically control the Wi-Fi module to power off without prompting the user.

[0252] In some other embodiments, the first electronic device always turns on the power consumption reduction function of the embodiment of the present application by default, or the first electronic device turns on Figure 3B or Figure 3C or Figure 3A In some scenarios, such as when the screen of the first electronic device is on, when the first electronic device detects a high power consumption state of Wi-Fi, such as when it detects that the number of first messages received from the second electronic device within a first time period reaches a first threshold, the first electronic device can prompt the user to switch the network connection from Wi-Fi connection to mobile data connection, such as popping up a pop-up message. Figure 6 The prompt box 601 shown in (1) of FIG. 1 shows “Wi-Fi is consuming a lot of power. Do you want to switch to mobile data connection?”. When the first electronic device receives the first instruction from the user, that is, the user chooses to switch the network connection from Wi-Fi connection to mobile data connection, such as clicking Figure 6 The first electronic device then controls the Wi-Fi module to power off and switches the network connection to the mobile data connection. In this way, the first electronic device can use the mobile data connection after the Wi-Fi module is powered off.

[0253] Users can also select Figure 6 The "Don't prompt again" option shown in (1) is selected, and the switch button is clicked. In this way, subsequently, when both the Wi-Fi function and the mobile data function are turned on, when the Wi-Fi module is powered off (i.e., the Wi-Fi connection is disconnected), the first electronic device no longer prompts the user, but automatically uses the mobile data connection.

[0254] In other embodiments, when the screen of the first electronic device is on, if the first electronic device detects that Wi-Fi consumes a lot of power, it may only prompt the user whether to turn off the Wi-Fi module. Figure 6 (2) shows the prompt box 602. When the user clicks on a button such as Figure 6 The off button shown in (2) controls the first electronic device to power off the Wi-Fi module.

[0255] Of course, the user can also set in the first electronic device in which scenarios to prompt the user whether to turn off the Wi-Fi module, or whether to switch to the mobile network module. Figure 3AThe setting interface shown in the figure can be set, or other setting methods can be adopted. In this way, the first electronic device can have different prompt schemes in different scenarios according to the user's settings. Alternatively, in other embodiments, the first electronic device can also automatically learn the user's usage habits and save the user's different prompt requirements in different scenarios in order to perform different prompt schemes. For example, when the user is in a scenario such as an airport, the user may not carry a charger. In order to reduce the power consumption when the screen is notified, the first electronic device may not prompt the user, but directly control the Wi-Fi module to power off.

[0256] Of course, the first electronic device can also prompt the user in other ways, and the embodiments of the present application do not limit the prompting methods. For example, during the day or when the user is using the first electronic device, the first electronic device plays a voice message "Wi-Fi high power consumption detected, do you want to switch to mobile data connection?"

[0257] In some other embodiments, the screen of the first electronic device is on, the user opens an immersive application and is using the application, and in order not to break the user's immersion, the first electronic device does not prompt the user when a high power consumption state of the Wi-Fi is detected.

[0258] Optionally, when the first electronic device detects that Wi-Fi consumes high power, if it determines that the mobile network traffic does not exceed the set threshold, it can automatically switch to the mobile network. Optionally, the first electronic device monitors the mobile network traffic, and when the first electronic device determines that the mobile network traffic exceeds the set threshold, the mobile network connection is disconnected.

[0259] Or, optionally, in order to avoid the delay caused by switching from the Wi-Fi connection to the mobile network connection, a brief network disconnection may occur, and the first electronic device continues to use the Wi-Fi connection to obtain network services and can delay the time to power off the Wi-Fi module.

[0260] The immersive application may be, for example, but not limited to, a large mobile game, etc. The delay in powering off the Wi-Fi module may be when the immersive application ends running, or at other times.

[0261] It should be noted that if the immersive application ends within a short period of time after the high power consumption state of Wi-Fi is detected, the first electronic device can directly control the Wi-Fi module to power off. It is also possible that the immersive application ends after a long time after the high power consumption state of Wi-Fi is detected, at which time the Wi-Fi power consumption may return to normal. Then, the first electronic device can restart a round of detection of whether Wi-Fi consumes high power, and control the Wi-Fi module to power off when it is determined that Wi-Fi consumes high power.

[0262] The embodiment of the present application does not restrict whether the first electronic device prompts the user to power off the Wi-Fi module after detecting high power consumption of Wi-Fi, the prompting method, and the prompting timing.

[0263] Currently, when the second electronic device is not designed in a standardized manner, resulting in serious power consumption of the Wi-Fi module of the first electronic device connected to the second electronic device, there is no positive solution, that is, it is impossible to require all manufacturers to control the working methods of data packets, messages, frames, etc. according to unified standards.

[0264] The method for reducing power consumption of a first electronic device provided in an embodiment of the present application is that when the first electronic device detects that the number of first messages reaches a first threshold value within a first time period, and / or detects that the number of Wi-Fi disconnections and / or connections reaches a third threshold value within a third time period, and / or detects that the number of preset identification position errors of a second message reaches a second threshold value within a second time period, it means that the Wi-Fi connection will cause high power consumption, and therefore, the first electronic device disconnects the WiFi connection. This avoids the problem of high power consumption of the first electronic device connected to the second electronic device via Wi-Fi due to the non-standard design of the second electronic device.

[0265] For example, taking a mobile phone with a battery capacity of 4000mAh as an example, a user may expect the mobile phone to consume less than 5% of its power when in standby mode, but the current router design is not standardized, which may cause the mobile phone to consume more than 20% of its power when in standby mode for 6 hours, or even consume 50% of its power. Using the method for reducing the power consumption of the first electronic device provided in the embodiment of the present application, the power consumption of the mobile phone when in standby mode for 6 hours can be reduced to about 3%-5%, meeting the user's battery life requirements.

[0266] In some embodiments, after the Wi-Fi module of the first electronic device is powered off, that is, after the Wi-Fi connection is disconnected, the first electronic device may not use the mobile network connection, that is, both the Wi-Fi connection and the mobile network connection are disconnected, or both the Wi-Fi module and the mobile network module enter a dormant state. For example, when the screen is off, the first electronic device detects that the Wi-Fi module consumes a lot of power and controls the Wi-Fi module to power off. Then, since the user did not turn on the screen, it means that the user may not want the first electronic device to be connected to the Internet at that time, the first electronic device may not switch the network connection to the mobile network connection, that is, the first electronic device may be in an offline state to further reduce the power consumption of the entire device.

[0267] The first time period, the second time period, and the third time period can be set independently. Two of the three time periods can be the same, or they can be different, or all three time periods can be the same, or other possible designs can be used.

[0268] In other embodiments, after the Wi-Fi module of the first electronic device is powered off, the first electronic device can use a mobile network connection to connect to the Internet for some services. That is, after step S402, the first electronic device can also perform the following step S403:

[0269] S403: After performing power saving processing on the Wi-Fi module, the first electronic device sends the service message to be sent through the mobile network connection.

[0270] It can be understood that since the Wi-Fi module consumes more power, the first electronic device can wake up a mobile network (such as a 4G network) module that consumes less power than the Wi-Fi module and communicate through the mobile network module.

[0271] In some embodiments, before step S403, the mobile network connection of the first electronic device remains connected, that is, the mobile network module is in an awakened state, and the first electronic device directly sends the service message through the mobile network connection established by the mobile network module.

[0272] In other embodiments, before step S403, the mobile network module is in a dormant state. Then, after the Wi-Fi module enters the dormant state, if the first electronic device has a service message to be sent, it is necessary to first wake up the mobile network module, establish a mobile network connection through the mobile network module, and send the service message through the mobile network connection.

[0273] Among them, after the Wi-Fi module is powered off, if it is determined that the mobile network traffic does not exceed the set threshold, the first electronic device can automatically use the mobile network connection to obtain network services. Or, ask the user whether to use the mobile network connection to obtain network services. For example, if the user has not manually turned on the mobile network function before, the first electronic device controls the Wi-Fi module to power off and asks the user whether to use the mobile network connection to obtain network services.

[0274] In this way, the first electronic device can interact with an Internet device, such as a server of a mobile game application, through a mobile network connection to obtain corresponding mobile game data and continue to operate the mobile game.

[0275] In some embodiments, after the first electronic device sends a service message to be sent, if the first electronic device does not send or receive other service messages within a period of time, the mobile network module is controlled to enter a sleep state to reduce power consumption.

[0276] S404: If the first electronic device detects that the first electronic device is in the second preset scene, the Wi-Fi module is awakened to interact with the second electronic device through the Wi-Fi connection.

[0277] It is understandable that the first electronic device continuously detects the usage status of the first electronic device.

[0278] The second preset scenario includes but is not limited to one or more of the following combinations: the first electronic device is charging, the first electronic device is moving, the first electronic device is turning on the screen, the first electronic device is turning on the screen and is unlocked, the first electronic device's screen-on time reaches a fourth threshold, the number of applications opened by the first electronic device is less than or equal to a preset number, the current time is within the second preset time period (for example, 20:00 to 22:00), the mobile network traffic reaches the fifth threshold after the Wi-Fi connection is disconnected, and the alarm timing arrives.

[0279] The movement of the first electronic device means that the user may use the first electronic device for business. The first electronic device lights up the screen in response to the user's unlock instruction to the first electronic device, which indicates that the user may use the first electronic device.

[0280] It is understandable that in some scenarios, the user turns on the screen of the first electronic device, which may be to use the first electronic device to surf the Internet. The first electronic device can wake up the Wi-Fi module when detecting that the screen is turned on.

[0281] In some scenarios, the user may light up the first electronic device by mistake, or may not want to use the first electronic device to surf the Internet. The first electronic device can wake up the Wi-Fi module when the user lights up the screen and unlocks the first electronic device.

[0282] In some scenarios, the user may set an alarm in the first electronic device, such as setting a wake-up time of 8 a.m. Then, the first electronic device may restore the Wi-Fi connection at 8 a.m. so that the user can use the Wi-Fi connection to surf the Internet.

[0283] The fifth threshold value can be set according to the user's traffic package or the user's traffic setting. For example, if the user sets the daily traffic limit to 500M, the fifth threshold value can be set to 500M, or set to other values.

[0284] In some embodiments of the present application, if the first electronic device still maintains a mobile network connection when the first electronic device determines that the first electronic device is in the second preset scenario, the first electronic device can actively disconnect the mobile network connection, wake up the Wi-Fi module, establish a Wi-Fi connection, and interact with the second electronic device using the Wi-Fi connection. In some examples, the first electronic device can also wake up the Wi-Fi module and establish a Wi-Fi connection without disconnecting the mobile network connection.

[0285] Alternatively, in some other embodiments, once the first electronic device detects that it is out of the first preset scene, it wakes up the Wi-Fi module and communicates with the second electronic device through the Wi-Fi module.

[0286] Figure 8 or Fig. 9 The following is an exemplary application scenario of the technical solution of the embodiment of the present application. Figure 8 As shown, when the user is sleeping, his mobile phone detects that the first preset scenario is met, for example, the phone is in the screen-off state for a long time and the Wi-Fi is in the connected state, the phone automatically turns on Wi-Fi anomaly detection. When the phone detects that the first condition is met, that is, the Wi-Fi is abnormal, the phone automatically performs power-saving processing on the Wi-Fi module, such as controlling the Wi-Fi module to sleep, to reduce the power consumption of the phone.

[0287] Of course, the technical solution of the embodiment of the present application can also be applied to other similar scenarios. Optionally, the scenario can be other scenarios where the user has not used the mobile phone for a long time. For example, although the user is not sleeping, he has been busy with work and has no time to operate the mobile phone.

[0288] In other embodiments, in the scenario where the user operates the mobile phone, the method for reducing power consumption in the embodiment of the present application can also be used. Fig. 9 As shown in the figure, the user's mobile phone battery is low, but the user may not have a charger. When the mobile phone detects that the battery is low and Wi-Fi is connected, the Wi-Fi anomaly detection function can be turned on. During this period, the user may have been operating the mobile phone. When the mobile phone detects Wi-Fi anomalies, it can Fig. 9 As shown, the user is prompted "Wi-Fi is detected to be high power consumption, do you want to switch to mobile data connection? (Other prompting methods may also be used)" Of course, the mobile phone may not prompt the user, but directly control the Wi-Fi to power off to reduce the power consumption of the mobile phone.

[0289] The present application also provides a chip system, such as Fig.10As shown, the chip system includes at least one processor 1101 and at least one interface circuit 1102. The processor 1101 and the interface circuit 1102 can be interconnected via lines. For example, the interface circuit 1102 can be used to receive signals from other devices (such as the memory of the first electronic device 100). For another example, the interface circuit 1102 can be used to send signals to other devices (such as the processor 1101). Exemplarily, the interface circuit 1102 can read the instructions stored in the memory and send the instructions to the processor 1101. When the instruction is executed by the processor 1101, the first electronic device can execute the various steps performed by the first electronic device 100 (for example, a mobile phone) in the above-mentioned embodiment. Of course, the chip system can also include other discrete devices, which are not specifically limited in the embodiments of the present application.

[0290] The embodiment of the present application also provides a device, which is included in a first electronic device or a second electronic device, and has the function of implementing the behavior of the first electronic device or the second electronic device in any method of the above embodiment. The function can be implemented by hardware, or by hardware executing corresponding software. The hardware or software includes at least one module or unit corresponding to the above function. For example, a detection module or unit, and a determination module or unit, etc.

[0291] An embodiment of the present application also provides a computer-readable storage medium, including computer instructions. When the computer instructions are executed on a first electronic device or a second electronic device, the first electronic device or the second electronic device executes any method in the above embodiments.

[0292] The embodiments of the present application also provide a computer program product. When the computer program product is run on a computer, the computer is enabled to execute any of the methods in the above embodiments.

[0293] It is understandable that, in order to realize the above functions, the above-mentioned first electronic device, etc., includes hardware structures and / or software modules corresponding to the execution of each function. Those skilled in the art should easily realize that, in combination with the units and algorithm steps of each example described in the embodiments disclosed herein, the embodiments of the present application can be implemented in the form of hardware or a combination of hardware and computer software. Whether a function is executed in the form of hardware or computer software driving hardware depends on the specific application and design constraints of the technical solution. Professional and technical personnel can use different methods to implement the described functions for each specific application, but such implementation should not be considered to exceed the scope of the embodiments of the present invention.

[0294] The embodiment of the present application can divide the functional modules of the first electronic device and the like according to the above method example. For example, each functional module can be divided according to each function, or two or more functions can be integrated into one processing module. The above integrated module can be implemented in the form of hardware or in the form of software functional modules. It should be noted that the division of modules in the embodiment of the present invention is schematic and is only a logical function division. There may be other division methods in actual implementation.

[0295] Through the description of the above implementation methods, technicians in the relevant field can clearly understand that for the convenience and simplicity of description, only the division of the above functional modules is used as an example. In actual applications, the above functions can be assigned to different functional modules as needed, that is, the internal structure of the device is divided into different functional modules to complete all or part of the functions described above. The specific working process of the system, device and unit described above can refer to the corresponding process in the aforementioned method embodiment, and will not be repeated here.

[0296] Each functional unit in each embodiment of the present application can be integrated into a processing unit, or each unit can exist physically separately, or two or more units can be integrated into one unit. The above integrated unit can be implemented in the form of hardware or in the form of software functional units.

[0297] If the integrated unit is implemented in the form of a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the embodiment of the present application is essentially or the part that contributes to the prior art or all or part of the technical solution can be embodied in the form of a software product, and the computer software product is stored in a storage medium, including a number of instructions to enable a computer device (which can be a personal computer, a server, or a network device, etc.) or a processor to perform all or part of the steps of the method described in each embodiment of the present application. The aforementioned storage medium includes: various media that can store program codes, such as flash memory, mobile hard disk, read-only memory, random access memory, disk or optical disk.

[0298] The above is only a specific implementation of the present application, but the protection scope of the present application is not limited thereto. Any changes or substitutions within the technical scope disclosed in the present application should be included in the protection scope of the present application. Therefore, the protection scope of the present application should be based on the protection scope of the claims.

Claims

1. A method for reducing power consumption, characterized in that: Applied to a first electronic device, the first electronic device has a Wi-Fi module and a mobile network module, the method includes: The first electronic device establishes a Wi-Fi connection with a second electronic device through the Wi-Fi module, and the first electronic device interacts with the second electronic device through the Wi-Fi connection; If the first electronic device determines that the first condition is met, the first electronic device performs power saving processing on the Wi-Fi module; The first condition includes any one or more of the following: Item 1: the number of first messages received by the first electronic device from the second electronic device through the Wi-Fi connection within a first time period is greater than or equal to a first threshold; Item 2: within a second time period, the number of times that the preset flag position of the second message received by the first electronic device from the second electronic device through the Wi-Fi connection is incorrect is greater than or equal to a second threshold; Item 3: During a fourth time period, a sending period of a third message received by the first electronic device from the second electronic device through the Wi-Fi connection is inaccurate; Item 4: During a fifth time period, the operating duration of the Wi-Fi module is greater than or equal to a preset duration threshold, and the number of fourth messages received by the first electronic device from the second electronic device through the Wi-Fi connection is less than or equal to a first preset number threshold; Item 5: Within a sixth time period, the working duration of the Wi-Fi module is greater than or equal to a preset duration threshold, and the number of fifth messages sent by the first electronic device to the second electronic device through the Wi-Fi connection is less than or equal to a second preset number threshold; The first message is a message used to detect Wi-Fi anomalies according to the number of messages; the second message is a message used to detect Wi-Fi anomalies according to the setting of a preset identification bit of the message; the third message is a message used to detect Wi-Fi anomalies according to the sending period of the message; the fourth message is a non-service message or a service message; the fifth message is a service message or a non-service message; The preset identification bit is used to indicate whether there is a service message to be sent by the second electronic device to the first electronic device.

2. The method for reducing power consumption according to claim 1, characterized in that: The first message, the second message, and the third message are all non-business messages; the first message includes any one or more of the following: a unicast message, a multicast message, a rekey message, a renew message, and a router advertisement RA message; the second message includes a Beacon message; the preset identification bit of the second message includes a traffic indication map TIM bit; the correctly set preset identification bit is used to indicate that there is a business message to be sent by the second electronic device to the first electronic device; the third message includes a Beacon message.

3. The method for reducing power consumption according to claim 1 or 2, characterized in that: The sending period of the third message is inaccurate, including that the sending period of the second electronic device sending the third message is not aligned with the receiving period of the first electronic device receiving the third message.

4. The method for reducing power consumption according to claim 1 or 2, characterized in that: The first electronic device determines that a preset flag position of the second message is wrong, including: The first electronic device receives the second message from the second electronic device, and a preset identification bit of the second message is set; The first electronic device sends an empty frame to the second electronic device, where the empty frame is used to request a service message from the second electronic device; If no service message is received from the second electronic device within the seventh time period, the first electronic device determines that the preset identification position of the second message is incorrect.

5. The method for reducing power consumption according to claim 1 or 2, characterized in that: The first electronic device determines that the sending period of the third message is inaccurate, comprising: if a reception rate of the third message received from the second electronic device is less than or equal to a reception threshold within a fourth time period, then the first electronic device determines that the sending period of the third message is inaccurate; The reception rate of the third messages is a ratio of the number of third messages actually received to the number of third messages that should be received.

6. The method for reducing power consumption according to claim 1 or 2, characterized in that: After the first electronic device determines that the first condition is satisfied, and before the first electronic device performs power saving processing on the Wi-Fi module, the method further includes: The first electronic device displays a first interface, where the first interface is used to prompt a user whether to disconnect the Wi-Fi connection; The first electronic device performs power saving processing on the Wi-Fi module, including: In response to a first instruction input by a user on the first interface, the first electronic device performs power saving processing on the Wi-Fi module and disconnects the Wi-Fi connection; the first instruction is used to instruct to disconnect the Wi-Fi connection.

7. The method for reducing power consumption according to claim 1 or 2, characterized in that: After the first electronic device determines that the first condition is satisfied, and before the first electronic device performs power saving processing on the Wi-Fi module, the method further includes: The first electronic device displays a second interface, where the second interface is used to prompt the user whether to switch the network connection from the Wi-Fi connection to the mobile network connection; The first electronic device performs power saving processing on the Wi-Fi module, including: In response to a second instruction input by the user on the second interface, the first electronic device performs power saving processing on the Wi-Fi module and switches the network connection to the mobile network connection; the second instruction is used to instruct the network connection to be switched to the mobile network connection.

8. The method according to claim 1 or 2, characterized in that: The method further comprises: The first electronic device turns on the first function when it receives an instruction from the user to turn on the first function, or when the first electronic device determines that it is in a first preset scenario; wherein the first function is a function of reducing the power consumption of the first electronic device; the first preset scenario includes: the battery level of the first electronic device is lower than a preset value, the number of applications turned on by the first electronic device is greater than a preset number, the first electronic device turns on a preset application, the current time is within a first preset time period, the screen of the first electronic device is off for longer than a preset time, the first electronic device maintains a network connection when set to sleep, the first electronic device does not detect any ongoing business for a period of time, and the ambient light brightness is less than or equal to any one or more of the preset brightnesses.

9. The method for reducing power consumption according to claim 1 or 2, characterized in that: The method further comprises: After the first electronic device performs power saving processing on the Wi-Fi module, if the first electronic device has a service message to be sent, the first electronic device sends the service message to be sent through the mobile network connection established by the mobile network module.

10. The method for reducing power consumption according to claim 1 or 2, characterized in that: After the first electronic device performs power saving processing on the Wi-Fi module, the method further includes: If the first electronic device detects that it is in the second preset scene or is no longer in the first preset scene, waking up the Wi-Fi module and re-establishing a Wi-Fi connection with the second electronic device through the Wi-Fi module; The second preset scenario includes any one or more of the following combinations: the first electronic device is charging, the first electronic device is moving, the first electronic device is turning on the screen, the first electronic device's screen-on time reaches a fourth threshold, the number of applications opened by the first electronic device is less than or equal to a preset number, the current time is within a preset time period, and the traffic of the mobile network reaches a fifth threshold after the Wi-Fi connection is disconnected.

11. The method for reducing power consumption according to claim 1 or 2, characterized in that: The first electronic device performs power saving processing on the Wi-Fi module, including: the first electronic device controls the Wi-Fi module to enter a sleep state.

12. The method for reducing power consumption according to claim 1 or 2, characterized in that: The second electronic device includes any one of a wireless router and a CPE.

13. An electronic device, characterized in that: include: A processor, a memory, a touch screen, a Wi-Fi module and a mobile network module, wherein the memory, the touch screen, the Wi-Fi module and the mobile network module are coupled to the processor, the memory is used to store computer program codes, and the computer program codes include computer instructions. When the processor reads the computer instructions from the memory, the electronic device executes the method for reducing power consumption as described in any one of claims 1 to 12.

14. A computer-readable storage medium, characterized in that: The method comprises computer instructions, and when the computer instructions are executed on an electronic device, the electronic device executes the method for reducing power consumption as claimed in any one of claims 1 to 12.

15. A chip system, characterized in that: The method comprises one or more processors. When the one or more processors execute instructions, the one or more processors perform the method for reducing power consumption according to any one of claims 1 to 12.

Citation Information

Patent Citations

  • Power conservation method and apparatus, and electronic device

    CN105653006A

  • WiFi connection management device and method, and mobile terminal

    CN105898809A