Application lag processing method and electronic equipment
By monitoring application data abnormalities on electronic devices and automatically disconnecting the reconnection network, the application's lag problem when switching network modes is solved, improving the timeliness of data transmission and user experience.
Patent Information
- Application Number
- CN202410338852.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-03-20
- Publication Date
- 2025-01-03
- Estimated Expiration
- 2044-03-20
AI Technical Summary
When electronic devices switch network mode, applications running in the foreground may stutter, affecting the user experience, mainly because the application cannot receive the updated application data address in time, resulting in abnormal data transmission.
In the front desk operation application of electronic devices, monitor whether the application data is abnormal, and automatically disconnect the current network and reconnect when an abnormality is detected to ensure that the application server updates the feedback data address in a timely manner and improves the timeliness and transmission efficiency of the application data.
By automatically disconnecting and reconnecting to the network, timely update of application data is improved, application lag time is reduced, and user experience is improved.
Smart Images

Figure CN119255409A_ABST
Abstract
Description
Technical Field
[0001] The embodiments of the present application relate to the field of terminals, and in particular to a method for processing application freezes and an electronic device. Background Art
[0002] Electronic devices will install various applications according to user needs, and the smoothness of application operation affects the user experience.
[0003] After the electronic device opens the application, when it is connected to the network, the user can use the functions in the application that require the network under the operation of the user. However, when the electronic device switches the network mode, the application running in the foreground of the electronic device may freeze, affecting the user experience.
[0004] For example, taking game applications as an example, after the electronic device is connected to Wi-Fi, the user can play the game under the operation of the user. When the electronic device is disconnected from Wi-Fi and switched to the mobile network, the game running in the foreground of the electronic device may freeze, affecting the user experience. Summary of the invention
[0005] The embodiments of the present application provide an application freeze processing method and an electronic device to reduce the application freeze time and improve the user experience.
[0006] To achieve the above objectives, the embodiments of the present application adopt the following technical solutions:
[0007] In a first aspect, a method for processing application freeze is provided, which is applied to an electronic device, and the method includes: running a first application in the foreground of the electronic device; while the first application is running in the foreground, monitoring whether application data of the first application is abnormal; wherein, abnormal application data of the first application may cause the first application to freeze; when the application data of the first application is abnormal, automatically disconnecting the network to which the electronic device is currently connected and reconnecting to the network.
[0008] In the present application, automatically disconnecting the network to which the electronic device is currently connected and reconnecting to the network can enable the application server to timely update the address of the feedback application data, which improves the timeliness of the address update of the feedback application data, and then the application can timely receive the application data sent by the application server, and the application can timely update the application data to be output, reducing the application freeze time and improving the user experience.
[0009] In a possible implementation manner of the first aspect, the first application is an application corresponding to an application identifier in an application list; wherein the application list includes at least one application identifier, and the application identifier and the application correspond one-to-one.
[0010] That is, the applications applicable to this application may not be all applications, but some preset applications.
[0011] In a possible implementation of the first aspect, monitoring whether the application data of the first application is abnormal includes: monitoring whether the ratio of the abnormal data packets of the first application to all the data packets of the first application within the preset time exceeds the abnormal threshold; wherein, if, within the preset time, the ratio of the abnormal data packets of the first application to all the 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 the abnormal conditions of 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 a possible implementation of the first aspect, monitoring whether the application data of the first application is abnormal includes: monitoring whether a key stream in the application data of the first application is abnormal; wherein the key stream includes multiple key data packets, and the key data packet is a data packet in which the data content is a characteristic field.
[0014] That is, the electronic device can monitor the abnormality of the key flow 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 determining the abnormality of the application data.
[0015] In a possible implementation of the first aspect, the monitoring of whether the application data of the first application is abnormal includes: monitoring whether the ratio of the key data packets of the first application that have abnormalities to all the key data packets of the first application within the preset time exceeds an abnormal threshold; wherein the key data packet is a data packet of the first application whose data content is a characteristic field; wherein, if within the preset time, the ratio of the key data packets of the first application that have abnormalities to all the key data packets of the first application within the preset time exceeds the abnormal threshold, then the application data is abnormal.
[0016] That is, the electronic device can monitor the abnormality of the key data packet 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 determining the abnormality of the application data.
[0017] In a possible implementation manner of the first aspect, the method further includes: when a preset monitoring time is exceeded, stopping the operation of monitoring whether the application data in the first application is abnormal.
[0018] In the present application, it is considered that if the application runs stably within a certain period of time, that is, there is no lag, then the application will most likely be in a stable running state afterwards, and it is no longer necessary to monitor whether the application data is abnormal. This can reduce the computing power loss caused by the electronic device monitoring the application data abnormalities.
[0019] In a possible implementation of the first aspect, while the first application is running in the foreground, monitoring whether application data of the first application is abnormal includes: while the first application is running in the foreground and a network mode switch occurs, monitoring whether application data of the first application is abnormal; or; while the first application is running in the foreground and connected to a first network, monitoring whether application data of the first application is abnormal.
[0020] That is, the electronic device may start monitoring the application data for abnormalities only when it detects that the application is running in the foreground and is currently connected to the network, or the electronic device may start monitoring the application data for abnormalities only when it detects that the application is running in the foreground and the network mode is switched.
[0021] It can be understood that due to the different IP address ranges (network segments) of different network modes, the IP address of the electronic device changes. Due to the change of the IP address of the electronic device, 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 time, it is easy to have the problem of abnormal application data transmission from the application server to the electronic device, for example, the application server cannot transmit the application data to the electronic device. When the application layer detects that the application is running in the foreground and the network mode is switched, it starts to trigger the kernel layer to monitor whether the application data of the application is abnormal, which accurately locates the detection time of the abnormal application data transmission, and further shortens the detection time of the abnormal application data transmission, thus improving the efficiency of abnormal application data detection. When the application layer detects that the application is running in the foreground and the network mode is switched, it starts to trigger the kernel layer to monitor whether the application data of the application is abnormal, which accurately locates the detection time of the abnormal data packet transmission, and further shortens the detection time of the abnormal data packet transmission, thus improving the efficiency of abnormal application data detection.
[0022] In a possible implementation manner of the first aspect, automatically disconnecting the network to which the electronic device is currently connected and reconnecting to the network includes: turning off and reopening a service switch of the network.
[0023] In a possible implementation manner of the first aspect, the data packet of the first application is socket data including an application identifier of the first application, and the socket data is data transmitted through a socket application programming interface.
[0024] In a possible implementation of the first aspect, the electronic device includes an application layer and a kernel layer; the monitoring of whether the application data of the first application is abnormal during the foreground running of the first application includes: the application layer sends a monitoring instruction to the kernel layer during the foreground running of the application. The monitoring instruction is used to instruct to monitor the application data of the application and determine whether the application data is abnormal; the kernel layer receives the monitoring instruction and determines whether the application data is abnormal.
[0025] In a possible implementation of the first aspect, when the application data of the first application is abnormal, automatically disconnecting the network to which the electronic device is currently connected and reconnecting the network includes: when the kernel layer feeds back information about the application data abnormality to the application layer, the application layer receives the information about the application data abnormality fed back by the kernel layer, and closes and reopens the service switch of the current network.
[0026] In a second aspect, an electronic device is provided, which includes a processor and a memory; the memory is used to store code instructions; the processor is used to run the code instructions to execute an application jamming processing method in any possible design method as in the first aspect.
[0027] In a third aspect, a computer-readable storage medium is provided, in which instructions are stored. When the instructions are executed on a computer, the computer executes an application jam processing method in any possible design method in the first aspect.
[0028] In a fourth aspect, a computer program product is provided, including a computer program / instruction, which, when executed by a processor, implements the application jam processing method in any possible design manner in the first aspect and the second aspect.
[0029] Among them, the technical effects brought about by any design method in the second to fourth aspects can refer to the technical effects brought about by different design methods in the first aspect, and will not be repeated here. BRIEF DESCRIPTION OF THE DRAWINGS
[0030] Figure 1 A schematic diagram showing a principle of transmission of game data based on socket;
[0031] Figure 2 A schematic diagram showing another principle of transmitting game data based on socket;
[0032] Figure 3 A schematic diagram showing another principle of transmitting game data based on socket;
[0033] Figure 4A schematic diagram of the structure of a mobile phone 100 provided in an embodiment of the present application is shown;
[0034] Figure 5 A software structure block diagram of a mobile phone 100 provided in an embodiment of the present application is shown;
[0035] Figure 6 A schematic diagram of a process for processing application jamming is shown;
[0036] Figure 7 A structural block diagram of a network transmission protocol provided by an embodiment of the present application is shown;
[0037] Figure 8 A schematic diagram showing the interface changes of an electronic device showing closing and reopening a service switch of a current network;
[0038] Fig. 9 A flow chart of another method for processing application jams is shown. DETAILED DESCRIPTION
[0039] The following is a brief overview of the terms involved in the embodiments of the present application.
[0040] (1) IP address: An Internet Protocol (IP) address is a set of digital identifiers used to identify and locate electronic devices on the Internet. It serves as an identity identifier that enables electronic devices to communicate and exchange data on the network. For example, in an embodiment of the present application, a mobile phone sends a game data request to a game application server, and the game data request may carry the IP address of the mobile phone. In response to the game data request, the game application server may send the game data to the mobile phone based on the IP address of the mobile phone carried in the game data request.
[0041] In a network environment, IP addresses are usually assigned dynamically, and an electronic device will obtain a different IP address each time it connects 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 the process. For example, in the embodiment of the present application, after the mobile phone obtains game data from the game application server, it can find the game application process of the mobile phone through the port and send the game data to the process.
[0043] (3) socket. Socket can be called a socket, and its essence is an application programming interface (API). Among them, a socket corresponds to a process, and a socket can include an IP address and port information. An electronic device can find a process in another electronic device based on a socket, and send feedback data to the process. An application can correspond to multiple processes. For example, in an embodiment of the present application, a game application server can send game data to a process corresponding to a game application of a mobile phone through a socket corresponding to the game application.
[0044] For example, Figure 1 A schematic diagram showing the principle of transmitting game data based on socket is shown. Figure 1 As shown, the figure includes a mobile phone 100 and a game application server system 200. Among them, the mobile phone 100 is provided with a game application, and the game application server system 200 may include multiple game application servers ( Figure 1 2 . The game application server 200 - 1 and the game application server 200 - 2 are exemplarily shown in FIG. 1 . The mobile phone 100 and the game application server system 200 can transmit instructions and data related to the game application to each other.
[0045] For example, the mobile phone 100 responds to the user's operation of starting the game and starts the game function. At this time, the mobile phone 100 can establish a battle stream process and generate a socket corresponding to the battle stream process. Among them, the battle stream is the game data generated by multiple game characters in the game battle. Moreover, the mobile phone 100 will send a battle stream request to the game application server system 200 based on the socket corresponding to the battle stream process. The socket corresponding to the battle stream process 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. 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 monitors the battle stream request, and in response to the battle stream request, it can establish a socket corresponding to the socket corresponding to the battle stream process of the mobile phone 100 based on the battle stream request, and the socket can include the IP address of the mobile phone 100 in the battle stream request and the port of the battle stream process of the mobile phone 100. The game application server system 200 can find the battle stream process of the mobile phone 100 based on the socket and feed back the battle stream to the battle stream process of the mobile phone 100.
[0046] For another example, the mobile phone 100 responds to the user's operation of turning on the microphone function in the game and turns on the microphone function in the game. At this time, the mobile phone 100 can establish an audio stream process and generate a socket corresponding to the audio stream process. Among them, the audio stream is the audio data of the players corresponding to the multi-party game characters using the microphone to talk in the game battle. Moreover, the 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. The socket corresponding to the audio stream process 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. 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 monitors the audio stream request, and in response to the audio stream request, it can establish a socket corresponding to the socket corresponding to the audio stream process of the mobile phone 100 based on the audio stream request, and the socket can include the IP address of the mobile phone 100 in the audio stream request and the port of the audio stream process of the mobile phone 100. The game application server system 200 can find the audio stream process of the mobile phone 100 based on the socket and feed back the audio stream to the audio stream process of the mobile phone 100.
[0047] It is understandable that the application data of an application may include multiple types of data streams. For example, taking a game application as an example, the game application may include data streams such as battle streams and audio streams. A data stream in the application may correspond to a data stream process. Since a socket corresponds to a process, in this case, a data stream in the application corresponds to a socket. Figure 1 Taking the battle flow in 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 can be understood that a data stream in an application can also correspond to multiple data stream processes. Since a socket corresponds to a process, in this case, a data stream in an application corresponds to multiple sockets. In this way, a data stream in an application can be transmitted synchronously in multiple processes, which improves the transmission rate of the data stream. Figure 1 Taking the battle stream in as an example, one battle stream can correspond to multiple battle stream processes, one battle stream process corresponds to one socket, and one battle stream can correspond to multiple sockets.
[0049] Wi-Fi and mobile networks are commonly used wireless network connection methods in daily life. The following 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, it is actually connected to a wireless router, which then connects to the Internet. Wireless networks usually refer to Wi-Fi.
[0051] (5) Mobile network: Mobile network is a communication technology that uses wireless signals provided by mobile network operators to connect electronic devices to the Internet, that is, it mainly refers to the technology of data transmission through mobile communication networks (such as 2G, 3G, 4G, 5G, etc.). Mobile networks use electronic device signal towers as central equipment and are based on the transmission of radio waves between different base stations. Cellular network is one of them, which divides the area into multiple cells through the coverage of base stations to achieve data transmission. Satellite network transmits data through satellites, with a wider coverage area, but relatively slow speed.
[0052] As described in the background technology above, after an electronic device opens an application, when it is connected to the network, the user can use the functions in the application that require networking. However, when the electronic device switches the network mode, the application running in the foreground of the electronic device may freeze, affecting the user experience.
[0053] At present, technicians have found that the reason why the application running in the foreground freezes after the electronic device switches the network mode is that the application of the electronic device cannot receive the corresponding application data after the electronic device switches the network mode. The specific possible reasons are as follows:
[0054] (1) After the electronic device switches the network mode, the IP address of the electronic device will change. For example, if the electronic device previously used a mobile network and currently switches to a wireless network (such as Wi-Fi), the IP address of the electronic device will change after switching the network mode because the IP address ranges (network segments) of different network modes are different. Conversely, if the electronic device previously used a wireless network and currently switches to a mobile network, the IP address of the electronic device will also change because the IP address ranges (network segments) of different network modes are different. Since the IP address of the electronic device has changed, the IP address in the socket corresponding to the process also needs to be changed, that is, the socket corresponding to the process of the application in the electronic device will change from the original socket 1 to socket 2, where the IP addresses in socket 1 and socket 2 are different. The electronic device will send an application data request to the application server based on the latest socket, that is, based on socket 2. At this time, if the application server is abnormal, it will not be able to monitor the latest application data request, and will not be able to establish the latest socket (i.e., the socket corresponding to socket2) corresponding to the socket corresponding to the audio stream process of the mobile phone 100 based on the latest application data request, and the latest socket includes the latest IP address of the mobile phone 100 in the latest application data request and the port of the audio stream process of the mobile phone 100. In this way, since the latest address used by the application server to feedback application data is not updated in time, the application server cannot send the application data to the process corresponding to the application of the electronic device, and the application cannot update the application data that needs to be output in time, such as being unable to update the display interface in time, resulting in application freeze.
[0055] Exemplary, combined Figure 1 , Figure 2 A schematic diagram showing another principle of transmitting game data based on socket. Figure 1 In addition to the mobile phone 100 and the game application server system 200 shown in FIG. Figure 2 As shown, the mobile phone 100 and the game application server system 200 may further include multiple network transmission nodes. Figure 2 The circles in the figure are used to schematically represent network transmission nodes. Any number of network transmission nodes can form a path for transmitting instructions and / or data related to the game application. Figure 2 Four paths schematically represented by solid lines are given as examples: path 1, path 2, path 3 and path 4, but the present invention is not limited thereto.
[0056] like Figure 2As shown in (a), in the process of running the game application in the foreground in response to the user operation, if the mobile phone 100 switches the network mode, the game application server 200-1 is abnormal, and the game application server 200-1 cannot monitor the latest battle stream request, and cannot establish the latest socket corresponding to the socket corresponding to the game data process of the mobile phone 100 based on the latest application data request (i.e., the socket corresponding to socket2), and the latest socket includes the latest IP address of the mobile phone 100 in the latest battle stream request and the port of the game data process of the mobile phone 100. The game application server 200-1 cannot send the game data (such as the battle stream described above) to the process corresponding to the game application of the mobile phone 100 (such as the battle stream process described above), and the game application cannot update the game data to be output in time, such as the game interface cannot be updated in time, resulting in application jams. The mobile phone can also display jam prompt information, for example, the mobile phone 100 displays the buffer mark 10. It can be understood that the jam prompt information can be prompted by text information in addition to the buffer mark, but is not limited to this.
[0057] (2) As the electronic device switches the network mode, the IP address in the socket corresponding to the process changes, and the socket corresponding to the process of the application in the electronic device changes from the original socket 1 to socket 2. The electronic device will send an application data request to the application server based on the latest socket, that is, based on socket 2. However, if the network transmission node (such as a router, base station, etc.) that transmits data and / or instructions between the electronic device and the application server is abnormal, for example, the network transmission node intercepts the transmission of the application data request, then the application server cannot monitor the latest application data request, and cannot establish the latest socket corresponding to the socket corresponding to the game data process of the mobile phone 100 (that is, the socket corresponding to socket 2) based on the latest application data request. The latest socket includes the latest IP address of the mobile phone 100 in the latest application data request and the port of the game data process of the mobile phone 100. In this way, since the latest address used by the application server to feedback application data is not updated in time, the application server cannot send the application data to the process corresponding to the application of the electronic device, and the application cannot update the application data to be output in time, resulting in application freeze.
[0058] Exemplary, combined Figure 2 , Figure 3 FIG. 1 is a schematic diagram showing another principle of transmitting game data based on socket. Figure 3As shown in (a), in the process of running the game application in the foreground in response to the user operation, if the mobile phone 100 switches the network mode, a network transmission node in path 1 intercepts the transmission of the latest battle stream request. In this way, the application server cannot monitor the latest battle stream request, and cannot establish the latest socket corresponding to the socket corresponding to the game data process of the mobile phone 100 (i.e., the socket corresponding to socket2), which includes the latest IP address of the mobile phone 100 in the latest battle stream request and the port of the game data process of the mobile phone 100. The game application server 200-1 cannot send the game data (such as the battle stream described above) to the process corresponding to the game application of the mobile phone 100 (such as the battle stream process described above), and the game application cannot update the game data to be output in time, such as the game interface cannot be updated in time, resulting in application jams. Similarly, the mobile phone can also display jam information, for example, the mobile phone 100 displays a buffer mark 10.
[0059] In order to solve this technical problem, the present application proposes a method for processing application jams. An application is installed on an electronic device. When the electronic device is running the application in the foreground, if the electronic device detects that the application of the electronic device cannot receive the corresponding application data, the electronic device can automatically disconnect the currently connected network and reconnect the network. For example, when the electronic device is running the application in the foreground, if it is detected that the electronic device has switched the network mode, the electronic device can detect whether the application data (such as data flow) of the application running in the foreground is abnormal. If abnormal, the currently connected network is automatically disconnected and the network is reconnected.
[0060] In this way, after the electronic device reconnects to the current network, the electronic device can send the latest application data request to the application server through the new path. Since the application server found through the new path may not be the original application server that cannot receive and monitor the latest application data request, that is, the replaced application server is generally an application server that can receive the latest application data request. The application server found through the new path can establish a new socket based on the latest application data request sent by the electronic device, and send application data to the electronic device based on the latest socket. This improves the timeliness of the address update of the feedback application data, so that the application can update the application data to be output in a timely manner, reduce the application freeze time, and improve the user experience.
[0061] For example, Figure 2As shown in (b), the network currently connected to the mobile phone 100 is a mobile network as an example. In order to solve the problem of the above-mentioned game application freeze, the mobile phone 100 can automatically turn off the mobile network function and reopen the mobile network function. In this way, the mobile phone 100 can refresh the mobile network. After the mobile phone 100 restarts the mobile network function, the path can be switched from path 1 to path 3, and the mobile phone 100 can send a game data request to the 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 cannot receive the latest battle flow request, that is, the replaced game application server 200-2 is an application server that can receive the battle flow request. Then the game application server 200-2 found through the new path 3 can establish a new socket based on the latest battle flow request sent by the mobile phone 100, and send game data to the mobile phone 100 based on the latest socket. In this way, the game application can update the game data to be output in time to avoid freeze. In addition, the mobile phone 100 can also cancel the display buffer mark 10.
[0062] Similarly, after the electronic device reconnects to the current network, the electronic device can send the latest application data request to the application server through the new path. Since the network transmission node that intercepts the latest battle stream request may not be in 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 the address update of the feedback application data, so that the application can update the application data to be output in a timely manner, reduce the application freeze time, and improve the user experience.
[0063] For example, Figure 3As shown in (b), the network currently connected to the mobile phone 100 is a mobile network as an example. In order to solve the problem of the above-mentioned game application freeze, the mobile phone 100 can automatically turn off the mobile network function and reopen the mobile network function. In this way, the mobile phone 100 can refresh the mobile network. After the mobile phone 100 restarts the mobile network function, the path can be switched from path 1 to path 2, and the mobile phone 100 can send a game data request to the game application server 200-2 through the new path 2. Since the network transmission node that intercepts the latest battle stream request is not in path 2, the electronic device can transmit the latest battle stream request to the application server through path 2. The game application server 200-1 found through the new path 2, the game application server 200-1 can establish a new socket based on the latest battle stream request sent by the mobile phone 100, and send game data to the mobile phone 100 based on the new socket. The game application can update the game data to be output in time to avoid freeze. In addition, the mobile phone 100 can also cancel the display buffer mark 10.
[0064] In the embodiments of the present application, the electronic device may be a device having a communication function and capable of running applications. For example, the electronic device may include but is not limited to a mobile phone, a tablet computer, a desktop computer, a laptop computer, a handheld computer, a notebook computer, an ultra-mobile personal computer (UMPC), a vehicle-mounted device, a smart home device and / or a smart city device, and the embodiments of the present application do not impose any special restrictions on the specific type of the electronic device.
[0065] Please refer to Figure 4 , is a schematic diagram of the structure of the mobile phone 100 provided in an embodiment of the present 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 to be understood that the structure shown 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 shown in the figure, or combine some components, or separate 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.
[0068] The processor 110 may include one or more processing units, for example, the processor 110 may include an application processor (AP), a modem processor, a graphics processor (GPU), an image signal processor (ISP), a controller, a memory, a video codec, a digital signal processor (DSP), a baseband processor, and / or a neural network processing unit (NPU), etc. Among them, different processing units may be independent devices or integrated in one or more processors.
[0069] In an embodiment of the present application, an application is installed on the mobile phone 100. When the mobile phone 100 is running the application in the foreground, if the mobile phone 100 detects that the application cannot receive application data, the processor 110 can automatically disconnect the currently connected network and reconnect to the network. After the processor 110 reconnects to the current network, the processor 110 can send an application data request carrying the latest socket to the application server through the communication module via a new path to avoid application freezes. The communication module can be a module corresponding to the currently connected network. For example, if the current connection is a wireless network, the above-mentioned communication module is the wireless communication module 160; if the current connection is a mobile network, the above-mentioned communication module is the mobile communication module 150.
[0070] The controller may be the nerve center and command center of the mobile phone 100. The controller may generate an operation control signal according to the instruction operation code and the timing signal to complete the control of fetching and executing instructions.
[0071] The processor 110 may also be provided with a memory for storing instructions and data. In some embodiments, the memory in the processor 110 is a cache memory. The memory may store instructions or data that the processor 110 has just used or cyclically used. If the processor 110 needs to use the instruction or data again, it may be directly called from the memory. This avoids repeated access, reduces the waiting time of the processor 110, and thus improves the efficiency of the system.
[0072] In some embodiments, the processor 110 may include one or more interfaces. The interface may include an I2C interface, an inter-integrated circuit sound (I2S) interface, a pulse code modulation (PCM) interface, a universal asynchronous receiver / transmitter (UART) interface, a mobile industry processor interface (MIPI), a general-purpose input / output (GPIO) interface, a subscriber identity module (SIM) interface, and / or a USB interface, etc.
[0073] The external memory interface 120 can be used to connect an external memory card, such as a Micro SD card, to expand the storage capacity of the mobile phone 100. The external memory card communicates with the processor 110 through the external memory interface 120 to implement a data storage function, such as storing music, video and other files in the external memory card.
[0074] The internal memory 121 may be used to store computer executable program codes, which include 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 an embodiment of the present application, the processor 110 may execute the instructions stored in the internal memory 121, and the internal memory 121 may include a program storage area and a data storage area.
[0075] The program storage area may store an operating system, an application required for at least one function (such as a sound playback function, an image playback function, etc.), etc. The data storage area may store data created during the use of the mobile phone 100 (such as audio data, a phone book, etc.), etc. In addition, the internal memory 121 may include a high-speed random access memory, and may also include a non-volatile memory, such as at least one disk storage device, a flash memory device, a universal flash storage (UFS), etc.
[0076] The USB interface 130 is an interface that complies with the USB standard specification, and specifically can be a Mini USB interface, a Micro USB interface, a USB Type C interface, etc. The USB interface 130 can be used to connect a charger to charge the electronic device 100, and can also be used to transfer data between the electronic device 100 and a peripheral device. It can also be used to connect headphones to play audio through the headphones. The interface can also be used to connect other electronic devices, such as AR devices, etc.
[0077] It is understandable that the interface connection relationship between the modules illustrated in the embodiment of the present invention is only a schematic illustration and does not constitute a structural limitation on the electronic device 100. In other embodiments of the present application, the electronic device 100 may also adopt different interface connection methods in the above embodiments, or a combination of multiple interface connection methods.
[0078] The charging management module 140 is used to receive charging input from a charger. The charger can be a wireless charger or a wired charger. While the charging management module 140 charges the battery 142, it can also power the electronic device through 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, and supplies power to the processor 110, the internal memory 121, the display screen 170, and the wireless communication module 160. In some embodiments, the power management module 141 and the charging management module 140 can also be set in the same device.
[0080] The wireless communication function of the electronic device 100 can be implemented through the antenna 1, the antenna 2, the mobile communication module 150, the wireless communication module 160, the modem processor and the baseband processor.
[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 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.
[0082] The mobile communication module 150 can provide solutions for wireless communications including 2G / 3G / 4G / 5G, etc., applied to the electronic device 100. The mobile communication module 150 may include at least one filter, a switch, a power amplifier, a low noise amplifier (LNA), etc. The mobile communication module 150 can receive electromagnetic waves from the antenna 1, and filter, amplify, and process the received electromagnetic waves, and transmit them to the modulation and demodulation processor for demodulation. The mobile communication module 150 can also amplify the signal modulated by the modulation and demodulation processor, and convert it into electromagnetic waves for radiation through the antenna 1. In some embodiments, at least some of the functional modules of the mobile communication module 150 can be set in the processor 110. In some embodiments, at least some of the functional modules of the mobile communication module 150 can be set in the same device as at least some of the modules of the processor 110.
[0083] The modem processor may include a modulator and a demodulator. Among them, the modulator is used to modulate the low-frequency baseband signal to be sent into a medium-high frequency signal. The demodulator is used to demodulate the received electromagnetic wave signal into a low-frequency baseband signal. The demodulator then transmits the demodulated low-frequency baseband signal to the baseband processor for processing. After the low-frequency baseband signal is processed by the baseband processor, it is passed to the application processor. The application processor outputs a sound signal through an audio device (not limited to a speaker 170A, a receiver 170B, etc.), or displays an image or video through a display screen 194. In some embodiments, the modem processor may be an independent device. In other embodiments, the modem processor may be independent of the processor 110 and be set in the same device as the mobile communication module 150 or other functional modules.
[0084] The wireless communication module 160 can provide wireless communication solutions including wireless local area networks (WLAN) (such as wireless fidelity (Wi-Fi) networks), Bluetooth (BT), global navigation satellite system (GNSS), frequency modulation (FM), near field communication (NFC), infrared technology (IR), etc., which are applied to the electronic device 100. The wireless communication module 160 can be one or more devices integrating at least one communication processing module. The wireless communication module 160 receives electromagnetic waves via the antenna 2, modulates the electromagnetic wave signal and filters it, and sends the processed signal to the processor 110. The wireless communication module 160 can also receive the signal to be sent from the processor 110, modulate the frequency, amplify it, and convert it into electromagnetic waves for radiation through the antenna 2.
[0085] In some embodiments, the antenna 1 of the electronic device 100 is coupled to the mobile communication module 150, and the antenna 2 is coupled to the wireless communication module 160, so that the electronic device 100 can communicate with the network and other devices through wireless communication technology. The wireless communication technology may include global system for mobile communications (GSM), general packet radio service (GPRS), code division multiple access (CDMA), wideband code division multiple access (WCDMA), time-division code division multiple access (TD-SCDMA), long term evolution (LTE), BT, GNSS, WLAN, NFC, FM, and / or IR technology, etc. The GNSS may include a global positioning system (GPS), a global navigation satellite system (GLONASS), a Beidou navigation satellite system (BDS), a quasi-zenith satellite system (QZSS) and / or a satellite-based augmentation system (SBAS).
[0086] The mobile phone 100 implements the display function through a GPU, a display screen 170, and an application processor. The GPU is a microprocessor for image processing, which connects 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 that execute program instructions to generate or change display information.
[0087] The display screen 170 is used to display images, videos, etc. The display screen 170 includes a display panel. In the embodiment of the present application, the display screen 170 can display application icons, screens of application functions executed under user operations, application freeze information, etc.
[0088] The software system of the mobile phone 100 may adopt a layered architecture, an event-driven architecture, a micro-kernel architecture, a micro-service architecture, or a cloud architecture. The embodiment of the present invention takes the Android system of the layered architecture as an example to exemplify the software structure of the mobile phone 100.
[0089] Figure 5 It is a software structure block diagram of the mobile phone 100 according to an embodiment of the present application.
[0090] The layered architecture divides the software into several layers, each with clear roles and division of labor. The layers communicate with each other through software interfaces. In some embodiments, the Android system is divided into four layers, from top to bottom, namely, the application layer, the application framework layer, the system library, and the kernel layer.
[0091] The application layer can include a series of application packages. Figure 5 As shown, the application package may include camera, gallery, calendar, call, map, navigation, WLAN, Bluetooth, music, video, short message and other applications.
[0092] In the embodiment of the present application, the application layer can be used to detect the application displayed and running on the display screen 170, or to detect the application running in the foreground. When it is detected that an application is running in the foreground, the application is monitored. Specifically, in some embodiments, the application layer can send a monitoring instruction to the kernel layer. The monitoring instruction is used to instruct the kernel layer to monitor the application and determine whether the application data of the application is abnormal. For example, the monitoring instruction can include an application identifier of the application.
[0093] Further, in some embodiments, only when the application running in the foreground is an application in the application identification list, the application is monitored. Specifically, in an embodiment of the present application, the application layer can be used to detect the application displayed and running on the display screen 170, or to detect the application running in the foreground, and determine whether the application is an application to be monitored. In some embodiments, the application layer stores an application identification list of applications to be monitored. The application layer can match the application identification of the currently displayed and running application with the application identification in the application identification list. If the application identification of the currently displayed and running application exists in the application identification list, it is determined that the currently displayed and running application is the application to be monitored. If the currently displayed and running application is the application to be monitored, a monitoring instruction is sent to the kernel layer.
[0094] The application framework layer provides an application programming interface (API) and a programming framework for the applications in the application layer. The application framework layer includes some predefined functions.
[0095] like Figure 5 As shown, the application framework layer may include a window manager, a content provider, a view system, a phone manager, a resource manager, a notification manager, and the like.
[0096] 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.
[0097] The kernel layer is the layer between hardware and software. The kernel layer contains at least display driver, camera driver, audio driver, and sensor driver.
[0098] In an embodiment of the present application, the kernel layer may receive a monitoring instruction sent by the application layer. In response, the kernel layer may determine whether the application data of the application to be monitored is abnormal. It is understandable that the application data includes multiple data packets. In some embodiments, the kernel layer may determine the proportion of abnormal data packets in 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 in all data packets of the application to be monitored exceeds the abnormal threshold, it is considered that an abnormality has occurred, and the abnormal information may be fed back to the application layer. When the application layer receives the abnormal information fed back by the kernel layer, the application layer can achieve the purpose of automatically disconnecting the network to which the electronic device is currently connected and reconnecting to the network by turning off and reopening the service switch of the current network.
[0099] It can be understood that multiple data streams can be generated during the operation of an application by the mobile phone 100, that is, the application data of an application can include multiple types of data streams. For example, during the operation of a game application by the mobile phone 100, a battle stream formed by the two parties in the game process and an audio stream formed by the two parties in the game process can be generated. If the audio stream in the game application is stuck, and the battle stream is not stuck, it generally does not affect the user's experience of the smoothness of playing the game. If the audio stream in the game application is not stuck, and the battle stream is stuck, the two parties in the game cannot continue to play the game, which will greatly affect the user's experience of the smoothness of playing the game. Therefore, the application layer can instruct the kernel layer to focus on monitoring the data stream that greatly affects the user's experience of using the application smoothness, and the data stream can be called a key stream. In other words, the kernel layer can determine whether the key stream of the application to be monitored is abnormal.
[0100] It can be understood that the application data includes multiple data packets. Each type of data flow is also composed of multiple data packets with the same characteristics. The kernel layer can specifically monitor whether the data packets of the key flow are abnormal to determine whether the key flow is abnormal. For example, the proportion of abnormal data packets in the data packets of the key flow in all data packets can be determined. If the proportion exceeds the abnormal threshold, it is considered that the key flow of the application to be monitored is abnormal.
[0101] Among them, one implementation method for determining whether a data packet is a data packet of a critical flow (such as simplified description as a critical data packet in this application) may be: determining a data packet whose data content is a characteristic field in the data packet of the first application as a critical data packet, and determining a data packet whose data content is not a characteristic field in the data packet of the first application as a non-critical data packet; that is, a critical data packet is a data packet whose data content is a characteristic field in the data packet of the first application.
[0102] Specifically, in some embodiments, it is identified whether the content of the first N bytes of a data packet in the application data is a characteristic field. If the content of the first N bytes of a data packet is a characteristic field, the data packet is determined to be a key data packet.
[0103] It can be understood that in some embodiments, in order to determine the key data packet, the above-mentioned monitoring instruction may carry a characteristic field in addition to the application identifier, and the characteristic field is used for the kernel layer to identify the key data packet in the application data. The characteristic field carried in the monitoring instruction may be one or more. If the characteristic field carried in the monitoring instruction is one, the key flow is generally one type of data flow in the application data; if the characteristic field carried in the monitoring instruction is multiple, the key flow is generally multiple types of data flow in the application data.
[0104] Table 1 shows the correspondence between application types, key flows of applications, and characteristic fields of data packets.
[0105] Table 1
[0106] Application Type Key flow of application The characteristic field of the data packet Game Applications Battle Stream XXXXXXXX:XXXXXXXX:XXXXXXXX:XXXXXXXX Audio and video applications Audio and video streaming YYYYYYYY:YYYYYYYY:YYYYYYYY:YYYYYYYY
[0107] As shown in Table 1, the key stream of the game application may be the battle stream, and the characteristic field of the data packet of the battle stream may be characteristic field 1, such as XXXXXXXX:XXXXXXXX:XXXXXXXX:XXXXXXXX. The key stream of the audio and video application is the audio and video stream, and the characteristic field of the data packet of the audio and video stream may be characteristic field 2, such as YYYYYYYY:YYYYYYYY:YYYYYYYYY:YYYYYYYYY.
[0108] The characteristic field can be represented by a binary number, an octal number, or a hexadecimal number.
[0109] If the kernel layer determines that the key flow of the application to be monitored is abnormal, it can feedback the abnormal information to the application layer. When the application layer receives the abnormal information fed back by the kernel layer, the application layer can automatically disconnect the network currently connected to the electronic device and reconnect to the network by turning off and reopening the service switch of the current network.
[0110] Embodiment 1
[0111] The following is based on Figure 5 The application layer and kernel layer in the present application are introduced, and an application jam processing method is provided in an embodiment of the present application. Figure 6 A schematic diagram of a process for processing application jams is shown, such as Figure 6 As shown, the process includes the following steps:
[0112] S601: The application layer sends a monitoring instruction to the kernel layer when the application is running in the foreground, wherein the monitoring instruction is used to indicate monitoring of the application data of the application to determine whether the application data is abnormal.
[0113] The application running in the foreground refers to the situation where the application is displayed on the display screen of the electronic device after it is turned on. In some embodiments, the electronic device can monitor whether the application data of the application is abnormal when detecting that the application is running in the foreground. The specific implementation scheme of the electronic device detecting that the application is running in the foreground and monitoring whether the application data of the application is abnormal is the same as the related technical scheme below, which will be described in detail below. It can be understood that the application in the embodiment of the present application can be called the first application.
[0114] It can be understood that in some embodiments, the above-mentioned applications may be some applications installed in the electronic device, such as those referred to as preset applications in the embodiments of the present application. For example, an application list (i.e., the application identification list mentioned above) may be set in the application layer, and the application list includes at least one application identification, and the application identification and the application correspond one to one. The application corresponding to the application identification set in the application list may be referred to as the preset application. The preset application may be the application to be monitored mentioned above. The application identification may be a unique identifier (UID) of the application, and the UID is a unique identifier used to determine the identity of the application.
[0115] The preset application may be a game application, an audio or video application, etc., but is not limited thereto.
[0116] Optionally, the application identifiers in the application list may be set in advance and stored in the electronic device for invocation by the application layer. The application identifiers in the application list may also be set according to the needs of the user during the user's use of the electronic device and stored in the electronic device after setting for invocation by the application layer.
[0117] The application layer can determine whether the application is in the application list, that is, whether the application identifier of the application is in the application list, when the application is running in the foreground. If the application is in the application list, that is, the application identifier of the application is in the application list, it indicates that the application is a preset application and is applicable to the application jam processing method provided in the embodiment of the present application, and then a monitoring instruction is sent to the kernel layer.
[0118] The application layer sends the monitoring instruction to the kernel layer at any time between the time when the application is started and the time when the application is not running in the foreground.
[0119] The above is explained by taking monitoring of preset applications as an example, and all applications installed in the electronic device can also be monitored, that is, the application layer can send a monitoring instruction to the kernel layer when it detects that an application is running in the foreground, so that the kernel layer can monitor the application.
[0120] As mentioned above, the application layer can instruct the kernel layer to focus on monitoring the data stream that has a greater impact on the user's experience of using the application smoothly. This data stream can be called a key stream. That is, the key stream is a more important data stream that causes application jams. This can improve the efficiency of application data abnormality judgment. Specifically, in some embodiments, the monitoring instruction sent by the application layer to the kernel layer can be used to instruct the monitoring of the key stream of the application, to determine whether the key stream of the application is abnormal, to determine whether the application data is abnormal, to deal with the problem of application jams caused by key stream abnormalities.
[0121] As an example, the monitoring instruction may carry an application identifier and a feature field, wherein 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 the key data packets in the corresponding application data to be monitored. The specific scheme for the kernel layer to identify the key data packets in the application data can be found in the description above, which will not be repeated here.
[0122] In addition, it is also necessary to add that the kernel layer can also monitor all data packets in the application data to determine whether the application data is abnormal. Accordingly, in this implementation, the above-mentioned monitoring instruction can further include an application identifier.
[0123] In some embodiments, the application data may refer to socket data. The following will introduce socket data based on the network transmission protocol structure in the mobile phone 100.
[0124] Figure 7 This is a network transmission protocol structure diagram provided by the embodiment of the present application. Figure 7As shown in the figure, the network transmission protocol structure diagram is the transmission control protocol (TCP) / IP protocol structure diagram, and the TCP / IP protocol structure diagram includes 4 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 of the TCP / IP protocol, the network layer is located at the third layer in the TCP / IP protocol, and the network interface layer is located at the fourth layer in the TCP / IP protocol.
[0125] In the embodiment of the present application, the socket data may be data transmitted between the application layer and the transport layer through the socket application programming interface (API). The socket data is composed of a plurality of data packets, and the data packets carry application identifiers (e.g., UI of the application). The kernel layer may identify whether the data packets carry the application identifier of the application to be monitored, and monitor the data packets carrying the application identifier of the application to be monitored, so as to achieve the purpose of monitoring the application data of the application to be monitored.
[0126] The application layer directly provides services for the application process. An application process corresponds to an application. Generally, an application has only one application process (referred to as a 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 a variety of protocols, such as Hypertext Transfer Protocol (HTTP), Simple Mail Transfer Protocol (SMTP), and Domain Name System (DNS). The application layer can use different protocols for different types of applications. For example, the World Wide Web application uses the HTTP protocol, the mail application uses the SMTP protocol, and the web application uses the DNS protocol.
[0128] The main work of the transport layer is to define ports, identify application identities, and implement port-to-port communication. A port number is only allowed to be occupied by one application process, and other electronic devices can find the application process of the application through this port number. For example, application 1 corresponds to application process 1 and uses port number 80. Application 2 corresponds to application process 2 and uses port number 25. Application 3 corresponds to application process 3 and uses port number 53. For example, in an embodiment of the present application, the mail application server can find the corresponding mobile phone through the IP address in the socket of the mail application, and further find the mail application process through the port number in the socket, and send mail data to the mail application of the mobile phone.
[0129] The transport layer includes multiple protocols, for example, TCP protocol and UDP protocol.
[0130] In the embodiment of the present application, the socket data may be data based on the TCP protocol, which may be referred to as TCP socket data; the socket data may be data based on the UDP protocol, which may be referred to as UDP socket data.
[0131] The main work of the network layer is to define network addresses, distinguish network segments, MAC addressing within subnets, and route data packets from different subnets. The network layer includes the IP protocol. In the TCP / IP protocol or the UDP / IP protocol, the network layer can establish and terminate network connections and find IP addresses.
[0132] In the embodiment of the present application, when the application layer detects that the application is running in the foreground, it can send a monitoring instruction to the kernel layer so that the kernel layer starts to monitor whether the application data of the application is abnormal.
[0133] In other embodiments, the electronic device may start monitoring whether the application data of the application is abnormal only when it detects that the application is running in the foreground and is currently connected to the network. For example, the application layer may send a monitoring instruction to the kernel layer only when it detects that the application is running in the foreground and is currently connected to the network, so that the kernel layer starts monitoring whether the application data of the application is abnormal. It can be understood that in this case, the currently connected network can also be called the first network.
[0134] In other embodiments, the electronic device may start monitoring whether the application data of the application is abnormal only when it detects that the application is running in the foreground and the network mode is switched. For example, the application layer may send a monitoring instruction to the kernel layer only when it detects that the application is running in the foreground and the network mode is switched, so that the kernel layer starts monitoring whether the application data of the application is abnormal.
[0135] It can be understood that due to the different IP address ranges (network segments) of different network modes, the IP address of the electronic device changes. Since 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 time, it is easy to have the problem of abnormal application data transmission from the application server to the electronic device, for example, the application server cannot transmit the application data to the electronic device. When the application layer detects that the application is running in the foreground and the network mode is switched, it starts to trigger the kernel layer to monitor whether the application data of the application is abnormal. This more accurately locates the detection time of the application data transmission anomaly, and further shortens the detection time of the application data transmission anomaly, thereby improving the efficiency of application data anomaly detection.
[0136] S602: The kernel layer receives the monitoring instruction and determines whether the application data is abnormal.
[0137] The electronic device can determine whether the application data is abnormal. If the application data is determined to be normal, the operation of determining whether the application data is abnormal can be re-executed. If the application data is determined to be abnormal, the network currently connected to the electronic device is automatically disconnected and reconnected to the network.
[0138] Specifically, in some embodiments, the kernel layer responds to the monitoring 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 abnormal application data is fed back to the application program layer, see S603 for details.
[0139] The kernel layer receives the monitoring instruction, and in response, the kernel layer determines whether the application data of the corresponding application is abnormal. The following introduces a solution for determining whether the application data is abnormal by determining whether the key stream in the application data of the corresponding application is abnormal. The key stream is the data stream composed of multiple key data packets introduced above, and the key data packet is a data packet whose first N bytes are characteristic fields.
[0140] Specifically, in some embodiments, the kernel layer can judge whether the key flow is abnormal, or judge whether the application data is abnormal, by monitoring whether the ratio of the key data packet that has an abnormality to all the key data packets within the preset time (for example, within A seconds) exceeds the abnormal threshold. If the kernel layer monitors the key data packet that has an abnormality within the preset time (for example, within A seconds) and the ratio of all the key data packets within the preset time exceeds the abnormal threshold, it is determined that the key flow is abnormal, or the application data is abnormal. At this time, the following S603-S604 can be executed. If the kernel layer monitors the key data packet that has an abnormality within the preset time (for example, within A seconds) and the ratio of all the key data packets within the preset time does not exceed the abnormal threshold, it is determined that the application data is not abnormal. At this time, it can continue to monitor whether the application data is abnormal, that is, execute S602. The identification of the key data packet can refer to the description of the related technical solution in the previous text, which will not be repeated here. In addition, the abnormal threshold is pre-set.
[0141] The kernel layer can determine whether a critical data packet is abnormal by determining whether the critical data packet is marked abnormal (such as the cause of the abnormality). It should be noted that, in addition to the critical data packet, all data packets in the application data can be determined to be abnormal by determining whether the data packet is marked abnormal.
[0142] There are generally multiple reasons for the abnormality of key data packets, such as failure to connect to the host (HostUnreachable), server request timeout (ConnectException), port unreachable (Port Unreachable), and various socket exceptions that may occur when using sockets (SocketException). Among them, the exception that may occur when using sockets may be that other electronic devices try to connect to the socket of an electronic device, but the electronic device rejects the connection.
[0143] The following takes the case where the cause of the abnormality of the key data packet is Host Unreachable as an example to illustrate the specific implementation scheme for identifying whether the application data is abnormal. Table 2 shows the causes of the abnormality of the key data packets recorded by the kernel layer over a period of time.
[0144] As shown in Table 2 below, the kernel layer monitors that there are 10 key data packets in the application data within A seconds. If all the 10 key data packets are abnormal, for example, the reason for the abnormality of the key data packets is Host Unreachable, the ratio of the abnormal key data packets to all key data packets within A seconds is 100%. If the abnormal threshold is 40%, 100% exceeds 40%, and the ratio of the abnormal key data packets to all key data packets within the preset time exceeds the abnormal threshold, the application data is determined to be abnormal.
[0145] Table 2
[0146]
[0147]
[0148] In other examples, if the kernel layer monitors 10 key data packets in the application data within A seconds, if 2 of the 10 key data packets are abnormal, and the other 8 data packets are normal, the ratio of abnormal key data packets to all key data packets within A seconds is about 20%, which is less than the abnormal threshold of 40%, and the ratio of abnormal key data packets to all key data packets within A seconds does not exceed the abnormal threshold, then it is determined that the application data is normal.
[0149] The above-described solution is to determine whether the application data is abnormal by determining whether the key flow in the application data is abnormal. In some other embodiments, the kernel layer can determine whether the application data is abnormal by determining whether all data packets in the application data are abnormal.
[0150] The kernel layer may receive the monitoring instruction sent by the application layer. In response, the kernel layer may determine whether all data packets in the application data are abnormal. Specifically, in some embodiments, if the kernel layer determines that the ratio of the data packets with abnormalities in all data packets in the application data exceeds the abnormal threshold, the following S603-S604 is executed. If the kernel layer determines that the ratio of the data packets with abnormalities in all data packets in the application data does not exceed the abnormal threshold, the operation of determining whether the application data is abnormal may be re-executed.
[0151] S603: The kernel layer feeds back information about application data anomalies to the application layer.
[0152] S604: The application layer receives the information about abnormal application data from the kernel layer, and closes and reopens the service switch of the current network.
[0153] When the electronic device detects that the application data of the application is abnormal, it can automatically disconnect the network to which the electronic device is currently connected and reconnect to the network. Specifically, in some embodiments, the application layer receives the information of the application data abnormality fed back by the kernel layer, and closes and reopens the service switch of the current network.
[0154] If the current network is a wireless network, the service switch of the wireless network is automatically turned off and turned on again. For example, the wireless network may be Wi-Fi, and the Wi-Fi switch may be automatically turned off and turned on again. If the current network is a mobile network, the service switch of the mobile network is automatically turned off and turned on again.
[0155] Optionally, during the process of the application layer closing and reopening the service switch of the current network, the display interface of the mobile phone 100 may display the change process of the service switch of the current network from the open state to the closed state and then to the open state. For example, the current network is a mobile network. Figure 8 A schematic diagram of the interface change of an electronic device showing closing and reopening a service switch of the current network is shown. Figure 8 (a) Figure 8 (b) and Figure 8 As shown in (c) of FIG. 1 , the pull-down control center interface 101 of the mobile phone 100 includes a mobile data service switch 1011. In the process of closing and reopening the mobile data network, the state of the mobile data service switch 1011 is as follows: Figure 8 The open state shown in (a) in the figure becomes Figure 8 The closed state shown in (b) in the figure finally changes to Figure 8 The open state shown in (c) in FIG.
[0156] The application layer can automatically disconnect the network to which the electronic device is currently connected and reconnect to the network by turning off and then turning on the service switch of the current network. In some other embodiments, the electronic device can automatically turn off the hardware switch related to the current network without the user's awareness, so as to automatically disconnect the network to which the electronic device is currently connected and reconnect to the network.
[0157] It can be understood that if the application running in the foreground in S601 is closed or switched to the background, the method provided in the embodiment of the present application can be stopped.
[0158] Based on the principles discussed in the previous article, after automatically disconnecting the network to which the electronic device is currently connected and reconnecting to the network, the application server can promptly update the address (i.e., socket) of the feedback application data, which improves the timeliness of updating the address (i.e., socket) of the feedback application data, and then the application can promptly update the application data to be output, reducing the application freeze time and improving the user experience.
[0159] Embodiment 2
[0160] In the first embodiment, as long as the application or the preset application is running in the foreground, the kernel layer will always detect the application data of the application, such as whether the key flow is abnormal, to prevent freezing at any time point during the foreground running of the application.
[0161] The difference between the second embodiment and the first embodiment is that, considering that if the application runs stably within a certain period of time, that is, there is no lag, then the application is likely to be in a stable running state afterwards, and it is no longer necessary to monitor whether the application data is abnormal, thereby reducing the computing power loss caused by the electronic device monitoring the application data abnormality. For details, see Fig. 9 The S905 in the.
[0162] Fig. 9 A flow chart of another method for processing application jams is shown, such as Fig. 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 monitoring time, the timer sends a stop monitoring instruction to the kernel layer.
[0165] A timer is set in the application layer, and the timer is used to send a stop monitoring instruction to the kernel layer when the preset monitoring time is exceeded. The stop monitoring instruction is used to instruct the kernel layer to stop monitoring whether the application data in the application is abnormal.
[0166] It can be understood that the timer can be started when the application is started or when the application layer sends a monitoring instruction to the kernel layer after detecting that the application is running in the foreground.
[0167] For example, when the application layer detects that the application is turned on, the timer is started. Moreover, after the application layer sends a monitoring instruction to the kernel layer, the kernel layer starts to monitor whether the application data is abnormal, and when the application data is monitored to be abnormal, the kernel layer feeds back information about the application data abnormality to the application layer. When the application layer receives the information about the application data abnormality, it can automatically disconnect the network to which the electronic device is currently connected and reconnect the network. After the application layer sends a monitoring instruction to the kernel layer, the kernel layer starts to monitor whether the application data is abnormal, and when the application data is monitored to be normal, it continues to re-execute the operation of determining whether the application data is abnormal. After the timer is started, the application layer can also use the timer to determine whether the preset monitoring time is exceeded, and when the preset monitoring time is exceeded, a stop monitoring instruction is sent to the kernel layer. The stop monitoring instruction is used to instruct the kernel layer to stop continuing to monitor whether the application data in the application is abnormal.
[0168] For another example, when the application layer sends a monitoring instruction to the kernel layer during the application running in the foreground, the timer is started. Moreover, after the application layer sends the monitoring instruction to the kernel layer, the kernel layer starts to monitor whether the application data is abnormal, and when the application data is monitored to be abnormal, the kernel layer feeds back the information of the application data abnormality to the application layer. After the application layer receives the information of the application data abnormality, it can automatically disconnect the network currently connected to the electronic device and reconnect the network. After the application layer sends the monitoring instruction to the kernel layer, the kernel layer starts to monitor whether the application data is abnormal, and when the application data is monitored to be normal, it continues to re-execute the operation of determining whether the application data is abnormal. After the timer is started, the application layer can use the timer to determine whether the preset monitoring time is exceeded, and when the preset monitoring time is exceeded, a stop monitoring instruction is sent to the kernel layer. The stop monitoring instruction is used to instruct the kernel layer to stop continuing to monitor whether the application data in the application is abnormal.
[0169] An embodiment of the present application also provides a computer storage medium, which includes computer instructions. When the computer instructions are executed on the above-mentioned electronic device, the electronic device executes each function or step executed by the mobile phone in the above-mentioned method embodiment.
[0170] The embodiment of the present application also provides a computer program product. When the computer program product is run on a computer, the computer is enabled to execute each function or step executed by the mobile phone in the above method embodiment.
[0171] It is understandable that the electronic device provided in the embodiment of the present application includes a hardware structure and / or software module corresponding to each function in order to realize the above functions. Those skilled in the art should easily realize that, in conjunction with the units and algorithm steps of each example described in the embodiment disclosed herein, the embodiment of the present application can be implemented in the form of hardware or a combination of hardware and computer software. Whether a function is executed in the form of hardware or computer software driving hardware depends on the specific application and design constraints of the technical solution. Professional and technical personnel can use different methods to implement the described functions for each specific application, but such implementation should not be considered to exceed the scope of the embodiment of the present application.
[0172] The embodiment of the present application can divide the functional modules of the above-mentioned electronic device according to the above-mentioned method example. For example, each functional module can be divided corresponding to each function, or two or more functions can be integrated into one processing module. The above-mentioned integrated module can be implemented in the form of hardware or in the form of software functional modules. It should be noted that the division of modules in the embodiment of the present application is schematic and is only a logical function division. There may be other division methods in actual implementation.
[0173] Through the description of the above implementation methods, technical personnel in the relevant field can clearly understand that for the convenience and simplicity of description, only the division of the above-mentioned functional modules is used as an example. In actual applications, the above-mentioned 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 the present application, it should be understood that the disclosed devices and methods can be implemented in other ways. For example, the device embodiments described above are only schematic. For example, the division of the modules or units is only a logical function division. There may be other division methods in actual implementation, such as multiple units or components can be combined or integrated into another device, or some features can be ignored or not executed. Another point is that the mutual coupling or direct coupling or communication connection shown or discussed can be through some interfaces, indirect coupling or communication connection of devices or units, which can be electrical, mechanical or other forms.
[0175] The units described as separate components may or may not be physically separated, and the components shown as units may be one physical unit or multiple physical units, that is, they may be located in one place or distributed in multiple different places. Some or all of the units may be selected according to actual needs to achieve the purpose of the present embodiment.
[0176] In addition, each functional unit in each embodiment of the present application may be integrated into one processing unit, or each unit may exist physically separately, or two or more units may be integrated into one unit. The above-mentioned integrated unit may be implemented in the form of hardware or in the form of software functional units.
[0177] If the integrated unit is implemented in the form of a software functional unit and sold or used as an independent product, it can be stored in a readable storage medium. Based on this understanding, the technical solution of the embodiment of the present application is essentially or the part that contributes to the prior art or all or part of the technical solution can be embodied in the form of a software product, which is stored in a storage medium, including several instructions to enable a device (which can be a single-chip microcomputer, chip, etc.) or a processor (processor) to perform all or part of the steps of the method described in each embodiment of the present application. The aforementioned storage medium includes: U disk, mobile hard disk, read-only memory (ROM), random access memory (RAM), disk or optical disk and other media that can store program code.
[0178] The above contents are only specific implementation methods of the present application, but the protection scope of the present application is not limited thereto. Any changes or substitutions within the technical scope disclosed in the present application shall be included in the protection scope of the present application. Therefore, the protection scope of the present application shall be subject to the protection scope of the claims.
Claims
1. A method for processing application jams, characterized in that: Applied to electronic equipment, the method comprises: Running a first application in the foreground of the electronic device; During the process of the first application running in the foreground, monitoring whether application data of the first application is abnormal; wherein the abnormal application data of the first application may cause the first application to freeze; When the application data of the first application is abnormal, the network to which the electronic device is currently connected is automatically disconnected and the network is reconnected.
2. The method according to claim 1, characterized in that The first application is an application corresponding to an application identifier in an application list; wherein the application list includes at least one application identifier, and the application identifiers and applications correspond one to one.
3. The method according to claim 1 or 2, characterized in that: The monitoring whether the application data of the first application is abnormal includes: monitoring whether a ratio of abnormal data packets of the first application to all data packets of the first application within a preset time exceeds an abnormal threshold; If, within the preset time, the ratio of the data packets of the first application that are abnormal to all the data packets of the first application within the preset time exceeds an abnormal threshold, the application data is abnormal.
4. The method according to claim 1 or 2, characterized in that: The monitoring whether the application data of the first application is abnormal includes: Monitoring whether the ratio of the key data packet of the first application that has an abnormality to all the key data packets of the first application within the preset time exceeds an abnormality threshold; wherein the key data packet is a data packet of the first application whose data content is a characteristic field; If, within the preset time, the ratio of the critical data packets of the first application that have abnormalities to all the critical data packets of the first application within the preset time exceeds an abnormal threshold, the application data is abnormal.
5. The method according to any one of claims 1 to 4, characterized in that The method further comprises: When the preset monitoring time is exceeded, the operation of monitoring whether the application data in the first application is abnormal is stopped.
6. The method according to any one of claims 1 to 5, characterized in that During the process that the first application is running in the foreground, monitoring whether the application data of the first application is abnormal includes: When the first application is running in the foreground and the network mode is switched, monitoring whether application data of the first application is abnormal; or; When the first application is running in the foreground and connected to the first network, whether application data of the first application is abnormal is monitored.
7. The method according to any one of claims 1 to 6, characterized in that The automatically disconnecting the network to which the electronic device is currently connected and reconnecting to the network comprises: Close and reopen the service switch of the network.
8. The method according to claim 3 or 4, characterized in that: The data packet of the first application is socket data including an application identifier of the first application, and the socket data is data transmitted through a socket application programming interface.
9. An electronic device, characterized in that: The electronic device comprises: a memory and one or more processors; The memory is used to store computer program codes, and the computer program codes include computer instructions; when the computer instructions are executed by the processor, the electronic device executes the method as described in any one of claims 1 to 8.
10. A computer-readable storage medium, characterized in that: including computer instructions; When the computer instructions are executed on an electronic device, the electronic device is caused to execute the method as claimed in any one of claims 1 to 8.
11. A computer program product, characterized in that When the computer program product is run on a computer, the computer is caused to execute the method according to any one of claims 1 to 8.
Citation Information
Patent Citations
Network anomaly recovery method, terminal and computer storage medium
CN112087772A
Network recovery method and device
CN113810901A
Network switching method and device and storage medium
CN115915318A
Network acceleration method and device
CN116709368A
Network reconnection method and device, terminal equipment and storage medium
CN116939000A
