Communication method, electronic equipment and storage medium

By setting a blacklist on the electronic device and discarding the frozen application data packet, it solves the problem of large power consumption caused by the frozen application to wake up the operating system, and achieves the effect of decreased power consumption and extended battery life.

CN119342559APending Publication Date: 2025-01-21HONOR DEVICE CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202310912314.8
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2023-07-20
Publication Date
2025-01-21

AI Technical Summary

Technical Problem

When the application is in a frozen state, when the electronic device receives a packet sent by a third-party server, it will continuously wake up the operating system, resulting in large power consumption and increased power consumption.

Method used

Set up a blacklist on the electronic device to determine that the application is frozen and the data packet comes from the server in the blacklist. These packets are not processed or discarded to avoid wake up the operating system.

Benefits of technology

By not processing the frozen application data packets, the power consumption of electronic equipment is reduced, the battery life is prolonged, and the heat generation of the equipment is reduced.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119342559A_ABST
    Figure CN119342559A_ABST
Patent Text Reader

Abstract

The invention relates to the technical field of terminals, and discloses a communication method, an electronic device and a storage medium, by setting a blacklist on a terminal device, when an application is in a frozen state, a third-party server sending a message to the application is added into the blacklist, and the application is in a frozen state. Therefore, when the terminal equipment receives the data packet sent to the application by the third-party server in the blacklist, the data packet is not sent to the application in the frozen state, for example, the data packet is discarded, so that the power consumption of the terminal equipment is reduced.
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 communication method, electronic equipment and storage medium. Background Art

[0002] When an application in an electronic device is in a frozen state (such as the electronic device is in an off-screen state or the application is switched to the background), if the electronic device receives data packets of the application from a third-party server corresponding to the application and continues to send them to the electronic device, the operating system of the electronic device will be continuously woken up to receive and process the data packets of the application.

[0003] Since the application in the electronic device is in a frozen state, the operating system of the electronic device does not need to receive and process the data packet of the application, and the data packet of the application can be directly discarded. However, in the process of constantly waking up the operating system of the electronic device, the power of the electronic device will be consumed, resulting in high power consumption of the electronic device. Summary of the invention

[0004] In order to solve the problem of high power consumption of electronic devices, embodiments of the present application provide a communication method, an electronic device and a storage medium.

[0005] A first aspect of an embodiment of the present application provides a communication method for a first electronic device, on which a first application is installed, and the method includes: receiving a first data packet sent by a second electronic device to the first application; determining that the first application is in a frozen state and that the sending and receiving relationship between the second electronic device and the first application is in a blacklist; and not processing the first data packet.

[0006] Based on the above scheme, by setting a blacklist on the first electronic device, the third-party server that sends messages to the application when the application is in a frozen state is added to the blacklist, so that when the first electronic device receives a data packet sent to the application by the second electronic device on the blacklist, it will not send it to the application in the frozen state, for example, the data packet will be discarded, thereby reducing the power consumption of the first electronic device.

[0007] It is understood that the first electronic device can be any implementable terminal device such as a smart phone, a tablet computer, a smart wearable device or a personal digital assistant, etc. The second electronic device can be a third-party server, for example, a third-party server corresponding to a game application, a third-party server corresponding to a browsing application, etc.

[0008] It is understandable that when the first electronic device determines that the first application is in a frozen state, and the transceiver relationship between the second electronic device and the first application is in the whitelist or blacklist, the first data packet can be discarded so that the operating system of the first electronic device continues to be in a dormant state.

[0009] In some optional instances, when the first electronic device determines that the first application is in a frozen state, or the sending and receiving relationship between the second electronic device and the first application is in a white or black list, the operating system of the first electronic device is woken up so that the operating system of the first electronic device receives and processes the first data packet of the first application sent by the second electronic device to the first electronic device.

[0010] In a possible implementation of the first aspect above, the method also includes: receiving a second data packet sent by a second electronic device to a first application on a first electronic device; determining that the first application in the first electronic device is in a frozen state, the transceiving relationship between the second electronic device and the first application is not in a blacklist, and the number of consecutive times received by the second electronic device to send data packets to the first application on the first electronic device is greater than a number threshold; and adding the transceiving relationship between the second electronic device and the first application to a blacklist.

[0011] It can be understood that the first electronic device can not only perform the blacklisting operation based on the second data packet sent by the second electronic device to the first application on the first electronic device, but also perform the blacklisting operation based on the second data packet sent by the second electronic device to the second application on the first electronic device, and can also perform the blacklisting operation based on the second data packet sent by the third electronic device to the first application on the first electronic device.

[0012] In a possible implementation of the first aspect above, the blacklist includes a correspondence between a protocol and a port used by the second electronic device to send a data packet to the first application on the first electronic device and the first application.

[0013] In some optional examples, a condition for adding to the blacklist can be set, for example, when the first application is in a frozen state, the first electronic device receives a data packet sent by the second electronic device to the first application N times (such as once or twice), then the second electronic device is added to the blacklist. For example, the corresponding relationship between the protocol and port of the second electronic device sending the data packet to the first application on the first electronic device and the first application is added to the blacklist.

[0014] In some optional embodiments, the blacklist may be presented in the form of a filter list.

[0015] In an embodiment of the present application, by setting a blacklist on the first electronic device, when the first electronic device subsequently receives a data packet sent by a second electronic device on the blacklist, it may not send the data packet to the application in the frozen state, but directly discard the data packet, thereby reducing the power consumption of the terminal device.

[0016] In a possible implementation of the first aspect above, the method also includes: obtaining a first protocol and a first port for the second electronic device to send a first data packet to a first application on the first electronic device; in the blacklist, determining that there is a second protocol and a second port corresponding to the first application, which are the same as the first protocol and the first port, and determining that the sending and receiving relationship between the second electronic device and the first application is in the blacklist.

[0017] In a possible implementation of the first aspect above, the frozen state includes at least one of the following: the first electronic device is in a screen-off state, the first electronic device is in a night mode, and the first application is switched to the background.

[0018] It can be understood that when the first electronic device is in the screen-off state, the first electronic device is in night mode, or the first application is switched to the background, it can be determined that the operating system of the first electronic device does not need to receive and process the data packet of the first application sent by the second electronic device to the first electronic device.

[0019] In a possible implementation of the first aspect above, the first electronic device is in a screen-off state and does not process the first data packet, including: discarding the first data packet and allowing the operating system of the first electronic device to continue to be in a sleep state.

[0020] In a possible implementation of the first aspect above, the method also includes: receiving a third data packet sent by the second electronic device to the first application on the first electronic device; determining that the first application in the first electronic device is in a non-frozen state, and that the transceiving relationship between the second electronic device and the first application is in a blacklist, removing the transceiving relationship between the second electronic device and the first application from the blacklist, and waking up the operating system of the first electronic device so that the operating system of the first electronic device receives and processes the third data packet.

[0021] In a possible implementation of the first aspect above, the protocol includes any one of a Transmission Control Protocol, a User Datagram Protocol, and an Internet Control Message Protocol.

[0022] In a second aspect, the present application provides an electronic device, comprising: a memory for storing instructions executed by one or more processors of the electronic device, and a processor, which is one of the one or more processors of the electronic device, for executing the communication method mentioned in the present application.

[0023] In a third aspect, the present application provides a readable storage medium, on which instructions are stored. When the instructions are executed on an electronic device, the electronic device executes the communication method mentioned in the present application. BRIEF DESCRIPTION OF THE DRAWINGS

[0024] Figure 1 According to some examples of the present application, a scenario schematic diagram of a communication method is shown;

[0025] Figure 2 According to some examples of the present application, a flow chart of a communication method is shown;

[0026] Figure 3 According to some examples of the present application, a flowchart of a blacklist setting method is shown;

[0027] Figure 4 According to some examples of the present application, a statistical graph of data packets sent based on different ports monitored within a preset time period is shown;

[0028] Figure 5 According to some examples of the present application, a schematic diagram of an interaction process of a communication method is shown;

[0029] Figure 6 According to some examples of the present application, a block diagram of a first electronic device is shown;

[0030] Figure 7 According to some examples of the present application, a software structure block diagram of a first electronic device is shown;

[0031] Figure 8 According to some examples of the present application, a schematic diagram of interaction between a kernel layer and an application framework layer is shown;

[0032] Fig. 9 According to some examples of the present application, a schematic diagram of the hardware structure of an electronic device is shown. DETAILED DESCRIPTION

[0033] The illustrative embodiments of the present application include, but are not limited to, a communication method, an electronic device, and a storage medium.

[0034] It is understood that the communication method provided in the embodiments of the present application can be executed by an electronic device or a network device. The electronic device can be any implementable terminal device such as a smart phone, a tablet computer, a smart wearable device or a personal digital assistant, and the network device can be any implementable device such as a router, an optical modem, a gateway, a network interface card, a wireless access point, etc.

[0035] Figure 1 A schematic diagram of a communication method is shown in FIG. Figure 1 As shown, when the terminal device 110 receives a data packet of an application sent by a third-party server 120, if the terminal device 110 detects that the application is in a frozen state and the third-party server 120 is in the blacklist, the terminal device 110 discards the data packet of the application sent by the third-party server 120 and does not wake up the operating system of the terminal device 110.

[0036] In order to solve the problem of high power consumption of electronic devices mentioned above, an embodiment of the present application provides a communication method. This method sets a blacklist on the terminal device, and adds a third-party server that sends messages to the application when the application is in a frozen state to the blacklist. This makes it possible for the terminal device to not send a data packet sent to the application by the blacklisted third-party server when receiving the data packet sent to the application, for example, discard the data packet, thereby reducing the power consumption of the terminal device.

[0037] In some optional instances, a condition for adding to the blacklist can be set. For example, when the terminal device receives a data packet sent to the application from a third-party server N times (such as once or twice) in a row when the application is in a frozen state, the third-party server is added to the blacklist. When the terminal device receives a data packet sent from the third-party server to the application in a frozen state again, the data packet is directly discarded without waking up the operating system of the terminal device. In this way, the power consumption of the terminal device can be reduced.

[0038] The following is an introduction to the communication method described in the embodiments of the present application. Figure 2 The present invention is a flow chart of a communication method, which can be executed by a first electronic device, wherein the first electronic device can be any implementable terminal device such as a smart phone, a tablet computer, a smart wearable device or a personal digital assistant. Figure 2 As shown, the communication method may include:

[0039] 201: Receive a first data packet of a first application sent by a second electronic device.

[0040] It is understandable that the second electronic device may be a third-party server, such as a third-party server corresponding to a game application, a third-party server corresponding to a browsing application, etc.

[0041] It is understood that the first electronic device may be installed with multiple applications, and the first application may be any one of the multiple applications installed on the first electronic device. The first data packet may be data required when the first application is in a non-frozen state (such as a foreground running state), for example, when the first application is a game application, the first data packet may be data such as rendered images and rendered audio.

[0042] It can be understood that the first data packet of the first application can be sent by the third-party server to the first electronic device through the first port and the first protocol. The first port can be any one of ports 8080, 5223, 443, etc., and the first protocol can be any one of protocols such as Transmission Control Protocol (TCP), User Datagram Protocol (UDP), and Internet Control Message Protocol (ICMP).

[0043] 202 : Determine whether the first application is in a frozen state. If the determination result is yes, go to step 203 ; otherwise, go to step 205 .

[0044] It can be understood that the first application being in a frozen state may refer to the state of the first application when the first electronic device is in a screen-off state, the state of the first application when the first electronic device is in night mode, or the state of the first application when the first application is switched to the background.

[0045] In some optional examples, when the first electronic device detects that the first application is in a frozen state, step 203 may be executed, i.e., determining whether the second electronic device is in the blacklist. When the first electronic device detects that the first application is in a non-frozen state, step 205 may be executed, i.e., waking up the operating system of the first electronic device so that the operating system of the first electronic device receives and processes the first data packet. The blacklist may be a filter list, which may have multiple matching ports and protocols. The setting method of the blacklist may be in Figure 3 Described in detail in.

[0046] In an embodiment of the present application, by determining whether an application is in a frozen state, the accuracy of subsequent discarded data packets can be improved, data packets of applications in a non-frozen state can be avoided from being discarded, and the accuracy of discarded data packets can be improved while reducing the power consumption of terminal devices.

[0047] 203 : Determine whether the second electronic device is in the blacklist. If the determination result is yes, go to step 204 ; otherwise, go to step 205 .

[0048] In some optional examples, the method for determining whether the second electronic device is in the blacklist may be: matching the first port and the first protocol of the first data packet with multiple matching ports and protocols in the filter list to determine whether the second electronic device is in the blacklist.

[0049] For example, when there is a second port corresponding to the first port of the first data packet in the filtering list, there is a second protocol corresponding to the first protocol of the first data packet, and the second port and the second protocol are matching ports and protocols, it can be determined that the second electronic device is in the blacklist.

[0050] When there is a second port corresponding to the first port of the first data packet in the filtering list, there is a second protocol corresponding to the first protocol of the first data packet, and the second port and the second protocol are mismatched ports and protocols, it can be determined that the second electronic device is not in the blacklist, that is, the second electronic device is in the whitelist.

[0051] When the second port corresponding to the first port of the first data packet exists in the filter list, and the second protocol corresponding to the first protocol of the first data packet does not exist, it can be determined that the second electronic device is not in the blacklist, that is, the second electronic device is in the whitelist.

[0052] When the second port corresponding to the first port of the first data packet does not exist in the filter list, and the second protocol corresponding to the first protocol of the first data packet exists, it can be determined that the second electronic device is not in the blacklist, that is, the second electronic device is in the whitelist.

[0053] In an embodiment of the present application, by determining whether a third-party server is on the blacklist, the accuracy of subsequent discarded data packets can be improved, and data packets sent to the terminal device by a third-party server on the whitelist can be avoided from being discarded. This can improve the accuracy of discarded data packets while reducing the power consumption of the terminal device.

[0054] 204: discard the first data packet, and do not wake up the operating system of the first electronic device.

[0055] It can be understood that when it is determined that the first application is in a frozen state and the second electronic device is in the blacklist, it can be determined that the operating system of the first electronic device does not need to receive and process the first data packet of the first application. Therefore, the first electronic device can directly discard the first data packet and does not wake up the operating system of the first electronic device to receive and process the first data packet.

[0056] In an embodiment of the present application, based on the blacklist on the terminal device, when a data packet is received from a third-party server on the blacklist, it may not be sent to an application in a frozen state, but the data packet may be directly discarded, thereby reducing the power consumption of the terminal device.

[0057] 205: Wake up the operating system of the first electronic device, so that the operating system of the first electronic device receives and processes the first data packet.

[0058] It can be understood that when it is determined that the first application is in a non-frozen state, or the second electronic device is in the whitelist, it can be determined that the operating system of the first electronic device needs to receive and process the first data packet of the first application, so the first electronic device can wake up the operating system of the first electronic device so that the operating system of the first electronic device receives and processes the first data packet.

[0059] The following is an introduction to the method of setting the blacklist mentioned in the embodiment of the present application. Figure 3 A schematic diagram of a blacklist setting method is shown, and the setting method can be executed by a first electronic device, wherein the first electronic device can be any implementable terminal device such as a smart phone, a tablet computer, a smart wearable device or a personal digital assistant. Figure 3 As shown, the blacklist settings may include:

[0060] 301: Receive a second data packet of a second application sent by a second electronic device.

[0061] It is understandable that the second electronic device may be a third-party server. The second electronic device may be the same electronic device as the second electronic device in the above communication method, or may be a different electronic device.

[0062] It is understood that the first electronic device may be installed with multiple applications, the second application may be any one of the multiple applications installed on the second electronic device, and the second application may be the same application as the first application in the above communication method, or may be a different application. The second data packet may be data required when the second application is in a non-frozen state (such as a foreground running state), for example, when the second application is a browsing application, the second data packet may be data such as a rendered page.

[0063] It can be understood that the second data packet of the second application can be sent by the third-party server to the first electronic device through the third port and the third protocol.

[0064] 302: Determine whether the second application is in a frozen state. If the determination result is yes, go to step 303, otherwise end.

[0065] It can be understood that the second application being in a frozen state may refer to the state of the second application when the first electronic device is in a screen-off state, the state of the second application when the first electronic device is in night mode, or the state of the second application when the second application is switched to the background.

[0066] In some optional examples, when the first electronic device detects that the second application is in a frozen state, step 303 may be executed, i.e., determining whether the consecutive number of times the second electronic device sends the second data packet of the second application is greater than a number threshold. When the first electronic device detects that the second application is in a non-frozen state, step 305 may be executed, i.e., adding the second electronic device to the whitelist.

[0067] 303 : Determine whether the consecutive number of times the second electronic device sends the second data packet of the second application is greater than a number threshold. If the determination result is yes, go to step 304 ; otherwise, go to step 305 .

[0068] It can be understood that the number threshold can be a preset number of times, such as 1 time or 2 times, or other preset numbers, and the embodiments of the present application do not specifically limit this.

[0069] 304: Add the second electronic device to the blacklist.

[0070] It can be understood that when the first electronic device receives the second data packet of the second application sent by the second electronic device N times in a row (such as once or twice), the second electronic device can be added to the blacklist.

[0071] In some optional implementations, the second electronic device may be added to the blacklist by obtaining the third port and the third protocol of the second data packet, matching the third port and the third protocol, and adding them to the filter list to obtain the blacklist. The third port may be any one of ports 8080, 5223, 443, etc., and the third protocol may be any one of protocols such as Transmission Control Protocol (TCP), User Datagram Protocol (UDP), and Internet Control Message Protocol (ICMP).

[0072] For example, when the third port is port 8080 and the third protocol is TCP, port 8080 and TCP can be matched as a piece of data in the filter list.

[0073] In some optional implementations, the third-party server may be added to the blacklist by obtaining the port and protocol of the data packet, matching the port and protocol, and adding the server to the filter list to obtain the blacklist. Figure 4 A statistical diagram of data packets sent based on different ports monitored within a preset time period is shown, such as Figure 4As shown, in the preset time period, the number of data packets sent based on ipv4 (a port connected to the external network) is 2345, the number of data packets sent based on null (a pseudo interface) is 3, and the number of data packets sent based on the ARPRESPONSE port is 1. The following Table 1 shows a statistical list of the operating system of the terminal device that is monitored to send data packets based on different ports and different protocols within the preset time period.

[0074] Table 1

[0075]

[0076]

[0077] As shown in Table 1, the monitoring module (raw_wifi_wakeup) in the first electronic device can detect that at time 2023-06-1104:19:40, the third-party server with the Media Access Control Address (MAC) of 22:00:4a:4f:b5:59 and the Internet Protocol (IP) address of 111.13.143.239 sends the data packet IPV4 TCPPacket1 to the terminal device with the MAC address of b2:07:f0:61:d3:43 and the IP address of 192.168.5.186 based on port 443 and the TCP protocol.

[0078] In an embodiment of the present application, by setting a blacklist on the terminal device, when the terminal device subsequently receives a data packet from a third-party server on the blacklist, it may not be sent to the application in the frozen state, but the data packet may be directly discarded, thereby reducing the power consumption of the terminal device.

[0079] 305: Add the second electronic device to the whitelist.

[0080] In some optional implementations, the third-party server may be added to the whitelist by obtaining the port and protocol of the data packet, matching the port and protocol, and adding the matched port and protocol to the pass list to obtain the whitelist.

[0081] For ease of understanding, the following takes the first electronic device as a terminal device and the second electronic device as a terminal device as an example to introduce the embodiment of the communication method mentioned in the embodiment of the present application, wherein the terminal device may include a wireless communication module, a wireless connection (Wireless fidelity, WiFi) driver, a wake-up monitoring module, a control module and a control delivery module. Figure 5 As shown, the communication method may include:

[0082] 501: The third-party server may send an application data packet to the wireless communication module in the terminal device.

[0083] It can be understood that the third-party server can send application data packets to the wireless communication module in the terminal device.

[0084] It is understandable that the terminal device can be any implementable electronic device such as a smart phone, a tablet computer, a smart wearable device or a personal digital assistant.

[0085] It can be understood that the terminal device can be installed with multiple applications, and the data packet of the application sent by the third-party server to the wireless communication module in the terminal device can be any one of the multiple applications, for example, the first application described above. The data packet of the application can be the data required when the application is in a non-frozen state (such as a foreground running state), for example, when the application is a game application, the data packet of the application can be data such as rendered images and rendered audio, for example, the first data packet described above.

[0086] 502: The wireless communication module receives a data packet of an application sent by a third-party server.

[0087] It can be understood that the wireless communication module can be written into the WiFi firmware. Based on the WiFi firmware, the wireless communication module can execute the operation of discarding the data packet sent by the third-party server, or wake up the operating system to receive and process the data packet.

[0088] 503: The wireless communication module sends the application data packet to the WiFi driver.

[0089] 504: When the WiFi driver detects that the application is in a frozen state, it obtains the protocol of the application's data packet.

[0090] It can be understood that the application being in a frozen state may refer to the state of the application when the terminal device is in a screen-off state, the state of the application when the terminal device is in night mode, or the state of the application when the application is switched to the background.

[0091] In some optional instances, the WiFi driver may extract the protocol of the application data packet from the application data packet, such as the TCP protocol, the UDP protocol, or the ICMP protocol.

[0092] 505: The WiFi driver sends a wake-up exception instruction to the wake-up monitoring module.

[0093] 506: The wake-up monitoring module sends a wake-up exception instruction to the management and control module.

[0094] 507: After receiving the abnormal wake-up instruction, the control module obtains the port of the application data packet.

[0095] It can be understood that the management and control module can obtain the port of the application data packet, such as 8080, 5223 or 443.

[0096] In some optional examples, after receiving the abnormal wake-up instruction, the control module can first determine whether the data packet of the application is a user-perceivable service, such as pausing background playback, downloading, and navigation services. In other words, if the suspension of the service (i.e., discarding the data packet of the application) will be perceived by the user, if the data packet of the application is determined to be a user-imperceivable service, the port of the data packet of the application can be obtained.

[0097] 508: The control module sends the port of the application data packet to the control delivery module.

[0098] 509: The control and delivery module sends the port of the application data packet to the WiFi driver.

[0099] 510: The WiFi driver determines whether the third-party server is in the blacklist based on the port and protocol of the application data packet. If the judgment result is yes, execute step 511, otherwise execute step 512.

[0100] In some optional examples, the method of determining whether the third-party server is in the blacklist may be: matching the port and protocol of the data packet with multiple matching ports and protocols in the filter list to determine whether the third-party server is in the blacklist.

[0101] For example, when the port corresponding to the port of the data packet exists in the filter list, and the protocol corresponding to the protocol of the data packet exists, and the port and the protocol are matched ports and protocols, it can be determined that the third-party server is in the blacklist.

[0102] When the port corresponding to the port of the data packet exists in the filter list, and the protocol corresponding to the protocol of the data packet exists, and the port and protocol are mismatched ports and protocols, it can be determined that the third-party server is not in the blacklist, that is, the third-party server is in the whitelist.

[0103] When the port corresponding to the port of the data packet exists in the filter list, and the protocol corresponding to the protocol of the data packet does not exist, it can be determined that the third-party server is not in the blacklist, that is, the third-party server is in the whitelist.

[0104] When the port corresponding to the port of the data packet does not exist in the filter list, and the protocol corresponding to the protocol of the data packet exists, it can be determined that the third-party server is not in the blacklist, that is, the third-party server is in the whitelist.

[0105] 511: The WiFi driver sends a filtering instruction to the wireless communication module.

[0106] It can be understood that the filtering instruction can instruct the wireless communication module to discard the data packet of the application.

[0107] 512: The WiFi driver wakes up the operating system, so that the operating system receives and processes the application data packet.

[0108] Figure 6 A block diagram of a first electronic device is shown, such as Figure 6 As shown, the first electronic device is a terminal device 610, and the terminal device 610 may include:

[0109] The wireless communication module 621 is used to receive application data packets sent by a third-party server and send application data packets to the WiFi driver 622 .

[0110] The wireless communication module 621 may also be used to discard application data packets sent by a third-party server based on a filtering instruction sent by a WiFi driver.

[0111] In some optional instances, the wireless communication module 621 may be written into WiFi firmware. Based on the WiFi firmware, the wireless communication module 621 may discard data packets sent by a third-party server, or wake up the operating system to receive and process data packets.

[0112] The WiFi driver 622 can be used to detect whether the application is in a frozen state, and can also be used to obtain the port and protocol of the application's data packet, and determine whether the third-party server is in the blacklist based on the port and protocol of the application's data packet, and send a filtering instruction to the wireless communication module 621 when it is determined that the third-party server is in the blacklist.

[0113] It can be understood that the application being in a frozen state may refer to the state of the application when the terminal device 610 is in an off-screen state, the state of the application when the terminal device 610 is in night mode, or the state of the application when the application is switched to the background.

[0114] In some optional instances, the WiFi driver 622 can be used to extract the protocol of the application data packet from the application data packet. For example, the WiFi driver 622 can identify the type of the application data packet, such as TCP protocol, UDP protocol or ICMP protocol. The WiFi driver 622 can be used to obtain the port of the application data packet sent by the control and delivery module, such as 8080, 5223 or 443.

[0115] In some optional examples, the method of determining whether the third-party server is in the blacklist may be: matching the port and protocol of the data packet with multiple matching ports and protocols in the filter list to determine whether the third-party server is in the blacklist.

[0116] For example, when the port corresponding to the port of the data packet exists in the filter list, and the protocol corresponding to the protocol of the data packet exists, and the port and the protocol are matched ports and protocols, it can be determined that the third-party server is in the blacklist.

[0117] When the port corresponding to the port of the data packet exists in the filter list, and the protocol corresponding to the protocol of the data packet exists, and the port and protocol are mismatched ports and protocols, it can be determined that the third-party server is not in the blacklist, that is, the third-party server is in the whitelist.

[0118] When the port corresponding to the port of the data packet exists in the filter list, and the protocol corresponding to the protocol of the data packet does not exist, it can be determined that the third-party server is not in the blacklist, that is, the third-party server is in the whitelist.

[0119] When the port corresponding to the port of the data packet does not exist in the filter list, and the protocol corresponding to the protocol of the data packet exists, it can be determined that the third-party server is not in the blacklist, that is, the third-party server is in the whitelist.

[0120] The WiFi driver 622 may also be used to send a wake-up exception instruction to the wake-up monitoring module 623 .

[0121] The wake-up monitoring module 623 may be configured to receive an abnormal wake-up instruction and report the abnormal wake-up instruction to the control module 624 .

[0122] The control module 624 may be used to obtain the port of the application data packet, such as 8080, 5223 or 443, after receiving the abnormal wake-up instruction. The control module 624 may also be used to send the port of the application data packet to the control delivery module 625.

[0123] The control module 624 can also be used to determine whether the application data packet is a user-perceivable service after receiving the abnormal wake-up instruction, such as pausing background playback, downloading, and navigation services. In other words, if the service is suspended (i.e., the application data packet is discarded), it will be perceived by the user.

[0124] The control and delivery module 625 in the terminal device 610 can send the port of the application data packet to the WiFi driver 622 .

[0125] The software structure of the first electronic device mentioned in this application is introduced below.

[0126] The software structure of the first electronic device and the second electronic device can adopt a layered architecture, an event-driven architecture, a micro-core architecture, a micro-service architecture, or a cloud architecture, etc. The embodiment of the present application takes the layered architecture as an example to illustrate the software structure of the first electronic device and the second electronic device. In some embodiments, the software structure of the first electronic device and the second electronic device can be the same.

[0127] Figure 7 FIG. 1 shows a software structure block diagram of a first electronic device. Figure 7 As shown, in some embodiments, the layered architecture divides the software into several layers, each layer has a clear role 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, namely, the application layer, the application framework layer, the system layer, and the kernel layer.

[0128] The application layer may include a series of application packages. Figure 7 As shown, the application package may include applications such as a power saving wizard.

[0129] The application framework layer provides application programming interface (API) and programming framework for the applications in the application layer. The application framework layer includes some predefined functions. Figure 7 As shown, the application framework layer may include a wireless fidelity (WiFi) manager.

[0130] WiFi managers can include the above Figure 6 The wake-up monitoring module, management and control module and management and control distribution module mentioned.

[0131] Among them, the wake-up monitoring module can receive the wake-up exception instruction sent by the WiFi driver in the kernel layer, and report the wake-up exception instruction to the management and control module. After receiving the wake-up exception instruction, the management and control module can obtain the port of the application's data packet, such as 8080, 5223 or 443, and can send the port of the application's data packet to the management and control sending module. The management and control module can also determine whether the application's data packet is a user-perceivable service after receiving the wake-up exception instruction, such as pausing background playback, downloading, and navigation services. In other words, if the service is suspended (i.e., discarding the application's data packet), it will be perceived by the user. The management and control sending module can send the port of the application's data packet to the WiFi driver in the kernel layer.

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

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

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

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

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

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

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

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

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

[0141] Figure 8 A schematic diagram of the interaction between the kernel layer and the application framework layer is shown, Figure 8As shown, in the kernel layer, the data packet (i.e., message) of the application sent by the third-party server can be sent to the protocol stack. When the protocol stack is abnormal, by judging whether the electronic device is in the screen-off state, or whether it is in the night mode, or whether the application is switched to the background, that is, the screen is on / off / freeze (doze) state / night mode, to judge whether the application is in the frozen state. When the application is in the frozen state, the protocol of the application data packet and the port of the application data packet sent by the application framework layer can be extracted through wlan_filter, and based on the protocol and port of the application data packet, it is judged whether the third-party server is in the blacklist. When the third-party server is judged to be in the blacklist, the ICMP filter switch sends a filtering instruction to the wireless communication module, that is, it is sent to fw. For the message that was not completely filtered out before, there will be relevant maintenance, and the five-tuple of the message will be reported. Monitor whether there are characteristic IPs and ports that frequently wake up the mobile phone. If an abnormality is identified, send a filtering instruction to the wireless communication module. The filtering instruction can refer to the wireless communication module discarding the application data packet.

[0142] The following is an introduction to the hardware structure of electronic equipment. Fig. 9 As shown, the electronic device 900 may include a processor 910, an external memory interface 920, an internal memory 921, a universal serial bus (USB) interface 930, a charging management module 940, a power management module 941, a battery 942, an antenna 1, an antenna 2, a mobile communication module 950, a wireless communication module 960, an audio module 970, a speaker 970A, a receiver 970B, a microphone 970C, an earphone interface 970D, a sensor module 980, a button 990, a motor 991, an indicator, a camera 993, a display screen 994, and a subscriber identification module (SIM) card interface 995, etc. The sensor module 980 may include a pressure sensor 980A, a gyroscope sensor 980B, an air pressure sensor 980C, a magnetic sensor 980D, an acceleration sensor 980E, a distance sensor 980F, a proximity light sensor 980G, a fingerprint sensor 980H, a temperature sensor 980J, a touch sensor 980K, an ambient light sensor 980L, a bone conduction sensor 980M, and the like.

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

[0144] The wireless communication function of the electronic device 900 can be implemented through antenna 1, antenna 2, mobile communication module 950, wireless communication module 960, modem processor and baseband processor.

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

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

[0147] The wireless communication module 960 can provide wireless communication solutions including wireless local area networks (WLAN) (such as wireless fidelity (Wi-Fi) networks), bluetooth (BT), global navigation satellite system (GNSS), frequency modulation (FM), near field communication (NFC), infrared (IR), etc., which are applied to the electronic device 900. The wireless communication module 960 can be one or more devices integrating at least one communication processing module. The wireless communication module 960 receives electromagnetic waves via the antenna 2, modulates the frequency of the electromagnetic wave signal and performs filtering, and sends the processed signal to the processor 910. The wireless communication module 960 can also receive the signal to be sent from the processor 910, modulate the frequency of it, amplify it, and convert it into electromagnetic waves for radiation through the antenna 2.

[0148] In the accompanying drawings, some structural or method features may be shown in a specific arrangement and / or order. However, it should be understood that such a specific arrangement and / or order may not be required. Instead, in some embodiments, these features may be arranged in a manner and / or order different from that shown in the illustrative drawings. In addition, the inclusion of structural or method features in a particular figure does not mean that such features are required in all embodiments, and in some embodiments, these features may not be included or may be combined with other features.

[0149] The various embodiments of the mechanism disclosed in the present application can be implemented in hardware, software, firmware or a combination of these implementation methods. The embodiments of the present application can be implemented as a computer program or program code executed on a programmable system, which includes at least one processor, a storage system (including volatile and non-volatile memory and / or storage elements), at least one input device and at least one output device.

[0150] Program code can be applied to input instructions to perform the functions described in this application and generate output information. The output information can be applied to one or more output devices in a known manner. For the purposes of this application, a processing system includes any system having a processor such as, for example, a digital signal processor (DSP), a microcontroller, an application specific integrated circuit, or a microprocessor.

[0151] Program code can be implemented with high-level programming language or object-oriented programming language to communicate with the processing system. When necessary, program code can also be implemented with assembly language or machine language. In fact, the mechanism described in this application is not limited to the scope of any specific programming language. In either case, the language can be a compiled language or an interpreted language.

[0152] In some cases, the disclosed embodiments may be implemented in hardware, firmware, software, or any combination thereof. The disclosed embodiments may also be implemented as instructions carried or stored on one or more temporary or non-temporary machine-readable (e.g., computer-readable) storage media, which may be read and executed by one or more processors. For example, instructions may be distributed over a network or through other computer-readable media. Therefore, machine-readable media may include any mechanism for storing or transmitting information in a machine (e.g., computer) readable form, including, but not limited to, floppy disks, optical disks, optical disks, read-only memories (CD-ROMs), magneto-optical disks, read-only memories (ROMs), random access memories (RAMs), erasable programmable read-only memories (EPROMs), electrically erasable programmable read-only memories (EEPROMs), magnetic or optical cards, flash memory, or a tangible machine-readable memory for transmitting information (e.g., carrier waves, infrared signals, digital signals, etc.) using the Internet in electrical, optical, acoustic, or other forms of propagation signals. Therefore, machine-readable media include any type of machine-readable media suitable for storing or transmitting electronic instructions or information in a machine (e.g., computer) readable form.

[0153] It should be noted that the units / modules mentioned in the various device embodiments of the present application are all logical units / modules. Physically, a logical unit / module can be a physical unit / module, or a part of a physical unit / module, or can be implemented as a combination of multiple physical units / modules. The physical implementation method of these logical units / modules themselves is not the most important. The combination of functions implemented by these logical units / modules is the key to solving the technical problems proposed by the present application. In addition, in order to highlight the innovative part of the present application, the above-mentioned device embodiments of the present application do not introduce units / modules that are not closely related to solving the technical problems proposed by the present application, which does not mean that there are no other units / modules in the above-mentioned device embodiments.

[0154] It should be noted that in the examples and description of this patent, relational terms such as first and second, etc. are only used to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Moreover, the terms "include", "comprise" or any other variants thereof are intended to cover non-exclusive inclusion, so that a process, method, article or device including a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, article or device. In the absence of further restrictions, the elements defined by the sentence "including one" do not exclude the existence of other identical elements in the process, method, article or device including the elements.

[0155] Although the present application has been illustrated and described with reference to certain preferred embodiments thereof, it will be understood by those skilled in the art that various changes in form and details may be made therein without departing from the scope of the present application.

Claims

1. A communication method, used in a first electronic device, characterized in that: The first electronic device has a first application installed thereon, and The method comprises: receiving a first data packet sent by a second electronic device to the first application; Determining that the first application is in a frozen state, and the sending and receiving relationship between the second electronic device and the first application is in a blacklist; The first data packet is not processed.

2. The method according to claim 1, characterized in that The method further comprises: receiving a second data packet sent by the second electronic device to the first application on the first electronic device; Determining that the first application in the first electronic device is in a frozen state, that the transceiver relationship between the second electronic device and the first application is not in the blacklist, and that the number of consecutive times that the second electronic device sends data packets to the first application on the first electronic device is greater than a number threshold; The sending and receiving relationship between the second electronic device and the first application is added to a blacklist.

3. The method according to claim 2, characterized in that The blacklist includes the correspondence between the protocol and port used by the second electronic device to send a data packet to the first application on the first electronic device and the first application.

4. The method according to claim 3, characterized in that Also includes: Acquire a first protocol and a first port for sending a first data packet by the second electronic device to the first application on the first electronic device; In the blacklist, it is determined that there is a second protocol and a second port corresponding to the first application, which are the same as the first protocol and the first port, and it is determined that the transceiver relationship between the second electronic device and the first application is in the blacklist.

5. The method according to claim 2, characterized in that: The frozen state includes at least one of the following: The first electronic device is in a screen-off state, the first electronic device is in night mode, and the first application is switched to the background.

6. The method according to claim 1, characterized in that The first electronic device is in a screen-off state, and The not processing the first data packet includes: The first data packet is discarded, and the operating system of the first electronic device continues to be in a dormant state.

7. The method according to claim 1, characterized in that The method further comprises: receiving a third data packet sent by the second electronic device to the first application on the first electronic device; Determine that the first application in the first electronic device is in a non-frozen state, and that the transceiving relationship between the second electronic device and the first application is in a blacklist, remove the transceiving relationship between the second electronic device and the first application from the blacklist, and wake up the operating system of the first electronic device so that the operating system of the first electronic device receives and processes the third data packet.

8. The method according to claim 3, characterized in that The protocol includes any one of the transmission control protocol, the user datagram protocol, and the Internet control message protocol.

9. An electronic device, characterized in that: include: A memory, used to store instructions executed by one or more processors of the electronic device, and a processor, which is one of the one or more processors of the electronic device, used to execute the communication method according to any one of claims 1-8.

10. A readable storage medium, characterized in that: The readable storage medium stores instructions, and when the instructions are executed on an electronic device, the electronic device executes the communication method according to any one of claims 1 to 8.