A method for processing application lag and an electronic device

By automatically disconnecting and reconnecting to the network when the electronic device detects abnormal application data, the problem of application lag when switching network modes is solved, enabling timely updates of application data and improving user experience.

CN119255409BActive Publication Date: 2025-11-21HONOR DEVICE CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202410338852.5
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2024-03-20
Publication Date
2025-11-21
Estimated Expiration
2044-03-20

AI Technical Summary

Technical Problem

When electronic devices switch network modes, applications running in the foreground may experience lag, affecting the user experience. This is because the application cannot receive data updates from the application server in a timely manner, resulting in abnormal application data transmission.

Method used

When an application data anomaly is detected, the electronic device automatically disconnects from the current network connection and reconnects to ensure that the application server can update the address of the application data in a timely manner and establish a socket connection through the new path to ensure timely data transmission.

Benefits of technology

It improved the timely update capability of application data, reduced application lag time, and enhanced the user experience.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119255409B_ABST
    Figure CN119255409B_ABST
Patent Text Reader

Abstract

The application discloses an application lag processing method and an electronic device, and relates to the terminal field. The method comprises the following steps: running a first application in the foreground of the electronic device; listening to whether application data of the first application is abnormal during the running of the first application in the foreground; wherein the abnormal application data of the first application will cause the first application to lag; and automatically disconnecting a network currently connected by the electronic device and reconnecting the network in the case that the application data of the first application is abnormal. Automatically disconnecting the network currently connected by the electronic device and reconnecting the network can make an application server update the address of the feedback application data in time, which improves the timeliness of the address update of the feedback application data, and then the application can receive the application data sent by the application server in time, the application can update the application data to be output in time, the application lag time is reduced, and the user experience is improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the field of terminals, and more particularly to an application lag handling method and an electronic device. Background Technology

[0002] Electronic devices install various applications based on user needs, and the smoothness of application operation affects the user experience.

[0003] When an electronic device has an application running and connected to the internet, users can access network-enabled functions within the application. However, when the electronic device switches network modes, applications running in the foreground may experience lag, impacting the user experience.

[0004] For example, taking gaming applications as an example, when an electronic device is connected to Wi-Fi, it can play games under the user's control. When the electronic device disconnects from Wi-Fi and switches to mobile data, the game running in the foreground may experience lag, affecting the user experience. Summary of the Invention

[0005] This application provides an application lag handling method and electronic device to reduce application lag time and improve user experience.

[0006] To achieve the above objectives, the embodiments of this application adopt the following technical solutions:

[0007] In a first aspect, an application lag handling method is provided for an electronic device. The method includes: running a first application in the foreground of the electronic device; monitoring whether the application data of the first application is abnormal during the operation of the first application in the foreground; wherein, abnormal application data of the first application will cause the first application to lag; and automatically disconnecting the network currently connected to the electronic device and reconnecting to the network when the application data of the first application is abnormal.

[0008] In this application, automatically disconnecting the network currently connected to the electronic device and reconnecting to the network enables the application server to update the address of the feedback application data in a timely manner. This improves the timeliness of the address update of the feedback application data, so that the application can receive the application data sent by the application server in a timely manner, and the application can update the application data to be output in a timely manner, reducing application lag time and improving user experience.

[0009] In one possible implementation of the first aspect, the first application is the application corresponding to the application identifier in the application list; wherein the application list includes at least one application identifier, and the application identifier and the application correspond one-to-one.

[0010] The applications applicable to this application may not be all applications, but rather some preset applications.

[0011] In one possible implementation of the first aspect, monitoring whether the application data of the first application is abnormal includes: monitoring whether the ratio of abnormal data packets of the first application to all data packets of the first application within the preset time exceeds an abnormal threshold; wherein, if the ratio of abnormal data packets of the first application to all data packets of the first application within the preset time exceeds the abnormal threshold, then the application data is abnormal.

[0012] That is, the electronic device can monitor all data packets in the application data of the first application to determine whether the application data of the first application is abnormal.

[0013] In one possible implementation of the first aspect, monitoring whether the application data of the first application is abnormal includes: monitoring whether the key flow in the application data of the first application is abnormal; wherein, the key flow includes multiple key data packets, and the key data packets are data packets in which the data content is a feature field.

[0014] In other words, electronic devices can monitor critical flows in the application data of the first application to determine whether the application data of the first application is abnormal. This can improve the efficiency of application data anomaly detection.

[0015] In one possible implementation of the first aspect, monitoring whether the application data of the first application is abnormal includes: monitoring whether the ratio of the critical data packet of the first application that is abnormal to all critical data packets of the first application within the preset time exceeds an abnormal threshold; wherein, the critical data packet is a data packet of the first application containing a data content that is a feature field; wherein, if the ratio of the critical data packet of the first application that is abnormal to all critical data packets of the first application within the preset time exceeds the abnormal threshold, then the application data is abnormal.

[0016] In other words, electronic devices can monitor key data packets in the application data of the first application to determine whether the application data of the first application is abnormal. This can improve the efficiency of application data anomaly detection.

[0017] In one possible implementation of the first aspect, the method further includes: stopping the operation of monitoring whether the application data in the first application is abnormal if a preset monitoring time has been exceeded.

[0018] In this application, considering that if the application runs stably without lag within a certain period of time, it is likely to remain in a stable running state thereafter, so it is no longer necessary to monitor whether the application data is abnormal. This can reduce the computational power consumption caused by electronic devices monitoring application data anomalies.

[0019] In one possible implementation of the first aspect, while the first application is running in the foreground, monitoring whether the application data of the first application is abnormal includes: monitoring whether the application data of the first application is abnormal when the network mode is switched while the first application is running in the foreground; or; monitoring whether the application data of the first application is abnormal when the first application is running in the foreground and connected to the first network.

[0020] This means that the electronic device can only start listening for abnormal application data when it detects that the application is running in the foreground and is currently connected to the network, or the electronic device can only start listening for abnormal application data when it detects that the application is running in the foreground and the network mode has switched.

[0021] It's understandable that the IP address range (network segment) differs between different network modes, causing changes in the IP address of electronic devices. Because the IP address of the electronic device changes, the IP address in the socket corresponding to the process also needs to be changed, and the IP address of the electronic device in the application data request will also change accordingly. If the application server cannot establish the latest socket based on the changed application data request in a timely manner, problems can easily arise in the application server's transmission of application data to the electronic device, such as the application server being unable to transmit application data to the electronic device. The application layer only triggers the kernel layer to listen for application data anomalies when it detects that the application is running in the foreground and a network mode switch has occurred. This more accurately locates the detection time for application data transmission anomalies and further shortens the detection time, thus improving the efficiency of application data anomaly detection. The application layer only triggers the kernel layer to listen for application data anomalies when it detects that the application is running in the foreground and a network mode switch has occurred. This more accurately locates the detection time for packet transmission anomalies and further shortens the detection time, thus improving the efficiency of application data anomaly detection.

[0022] In one possible implementation of the first aspect, the automatic disconnection of the network currently connected to the electronic device and the reconnection to the network includes: turning off and then turning on the network's service switch.

[0023] In one possible implementation of the first aspect, the data packet of the first application is socket data including the application identifier of the first application, and the socket data is data transmitted through a socket application programming interface.

[0024] In one possible implementation of the first aspect, the electronic device includes an application layer and a kernel layer; the step of monitoring whether the application data of the first application is abnormal during the foreground operation of the first application includes: the application layer sending a monitoring instruction to the kernel layer during the foreground operation of the application. The monitoring instruction is used to instruct the monitoring of the application data of the application to determine whether the application data is abnormal; the kernel layer receives the monitoring instruction and determines whether the application data is abnormal.

[0025] In one possible implementation of the first aspect, the step of automatically disconnecting the network currently connected to the electronic device and reconnecting to the network when the application data of the first application is abnormal includes: when the kernel layer reports the application data abnormality information to the application layer, the application layer receives the application data abnormality information reported by the kernel layer, and shuts down and restarts the service switch of the current network.

[0026] In a second aspect, an electronic device is provided, comprising a processor and a memory; the memory is used to store code instructions; the processor is used to execute the code instructions to perform an application stuttering handling method as described in any of the possible design embodiments of the first aspect.

[0027] Thirdly, a computer-readable storage medium is provided that stores instructions which, when executed on a computer, cause the computer to perform an application stuttering handling method as described in any of the possible design embodiments of the first aspect.

[0028] Fourthly, a computer program product is provided, including a computer program / instructions that, when executed by a processor, implement the application stuttering processing method in either the first or second aspect of the design.

[0029] The technical effects of any of the design methods in the second to fourth aspects can be found in the technical effects of different design methods in the first aspect, and will not be repeated here. Attached Figure Description

[0030] Figure 1 A schematic diagram illustrating the principle of game data transmission based on sockets is shown.

[0031] Figure 2 This diagram illustrates another method of transmitting game data based on sockets.

[0032] Figure 3 This diagram illustrates yet another method of transmitting game data based on sockets.

[0033] Figure 4A schematic diagram of the structure of a mobile phone 100 provided in an embodiment of this application is shown;

[0034] Figure 5 A software structure block diagram of a mobile phone 100 provided in an embodiment of this application is shown;

[0035] Figure 6 A flowchart illustrating an application stuttering handling method is shown;

[0036] Figure 7 A block diagram of a network transmission protocol structure provided in an embodiment of this application is shown;

[0037] Figure 8 This diagram illustrates the interface changes of an electronic device that displays the switch for turning current network services off and on again.

[0038] Figure 9 A flowchart illustrating another method for handling application stuttering is shown. Detailed Implementation

[0039] The following is a brief overview of the terminology used in the embodiments of this application.

[0040] (1) IP address: An Internet Protocol (IP) address is a set of digital identifiers used on the Internet to identify and locate electronic devices. As an identity identifier, it enables electronic devices to communicate and exchange data over the network. For example, in this embodiment, a mobile phone sends a game data request to a game application server, and the game data request may carry the mobile phone's IP address. In response to the game data request, the game application server can send game data to the mobile phone based on the mobile phone's IP address carried in the game data request.

[0041] In a network environment, IP addresses are usually dynamically assigned, and electronic devices obtain a different IP address each time they connect to the Internet.

[0042] (2) Port: A port is a string of numbers used to uniquely identify a process in an electronic device. This string of numbers allows the electronic device to find the process of a certain application and send application data to that process. For example, in this embodiment of the application, after the mobile phone obtains game data from the game application server, it can find the mobile phone's game application process through the port and send the game data to that process.

[0043] (3) Socket. A socket, also known as a network socket, is essentially an Application Programming Interface (API). A socket corresponds to a process, and it can include an IP address and port information. An electronic device can use a socket to locate a process within another electronic device and send feedback data to that process. An application can correspond to multiple processes. For example, in this embodiment, a game application server can send game data to the process corresponding to the game application on a mobile phone through the socket corresponding to the game application.

[0044] For example, Figure 1 This diagram illustrates the principle of socket-based transmission of game data. Figure 1 As shown in the diagram, the figure includes a mobile phone 100 and a game application server system 200. The mobile phone 100 hosts a game application, and the game application server system 200 may include multiple game application servers (…). Figure 1 Examples of game application servers 200-1 and 200-2 are provided. Mobile phone 100 and game application server system 200 can transmit game application-related instructions and data to each other.

[0045] For example, in response to a user's action of starting a game, mobile phone 100 activates the game function. At this time, mobile phone 100 can establish a battle stream process and generate a socket corresponding to the battle stream process. The battle stream refers to the game data generated by multiple game characters during gameplay. Furthermore, mobile phone 100 sends a battle stream request to the game application server system 200 based on the socket corresponding to the battle stream process. This socket includes the IP address of the game application server system 200, the IP address of mobile phone 100, and the port of mobile phone 100's battle stream process. Since the battle stream request also includes the IP address of the game application server system 200, the IP address of the mobile phone 100, and the port of the battle stream process of the mobile phone 100, the game application server system 200, upon receiving the battle stream request, can establish a socket corresponding to the socket of the battle stream process of the mobile phone 100 based on the battle stream request. This socket can include the IP address of the mobile phone 100 and the port of the battle stream process of the mobile phone 100 from the battle stream request. The game application server system 200 can then locate the battle stream process of the mobile phone 100 based on this socket and send battle stream updates to the battle stream process of the mobile phone 100.

[0046] For example, in response to a user's action of enabling the microphone function in a game, mobile phone 100 enables the microphone function in the game. At this time, mobile phone 100 can establish an audio stream process and generate a corresponding socket for the audio stream process. The audio stream refers to the audio data of the players using their microphones to communicate during gameplay. Furthermore, mobile phone 100 will send an audio stream request to the game application server system 200 based on the socket corresponding to the audio stream process. This socket includes the IP address of the game application server system 200, the IP address of mobile phone 100, and the port of mobile phone 100's audio stream process. Since the audio stream request also includes the IP address of the game application server system 200, the IP address of the mobile phone 100, and the port of the audio stream process of the mobile phone 100, the game application server system 200, upon receiving the audio stream request, can establish a socket corresponding to the socket of the audio stream process of the mobile phone 100 based on the audio stream request. This socket can include the IP address of the mobile phone 100 and the port of the audio stream process of the mobile phone 100 from the audio stream request. The game application server system 200 can then locate the audio stream process of the mobile phone 100 based on this socket and send the audio stream back to the audio stream process of the mobile phone 100.

[0047] It's understandable that an application's data can include multiple types of data streams. For example, a game application might include data streams such as battle streams and audio streams. One type of data stream in an application can correspond to one data stream process. Since one socket corresponds to one process, in this case, one type of data stream in the application corresponds to one socket. (The above text...) Figure 1 Taking the battle flow as an example, one battle flow can correspond to one battle flow process, one battle flow process corresponds to one socket, and one battle flow corresponds to one socket.

[0048] It's understandable that one data stream in an application can correspond to multiple data stream processes. Since one socket corresponds to one process, in this case, one data stream in the application corresponds to multiple sockets. In this way, one data stream in the application can be transmitted synchronously in multiple processes, improving the data transmission rate. (The above text...) Figure 1 Taking the battle flow as an example, one battle flow can correspond to multiple battle flow processes, one battle flow process corresponds to one socket, and one battle flow can correspond to multiple sockets.

[0049] Wi-Fi and mobile networks are commonly used wireless network connection methods in daily life. The following sections will introduce Wi-Fi and mobile networks respectively.

[0050] (4) Wi-Fi. Wi-Fi is a wireless local area network technology that uses radio waves to connect devices to the Internet. Wi-Fi uses a wireless router as a central device to transmit data via wireless signals. When an electronic device connects to a Wi-Fi network, the electronic device is actually connecting to a wireless router, which then connects to the Internet. Wireless networks usually refer to Wi-Fi.

[0051] (5) Mobile Networks: Mobile networks are a communication technology that uses wireless signals provided by mobile network operators to connect electronic devices to the Internet. Essentially, it refers to the technology of data transmission via mobile communication networks (such as 2G, 3G, 4G, 5G, etc.). Mobile networks use electronic device signal towers as central devices, transmitting data between different base stations based on radio waves. Cellular networks are one type, dividing an area into multiple cells based on the coverage of base stations to achieve data transmission. Satellite networks, on the other hand, transmit data via satellites, offering wider coverage but at relatively slower speeds.

[0052] As described in the background section, once an electronic device has an application running and connected to the network, it can use network-required functions within the application under the user's control. However, when the electronic device switches network modes, the application running in the foreground may experience lag, impacting the user experience.

[0053] Currently, technicians have discovered that the lag experienced by foreground applications after switching network modes on electronic devices is due to the devices' inability to receive corresponding application data after the network mode switch. The specific possible reasons are as follows:

[0054] (1) When an electronic device switches network modes, its IP address changes. For example, if the electronic device was previously using a mobile network and is now switching to a wireless network (e.g., Wi-Fi), the IP address will change after switching because different network modes have different IP address ranges (network segments). Conversely, if the electronic device was previously using a wireless network and is now switching to a mobile network, the IP address will also change due to the different IP address ranges (network segments) of different network modes. Because the electronic device's IP address changes, the IP address in the socket corresponding to the process also needs to change. That is, the socket corresponding to the application process in the electronic device will change from the original socket1 to socket2, where the IP addresses in socket1 and socket2 are different. The electronic device will send application data requests to the application server based on the latest socket, i.e., based on socket2. If the application server malfunctions at this point, it will be unable to receive the latest application data requests and will be unable to establish a new socket (i.e., the socket corresponding to socket2) corresponding to the socket of the audio stream process on mobile phone 100 based on the latest application data requests. This newest socket includes the latest IP address of mobile phone 100 and the port of the audio stream process on mobile phone 100 from the latest application data requests. Thus, because the latest address used by the application server to feedback application data is not updated in time, the application server cannot send application data to the corresponding process of the application on the electronic device. Consequently, the application cannot update the application data it needs to output in a timely manner, such as failing to update the display interface in a timely manner, leading to application lag.

[0055] For example, in combination Figure 1 , Figure 2 This diagram illustrates another method of game data transmission based on sockets. Besides... Figure 1 In addition to the mobile phone 100 and the game application server system 200 shown, such as Figure 2 As shown, the mobile phone 100 and the game application server system 200 may also include multiple network transmission nodes. Figure 2 The circles in the diagram are used to schematically represent network transmission nodes. Any number of network transmission nodes can form a path for transmitting game application-related commands and / or data. Figure 2 The example shows four paths schematically represented by solid lines: path 1, path 2, path 3, and path 4, but is not limited to these.

[0056] like Figure 2As shown in (a), when mobile phone 100 responds to user operations and runs a game application in the foreground, if mobile phone 100 switches network modes, the game application server 200-1 malfunctions. Game application server 200-1 cannot listen for the latest battle stream requests and cannot establish a new socket (i.e., the socket corresponding to socket2) corresponding to the socket of mobile phone 100's game data process based on the latest application data request. This new socket includes the latest IP address of mobile phone 100 in the latest battle stream request and the port of mobile phone 100's game data process. Therefore, game application server 200-1 cannot send game data (such as the battle stream described above) to the process corresponding to the game application on mobile phone 100 (such as the battle stream process described above). The game application cannot update the game data to be output in a timely manner, resulting in application lag, such as the inability to update the game interface in a timely manner. The mobile phone can also display lag prompts, for example, mobile phone 100 displays buffer indicator 10. It can be understood that lag prompts can be indicated by buffer indicators or text messages, but are not limited to these.

[0057] (2) Due to the switching of network modes by the electronic device, the IP address in the socket corresponding to the process changes, and the socket corresponding to the application process in the electronic device changes from the original socket1 to socket2. The electronic device will send application data requests to the application server based on the latest socket, i.e., based on socket2. However, if the network transmission node (e.g., router, base station, etc.) that transmits data and / or instructions between the electronic device and the application server malfunctions, for example, if the network transmission node intercepts the transmission of application data requests, the application server will not be able to listen for the latest application data requests and will not be able to establish the latest socket corresponding to the socket corresponding to the game data process of mobile phone 100 (i.e., the socket corresponding to socket2) based on the latest application data requests. This latest socket includes the latest IP address of mobile phone 100 and the port of the game data process of mobile phone 100 in the latest application data requests. In this way, since the latest address used by the application server to feed back application data is not updated in time, the application server cannot send application data to the application process corresponding to the application on the electronic device, and the application cannot update the application data that needs to be output in time, resulting in application lag.

[0058] For example, in combination Figure 2 , Figure 3 This diagram illustrates yet another method of transmitting game data based on sockets. Figure 3As shown in (a), when mobile phone 100 responds to user operation and is running a game application in the foreground, if mobile phone 100 switches network modes, a network transmission node in path 1 intercepts the transmission of the latest battle stream request. Thus, the application server cannot listen for the latest battle stream request and cannot establish a new socket corresponding to the socket corresponding to the game data process of mobile phone 100 (i.e., the socket corresponding to socket2). This new socket includes the latest IP address of mobile phone 100 in the latest battle stream request and the port of the game data process of mobile phone 100. Game application server 200-1 cannot send game data (such as the battle stream described above) to the process corresponding to the game application of mobile phone 100 (such as the battle stream process described above). The game application cannot update the game data to be output in a timely manner, resulting in application lag, such as the inability to update the game interface in a timely manner. Similarly, the mobile phone can also display lag information, for example, mobile phone 100 displays buffer indicator 10.

[0059] To address this technical problem, this application proposes an application lag handling method. When an application is installed on an electronic device and is running in the foreground, if the electronic device detects that the application cannot receive corresponding application data, it can automatically disconnect from the currently connected network and reconnect to it. For example, if the electronic device detects a network mode switch while the application is running in the foreground, it can check whether the application data (such as data stream) of the application running in the foreground is abnormal. If abnormal, it automatically disconnects from the currently connected network and reconnects to it.

[0060] Thus, after the electronic device reconnects to the current network, it can send the latest application data request to the application server via a new path. Since the application server found through the new path may not be the original one that couldn't receive or listen for the latest application data request—meaning the new application server is generally capable of receiving such requests—it can establish a new socket based on the latest application data request sent by the electronic device and send application data to the device using that socket. This improves the timeliness of address updates for feedback application data, allowing the application to update its output data promptly, reducing application lag and improving the user experience.

[0061] For example, such as Figure 2As shown in (b), taking the mobile network currently connected to mobile phone 100 as an example, to solve the game application lag problem mentioned above, mobile phone 100 can automatically turn off and then turn on the mobile network function. This allows mobile phone 100 to refresh the mobile network. After restarting the mobile network function, mobile phone 100 can switch the path from path 1 to path 3. Mobile phone 100 can then send game data requests to game application server 200-2 through the new path 3. Since the application server found through the new path 3 is not the original game application server 200-1 that could not receive the latest battle stream requests, the replaced game application server 200-2 can receive battle stream requests. Therefore, game application server 200-2 found through the new path 3 can establish a new socket based on the latest battle stream request sent by mobile phone 100 and send game data to mobile phone 100 based on this latest socket. In this way, the game application can update the game data to be output in a timely manner, avoiding lag. Additionally, mobile phone 100 can also disable the display of buffer flag 10.

[0062] Similarly, after an electronic device reconnects to the current network, it can send the latest application data request to the application server via a new path. Since the network transmission node intercepting the latest battle flow request may not be on the new path, the electronic device can transmit the latest application data request to the application server through the new path. The application server can then establish a new socket based on the latest application data request and send application data to the electronic device based on the new socket. This improves the timeliness of address updates for feedback application data, allowing the application to update the application data to be output promptly, reducing application lag time and improving user experience.

[0063] For example, such as Figure 3As shown in (b), taking the mobile network currently connected to mobile phone 100 as an example, to solve the aforementioned game application lag problem, mobile phone 100 can automatically turn off and then turn on the mobile network function. This allows mobile phone 100 to refresh the mobile network. After restarting the mobile network function, mobile phone 100 can switch the path from path 1 to path 2. Mobile phone 100 can then send game data requests to game application server 200-2 via the new path 2. Since the network transmission node intercepting the latest battle flow request is not in path 2, the electronic device can transmit the latest battle flow request to the application server via path 2. Game application server 200-1, found through the new path 2, can then establish a new socket based on the latest battle flow request sent by mobile phone 100 and send game data to mobile phone 100 based on the new socket. The game application can then update the game data to be output in a timely manner, avoiding lag. Additionally, mobile phone 100 can also disable the display of buffer flag 10.

[0064] In this application embodiment, the aforementioned electronic device can be a device with communication capabilities and capable of running applications. Exemplary examples include, but are not limited to, mobile phones, tablets, desktop computers, laptop computers, handheld computers, ultra-mobile personal computers (UMPCs), in-vehicle devices, smart home devices, and / or smart city devices. This application embodiment does not impose any special limitations on the specific type of electronic device.

[0065] Please refer to Figure 4 This is a schematic diagram of the structure of the mobile phone 100 provided in the embodiments of this application.

[0066] like Figure 4 As shown, the mobile phone 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, a display screen 170, etc.

[0067] It is understood that the structure illustrated in this embodiment does not constitute a specific limitation on the mobile phone 100. In other embodiments, the mobile phone 100 may include more or fewer components than illustrated, or combine some components, or split some components, or have different component arrangements. The illustrated components may be implemented in hardware, software, or a combination of software and hardware.

[0068] Processor 110 may include one or more processing units, such as: application processor (AP), modem processor, graphics processing unit (GPU), image signal processor (ISP), controller, memory, video codec, digital signal processor (DSP), baseband processor, and / or neural network processing unit (NPU), etc. The different processing units may be independent devices or integrated into one or more processors.

[0069] In this embodiment, an application is installed on the mobile phone 100. While the application is running in the foreground, if the mobile phone 100 detects that the application cannot receive application data, the processor 110 can automatically disconnect from the currently connected network and reconnect to it. After reconnecting to the current network, the processor 110 can send an application data request carrying the latest socket to the application server via a new path through the communication module to avoid application lag. This communication module can be the module corresponding to the currently connected network. For example, if the current connection is to a wireless network, the communication module is the wireless communication module 160; if the current connection is to a mobile network, the communication module is the mobile communication module 150.

[0070] The controller can be the nerve center and command center of the mobile phone 100. The controller can generate operation control signals based on the instruction operation code and timing signals to complete the control of fetching and executing instructions.

[0071] The processor 110 may also include a memory for storing instructions and data. In some embodiments, the memory in the processor 110 is a cache memory. This memory can store instructions or data that the processor 110 has just used or that are used repeatedly. If the processor 110 needs to use the instruction or data again, it can retrieve it directly from the memory. This avoids repeated accesses, reduces the waiting time of the processor 110, and thus improves the efficiency of the system.

[0072] In some embodiments, the processor 110 may include one or more interfaces. Interfaces may include an I2C interface, an inter-integrated audio (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 subscribing identity module (SIM) interface, and / or a USB interface, etc.

[0073] The external storage interface 120 can be used to connect an external storage card, such as a Micro SD card, to expand the storage capacity of the mobile phone 100. The external storage card communicates with the processor 110 through the external storage interface 120 to perform data storage functions. For example, music, video, and other files can be saved on the external storage card.

[0074] The internal memory 121 can be used to store computer executable program code, which includes instructions. The processor 110 executes various functional applications and data processing of the mobile phone 100 by running the instructions stored in the internal memory 121. For example, in this embodiment, the processor 110 can execute instructions stored in the internal memory 121, which may include a program storage area and a data storage area.

[0075] The program storage area can store the operating system, at least one application program required for a function (such as sound playback function, image playback function, etc.). The data storage area can store data created during the use of the mobile phone 100 (such as audio data, phonebook, etc.). In addition, the internal memory 121 may include high-speed random access memory, and may also include non-volatile memory, such as at least one disk storage device, flash memory device, universal flash storage (UFS), etc.

[0076] USB port 130 is a USB standard compliant interface, specifically a Mini USB port, Micro USB port, USB Type-C port, etc. USB port 130 can be used to connect a charger to charge electronic device 100, and can also be used for data transfer between electronic device 100 and peripheral devices. It can also be used to connect headphones for audio playback. This interface can also be used to connect other electronic devices, such as AR devices.

[0077] It is understood that the interface connection relationships between the modules illustrated in the embodiments of the present invention are merely illustrative and do not constitute a structural limitation on the electronic device 100. In other embodiments of this application, the electronic device 100 may also employ different interface connection methods or combinations of multiple interface connection methods as described in the above embodiments.

[0078] The charging management module 140 receives charging input from a charger, which can be a wireless charger or a wired charger. While charging the battery 142, the charging management module 140 can also supply power to the electronic device via the power management module 141.

[0079] The power management module 141 is used to connect the battery 142, the charging management module 140, and the processor 110. The power management module 141 receives input from the battery 142 and / or the charging management module 140 to power the processor 110, internal memory 121, display screen 170, and wireless communication module 160, etc. In some embodiments, the power management module 141 and the charging management module 140 may also be housed in the same device.

[0080] The wireless communication function of electronic device 100 can be realized through antenna 1, antenna 2, mobile communication module 150, wireless communication module 160, modem processor and baseband processor, etc.

[0081] Antenna 1 and antenna 2 are used to transmit and receive electromagnetic wave signals. Each antenna in electronic device 100 can be used to cover one or more communication frequency bands. Different antennas can also be multiplexed to improve antenna utilization. For example, antenna 1 can be multiplexed as a diversity antenna for a wireless local area network. In some other embodiments, the antennas can be used in conjunction with tuning switches.

[0082] The mobile communication module 150 can provide solutions for wireless communication, including 2G / 3G / 4G / 5G, applied to the electronic device 100. The mobile communication module 150 may include at least one filter, switch, power amplifier, low-noise amplifier (LNA), etc. The mobile communication module 150 can receive electromagnetic waves via antenna 1, and perform filtering, amplification, and other processing on the received electromagnetic waves before transmitting them to a modem processor for demodulation. The mobile communication module 150 can also amplify the signal modulated by the modem processor and convert it into electromagnetic waves for radiation via antenna 1. In some embodiments, at least some functional modules of the mobile communication module 150 may be housed in the processor 110. In some embodiments, at least some functional modules of the mobile communication module 150 and at least some modules of the processor 110 may be housed in the same device.

[0083] The modem processor may include a modulator and a demodulator. The modulator modulates the low-frequency baseband signal to be transmitted into a mid-to-high frequency signal. The demodulator demodulates 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 processing by the baseband processor, the low-frequency baseband signal is transmitted to the application processor. The application processor outputs sound signals through an audio device (not limited to speaker 170A, receiver 170B, etc.) or displays images or videos through the display screen 194. In some embodiments, the modem processor may be a separate device. In other embodiments, the modem processor may be independent of the processor 110 and may be housed in the same device as the mobile communication module 150 or other functional modules.

[0084] The wireless communication module 160 can provide solutions for wireless communication applications on the electronic device 100, including wireless local area networks (WLANs) (such as Wi-Fi), Bluetooth (BT), Global Navigation Satellite System (GNSS), Frequency Modulation (FM), Near Field Communication (NFC), and Infrared (IR). The wireless communication module 160 can be one or more devices integrating at least one communication processing module. The wireless communication module 160 receives electromagnetic waves via antenna 2, modulates and filters the electromagnetic wave signals, and sends the processed signal to processor 110. The wireless communication module 160 can also receive signals to be transmitted from processor 110, modulate and amplify them, and then convert them into electromagnetic waves for radiation via antenna 2.

[0085] In some embodiments, antenna 1 of electronic device 100 is coupled to mobile communication module 150, and antenna 2 is coupled to wireless communication module 160, enabling electronic device 100 to communicate with networks and other devices via wireless communication technology. The wireless communication technology may include Global System for Mobile Communications (GSM), General Packet Radio Service (GPRS), Code Division Multiple Access (CDMA), Wideband Code Division Multiple Access (WCDMA), Time Division Code Division Multiple Access (TD-SCDMA), Long Term Evolution (LTE), BT, GNSS, WLAN, NFC, FM, and / or IR technologies, etc. The GNSS may include the Global Positioning System (GPS), the Global Navigation Satellite System (GLONASS), the BeiDou Navigation Satellite System (BDS), the Quasi-Zenith Satellite System (QZSS), and / or satellite-based augmentation systems (SBAS).

[0086] The mobile phone 100 implements display functions through a GPU, a display screen 170, and an application processor. The GPU is a microprocessor for image processing, connected to the display screen 170 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, which execute program instructions to generate or modify display information.

[0087] The display screen 170 is used to display images, videos, etc. The display screen 170 includes a display panel. In this embodiment, the display screen 170 can display application icons, screenshots of application functions executed under user operation, application lag information, etc.

[0088] The software system of mobile phone 100 can adopt a layered architecture, event-driven architecture, microkernel architecture, microservice architecture, or cloud architecture. This embodiment of the invention uses the layered architecture Android system as an example to illustrate the software structure of mobile phone 100.

[0089] Figure 5 This is a software structure block diagram of the mobile phone 100 according to an embodiment of this application.

[0090] A layered architecture divides software into several layers, each with a clear role and function. 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 system libraries, and the kernel layer.

[0091] The application layer can include a series of application packages. For example... Figure 5 As shown, the application package may include applications such as camera, gallery, calendar, call, map, navigation, WLAN, Bluetooth, music, video, and SMS.

[0092] In this embodiment, the application layer can be used to detect applications displayed and running on the display screen 170, or in other words, to detect applications running in the foreground. Upon detecting an application running in the foreground, the application layer will listen to that application. Specifically, in some embodiments, the application layer can send a listening instruction to the kernel layer. This listening instruction instructs the kernel layer to listen to the application and determine if the application data is abnormal. For example, the listening instruction may include the application's identifier.

[0093] Furthermore, in some embodiments, the application is only monitored if the foreground application is one of the applications in the application identifier list. Specifically, in this embodiment, the application layer can be used to detect applications displayed and running on the display screen 170, or applications running in the foreground, and determine whether the application is one to be monitored. In some embodiments, the application layer stores a list of application identifiers for applications to be monitored. The application layer can match the application identifier of the currently displayed and running application with the application identifiers in the application identifier list. If the application identifier of the currently displayed and running application exists in the application identifier list, then the currently displayed and running application is determined to be one to be monitored. If the currently displayed and running application is one to be monitored, a monitoring instruction is sent to the kernel layer.

[0094] The application framework layer provides application programming interfaces (APIs) and a programming framework for applications in the application layer. The application framework layer includes some predefined functions.

[0095] likeFigure 5 As shown, the application framework layer may include a window manager, content provider, view system, phone manager, resource manager, notification manager, etc.

[0096] System libraries can include multiple functional modules. For example: surface manager, media libraries, 3D graphics processing libraries (e.g., OpenGL ES), 2D graphics engines (e.g., SGL), etc.

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

[0098] In this embodiment, the kernel layer can receive a listening instruction sent by the application layer. In response, the kernel layer can determine whether the application data of the application to be monitored is abnormal. It is understood that application data includes multiple data packets. In some embodiments, the kernel layer can determine the proportion of abnormal data packets among all data packets of the application to be monitored. If the kernel layer determines that the ratio of abnormal data packets to all data packets of the application to be monitored exceeds an abnormality threshold, it considers an anomaly and can report the anomaly information to the application layer. Upon receiving the anomaly information from the kernel layer, the application layer can automatically disconnect the currently connected network and reconnect to it by turning the current network service switch off and on again.

[0099] It's understandable that a mobile phone running an application can generate multiple data streams; that is, application data for a single application can include various types of data streams. For example, when a mobile phone runs a game application, it can generate a battle stream formed by the players during gameplay and an audio stream formed by their communication during gameplay. If the audio stream in the game application is choppy, but the battle stream is smooth, it generally doesn't significantly affect the user's gaming experience. However, if the audio stream is smooth but the battle stream is choppy, the players cannot continue playing, which greatly impacts the user's gaming experience. Therefore, the application layer can instruct the kernel layer to focus on monitoring the data streams that significantly affect the user's experience of using the application smoothly; these data streams can be called critical streams. In other words, the kernel layer can determine whether the critical streams of the application being monitored are abnormal.

[0100] It's understandable that application data comprises multiple data packets. Each type of data stream also consists of multiple data packets with the same characteristics. The kernel layer can specifically monitor whether the data packets of a critical flow are abnormal to determine if the critical flow is abnormal. For example, it can determine the percentage of abnormal data packets within a critical flow out of all data packets. If the percentage exceeds an abnormality threshold, the critical flow of the application being monitored is considered abnormal.

[0101] One implementation of determining whether a data packet is a critical flow data packet (simplified as a critical data packet in this application) is as follows: data packets in the data packets of the first application whose data content is a feature field are identified as critical data packets, and data packets in the data packets of the first application whose data content is not a feature field are identified as non-critical data packets; that is, critical data packets are data packets in the data packets of the first application whose data content is a feature field.

[0102] Specifically, in some embodiments, it is determined whether the first N bytes of a data packet in the application data are a feature field. If the first N bytes of a data packet are a feature field, then the data packet is determined to be a critical data packet.

[0103] It is understood that, in some embodiments, in order to determine critical data packets, the aforementioned monitoring instruction may carry a feature field in addition to the application identifier. This feature field is used by the kernel layer to identify critical data packets in the application data. The feature field carried in the monitoring instruction can be one or more. If the feature field carried in the monitoring instruction is one type, the critical flow is generally one type of data flow in the application data; if the feature field carried in the monitoring instruction is multiple types, the critical flow is generally multiple types of data flow in the application data.

[0104] Table 1 shows the correspondence between application type, application key flow, and data packet characteristic fields.

[0105] Table 1

[0106] Application type Key flow of application Characteristic field of data packet Game application Combat flow XXXXXXXX:XXXXXXXX:XXXXXXXX:XXXXXXXX Audio and video application Audio and video flow YYYYYYYY:YYYYYYYY:YYYYYYYY:YYYYYYYY

[0107] As shown in Table 1, the key stream for game applications can be the battle stream, and the characteristic field of the data packets for the battle stream can be characteristic field 1, such as XXXXXXXX:XXXXXXXX:XXXXXXXX:XXXXXXXX. The key stream for audio and video applications is the audio and video stream, and the characteristic field of the data packets for the audio and video stream can be characteristic field 2, such as YYYYYYYY:YYYYYYYY:YYYYYYYY:YYYYYYYYY.

[0108] Feature fields can be represented using binary, octal, or hexadecimal numbers.

[0109] If the kernel layer determines that a critical flow of the application being monitored is abnormal, it can send an exception message to the application layer. Upon receiving the exception message from the kernel layer, the application layer can automatically disconnect and reconnect to the network by turning the network service on and off.

[0110] Example 1

[0111] The following is based on Figure 5 The application layer and kernel layer of this application are described, and the application lag handling method provided in the embodiments of this application is introduced. Figure 6 A flowchart illustrating an application stuttering handling method is shown, such as... Figure 6 As shown, the process includes the following steps:

[0112] S601: During the application's foreground execution, the application layer sends listening instructions to the kernel layer. These listening instructions are used to instruct the kernel to monitor the application's data and determine if the data is abnormal.

[0113] Running an application in the foreground refers to the state where an application is displayed on the screen of an electronic device after it is opened. In some embodiments, the electronic device can monitor whether the application data of the application is abnormal while detecting that the application is running in the foreground. The specific implementation schemes for the electronic device to detect that the application is running in the foreground and to monitor whether the application data of the application is abnormal are the same as the related technical solutions below, and will be described in detail below. It can be understood that the application in the embodiments of this application can be referred to as the first application.

[0114] It is understood that in some embodiments, the aforementioned applications may be some applications installed in the electronic device, referred to as preset applications in the embodiments of this application. For example, an application list (i.e., the application identifier list mentioned above) can be set in the application layer. This application list includes at least one application identifier, and there is a one-to-one correspondence between the application identifier and the application. The application corresponding to the application identifier set in this application list can be simply referred to as a preset application. The preset application can be the application to be monitored mentioned above. The application identifier can be the application's unique identifier (UID), which is a unique identifier used to determine the identity of an application.

[0115] The default application can be a game application, an audio / video application, etc., but is not limited to these.

[0116] Optionally, the application identifiers in this application list can be pre-set and stored in the electronic device for use by the application layer. Alternatively, the application identifiers in this application list can be set by the user during the use of the electronic device, and then stored in the electronic device for use by the application layer.

[0117] The application layer can determine whether the application is in the application list, i.e., whether the application's application identifier is in the application list, while the application is running in the foreground. If the application is in the application list, i.e., the application's application identifier is in the application list, it indicates that the application is a preset application and is applicable to the application lag handling method provided in this application embodiment. Then, a listening instruction is sent to the kernel layer.

[0118] The application layer sends a listening instruction to the kernel layer at any time between when the application is started and when the application is no longer running in the foreground.

[0119] The above explanation uses monitoring a preset application as an example. However, it is also possible to monitor all applications installed on an electronic device. That is, when the application layer detects that an application is running in the foreground, it can send a monitoring instruction to the kernel layer so that the kernel layer can monitor that application.

[0120] As mentioned earlier, the application layer can instruct the kernel layer to focus on monitoring data streams that significantly impact the user's experience of using the application smoothly; these data streams can be called critical streams. In other words, critical streams are the most important data streams that cause application stuttering. This can improve the efficiency of application data anomaly detection. Specifically, in some embodiments, the monitoring instructions sent by the application layer to the kernel layer can be used to instruct the monitoring of the application's critical streams, determine whether these critical streams are abnormal, and thus identify and address application stuttering issues caused by critical stream anomalies.

[0121] As an example, a monitoring command can carry an application identifier and a feature field. The application identifier is used by the kernel layer to identify the application to be monitored, and the feature field is used by the kernel layer to identify key data packets in the corresponding application data to be monitored. The specific scheme for the kernel layer to identify key data packets in application data can be found in the description above, and will not be repeated here.

[0122] Additionally, it should be noted that the kernel layer can also monitor all data packets in the application data to determine if the application data is abnormal. Accordingly, in this implementation, the aforementioned monitoring instructions can include the application identifier.

[0123] In some embodiments, application data may refer to socket data. The following will describe socket data based on the network transmission protocol structure in mobile phone 100.

[0124] Figure 7 This is a block diagram of a network transmission protocol structure provided in an embodiment of this application. For example... Figure 7As shown, the network transmission protocol structure diagram is a Transmission Control Protocol (TCP) / IP protocol structure diagram. The TCP / IP protocol structure diagram includes four layers: application layer, transport layer, network layer, and network interface layer. The application layer is the first layer of the TCP / IP protocol, the transport layer is the second layer, the network layer is the third layer, and the network interface layer is the fourth layer.

[0125] In this embodiment, the socket data can be data transmitted between the application layer and the transport layer via the socket application programming interface (API). The socket data consists of multiple data packets, each carrying an application identifier (e.g., the application's UID). The kernel layer can identify whether these data packets carry the application identifier of the application to be monitored, and thus listen to data packets carrying the application identifier of the application to be monitored, thereby achieving the purpose of monitoring the application data of the application to be monitored.

[0126] The application layer directly provides services to application processes. An application process corresponds to an application. Generally, an application has only one application process (or simply process) by default. For example, application 1 corresponds to application process 1. Application 2 corresponds to application process 2. Application 3 corresponds to application process 3.

[0127] The application layer includes various protocols, such as Hypertext Transfer Protocol (HTTP), Simple Mail Transfer Protocol (SMTP), and Domain Name System (DNS). Different protocols can be used for different types of applications; for example, World Wide Web applications use HTTP, email applications use SMTP, and web applications use DNS.

[0128] The main function of the transport layer is to define ports, identify application identities, and enable port-to-port communication. Only one application process can occupy a port number, and other electronic devices can find the application process through this port number. For example, application 1 corresponds to application process 1, using port number 80. Application 2 corresponds to application process 2, using port number 25. Application 3 corresponds to application process 3, using port number 53. For example, in this embodiment, the email application server can find the corresponding mobile phone through the IP address in the email application's socket, and further find the email application process through the port number in the socket, and then send email data to the mobile phone's email application.

[0129] The transport layer includes various protocols, such as TCP and UDP.

[0130] In this embodiment of the application, the socket data can be based on the TCP protocol and can be called TCP socket data; the socket data can be based on the UDP protocol and can be called UDP socket data.

[0131] The main functions of the network layer are defining network addresses, distinguishing network segments, performing MAC addressing within subnets, and routing data packets between different subnets. The network layer includes the IP protocol. Within the TCP / IP or UDP / IP protocols, the network layer can establish and terminate network connections and perform IP address lookup functions.

[0132] In this embodiment, when the application layer detects that the application is running in the foreground, it can send a listening instruction to the kernel layer so that the kernel layer can start listening for any abnormalities in the application data.

[0133] In other embodiments, the electronic device may only begin monitoring for abnormal application data if it detects that the application is running in the foreground and is currently connected to a network. For example, the application layer may send a monitoring instruction to the kernel layer only if it detects that the application is running in the foreground and is currently connected to a network, so that the kernel layer can begin monitoring for abnormal application data. It can be understood that in this case, the currently connected network can also be referred to as the first network.

[0134] In other embodiments, the electronic device may only begin monitoring for abnormal application data when it detects that the application is running in the foreground and a network mode switch has occurred. For example, the application layer may send a monitoring command to the kernel layer only when it detects that the application is running in the foreground and a network mode switch has occurred, so that the kernel layer can begin monitoring for abnormal application data.

[0135] It's understandable that the IP address range (network segment) differs between different network modes, causing changes in the IP address of electronic devices. Because the IP address of the electronic device changes, the IP address in the socket corresponding to the process also needs to be changed, and the IP address of the electronic device in the application data request will also change accordingly. If the application server cannot establish the latest socket based on the changed application data request in a timely manner, problems can easily arise in the application server's transmission of application data to the electronic device, such as the application server being unable to transmit application data to the electronic device. The application layer only triggers the kernel layer to listen for application data anomalies when it detects that the application is running in the foreground and a network mode switch has occurred. This more accurately locates the detection time for application data transmission anomalies and further shortens the detection time, thus improving the efficiency of application data anomaly detection.

[0136] S602: The kernel layer receives a listening instruction and determines whether the application data is abnormal.

[0137] Electronic devices can determine if application data is abnormal. If the application data is normal, the abnormality check can be repeated. If the application data is abnormal, the electronic device will automatically disconnect from the network it is currently connected to and reconnect to the network.

[0138] Specifically, in some embodiments, the kernel layer responds to a listening instruction to determine whether the application data is abnormal. If the application data is normal, the operation of determining whether the application data is abnormal can be re-executed. If the application data is abnormal, information about the application data abnormality is reported to the application layer, as detailed in S603.

[0139] Upon receiving a listening command, the kernel layer responds by determining whether the application data of the corresponding application is abnormal. Below, we introduce a scheme to determine application data anomalies by checking the critical flow within the application data. The critical flow, as described above, is a data stream composed of multiple critical data packets. A critical data packet is a packet whose first N bytes contain a characteristic field.

[0140] Specifically, in some embodiments, the kernel layer can determine whether a critical flow is abnormal, or whether application data is abnormal, by monitoring whether the ratio of the abnormal critical data packet to all critical data packets within a preset time period (e.g., within A seconds) exceeds an abnormal threshold. If the kernel layer determines that the critical flow is abnormal, or application data is abnormal, by monitoring whether the ratio of the abnormal critical data packet to all critical data packets within the preset time period (e.g., within A seconds) exceeds the abnormal threshold, then the kernel layer determines that the critical flow is abnormal, or application data is abnormal. In this case, steps S603-S604 can be executed. If the kernel layer determines that the ratio of the abnormal critical data packet to all critical data packets within the preset time period (e.g., within A seconds) does not exceed the abnormal threshold, then the kernel layer determines that application data is not abnormal. In this case, the kernel layer can continue to monitor whether application data is abnormal, i.e., step S602 can be executed. The identification of critical data packets can be referred to the description of the relevant technical solutions above, and will not be repeated here. In addition, the abnormal threshold is preset.

[0141] The kernel layer can determine whether a critical data packet has encountered an anomaly by checking if it has been marked as such (e.g., indicating the cause of the anomaly). It should be noted that, in addition to critical data packets, all data packets in the application can be identified as anomaly by checking if they have been marked as such.

[0142] There are generally several reasons why critical data packets might fail, such as HostUnreachable, Server Request Timeout, PortUnreachable, and various Socket exceptions that may occur when using sockets. One such exception could be that another electronic device attempts to connect to the socket of an electronic device, but that device rejects the connection.

[0143] The following example, using "Host Unreachable" as an example of a critical data packet anomaly, illustrates a specific implementation scheme for identifying whether application data is abnormal. Table 2 shows the reasons for critical data packet anomalies recorded by the kernel layer over a period of time.

[0144] As shown in Table 2, the kernel layer listens for A seconds. Within this timeframe, there are 10 critical data packets in the application data. If all 10 critical data packets are abnormal (e.g., the cause of the abnormal packets is "Host Unreachable"), the ratio of the abnormal critical data packets to all critical data packets within A seconds is 100%. If the abnormal threshold is 40%, and 100% exceeds 40%, meaning the ratio of the abnormal critical data packets to all critical data packets within a preset time exceeds the abnormal threshold, then the application data is considered abnormal.

[0145] Table 2

[0146]

[0147]

[0148] In other examples, if the kernel layer listens for 10 critical data packets in the application data within A seconds, and 2 of these 10 critical data packets are abnormal while the other 8 are normal, the ratio of the abnormal critical data packets to all critical data packets within A seconds is approximately 20%, which is less than the abnormal threshold of 40%. If the ratio of the abnormal critical data packets to all critical data packets within A seconds does not exceed the abnormal threshold, then the application data is considered normal.

[0149] The above describes a scheme for determining whether application data is abnormal by judging whether the critical flow in the application data is abnormal. In some other embodiments, the kernel layer can determine whether the application data is abnormal by judging whether all data packets in the application data are abnormal.

[0150] The kernel layer can receive listening commands sent by the application layer. In response, the kernel layer can determine whether all data packets in the application data are abnormal. Specifically, in some embodiments, if the kernel layer determines that the ratio of abnormal data packets to all data packets in the application data exceeds an abnormality threshold, it executes steps S603-S604 as follows. If the kernel layer determines that the ratio of abnormal data packets to all data packets in the application data does not exceed the abnormality threshold, it can re-execute the operation of determining whether the application data is abnormal.

[0151] S603: The kernel layer sends feedback information about application data anomalies to the application layer.

[0152] S604: The application layer receives information about application data anomalies from the kernel layer, and shuts down and restarts the current network service switch.

[0153] When an electronic device detects abnormal application data, it can automatically disconnect from the currently connected network and reconnect to it. Specifically, in some embodiments, the application layer receives information about abnormal application data from the kernel layer and then shuts down and restarts the current network's service switch.

[0154] If the current network is a wireless network, the wireless network service will be automatically turned off and then on again. For example, if the wireless network is Wi-Fi, the Wi-Fi switch will be automatically turned off and on again. If the current network is a mobile network, the mobile network service will be automatically turned off and on again.

[0155] Optionally, during the process of the application layer turning the current network service switch off and on again, the display interface of the mobile phone 100 can show the process of the current network service switch changing from an on state to an off state and then back to an on state. For example, taking the current network as a mobile network. Figure 8 This diagram illustrates the interface changes of an electronic device that displays a switch for turning current network services off and on again. Figure 8 (a) Figure 8 (b) and Figure 8 As shown in (c), the pull-down control center interface 101 of the mobile phone 100 includes a mobile data service switch 1011. During the process of turning the mobile data network off and on again, the state of the mobile data service switch 1011 changes as follows: Figure 8 The on state shown in (a) changes to the state shown in the figure. Figure 8 The closed state shown in (b) eventually changes back to the state shown in the diagram. Figure 8 The on state is shown in (c) in the diagram.

[0156] The application layer can automatically disconnect and reconnect to the network currently connected to an electronic device by turning the service switch of the current network off and on again. In some other embodiments, the electronic device can automatically turn off the hardware switch related to the current network without the user's awareness, thereby automatically disconnecting and reconnecting to the network currently connected to the electronic device.

[0157] It is understood that if the application running in the foreground in S601 is closed or switched to running in the background, the method provided in this application embodiment can be stopped.

[0158] Based on the principles discussed above, after automatically disconnecting and reconnecting to the network currently connected to the electronic device, the application server can promptly update the address (i.e., socket) for feedback application data. This improves the timeliness of updating the address (i.e., socket) for feedback application data, thereby allowing the application to update the application data to be output in a timely manner, reducing application lag time and improving user experience.

[0159] Example 2

[0160] In Implementation Example 1, as long as the application or a preset application is running in the foreground, the kernel layer will continuously monitor the application data of the application, such as whether the critical flow is abnormal, in order to prevent lag at any point in time during the application's foreground operation.

[0161] The difference between Example 2 and Example 1 is that, considering that if the application runs stably without lag within a certain period, it is highly likely to remain stable thereafter, then monitoring for application data anomalies will no longer be necessary. This reduces the computational power consumption caused by electronic devices monitoring for application data anomalies. See details below. Figure 9 The S905 in the middle.

[0162] Figure 9 A flowchart illustrating another method for handling application stuttering is shown, such as... Figure 9 As shown, the process includes the following steps:

[0163] The technical solutions of S901 to S904 are the same as those of S601 to S604, and will not be repeated here.

[0164] S905: When the timer exceeds the preset listening time, it sends a stop listening command to the kernel layer.

[0165] A timer is set in the application layer to send a stop-listening command to the kernel layer if a preset listening time is exceeded. This stop-listening command instructs the kernel layer to stop monitoring the application data for anomalies.

[0166] It is understandable that the timer can be started when the application is started or when the application layer sends a listening instruction to the kernel layer when it detects that the application is running in the foreground.

[0167] For example, when the application layer detects that an application has been launched, it starts a timer. After the application layer sends a listening command to the kernel layer, the kernel layer begins monitoring for abnormal application data. If an abnormality is detected, the kernel layer sends a notification to the application layer. Upon receiving this notification, the application layer can automatically disconnect from the network and reconnect. Alternatively, if the application layer sends a listening command and the kernel layer detects no abnormalities, it can re-execute the abnormality check. After the timer starts, the application layer can also use it to determine if a preset listening time has been exceeded. If so, it sends a stop listening command to the kernel layer. This stop listening command instructs the kernel layer to stop monitoring for abnormal application data.

[0168] For example, when the application layer sends a listening command to the kernel layer while the application is running in the foreground, it starts a timer. After the application layer sends the listening command, the kernel layer begins monitoring for application data anomalies. If an anomaly is detected, the kernel layer sends a notification to the application layer. Upon receiving this notification, the application layer can automatically disconnect from the network and reconnect. Alternatively, after the application layer sends the listening command, the kernel layer begins monitoring for application data anomalies. If no anomalies are detected, the kernel layer continues to re-execute the anomaly check. After the timer starts, the application layer can use the timer to determine if a preset listening time has been exceeded. If so, it sends a stop listening command to the kernel layer. This stop listening command instructs the kernel layer to stop monitoring for application data anomalies.

[0169] This application also provides a computer storage medium that includes computer instructions. When the computer instructions are executed on the electronic device, the electronic device causes the electronic device to perform various functions or steps performed by the mobile phone in the above method embodiment.

[0170] This application also provides a computer program product that, when run on a computer, causes the computer to perform the various functions or steps performed by the mobile phone in the above method embodiments.

[0171] It is understood that the electronic device provided in this application embodiment includes hardware structures and / or software modules corresponding to perform each function in order to achieve the above-mentioned functions. Those skilled in the art should readily recognize that, in conjunction with the units and algorithm steps of the various examples described in the embodiments disclosed herein, the embodiments of this application can be implemented in hardware or a combination of hardware and computer software. Whether a function is executed by hardware or by computer software driving hardware depends on the specific application and design constraints of the technical solution. Those skilled in the art can use different methods to implement the described functions for each specific application, but such implementation should not be considered beyond the scope of the embodiments of this application.

[0172] This application embodiment can divide the above-described electronic device into functional modules based on the method example described above. For example, each function can be divided into its own functional modules, or two or more functions can be integrated into one processing module. The integrated modules can be implemented in hardware or as software functional modules. It should be noted that the module division in this application embodiment is illustrative and only represents one logical functional division; other division methods may be used in actual implementation.

[0173] Through the above description of the embodiments, those skilled in the art can clearly understand that, for the sake of convenience and brevity, 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 can be divided into different functional modules to complete all or part of the functions described above.

[0174] In the several embodiments provided in this application, it should be understood that the disclosed apparatus and methods can be implemented in other ways. For example, the apparatus embodiments described above are merely illustrative; for instance, the division of modules or units is only a logical functional division, and in actual implementation, there may be other division methods. For example, multiple units or components may be combined or integrated into another device, or some features may be ignored or not executed. Furthermore, the mutual coupling or direct coupling or communication connection shown or discussed may be through some interfaces; the indirect coupling or communication connection between devices or units may be electrical, mechanical, or other forms.

[0175] The units described as separate components may or may not be physically separate. A component shown as a unit can be one or more physical units; that is, it can be located in one place or distributed in multiple different locations. Some or all of the units can be selected to achieve the purpose of this embodiment according to actual needs.

[0176] Furthermore, the functional units in the various embodiments of this application can be integrated into one processing unit, or each unit can exist physically separately, or two or more units can be integrated into one unit. The integrated unit can be implemented in hardware or as a software functional unit.

[0177] If the integrated unit is implemented as a software functional unit and sold or used as an independent product, it can be stored in a readable storage medium. Based on this understanding, the technical solutions of the embodiments of this application, essentially, or the parts that contribute to the prior art, or all or part of the technical solutions, can be embodied in the form of a software product. This software product is stored in a storage medium and includes several instructions to cause a device (which may be a microcontroller, chip, etc.) or processor to execute all or part of the steps of the methods described in the various embodiments of this application. The aforementioned storage medium includes various media capable of storing program code, such as USB flash drives, portable hard drives, read-only memory (ROM), random access memory (RAM), magnetic disks, or optical disks.

[0178] The above description is merely a specific embodiment of this application, but the scope of protection of this application is not limited thereto. Any variations or substitutions within the technical scope disclosed in this application should be included within the scope of protection of this application. Therefore, the scope of protection of this application should be determined by the scope of the claims.

Claims

1. A method for handling application lag, characterized in that, Applied to electronic devices, the method includes: A first application runs in the foreground of the electronic device; While the first application is running in the foreground and a network mode switch occurs, monitor whether the application data of the first application is abnormal; where abnormal application data of the first application will cause the first application to lag. The step of monitoring whether the application data of the first application is abnormal includes: when the ratio of the critical data packet of the first application that is abnormal to all critical data packets of the first application exceeds an abnormal threshold within a preset time, the application data of the first application is determined to be abnormal; wherein, the critical data packet is a data packet in the data packet of the first application whose data content is a feature field. In the event of abnormal application data in the first application, the network currently connected to the electronic device is automatically disconnected and reconnected to the network to update the address for the feedback of application data between the first application and the application server.

2. The method according to claim 1, characterized in that, The first application is the application corresponding to the application identifier in the application list; wherein, the application list includes at least one application identifier, and there is a one-to-one correspondence between the application identifier and the application.

3. The method according to claim 1 or 2, characterized in that, The monitoring of whether the application data of the first application is abnormal includes: Within a preset monitoring period, the ratio of abnormal data packets of the first application to all data packets of the first application within the preset period is monitored to see if it exceeds an abnormal threshold. If, within the preset time period, the ratio of abnormal data packets of the first application to all data packets of the first application within the preset time period exceeds an abnormal threshold, then the application data is considered abnormal.

4. The method according to claim 1 or 2, characterized in that, The method further includes: If the preset listening time is exceeded, the operation of monitoring whether the application data in the first application is abnormal will be stopped.

5. The method according to claim 1 or 2, characterized in that, The automatic disconnection and reconnection of the electronic device to the network includes: Turn the network's service switch off and on again.

6. The method according to claim 1, characterized in that, The data packet of the first application is socket data including the application identifier of the first application, and the socket data is transmitted through the socket application programming interface.

7. An electronic device, characterized in that, The electronic device includes: a memory and one or more processors; The memory is used to store computer program code, which includes computer instructions; when the computer instructions are executed by the processor, the electronic device performs the method as described in any one of claims 1-6.

8. A computer-readable storage medium, characterized in that, Includes computer instructions; When the computer instructions are executed on the electronic device, the electronic device causes the electronic device to perform the method as described in any one of claims 1-6.

9. A computer program product, characterized in that, When the computer program product is run on a computer, it causes the computer to perform the method as described in any one of claims 1-6.

Citation Information

Patent Citations

  • Network anomaly recovery method, terminal and computer storage medium

    CN112087772A

  • Network recovery method and device

    CN113810901A