CN115002797B - Network quality detection method and related electronic equipment - Google Patents

Network quality detection method and related electronic equipment Download PDF

Info

Publication number
CN115002797B
CN115002797B CN202111367405.5A CN202111367405A CN115002797B CN 115002797 B CN115002797 B CN 115002797B CN 202111367405 A CN202111367405 A CN 202111367405A CN 115002797 B CN115002797 B CN 115002797B
Authority
CN
China
Prior art keywords
network
application
message
channel
network channel
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Active
Application number
CN202111367405.5A
Other languages
Chinese (zh)
Other versions
CN115002797A (en
Inventor
刘继蕾
王金香
梁恒辉
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Honor Device Co Ltd
Original Assignee
Honor Device Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Honor Device Co Ltd filed Critical Honor Device Co Ltd
Priority to CN202111367405.5A priority Critical patent/CN115002797B/en
Priority to CN202310358098.7A priority patent/CN116405960B/en
Publication of CN115002797A publication Critical patent/CN115002797A/en
Application granted granted Critical
Publication of CN115002797B publication Critical patent/CN115002797B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04WWIRELESS COMMUNICATION NETWORKS
    • H04W24/00Supervisory, monitoring or testing arrangements
    • H04W24/02Arrangements for optimising operational condition
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L69/00Network arrangements, protocols or services independent of the application payload and not provided for in the other groups of this subclass
    • H04L69/22Parsing or analysis of headers
    • YGENERAL TAGGING OF NEW TECHNOLOGICAL DEVELOPMENTS; GENERAL TAGGING OF CROSS-SECTIONAL TECHNOLOGIES SPANNING OVER SEVERAL SECTIONS OF THE IPC; TECHNICAL SUBJECTS COVERED BY FORMER USPC CROSS-REFERENCE ART COLLECTIONS [XRACs] AND DIGESTS
    • Y02TECHNOLOGIES OR APPLICATIONS FOR MITIGATION OR ADAPTATION AGAINST CLIMATE CHANGE
    • Y02DCLIMATE CHANGE MITIGATION TECHNOLOGIES IN INFORMATION AND COMMUNICATION TECHNOLOGIES [ICT], I.E. INFORMATION AND COMMUNICATION TECHNOLOGIES AIMING AT THE REDUCTION OF THEIR OWN ENERGY USE
    • Y02D30/00Reducing energy consumption in communication networks
    • Y02D30/70Reducing energy consumption in communication networks in wireless communication networks

Landscapes

  • Engineering & Computer Science (AREA)
  • Computer Networks & Wireless Communication (AREA)
  • Signal Processing (AREA)
  • Computer Security & Cryptography (AREA)
  • Mobile Radio Communication Systems (AREA)

Abstract

本申请提供了一种网络质量的检测方法及相关电子设备,该方法包括:响应用户的第一操作,启动第一应用;周期性地接收目标流的报文统计信息;该报文统计信息为第一应用与服务器之间数据流的统计信息;在基于当前周期的报文统计信息判断出第一应用处于暂停下载/停止下载状态的情况下,不记录当前周期的网络质量;基于当前周期的报文统计信息判断上行报文是否为ACK报文;在所述上行报文不为ACK报文的情况下,记录下一周期的网络质量。

Figure 202111367405

The present application provides a network quality detection method and related electronic equipment, the method comprising: responding to the user's first operation, starting the first application; periodically receiving packet statistical information of the target flow; the packet statistical information is Statistical information of the data flow between the first application and the server; when it is judged that the first application is in the state of suspending download/stopping download based on the packet statistical information of the current period, the network quality of the current period is not recorded; the network quality based on the current period is not recorded The message statistical information judges whether the uplink message is an ACK message; if the uplink message is not an ACK message, record the network quality of the next period.

Figure 202111367405

Description

一种网络质量的检测方法及相关电子设备Method for detecting network quality and related electronic equipment

技术领域technical field

本申请涉及网络质量检测领域,尤其涉及一种网络质量的检测方法及相关电子设备。The present application relates to the field of network quality detection, in particular to a network quality detection method and related electronic equipment.

背景技术Background technique

随着电子技术及互联网技术的快速发展,手机等移动设备在人们日常生活中的应用越来越广,例如,可以通过手机进行移动支付及游戏等。为了保证常用业务(例如,游戏,通话、社交软件等业务)的正常运行,通常用户的手机都会连接无线网络。在网络质量变差的情况下,通常会进行网络加速。但是,在用户进行上网过程中,对于网络质量检测往往存在不准确的问题,在网络质量检测不准确的情况下,会发生网络误切的问题,可能会造成用户使用大量的数据流量进行网络加速,在用户数据流量套餐不足的情况下,可能会超出用户的套餐限额,从而使得用户需要缴纳额外的话费,从而降低用户的上网体验。With the rapid development of electronic technology and Internet technology, mobile devices such as mobile phones are more and more widely used in people's daily life. For example, mobile payment and games can be performed through mobile phones. In order to ensure the normal operation of common services (such as games, calls, social software, etc.), usually the user's mobile phone will be connected to the wireless network. In the case of poor network quality, network acceleration is usually performed. However, in the process of users surfing the Internet, the network quality detection often has inaccurate problems. In the case of inaccurate network quality detection, the problem of network misconnection may occur, which may cause users to use a large amount of data traffic for network acceleration. , when the user's data traffic package is insufficient, the user's package limit may be exceeded, so that the user needs to pay additional phone charges, thereby reducing the user's online experience.

发明内容Contents of the invention

本申请实施例提供了一种网络质量检测方法,解决了因网络质量检测结果不准确,使得在网络加速过程中,错误切换网络通道的问题。The embodiment of the present application provides a network quality detection method, which solves the problem of incorrectly switching network channels during the network acceleration process due to inaccurate network quality detection results.

第一方面,本申请实施例提供了一种方法,包括:响应用户的第一操作,启动第一应用;周期性地接收目标流的报文统计信息;该报文统计信息为第一应用与服务器之间数据流的统计信息;在基于当前周期的报文统计信息判断出第一应用处于暂停下载/停止下载状态的情况下,不记录当前周期的网络质量;基于当前周期的报文统计信息判断上行报文是否为ACK报文;在上行报文不为ACK报文的情况下,记录下一周期的网络质量。在上述实施例中,判断上行报文是否为ACK报文,若上行报文为ACK报文,则电子设备按照原有状态检测网络质量,例如,当第一应用处于下载状态的情况下,电子设备基于下行网络速率检测网络质量,当第一应用处于暂停下载/结束下载的情况下,电子设备不记录网络质量。通过这样的方法,能够解决在第一应用处于暂停下载/结束下载的状态下,电子设备将上行报文错误判断为下载请求报文,继续检测下载结束后的网络质量,造成网络质量检测结果的不准确,使得电子设备将这个不准确的网络检测结果作为判断是否进行网络通道切换的参考因素,造成电子设备错误切换第一应用的网络通道的问题。In the first aspect, the embodiment of the present application provides a method, including: responding to the user's first operation, starting the first application; periodically receiving packet statistical information of the target flow; the packet statistical information is the first application and Statistical information of data flow between servers; when it is judged that the first application is in the state of suspending download/stop downloading based on the packet statistical information of the current period, the network quality of the current period is not recorded; based on the packet statistical information of the current period Determine whether the uplink message is an ACK message; if the uplink message is not an ACK message, record the network quality of the next period. In the above embodiment, it is determined whether the uplink message is an ACK message. If the uplink message is an ACK message, the electronic device detects the network quality according to the original state. For example, when the first application is in the download state, the electronic device The device detects the network quality based on the downlink network rate, and the electronic device does not record the network quality when the download of the first application is suspended/terminated. Through such a method, it can be solved that when the first application is in the state of suspending download/ending download, the electronic device misjudges the uplink message as a download request message, and continues to detect the network quality after the download is completed, resulting in the error of the network quality detection result. The inaccuracy makes the electronic device use the inaccurate network detection result as a reference factor for judging whether to switch the network channel, causing the problem that the electronic device wrongly switches the network channel of the first application.

在一种可能实现的方式中,该方法还包括:在上行报文为ACK报文的情况下,判断下一周期的上行报文是否为ACK报文。In a possible implementation manner, the method further includes: if the uplink message is an ACK message, judging whether the uplink message of the next cycle is an ACK message.

在一种可能实现的方式中,基于当前周期的报文统计信息判断上行报文是否为ACK报文,具体包括:基于报文统计信息判断上行报文的网络协议是否为GQUIC协议;在网络协议不为GQUIC协议的情况下,确定上行报文不为ACK报文;在网络协议为GQUIC协议的情况下,检测上行报文的payload字段的长度是否大于或等于第一阈值;若大于或等于第一阈值,确定该上行报文不为ACK报文;若小于所述第一阈值,确定该上行报文为ACK报文。这样,电子设备能够区分上行报文为ACK报文或下载请求报文,从而能够避免在第一应用处于暂停下载/结束下载的状态下,电子设备将上行报文错误判断为下载请求报文,继续检测下载结束后的网络质量,造成网络质量检测结果的不准确,使得电子设备将这个不准确的网络质量检测结果作为判断是否进行网络通道切换的参考因素,从而使得电子设备错误切换第一应用的网络通道。In a possible implementation manner, judging whether the uplink packet is an ACK packet based on the packet statistical information of the current period specifically includes: judging whether the network protocol of the uplink packet is the GQUIC protocol based on the packet statistical information; If it is not the GQUIC protocol, determine that the uplink message is not an ACK message; if the network protocol is the GQUIC protocol, check whether the length of the payload field of the uplink message is greater than or equal to the first threshold; if greater than or equal to the first threshold a threshold, determine that the uplink message is not an ACK message; if it is less than the first threshold, determine that the uplink message is an ACK message. In this way, the electronic device can distinguish the uplink message as an ACK message or a download request message, so as to prevent the electronic device from misjudging the uplink message as a download request message when the first application is in the state of suspending download/ending download. Continue to detect the network quality after the download is completed, resulting in inaccurate network quality detection results, so that the electronic device uses this inaccurate network quality detection result as a reference factor for judging whether to switch the network channel, so that the electronic device switches the first application by mistake network channel.

在一种可能实现的方式中,基于报文统计信息判断所述上行报文的网络协议是否为GQUIC协议,包括:判断该上行报文是否存在CHLO字段;若存在CHLO字段,确定该上行报文的网络协议为GQUIC协议;若不存在CHLO字段,确定该上行报文的网络协议不为GQUIC协议。这样,通过CHLO字段判断上行报文的网络协议是否为GQUIC协议,可以在确定网络协议是GQUIC协议的情况下,进一步判断该上行报文是否为ACK报文。In a possible implementation manner, judging whether the network protocol of the uplink message is the GQUIC protocol based on message statistical information includes: judging whether the uplink message has a CHLO field; if there is a CHLO field, determining the uplink message The network protocol of the uplink message is the GQUIC protocol; if there is no CHLO field, it is determined that the network protocol of the uplink message is not the GQUIC protocol. In this way, judging whether the network protocol of the uplink message is the GQUIC protocol through the CHLO field can further determine whether the uplink message is an ACK message when the network protocol is determined to be the GQUIC protocol.

在一种可能实现的方式中,网络质量为基于当前周期的报文统计信息中的下行网络速率得到的;若下行网络速率小于或等于预设的速率阈值,则当前周期的网络质量记录为差;若下行网络速率大于预设的速率阈值,则当前周期的网络质量记录为优。这样,电子设备能够基于网络质量判断是否进行网络通道的切换,从而避免第一应用出现业务卡顿,降低用户的上网体验。In a possible implementation manner, the network quality is obtained based on the downlink network rate in the packet statistics information of the current period; if the downlink network rate is less than or equal to the preset rate threshold, the network quality of the current period is recorded as poor ; If the downlink network rate is greater than the preset rate threshold, the network quality record of the current cycle is excellent. In this way, the electronic device can judge whether to switch the network channel based on the network quality, so as to prevent the first application from being stuck and reduce the user's online experience.

在一种可能实现的方式中,所述基于当前周期的报文统计信息判断上行报文是否为ACK报文之后,还包括:在当前的统计周期数量大于M的情况下,获取与当前周期相邻的M个周期的网络质量;判断在该M个周期中,是否超过N个周期的网络质量为差;若判断为是,确定切换所述第一应用的网络通道;若判断为否,确定不切换第一应用的网络通道;在当前的统计周期数量小于或等于M的情况下,获取与当前周期所有相邻的P个周期的网络质量;判断在该P个周期中,是否超过(P*N)/M个周期的网络质量为差;若判断为是,确定切换第一应用的网络通道;若判断为否,确定不切换第一应用的网络通道。这样,电子设备能够基于网络质量判断是否进行网络通道的切换,从而避免第一应用出现业务卡顿,降低用户的上网体验。In a possible implementation manner, after determining whether the uplink packet is an ACK packet based on the packet statistical information of the current period, it further includes: when the number of current statistical periods is greater than M, obtaining The network quality of the adjacent M cycles; judge whether the network quality of more than N cycles is poor in the M cycles; if the judgment is yes, determine to switch the network channel of the first application; if the judgment is no, determine The network channel of the first application is not switched; in the case that the number of current statistical periods is less than or equal to M, obtain the network quality of all P periods adjacent to the current period; judge whether in the P periods, it exceeds (P *N)/M period of network quality is poor; if judged as yes, determine to switch the network channel of the first application; if judged as no, determine not to switch the network channel of the first application. In this way, the electronic device can judge whether to switch the network channel based on the network quality, so as to prevent the first application from being stuck and reduce the user's online experience.

在一种可能实现的方式中,在基于所述当前周期的报文统计信息判断该上行报文不为述ACK报文之后,记录下一周期的网络质量之前,还包括:将下载结束标志设置为第二标识,第二标识用于表征第一应用处于开始下载状态。这样,有利于电子设备在下一个周期判断是否记录网络质量。In a possible implementation manner, after judging that the uplink packet is not the ACK packet based on the packet statistics information of the current period, before recording the network quality of the next period, it also includes: setting the download end flag is a second identifier, and the second identifier is used to indicate that the first application is in a state of starting to download. In this way, it is beneficial for the electronic device to judge whether to record the network quality in the next period.

在一种可能实现的方式中,在基于当前周期的报文统计信息判断出第一应用处于暂停下载/停止下载状态的情况下,不记录当前周期的网络质量,包括:基于当前周期的报文统计信息判断出下载结束标志为第一标识的情况下,不记录当前周期的网络质量;其中,下载结束标志为用于表征第一应用的下载状态;第一标识用于表征第一应用处于暂停下载/停止下载状态。In a possible implementation manner, when it is judged that the first application is in the state of suspending download/stop downloading based on the packet statistics information of the current period, the network quality of the current period is not recorded, including: packets based on the current period When the statistical information judges that the download end flag is the first flag, the network quality of the current period is not recorded; the download end flag is used to represent the download status of the first application; the first flag is used to represent that the first application is suspended Download/stop download status.

在一种可能实现的方式中,基于当前周期的报文统计信息判断出下载结束标志为第一标志的情况下,不记录当前周期的网络质量之前,还包括:所述当前周期的报文统计信息判断是否将所述下载结束标志设置为所述第一标识;在判断为是的情况下,将下载结束标志设置为所述第一标识;判断下载结束标志是否为第一标识。In a possible implementation manner, when it is judged that the download end flag is the first flag based on the packet statistics information of the current period, before recording the network quality of the current period, it also includes: the packet statistics of the current period The information judges whether to set the download end flag as the first identifier; if the judgment is yes, set the download end flag to the first identifier; judge whether the download end flag is the first identifier.

第二方面,本申请实施例提供了一种电子设备,该电子设备包括:一个或多个处理器和存储器;该存储器与该一个或多个处理器耦合,该存储器用于存储计算机程序代码,该计算机程序代码包括计算机指令,该一个或多个处理器调用该计算机指令以使得该电子设备执行:响应用户的第一操作,启动第一应用;周期性地接收目标流的报文统计信息;该报文统计信息为第一应用与服务器之间数据流的统计信息;在基于当前周期的报文统计信息判断出第一应用处于暂停下载/停止下载状态的情况下,不记录当前周期的网络质量;基于当前周期的报文统计信息判断上行报文是否为ACK报文;在上行报文不为ACK报文的情况下,记录下一周期的网络质量。In a second aspect, an embodiment of the present application provides an electronic device, which includes: one or more processors and a memory; the memory is coupled to the one or more processors, and the memory is used to store computer program codes, The computer program code includes computer instructions, and the one or more processors invoke the computer instructions to cause the electronic device to execute: responding to a first user operation, starting a first application; periodically receiving packet statistics information of a target flow; The packet statistical information is the statistical information of the data flow between the first application and the server; if it is judged based on the packet statistical information of the current period that the first application is in the state of suspending download/stopping download, the network traffic of the current period is not recorded. Quality: judge whether the uplink packet is an ACK packet based on the packet statistics of the current cycle; if the uplink packet is not an ACK packet, record the network quality of the next cycle.

在一种可能实现的方式中,该一个或多个处理器调用该计算机指令以使得该电子设备还执行:在上行报文为ACK报文的情况下,判断下一周期的上行报文是否为ACK报文。In a possible implementation manner, the one or more processors invoke the computer instruction so that the electronic device further executes: in the case that the uplink message is an ACK message, judging whether the uplink message of the next cycle is ACK message.

在一种可能实现的方式中,该一个或多个处理器调用该计算机指令以使得该电子设备执行:基于报文统计信息判断上行报文的网络协议是否为GQUIC协议;在网络协议不为GQUIC协议的情况下,确定上行报文不为ACK报文;在网络协议为GQUIC协议的情况下,检测上行报文的payload字段的长度是否大于或等于第一阈值;若大于或等于第一阈值,确定该上行报文不为ACK报文;若小于所述第一阈值,确定该上行报文为ACK报文。In a possible implementation manner, the one or more processors call the computer instruction to make the electronic device execute: determine whether the network protocol of the uplink message is the GQUIC protocol based on the packet statistical information; if the network protocol is not GQUIC In the case of the protocol, it is determined that the uplink message is not an ACK message; in the case of the GQUIC protocol in the network protocol, whether the length of the payload field of the uplink message is greater than or equal to the first threshold is detected; if greater than or equal to the first threshold, Determine that the uplink message is not an ACK message; if it is smaller than the first threshold, determine that the uplink message is an ACK message.

在一种可能实现的方式中,该一个或多个处理器调用该计算机指令还可以使得该电子设备执行:基于报文统计信息判断所述上行报文的网络协议是否为GQUIC协议,包括:判断该上行报文是否存在CHLO字段;若存在CHLO字段,确定该上行报文的网络协议为GQUIC协议;若不存在CHLO字段,确定该上行报文的网络协议不为GQUIC协议。In a possible implementation manner, calling the computer instruction by the one or more processors may also cause the electronic device to execute: judging whether the network protocol of the uplink packet is the GQUIC protocol based on the packet statistical information, including: judging Whether there is a CHLO field in the uplink message; if there is a CHLO field, it is determined that the network protocol of the uplink message is the GQUIC protocol; if there is no CHLO field, it is determined that the network protocol of the uplink message is not the GQUIC protocol.

在一种可能实现的方式中,该一个或多个处理器调用该计算机指令还可以使得该电子设备执行:在当前的统计周期数量大于M的情况下,获取与当前周期相邻的M个周期的网络质量;判断在该M个周期中,是否超过N个周期的网络质量为差;若判断为是,确定切换所述第一应用的网络通道;若判断为否,确定不切换第一应用的网络通道;在当前的统计周期数量小于或等于M的情况下,获取与当前周期所有相邻的P个周期的网络质量;判断在该P个周期中,是否超过(P*N)/M个周期的网络质量为差;若判断为是,确定切换第一应用的网络通道;若判断为否,确定不切换第一应用的网络通道。In a possible implementation manner, calling the computer instruction by the one or more processors may also cause the electronic device to perform: when the current statistical cycle number is greater than M, acquire M cycles adjacent to the current cycle network quality; judge whether the network quality of more than N cycles is poor in the M cycles; if judged to be yes, determine to switch the network channel of the first application; if judged to be no, determine not to switch the first application network channel; when the number of current statistical periods is less than or equal to M, obtain the network quality of all P periods adjacent to the current period; judge whether it exceeds (P*N)/M in the P periods The network quality of a cycle is poor; if the judgment is yes, it is determined to switch the network channel of the first application; if the judgment is no, it is determined not to switch the network channel of the first application.

在一种可能实现的方式中,该一个或多个处理器调用该计算机指令还可以使得该电子设备执行:将下载结束标志设置为第二标识,下载结束标志用于表征第一应用的下载状态。这样,有利于电子设备在下一个周期判断是否记录网络质量。In a possible implementation manner, calling the computer instruction by the one or more processors may also cause the electronic device to execute: setting the download end flag as the second identifier, where the download end flag is used to represent the download status of the first application . In this way, it is beneficial for the electronic device to judge whether to record the network quality in the next period.

在一种可能实现的方式中,该一个或多个处理器调用该计算机指令以使得该电子设备执行:在基于当前周期的报文统计信息判断出第一应用处于暂停下载/停止下载状态的情况下,不记录当前周期的网络质量,具体包括:基于当前周期的报文统计信息判断出下载结束标志为第一标识的情况下,不记录当前周期的网络质量;其中,下载结束标志为用于表征第一应用的下载状态;第一标识用于表征第一应用处于暂停下载/停止下载状态。In a possible implementation manner, the one or more processors call the computer instruction to make the electronic device execute: when it is determined based on the packet statistics information of the current period that the first application is in the state of suspending download/stop downloading In this case, the network quality of the current period is not recorded, which specifically includes: when it is judged based on the packet statistics of the current period that the download end flag is the first identifier, the network quality of the current period is not recorded; where the download end flag is used for Indicates the download status of the first application; the first identifier is used to indicate that the first application is in a state of pausing download/stopping download.

在一种可能实现的方式中,该一个或多个处理器调用该计算机指令还可以使得该电子设备执行:所述当前周期的报文统计信息判断是否将所述下载结束标志设置为所述第一标识;在判断为是的情况下,将下载结束标志设置为所述第一标识;判断下载结束标志是否为第一标识。In a possible implementation manner, calling the computer instruction by the one or more processors may also cause the electronic device to execute: judging whether to set the download end flag as the first An identifier; if the judgment is yes, setting the download end flag as the first identifier; judging whether the download end flag is the first identifier.

第三方面,本申请实施例提供了一种电子设备,包括:触控屏、摄像头、一个或多个处理器和一个或多个存储器;所述一个或多个处理器与所述触控屏、所述摄像头、所述一个或多个存储器耦合,所述一个或多个存储器用于存储计算机程序代码,计算机程序代码包括计算机指令,当所述一个或多个处理器执行所述计算机指令时,使得所述电子设备执行如第一方面或第一方面的任意一种可能实现的方式所述的方法。In a third aspect, an embodiment of the present application provides an electronic device, including: a touch screen, a camera, one or more processors, and one or more memories; the one or more processors and the touch screen , the camera, the one or more memories are coupled, the one or more memories are used to store computer program codes, the computer program codes include computer instructions, and when the one or more processors execute the computer instructions , so that the electronic device executes the method described in the first aspect or any possible implementation manner of the first aspect.

第四方面,本申请实施例提供了一种芯片系统,该芯片系统应用于电子设备,该芯片系统包括一个或多个处理器,该处理器用于调用计算机指令以使得该电子设备执行如第一方面或第一方面的任意一种可能实现的方式所述的方法。In a fourth aspect, an embodiment of the present application provides a chip system, which is applied to an electronic device, and the chip system includes one or more processors, and the processor is used to call a computer instruction so that the electronic device executes the first Aspect or the method described in any possible implementation manner of the first aspect.

第五方面,本申请实施例提供了一种包含指令的计算机程序产品,当该计算机程序产品在电子设备上运行时,使得该电子设备执行如第一方面或第一方面的任意一种可能实现的方式所述的方法。In the fifth aspect, the embodiment of the present application provides a computer program product containing instructions. When the computer program product is run on an electronic device, the electronic device is made to execute any one of the possible implementations of the first aspect or the first aspect. The method described in the manner.

第六方面,本申请实施例提供了一种计算机可读存储介质,包括指令,当该指令在电子设备上运行时,使得该电子设备执行如第一方面或第一方面的任意一种可能实现的方式所述的方法。In the sixth aspect, the embodiment of the present application provides a computer-readable storage medium, including instructions, and when the instructions are run on the electronic device, the electronic device executes any one of the possible implementations of the first aspect or the first aspect. The method described in the manner.

附图说明Description of drawings

图1是本申请实施例提供的电子设备100的硬件结构示意图;FIG. 1 is a schematic diagram of a hardware structure of an electronic device 100 provided by an embodiment of the present application;

图2是本申请实施例提供的一种室内网络连接场景图;FIG. 2 is a scene diagram of an indoor network connection provided by an embodiment of the present application;

图3A-图3F是本申请实施例提供的一组用户使用电子设备100在线观看视频的示例性界面;3A-3F are exemplary interfaces provided by an embodiment of the present application for a group of users to use the electronic device 100 to watch videos online;

图4是本申请实施例提供的电子设备进行网络切换的架构图;FIG. 4 is an architecture diagram of network switching performed by an electronic device provided in an embodiment of the present application;

图5是本申请实施例提供的一种第一应用通过GQUIC协议与服务器进行数据传输的示意图;Fig. 5 is a schematic diagram of data transmission between a first application and a server through the GQUIC protocol provided by the embodiment of the present application;

图6是本申请实施例提供的一种网络质量检测方法的流程图;FIG. 6 is a flowchart of a method for detecting network quality provided by an embodiment of the present application;

图7是本申请实施例提供的一种报文监控的架构图;FIG. 7 is an architecture diagram of message monitoring provided by an embodiment of the present application;

图8是本申请实施例提供的流量感知组件以一个周期为单位检测网络质量的流程图;FIG. 8 is a flow chart of detecting network quality by the flow sensing component provided by the embodiment of the present application in units of one cycle;

图9是本申请实施例提供使用GQUIC协议的上行报文结构图;FIG. 9 is a structural diagram of an uplink message using the GQUIC protocol provided by the embodiment of the present application;

图10是本申请实施例提供的一种流量感知组件判断上行报文是否为ACK报文的流程图;FIG. 10 is a flow chart for judging whether an uplink message is an ACK message by a traffic sensing component provided in an embodiment of the present application;

图11是本申请实施例提供一种第一应用下载过程的示意图;FIG. 11 is a schematic diagram of a first application download process provided by an embodiment of the present application;

图12是本申请实施例提供一种第一应用判断是否切换网络通道的流程图;Fig. 12 is a flow chart of the first application judging whether to switch the network channel provided by the embodiment of the present application;

图13是本申请实施例提供一种电子设备的系统框架图;FIG. 13 is a system frame diagram of an electronic device provided by an embodiment of the present application;

图14是本申请实施例提供的一种Android系统的电子设备的软件结构框图。Fig. 14 is a software structural block diagram of an electronic device with an Android system provided by an embodiment of the present application.

具体实施方式Detailed ways

下面将结合本申请实施例中的附图,对本申请实施例中的技术方案进行清楚、完整地描述。显然,所描述的实施例仅仅是本申请一部分实施例,而不是全部的实施例。在本文中提及“实施例”意味着,结合实施例描述的特定特征、结构或者特性可以包含在本实施例申请的至少一个实施例中。在说明书中的各个位置出现该短语并不一定均是相同的实施例,也不是与其它实施例互斥的独立的或是备选的实施例。本领域技术人员可以显式地和隐式地理解的是,本文所描述的实施例可以与其它实施例相结合。基于本申请中的实施例,本领域普通技术人员在没有做出创造性劳动前提下所获得的所有其他实施例,都属于本申请保护的范围。The technical solutions in the embodiments of the present application will be clearly and completely described below in conjunction with the drawings in the embodiments of the present application. Apparently, the described embodiments are only some of the embodiments of this application, not all of them. Reference herein to an "embodiment" means that a particular feature, structure, or characteristic described in connection with the embodiment may be included in at least one embodiment of the present application of the embodiments. The occurrences of this phrase in various places in the specification are not necessarily all referring to the same embodiment, nor are separate or alternative embodiments mutually exclusive of other embodiments. It is understood explicitly and implicitly by those skilled in the art that the embodiments described herein can be combined with other embodiments. Based on the embodiments in this application, all other embodiments obtained by persons of ordinary skill in the art without making creative efforts belong to the scope of protection of this application.

本申请的说明书和权利要求书及所述附图中术语“第一”、“第二”、“第三”等是区别于不同的对象,而不是用于描述特定顺序。此外,术语“包括”和“具有”以及它们的任何变形,意图在于覆盖不排他的包含。例如,包含了一系列步骤或单元,或者可选地,还包括没有列出的步骤或单元,或者可选地还包括这些过程、方法、产品或设备固有的其它步骤或单元。The terms "first", "second", "third" and the like in the specification and claims of the present application and the drawings are used to distinguish different objects, and are not used to describe a specific order. Furthermore, the terms "comprising" and "having", as well as any variations thereof, are intended to cover a non-exclusive inclusion. For example, a series of steps or units are included, or alternatively, unlisted steps or units are also included, or other steps or units inherent in the process, method, product or apparatus are optionally included.

附图中仅示出了与本申请相关的部分而非全部内容。在更加详细地讨论示例性实施例之前,应当提到的是,一些示例性实施例被描述成作为流程图描绘的处理或方法。虽然流程图将各项操作(或步骤)描述成顺序的处理,但是其中的许多操作可以并行地、并发地或者同时实施。此外,各项操作的顺序可以被重新安排。当其操作完成时所述处理可以被终止,但是还可以具有未包括在附图中的附加步骤。所述处理可以对应于方法、函数、规程、子例程、子程序等等。The accompanying drawings only show the part relevant to the present application but not the whole content. Before discussing the exemplary embodiments in more detail, it should be mentioned that some exemplary embodiments are described as processes or methods depicted as flowcharts. Although the flowcharts describe various operations (or steps) as sequential processing, many of the operations may be performed in parallel, concurrently, or simultaneously. In addition, the order of operations can be rearranged. The process may be terminated when its operations are complete, but may also have additional steps not included in the figure. The processing may correspond to a method, function, procedure, subroutine, subroutine, or the like.

在本说明书中使用的术语“部件”、“模块”、“系统”、“单元”等用于表示计算机相关的实体、硬件、固件、硬件和软件的组合、软件或执行中的软件。例如,单元可以是但不限于在处理器上运行的进程、处理器、对象、可执行文件、执行线程、程序和/或分布在两个或多个计算机之间。此外,这些单元可从在上面存储有各种数据结构的各种计算机可读介质执行。单元可例如根据具有一个或多个数据分组(例如来自与本地系统、分布式系统和/或网络间的另一单元交互的第二单元数据。例如,通过信号与其它系统交互的互联网)的信号通过本地和/或远程进程来通信。The terms "component", "module", "system", "unit" and the like are used in this specification to denote a computer-related entity, hardware, firmware, a combination of hardware and software, software or software in execution. For example, a unit may be, but is not limited to being limited to, a process running on a processor, a processor, an object, an executable, a thread of execution, a program, and/or distributed between two or more computers. In addition, these units can execute from various computer readable media having various data structures stored thereon. A unit may, for example, be based on a signal having one or more data packets (eg, data from a second unit interacting with another unit between a local system, a distributed system, and/or a network. For example, the Internet via a signal interacting with other systems) Communicate through local and/or remote processes.

首先对本申请实施例涉及的名词进行示例性而非限定性的说明。Firstly, nouns involved in the embodiments of the present application are described as examples but not limitations.

1、移动识别模块(Subscriber Identity Module,SIM)卡:是GSM系统的移动用户所持有的IC卡,称为用户识别卡。GSM系统通过SIM卡来识别GSM用户,同一张SIM卡可在不同的手机上使用,GSM手机只有插入SIM卡后,才能入网使用。1. Mobile Identification Module (Subscriber Identity Module, SIM) card: It is an IC card held by a mobile user of the GSM system, called a Subscriber Identity Card. The GSM system identifies GSM users through the SIM card. The same SIM card can be used on different mobile phones, and the GSM mobile phone can only be connected to the network after inserting the SIM card.

2、全球移动通信系统(Global System for Mobile Communications,GSM):由欧洲电信标准组织ETSI制订的一个数字移动通信标准。它的空中接口采用时分多址技术。2. Global System for Mobile Communications (GSM): A digital mobile communication standard formulated by the European Telecommunications Standards Organization ETSI. Its air interface uses time division multiple access technology.

3、数据业务网卡是支持通过通用分组无线服务(General packet radioservice,GPRS)、增强型数据速率GSM演进技术(Enhanced Data Rate for GSM Evolution,EDGE)、时分同步码分多址(Time Division-Synchronous Code Division MultipleAccess,TD-SCDMA)、高速下行链路分组接入(High Speed Downlink Packet Access,HSDPA)、宽带码分多址(Wideband Code Division Multiple Access,WCDMA)、长期演进(Long Term Evolution,LTE)、第五代移动通信技术(5th Generation MobileCommunication Technology,5G)等移动通信技术上网的装置。3. The data service network card supports general packet radio service (General packet radioservice, GPRS), enhanced data rate GSM evolution technology (Enhanced Data Rate for GSM Evolution, EDGE), time division synchronous code division multiple access (Time Division-Synchronous Code Division Multiple Access (TD-SCDMA), High Speed Downlink Packet Access (HSDPA), Wideband Code Division Multiple Access (WCDMA), Long Term Evolution (LTE), Devices that use mobile communication technologies such as the fifth generation mobile communication technology (5th Generation Mobile Communication Technology, 5G) to access the Internet.

4、WIFI网卡是支持通过无线局域网(Wireless Local Area Network,WLAN)方式上网的装置。4. The WIFI network card is a device that supports Internet access through a wireless local area network (Wireless Local Area Network, WLAN).

5、谷歌快速UDP互联网连接协议(Google Quick UDP Internet Connections,GQUIC)是Google制定的一种基于UDP协议的低时延互联网应用层协议。5. Google Quick UDP Internet Connections (GQUIC) is a low-latency Internet application layer protocol based on UDP protocol developed by Google.

6、网络通道是指网络中两个或两个以上节点间的任何路由,或网络中一个源地址到一个目的地址的路由。6. A network channel refers to any route between two or more nodes in the network, or a route from a source address to a destination address in the network.

本申请实施例中电子设备的网络通道是指通过使用上述WIFI网卡或者数据业务网卡等上网的装置与其他电子设备例如服务器之间建立的路由。本申请实施例中,将使用WIFI网卡建立的网络通道,称为WIFI网络通道,将使用数据业务网卡建立的网络通道称为移动数据网络通道。The network channel of the electronic device in the embodiment of the present application refers to the route established between the above-mentioned WIFI network card or data service network card and other devices connected to the Internet and other electronic devices such as servers. In the embodiment of the present application, the network channel established by using the WIFI network card is called the WIFI network channel, and the network channel established by using the data service network card is called the mobile data network channel.

电子设备中可以预先配置多条网络通道,示例性的,该多条网络通道可以包括主WIFI网络通道、辅WIFI网络通道、主移动数据网络通道及辅移动数据网络通道,其中,上述主WIFI网络通道和辅WIFI网络通道可以工作在2.4GHz频段或5GHz频段,示例性的,若主WIFI网络通道工作在2.4GHz频段,则辅WIFI网络通道工作在5GHz频段;若主WIFI网络通道工作在5GHz频段,则辅WIFI网络通道工作在2.4GHz频段。此外,主移动数据网络通道和辅移动数据网络通道可以和运营商网络对应,例如,主移动数据网络通道可以使用SIM卡1(该SIM卡1归属于运营商A),辅移动数据网络通道可以使用SIM卡2(该SIM卡2归属于运营商B)。在通常情况下,主WIFI网络通道的优先级高于其余三条通道,因此,主网络通道通常为主WIFI网络通道。在通常情况下,考虑电子设备的数据流量消耗,WIFI网络通道的优先级高于移动数据网络通道的优先级。可以理解的是,上述预置通道仅是示例性说明,并不构成对本申请实施例的限定,在一些实施例中,还可以包括更多或更少的通道。此外,将主WIFI网络通道作为主网络通道也只是优选方案,并不构成对本申请实施例的限定,在一些实施例中,也可以选取其他网络通道作为主网络通道。Multiple network channels may be pre-configured in the electronic device. Exemplarily, the multiple network channels may include a primary WIFI network channel, a secondary WIFI network channel, a primary mobile data network channel, and a secondary mobile data network channel, wherein the primary WIFI network The channel and the auxiliary WIFI network channel can work in the 2.4GHz frequency band or the 5GHz frequency band. For example, if the main WIFI network channel works in the 2.4GHz frequency band, the auxiliary WIFI network channel works in the 5GHz frequency band; if the main WIFI network channel works in the 5GHz frequency band , the auxiliary WIFI network channel works in the 2.4GHz frequency band. In addition, the primary mobile data network channel and the secondary mobile data network channel may correspond to the operator's network. For example, the primary mobile data network channel may use SIM card 1 (the SIM card 1 belongs to operator A), and the secondary mobile data network channel may use Use SIM card 2 (the SIM card 2 belongs to operator B). Under normal circumstances, the priority of the main WIFI network channel is higher than that of the other three channels. Therefore, the main network channel is usually the main WIFI network channel. Under normal circumstances, considering the data traffic consumption of electronic devices, the priority of the WIFI network channel is higher than that of the mobile data network channel. It can be understood that the above-mentioned preset channels are only illustrative, and do not constitute a limitation to the embodiment of the present application, and in some embodiments, more or fewer channels may be included. In addition, using the main WIFI network channel as the main network channel is only a preferred solution and does not constitute a limitation to the embodiment of the present application. In some embodiments, other network channels may also be selected as the main network channel.

下面对电子设备100的结构进行介绍。请参阅图1,图1是本申请实施例提供的电子设备100的硬件结构示意图。The structure of the electronic device 100 will be introduced below. Please refer to FIG. 1 . FIG. 1 is a schematic diagram of a hardware structure of an electronic device 100 provided by an embodiment of the present application.

电子设备100可以包括处理器110,外部存储器接口120,内部存储器121,通用串行总线(universal serial bus,USB)接口130,充电管理模块140,电源管理模块141,电池142,天线1,天线2,移动通信模块150,无线通信模块160,音频模块170,扬声器170A,受话器170B,麦克风170C,耳机接口170D,传感器模块180,按键190,马达191,指示器192,摄像头193,显示屏194,以及用户标识模块(subscriber identification module,SIM)卡接口195等。其中传感器模块180可以包括压力传感器180A,陀螺仪传感器180B,气压传感器180C,磁传感器180D,加速度传感器180E,距离传感器180F,接近光传感器180G,指纹传感器180H,温度传感器180J,触摸传感器180K,环境光传感器180L,骨传导传感器180M等。The electronic device 100 may include a processor 110, an external memory interface 120, an internal memory 121, a universal serial bus (universal serial bus, USB) interface 130, a charging management module 140, a power management module 141, a battery 142, an antenna 1, and an antenna 2 , mobile communication module 150, wireless communication module 160, audio module 170, speaker 170A, receiver 170B, microphone 170C, earphone jack 170D, sensor module 180, button 190, motor 191, indicator 192, camera 193, display screen 194, and A subscriber identification module (subscriber identification module, SIM) card interface 195 and the like. The sensor module 180 may include a pressure sensor 180A, a gyroscope sensor 180B, an air pressure sensor 180C, a magnetic sensor 180D, an acceleration sensor 180E, a distance sensor 180F, a proximity light sensor 180G, a fingerprint sensor 180H, a temperature sensor 180J, a touch sensor 180K, an ambient light sensor 180L, bone conduction sensor 180M, etc.

可以理解的是,本发明实施例示意的结构并不构成对电子设备100的具体限定。在本申请另一些实施例中,电子设备100可以包括比图示更多或更少的部件,或者组合某些部件,或者拆分某些部件,或者不同的部件布置。图示的部件可以以硬件,软件或软件和硬件的组合实现。It can be understood that, the structure illustrated in the embodiment of the present invention does not constitute a specific limitation on the electronic device 100 . In other embodiments of the present application, the electronic device 100 may include more or fewer components than shown in the figure, or combine certain components, or separate certain components, or arrange different components. The illustrated components can be realized in hardware, software or a combination of software and hardware.

处理器110可以包括一个或多个处理单元,例如:处理器110可以包括应用处理器(application processor,AP),调制解调处理器,图形处理器(graphics processingunit,GPU),图像信号处理器(image signal processor,ISP),控制器,存储器,视频编解码器,数字信号处理器(digital signal processor,DSP),基带处理器,和/或神经网络处理器(neural-network processing unit,NPU)等。其中,不同的处理单元可以是独立的器件,也可以集成在一个或多个处理器中。The processor 110 may include one or more processing units, for example: the processor 110 may include an application processor (application processor, AP), a modem processor, a graphics processing unit (graphics processing unit, GPU), an image signal processor ( image signal processor, ISP), controller, memory, video codec, digital signal processor (digital signal processor, DSP), baseband processor, and/or neural network processor (neural-network processing unit, NPU), etc. . Wherein, different processing units may be independent devices, or may be integrated in one or more processors.

电子设备100的无线通信功能可以通过天线1,天线2,移动通信模块150,无线通信模块160,调制解调处理器以及基带处理器等实现。The wireless communication function of the electronic device 100 can be realized by the antenna 1 , the antenna 2 , the mobile communication module 150 , the wireless communication module 160 , a modem processor, a baseband processor, and the like.

天线1和天线2用于发射和接收电磁波信号。电子设备100中的每个天线可用于覆盖单个或多个通信频带。不同的天线还可以复用,以提高天线的利用率。例如:可以将天线1复用为无线局域网的分集天线。在另外一些实施例中,天线可以和调谐开关结合使用。Antenna 1 and Antenna 2 are used to transmit and receive electromagnetic wave signals. Each antenna in electronic device 100 may be used to cover single or multiple communication frequency bands. Different antennas can also be multiplexed to improve the utilization of the antennas. For example: Antenna 1 can be multiplexed as a diversity antenna of a wireless local area network. In other embodiments, the antenna may be used in conjunction with a tuning switch.

移动通信模块150可以提供应用在电子设备100上的包括2G/3G/4G/5G等无线通信的解决方案。移动通信模块150可以包括至少一个滤波器,开关,功率放大器,低噪声放大器(low noise amplifier,LNA)等。移动通信模块150可以由天线1接收电磁波,并对接收的电磁波进行滤波,放大等处理,传送至调制解调处理器进行解调。移动通信模块150还可以对经调制解调处理器调制后的信号放大,经天线1转为电磁波辐射出去。在一些实施例中,移动通信模块150的至少部分功能模块可以被设置于处理器110中。在一些实施例中,移动通信模块150的至少部分功能模块可以与处理器110的至少部分模块被设置在同一个器件中。The mobile communication module 150 can provide wireless communication solutions including 2G/3G/4G/5G applied on the electronic device 100 . The mobile communication module 150 may include at least one filter, switch, power amplifier, low noise amplifier (low noise amplifier, LNA) and the like. The mobile communication module 150 can receive electromagnetic waves through the antenna 1, filter and amplify the received electromagnetic waves, and send them to the modem processor for demodulation. The mobile communication module 150 can also amplify the signals modulated by the modem processor, and convert them into electromagnetic waves through the antenna 1 for radiation. In some embodiments, at least part of the functional modules of the mobile communication module 150 may be set in the processor 110 . In some embodiments, at least part of the functional modules of the mobile communication module 150 and at least part of the modules of the processor 110 may be set in the same device.

无线通信模块160可以提供应用在电子设备100上的包括无线局域网(wirelesslocal area networks,WLAN)(如Wi-Fi网络),蓝牙(BlueTooth,BT),BLE广播,全球导航卫星系统(global navigation satellite system,GNSS),调频(frequency modulation,FM),近距离无线通信技术(near field communication,NFC),红外技术(infrared,IR)等无线通信的解决方案。无线通信模块160可以是集成至少一个通信处理模块的一个或多个器件。无线通信模块160经由天线2接收电磁波,将电磁波信号调频以及滤波处理,将处理后的信号发送到处理器110。无线通信模块160还可以从处理器110接收待发送的信号,对其进行调频,放大,经天线2转为电磁波辐射出去。The wireless communication module 160 can provide wireless local area network (wireless local area networks, WLAN) (such as Wi-Fi network), Bluetooth (BlueTooth, BT), BLE broadcasting, global navigation satellite system (global navigation satellite system) applied on the electronic device 100. , GNSS), frequency modulation (frequency modulation, FM), near field communication technology (near field communication, NFC), infrared technology (infrared, IR) and other wireless communication solutions. The wireless communication module 160 may be one or more devices integrating at least one communication processing module. The wireless communication module 160 receives electromagnetic waves via the antenna 2 , frequency-modulates and filters the electromagnetic wave signals, and sends the processed signals to the processor 110 . The wireless communication module 160 can also receive the signal to be sent from the processor 110 , frequency-modulate it, amplify it, and convert it into electromagnetic waves through the antenna 2 for radiation.

电子设备100通过GPU,显示屏194,以及应用处理器等实现显示功能。GPU为图像处理的微处理器,连接显示屏194和应用处理器。GPU用于执行数学和几何计算,用于图形渲染。处理器110可包括一个或多个GPU,其执行程序指令以生成或改变显示信息。The electronic device 100 realizes the display function through the GPU, the display screen 194 , and the application processor. The GPU is a microprocessor for image processing, and is connected to the display screen 194 and the application processor. GPUs are used to perform mathematical and geometric calculations for graphics rendering. Processor 110 may include one or more GPUs that execute program instructions to generate or change display information.

显示屏194用于显示图像,视频等。显示屏194包括显示面板。显示面板可以采用液晶显示屏(liquid crystal display,LCD),有机发光二极管(organic light-emittingdiode,OLED),有源矩阵有机发光二极体或主动矩阵有机发光二极体(active-matrixorganic light emitting diode的,AMOLED),柔性发光二极管(flex light-emittingdiode,FLED),Miniled,MicroLed,Micro-oLed,量子点发光二极管(quantum dot lightemitting diodes,QLED)等。在一些实施例中,电子设备100可以包括1个或N个显示屏194,N为大于1的正整数。The display screen 194 is used to display images, videos and the like. The display screen 194 includes a display panel. The display panel can be a liquid crystal display (LCD), an organic light-emitting diode (OLED), an active-matrix organic light-emitting diode or an active-matrix organic light-emitting diode (active-matrixorganic light-emitting diode) , AMOLED), flexible light-emitting diode (flex light-emitting diode, FLED), Miniled, MicroLed, Micro-oLed, quantum dot light-emitting diodes (quantum dot light emitting diodes, QLED), etc. In some embodiments, the electronic device 100 may include 1 or N display screens 194 , where N is a positive integer greater than 1.

电子设备100可以通过ISP,摄像头193,视频编解码器,GPU,显示屏194以及应用处理器等实现拍摄功能。The electronic device 100 can realize the shooting function through the ISP, the camera 193 , the video codec, the GPU, the display screen 194 and the application processor.

ISP用于处理摄像头193反馈的数据。例如,拍照时,打开快门,光线通过镜头被传递到摄像头感光元件上,光信号转换为电信号,摄像头感光元件将所述电信号传递给ISP处理,转化为肉眼可见的图像。ISP还可以对图像的噪点,亮度,肤色进行算法优化。ISP还可以对拍摄场景的曝光,色温等参数优化。在一些实施例中,ISP可以设置在摄像头193中。The ISP is used for processing the data fed back by the camera 193 . For example, when taking a picture, open the shutter, the light is transmitted to the photosensitive element of the camera through the lens, and the light signal is converted into an electrical signal, and the photosensitive element of the camera transmits the electrical signal to the ISP for processing, and converts it into an image visible to the naked eye. ISP can also perform algorithm optimization on image noise, brightness, and skin color. ISP can also optimize the exposure, color temperature and other parameters of the shooting scene. In some embodiments, the ISP may be located in the camera 193 .

数字信号处理器用于处理数字信号,除了可以处理数字图像信号,还可以处理其他数字信号。例如,当电子设备100在频点选择时,数字信号处理器用于对频点能量进行傅里叶变换等。Digital signal processors are used to process digital signals. In addition to digital image signals, they can also process other digital signals. For example, when the electronic device 100 selects a frequency point, the digital signal processor is used to perform Fourier transform on the energy of the frequency point.

NPU为神经网络(neural-network,NN)计算处理器,通过借鉴生物神经网络结构,例如借鉴人脑神经元之间传递模式,对输入信息快速处理,还可以不断的自学习。通过NPU可以实现电子设备100的智能认知等应用,例如:图像识别,人脸识别,语音识别,文本理解等。The NPU is a neural-network (NN) computing processor. By referring to the structure of biological neural networks, such as the transfer mode between neurons in the human brain, it can quickly process input information and continuously learn by itself. Applications such as intelligent cognition of the electronic device 100 can be realized through the NPU, such as image recognition, face recognition, speech recognition, text understanding, and the like.

电子设备100可以通过音频模块170,扬声器170A,受话器170B,麦克风170C,耳机接口170D,以及应用处理器等实现音频功能。例如音乐播放,录音等。The electronic device 100 can implement audio functions through the audio module 170 , the speaker 170A, the receiver 170B, the microphone 170C, the earphone interface 170D, and the application processor. Such as music playback, recording, etc.

音频模块170用于将数字音频信息转换成模拟音频信号输出,也用于将模拟音频输入转换为数字音频信号。音频模块170还可以用于对音频信号编码和解码。在一些实施例中,音频模块170可以设置于处理器110中,或将音频模块170的部分功能模块设置于处理器110中。The audio module 170 is used to convert digital audio information into analog audio signal output, and is also used to convert analog audio input into digital audio signal. The audio module 170 may also be used to encode and decode audio signals. In some embodiments, the audio module 170 may be set in the processor 110 , or some functional modules of the audio module 170 may be set in the processor 110 .

扬声器170A,也称“喇叭”,用于将音频电信号转换为声音信号。电子设备100可以通过扬声器170A收听音乐,或收听免提通话。Speaker 170A, also referred to as a "horn", is used to convert audio electrical signals into sound signals. Electronic device 100 can listen to music through speaker 170A, or listen to hands-free calls.

受话器170B,也称“听筒”,用于将音频电信号转换成声音信号。当电子设备100接听电话或语音信息时,可以通过将受话器170B靠近人耳接听语音。Receiver 170B, also called "earpiece", is used to convert audio electrical signals into sound signals. When the electronic device 100 receives a call or a voice message, the receiver 170B can be placed close to the human ear to receive the voice.

麦克风170C,也称“话筒”,“传声器”,用于将声音信号转换为电信号。当拨打电话或发送语音信息时,用户可以通过人嘴靠近麦克风170C发声,将声音信号输入到麦克风170C。电子设备100可以设置至少一个麦克风170C。在另一些实施例中,电子设备100可以设置两个麦克风170C,除了采集声音信号,还可以实现降噪功能。在另一些实施例中,电子设备100还可以设置三个,四个或更多麦克风170C,实现采集声音信号、降噪、还可以识别声音来源,实现定向录音功能等。The microphone 170C, also called "microphone" or "microphone", is used to convert sound signals into electrical signals. When making a phone call or sending a voice message, the user can put his mouth close to the microphone 170C to make a sound, and input the sound signal to the microphone 170C. The electronic device 100 may be provided with at least one microphone 170C. In some other embodiments, the electronic device 100 may be provided with two microphones 170C, which may also implement a noise reduction function in addition to collecting sound signals. In some other embodiments, the electronic device 100 can also be provided with three, four or more microphones 170C to realize sound signal collection, noise reduction, sound source identification, and directional recording functions.

压力传感器180A用于感受压力信号,可以将压力信号转换成电信号。在一些实施例中,压力传感器180A可以设置于显示屏194。The pressure sensor 180A is used to sense the pressure signal and convert the pressure signal into an electrical signal. In some embodiments, pressure sensor 180A may be disposed on display screen 194 .

气压传感器180C用于测量气压。在一些实施例中,电子设备100通过气压传感器180C测得的气压值计算海拔高度,辅助定位和导航。The air pressure sensor 180C is used to measure air pressure. In some embodiments, the electronic device 100 calculates the altitude based on the air pressure value measured by the air pressure sensor 180C to assist positioning and navigation.

磁传感器180D包括霍尔传感器。电子设备100可以利用磁传感器180D检测翻盖皮套的开合。The magnetic sensor 180D includes a Hall sensor. The electronic device 100 may use the magnetic sensor 180D to detect the opening and closing of the flip leather case.

加速度传感器180E可检测电子设备100在各个方向上(一般为三轴)加速度的大小。当电子设备100静止时可检测出重力的大小及方向。还可以用于识别电子设备姿态,应用于横竖屏切换,计步器等应用。The acceleration sensor 180E can detect the acceleration of the electronic device 100 in various directions (generally three axes). The magnitude and direction of gravity can be detected when the electronic device 100 is stationary. It can also be used to identify the posture of electronic devices, and can be used in applications such as horizontal and vertical screen switching, pedometers, etc.

指纹传感器180H用于采集指纹。电子设备100可以利用采集的指纹特性实现指纹解锁,访问应用锁,指纹拍照,指纹接听来电等。The fingerprint sensor 180H is used to collect fingerprints. The electronic device 100 can use the collected fingerprint characteristics to implement fingerprint unlocking, access to application locks, take pictures with fingerprints, answer incoming calls with fingerprints, and the like.

触摸传感器180K,也称“触控面板”。触摸传感器180K可以设置于显示屏194,由触摸传感器180K与显示屏194组成触摸屏,也称“触控屏”。触摸传感器180K用于检测作用于其上或附近的触摸操作。触摸传感器可以将检测到的触摸操作传递给应用处理器,以确定触摸事件类型。可以通过显示屏194提供与触摸操作相关的视觉输出。在另一些实施例中,触摸传感器180K也可以设置于电子设备100的表面,与显示屏194所处的位置不同。Touch sensor 180K, also known as "touch panel". The touch sensor 180K can be disposed on the display screen 194, and the touch sensor 180K and the display screen 194 form a touch screen, also called a “touch screen”. The touch sensor 180K is used to detect a touch operation on or near it. The touch sensor can pass the detected touch operation to the application processor to determine the type of touch event. Visual output related to the touch operation can be provided through the display screen 194 . In other embodiments, the touch sensor 180K may also be disposed on the surface of the electronic device 100 , which is different from the position of the display screen 194 .

骨传导传感器180M可以获取振动信号。在一些实施例中,骨传导传感器180M可以获取人体声部振动骨块的振动信号。The bone conduction sensor 180M can acquire vibration signals. In some embodiments, the bone conduction sensor 180M can acquire the vibration signal of the vibrating bone mass of the human voice.

下面,结合图2-图3F对本申请实施例提出的网络质量检测方法的应用场景做相关介绍。In the following, the application scenarios of the network quality detection method proposed in the embodiment of the present application will be introduced with reference to FIG. 2 to FIG. 3F .

图2是本申请实施例提供的一种室内网络连接场景图,该室内场景为用户客厅。在用户客厅中包括路由器101,路由器101通过与网络连接,发出WIFI信号,使得客厅内的电子设备100、电视机103以及智能空调104能够通过路由器101发射的WIFI信号与网络连接,且电子设备100、电视机103以及智能空调104处于同一局域网内。图2以用户当前使用电子设备100,通过WIFI连接网络、在线观看视频为例进行举例说明,假设路由器101发射的WIFI信号的覆盖范围仅为客厅,且电子设备100在连接WIFI后的网络质量随着电子设备100与路由器101距离的增大而变差。FIG. 2 is a diagram of an indoor network connection scene provided by an embodiment of the present application, and the indoor scene is a living room of a user. A router 101 is included in the living room of the user, and the router 101 sends out a WIFI signal by connecting to the network, so that the electronic equipment 100, the TV set 103 and the intelligent air conditioner 104 in the living room can be connected to the network through the WIFI signal transmitted by the router 101, and the electronic equipment 100 , the television 103 and the intelligent air conditioner 104 are in the same local area network. FIG. 2 is an example illustrating that the user is currently using the electronic device 100 to connect to the network and watch videos online through WIFI. It is assumed that the coverage of the WIFI signal transmitted by the router 101 is only in the living room, and the network quality of the electronic device 100 after connecting to WIFI varies. It becomes worse as the distance between the electronic device 100 and the router 101 increases.

下面,结合图3A-图3F对用户在线观看视频的过程中,由于网络质量变差,电子设备进行网络通道切换的应用场景进行介绍,图3A-图3F是本申请实施例提供的一组用户使用电子设备100在线观看视频的示例性界面。Next, in combination with Figure 3A-Figure 3F , the application scenario of electronic equipment performing network channel switching due to the deterioration of network quality during the process of users watching videos online will be introduced. Figure 3A-Figure 3F is a group of users provided by the embodiment of this application An exemplary interface for watching videos online using the electronic device 100 .

图3A为电子设备100的用户界面10,在用户界面10中包括WIFI网络图标301、移动数据图标302、视频应用图标303、网速显示图标304以及其它应用图标。其中,WIFI网络图标301用于指示电子设备100已与WIFI网络通道连接,移动数据图标302用于指示电子设备100已与移动数据网络通道连接,假设电子设备100具有主SIM卡和副SIM卡且这两张SIM卡都启动了移动数据业务,由图3A可知,电子设备100当前连接了WIFI网络通道、主移动数据网络通道(主SIM卡对应的网络通道)以及副移动数据网络通道(副SIM卡对应的网络通道)。本申请实施例以电子设备100将WIFI网络通道作为主网络通道,且当前电子设备100启用的网络通道为主网络通道为例,进行说明。网速显示图标304用于显示当前启用的网络通道的下行速率,例如,如图3A所示,当前WIFI网络通道的下行速率为1.4M/S。当电子设备100检测到针对视频应用图标303的单击输入操作后,响应该输入操作,电子设备100显示如图3B所述的用户界面20。3A is the user interface 10 of the electronic device 100, which includes a WIFI network icon 301, a mobile data icon 302, a video application icon 303, a network speed display icon 304 and other application icons. Among them, the WIFI network icon 301 is used to indicate that the electronic device 100 has been connected to the WIFI network channel, and the mobile data icon 302 is used to indicate that the electronic device 100 has been connected to the mobile data network channel. It is assumed that the electronic device 100 has a primary SIM card and a secondary SIM card and These two SIM cards have both started the mobile data service. It can be seen from FIG. 3A that the electronic device 100 is currently connected to the WIFI network channel, the primary mobile data network channel (the network channel corresponding to the primary SIM card) and the secondary mobile data network channel (the secondary SIM card). network channel corresponding to the card). In the embodiment of the present application, the electronic device 100 uses the WIFI network channel as the main network channel, and the network channel currently enabled by the electronic device 100 is the main network channel as an example for description. The network speed display icon 304 is used to display the downlink rate of the currently enabled network channel. For example, as shown in FIG. 3A , the downlink rate of the current WIFI network channel is 1.4M/S. After the electronic device 100 detects a click input operation on the video application icon 303, in response to the input operation, the electronic device 100 displays the user interface 20 as shown in FIG. 3B.

如图3B所示,用户界面20为视频应用的主界面,包括视频推荐区域310,视频推荐区域当前显示的视频封面311为“宠物的故事”,当电子设备100检测到针对视频封面311的单击输入操作后,电子设备100显示如图3C所示的用户界面30。As shown in Figure 3B, the user interface 20 is the main interface of the video application, including a video recommendation area 310. The video cover 311 currently displayed in the video recommendation area is "Pet Story". After the click input operation, the electronic device 100 displays the user interface 30 as shown in FIG. 3C.

如图3C所示,用户界面30为播放视频的界面,由图3C可知,电子设备100当前启用的网络通道为主网络通道(假设主网络通道为WIFI网络通道),当前网速为1.8M/s,当前视频的播放进度为05:48。As shown in Figure 3C, the user interface 30 is an interface for playing video. As can be seen from Figure 3C, the network channel currently enabled by the electronic device 100 is the main network channel (assuming that the main network channel is a WIFI network channel), and the current network speed is 1.8M/ s, the playback progress of the current video is 05:48.

如图3D所示,在视频观看的过程中,用户携带电子设备100从活动区域1移动到活动区域2,再由活动区域2移动到活动区域3开启空调,且活动区域1、活动区域2、活动区域3,与路由器101的距离依次递减。当用户移动到活动区域2后,电子设备100显示如图3E所示的用户界面40。As shown in Figure 3D, during the video watching process, the user carries the electronic device 100 and moves from activity area 1 to activity area 2, and then moves from activity area 2 to activity area 3 to turn on the air conditioner, and activity area 1, activity area 2, The distance between the active area 3 and the router 101 decreases successively. When the user moves to the active area 2, the electronic device 100 displays a user interface 40 as shown in FIG. 3E.

如图3E所示,用户界面40为视频播放界面,当前电子设备100启用的网络通道为主网络通道,当前网速为512k/s,当前视频的播放进度为06:48。由图3E可知,由于电子设备100在活动区域2处的网络质量差于在活动区域1的网络质量,使得电子设备100的网速相较于在活动区域1时有所下降,当用户移动到活动区域3后,电子设备100显示如图3F所示的用户界面50。As shown in FIG. 3E , the user interface 40 is a video playback interface, the current network channel enabled by the electronic device 100 is the main network channel, the current network speed is 512k/s, and the current video playback progress is 06:48. It can be seen from FIG. 3E that because the network quality of the electronic device 100 in the active area 2 is worse than that in the active area 1, the network speed of the electronic device 100 is lower than that in the active area 1. When the user moves to After the area 3 is activated, the electronic device 100 displays the user interface 50 as shown in FIG. 3F .

如图3F所示,用户界面50为视频播放界面,该视频播放界面包括网络加速提示框501,该网络加速提示框501用于提示已开启视频应用的网络加速。例如,图3F中的网络加速提示框501显示“已完成网络通道的切换,进行网络加速”的信息。可以在用户界面50中看到,当前视频应用启用的网络通道为备用网络通道,当前网速为1.8M/s,当前视频的播放进度为06:48。电子设备100完成了由主网络通道到备用网络的切换,且相较于在活动区域2的网络速率,电子设备在活动区域3切换到备用网络通道后,网络速率有大幅提高。As shown in FIG. 3F , the user interface 50 is a video playback interface, and the video playback interface includes a network acceleration prompt box 501 , and the network acceleration prompt box 501 is used to prompt that the network acceleration of the video application has been enabled. For example, the network acceleration prompt box 501 in FIG. 3F displays the information of "the switching of the network channel has been completed, and the network acceleration is performed". It can be seen in the user interface 50 that the network channel enabled by the current video application is a backup network channel, the current network speed is 1.8M/s, and the playback progress of the current video is 06:48. The electronic device 100 completes the switching from the main network channel to the standby network, and compared with the network rate in the active area 2, after the electronic device switches to the standby network channel in the active area 3, the network rate is greatly improved.

应该理解的是,上述图3A-图3F示出的是电子设备在放视频的过程中,由于电子设备与路由器直线距离的改变,引起网络质量的变化,电子设备在基于检测的网络质量,进行网络通道切换的一组示例性用户界面,不应对本申请实施例形成限制。It should be understood that the above-mentioned Figures 3A-3F show that during the process of playing video on the electronic device, the network quality changes due to the change of the straight-line distance between the electronic device and the router, and the electronic device is based on the detected network quality. A set of exemplary user interfaces for network channel switching shall not limit this embodiment of the present application.

上述图2-图3F介绍了电子设备进行网络质量检测的应用场景。在上述实施例中,用户从活动区域1移动到活动区域2,再从活动区域2移动到活动区域3的过程中,由于电子设备与路由器的直线距离不断增大,导致网络质量变差,进而使得电子设备的网络速率不断降低。当电子设备的网络速率降低到某一特定阈值时,电子设备会将切换网络通道(例如,从WIFI网络通道切换到主移动数据网络通道),切换后的网络质量相较于切换前的网络质量更好。The foregoing FIGS. 2-3F introduce application scenarios in which electronic devices perform network quality detection. In the above-mentioned embodiment, when the user moves from active area 1 to active area 2, and then from active area 2 to active area 3, the network quality deteriorates due to the continuous increase of the linear distance between the electronic device and the router. The network speed of electronic devices is continuously reduced. When the network rate of the electronic device drops to a certain threshold, the electronic device will switch the network channel (for example, switch from the WIFI network channel to the main mobile data network channel), and the network quality after the switch is compared with the network quality before the switch better.

下面,结合附图对电子设备网络质量检测方法的原理进行介绍,如图4所示,电子设备通过WIFI网络通道与服务器进行数据流的传输,在WIFI网络通道中包括多条流通道(图中只列举了两条流通道),其中,流通道A用于传输应用1向服务器的上行数据流,流通道B用于服务器向应用1传输下行数据流。当应用1通过流通道1向服务器发送上行报文后,电子设备开始检测下行数据流网络质量(例如,下行数据报的传输速率、数据报的延时、丢包率等等),在检测到数据流的网络质量变差时,将应用1与服务器之间的数据流切换到移动数据网络通道上进行传输。Below, the principle of the electronic device network quality detection method is introduced in conjunction with the accompanying drawings. As shown in Figure 4, the electronic device transmits data streams with the server through the WIFI network channel, and the WIFI network channel includes multiple stream channels (in the figure Only two flow channels are listed), wherein, flow channel A is used to transmit the upstream data flow from the application 1 to the server, and flow channel B is used to transmit the downstream data flow from the server to the application 1. After application 1 sends an uplink message to the server through stream channel 1, the electronic device starts to detect the network quality of the downlink data flow (for example, the transmission rate of the downlink datagram, the delay of the datagram, the packet loss rate, etc.), and the When the network quality of the data flow deteriorates, the data flow between the application 1 and the server is switched to the mobile data network channel for transmission.

应用1与服务器通常使用UDP协议传输报文,应用1先向服务器发送上行下载请求报文,用于与服务器进行通信,当服务器接收到上行下载请求报文之后,会向应用1发送下行数据流,此时,会触发电子设备对下行数据流进行报文检测,从而检测当前数据流的网络质量,根据网络质量判断是否需要进行网络通道的切换。当服务器发送下行数据流结束后,电子设备不再进行网络质量检测、网络通道切换等相关操作。Application 1 and the server usually use the UDP protocol to transmit messages. Application 1 first sends an uplink download request message to the server for communication with the server. When the server receives the uplink download request message, it will send a downlink data stream to application 1. , at this time, the electronic device will be triggered to perform message detection on the downlink data flow, thereby detecting the network quality of the current data flow, and judging whether to switch the network channel according to the network quality. After the server sends the downlink data stream, the electronic device no longer performs network quality detection, network channel switching and other related operations.

然而,如图5所示,当应用1使用GQUIC等协议传输上行报文时,应用1向服务器发送上行下载请求报文后,服务器向应用1发送下行数据流。在服务器向应用1发送下行数据流的过程中,应用1可能会向服务器发送上行的ACK等确认报文,这类确认报文仅仅是用于通知服务器,应用1已接收到服务器发送的下行数据流,没有其它的作用。电子设备通常基于下行网络速率对网络质量进行检测,而下行网络速率是基于服务器向应用1发送的下行数据流测得的,因此,应用1向服务器发送上行ACK等确认报文不会影响下行速率的准确性。所以,在服务器向应用1发送下行数据流的过程中,如果应用1发送上行确认报文,不会影响网络质量的检测结果,但是,当服务器停止/暂停向应用1发送下行数据流后,若应用1向服务器发送上行确认报文,而电子设备不能识别该上行确认报文,将其当作下载请求报文,会使得电子设备将接收该上行确认报文后的下行网络速率作为网络质量好坏的因素,使得电子设备检测网络质量的结果不准确,从而造成网络通道错误切换的情况。若电子设备将WIFI网络通道切换到移动数据网络通道,会因为进行网络加速而耗费大量的移动数据流量,对于一些用户流量套餐总额不多或者剩余流量不多的用户,可能造成流量超出套餐限额,从而使得用户多缴超出套餐限额部分的话费,进而给用户带来不好的使用体验。However, as shown in FIG. 5 , when application 1 transmits an uplink message using a protocol such as GQUIC, after application 1 sends an uplink download request message to the server, the server sends a downlink data stream to application 1. When the server sends downlink data to application 1, application 1 may send uplink ACK and other confirmation messages to the server. This kind of confirmation message is only used to notify the server that application 1 has received the downlink data sent by the server. stream, and has no other effect. Electronic devices usually detect network quality based on the downlink network rate, and the downlink network rate is measured based on the downlink data flow sent by the server to application 1. Therefore, the uplink ACK and other confirmation messages sent by application 1 to the server will not affect the downlink rate. accuracy. Therefore, when the server sends downlink data to application 1, if application 1 sends an uplink acknowledgment message, the network quality detection result will not be affected. However, when the server stops/pauses sending downlink data to application 1, if Application 1 sends an uplink confirmation message to the server, but the electronic device cannot recognize the uplink confirmation message, and regards it as a download request message, which will make the electronic device regard the downlink network speed after receiving the uplink confirmation message as the network quality is good. Bad factors make the results of electronic equipment detection of network quality inaccurate, resulting in wrong switching of network channels. If the electronic device switches the WIFI network channel to the mobile data network channel, a large amount of mobile data traffic will be consumed due to network acceleration. For some users with a small amount of total traffic or a small amount of remaining traffic, the traffic may exceed the package limit. As a result, the user pays more than the part of the package limit, which in turn brings a bad user experience to the user.

为了解决电子设备因为不能识别ACK等确认报文,而造成电子设备网络质量的检测结果不准确,进而造成的网络通道误切的问题,本申请实施例提供了一种网络质量检测方法,下面,结合图6对该网络通道切换方法的具体流程进行说明。请参见图6,图6是本申请实施例提供的一种网络质量检测方法的流程图,具体流程如下:In order to solve the problem of inaccurate detection results of the network quality of the electronic device due to the inability of the electronic device to recognize confirmation messages such as ACKs, which in turn causes incorrect switching of the network channel, an embodiment of the present application provides a network quality detection method, as follows, The specific flow of the network channel switching method will be described with reference to FIG. 6 . Please refer to FIG. 6. FIG. 6 is a flow chart of a network quality detection method provided in an embodiment of the present application. The specific process is as follows:

步骤S601:响应于用户的第一操作,启动第一应用。Step S601: Start a first application in response to a first user operation.

具体地,用户在电子设备中打开第一应用,第一应用启动。示例性的,如图3A所示,当电子设备100检测到针对视频应用图标的输入操作后(例如,单击),启动视频应用。可以理解的是,上述实施例仅是示出了通过点击的方式启动第一应用(视频应用)的场景,并不构成对本申请实施例的限定,在一些实施例中,还可以通过其他的操作方式(例如,双击、滑动等操作)启动第一应用。Specifically, the user opens the first application in the electronic device, and the first application starts. Exemplarily, as shown in FIG. 3A , when the electronic device 100 detects an input operation (eg, click) on the video application icon, the video application is started. It can be understood that the above embodiment only shows the scene of starting the first application (video application) by clicking, and does not constitute a limitation to the embodiment of the present application. In some embodiments, other operations can also be used to Ways (for example, operations such as double-clicking and sliding) to start the first application.

其中,第一应用为网络应用,即需要进行联网的应用,例如,第一应用可以为在线视频应用、在线音乐应用、在线短视频应用、联机游戏应用、社交软件应用等。Wherein, the first application is a network application, that is, an application that requires networking. For example, the first application may be an online video application, an online music application, an online short video application, an online game application, a social software application, and the like.

步骤S602:环境感知组件探测到第一应用切换到前台后,向策略管理组件发送第一通知消息。Step S602: After the environment awareness component detects that the first application is switched to the foreground, it sends a first notification message to the policy management component.

具体地,电子设备服务层中的环境探测组件可以对第一应用的状态进行检测,当环境感知组件检测到任一应用切换到前台后,发送第一通知消息给策略管理组件。其中,第一通知消息用于通知策略管理组件第一应用已切换到前台。其中,第一通知消息包括第一应用的身份标识,该身份标识用于标识第一应用的唯一身份。Specifically, the environment detection component in the service layer of the electronic device can detect the state of the first application, and when the environment detection component detects that any application switches to the foreground, it sends a first notification message to the policy management component. Wherein, the first notification message is used to notify the policy management component that the first application has switched to the foreground. Wherein, the first notification message includes the identity of the first application, and the identity is used to identify the unique identity of the first application.

步骤S603:策略管理组件接收环境感知组件发送的第一通知消息后,判断第一应用是否满足开启网络加速的条件。Step S603: After receiving the first notification message sent by the environment awareness component, the policy management component determines whether the first application satisfies the condition for enabling network acceleration.

具体地,当应用级策略管理组件接收第一通知消息后,可以获知第一应用切换到前台,然后,应用级策略管理组件通过查询应用配置库来判断第一应用是否满足开启网络加速的条件。其中,应用配置库包括电子设备所有应用程序的配置信息,该配置信息包括但不限于每个应用程序是否被授予网络加速的权限。策略管理组件基于第一应用的身份标识在应用配置库获取第一应用的配置信息,并确定第一应用是否有网络加速的权限,若有网络加速的权限,则第一应用程序满足网络加速的条件,否则,第一应用程序不满足网络加速的条件。Specifically, when the application-level policy management component receives the first notification message, it can know that the first application has switched to the foreground, and then, the application-level policy management component checks the application configuration library to determine whether the first application meets the conditions for enabling network acceleration. Wherein, the application configuration library includes configuration information of all application programs of the electronic device, and the configuration information includes but is not limited to whether each application program is granted the permission of network acceleration. The policy management component obtains the configuration information of the first application in the application configuration library based on the identity of the first application, and determines whether the first application has the authority of network acceleration. If there is the authority of network acceleration, the first application meets the requirements of network acceleration. condition, otherwise, the first application program does not meet the condition of network acceleration.

步骤S604:在第一应用满足开启网络加速条件的情况下,策略管理组件向流级路径管理组件发送通道启用消息,请求启用主网络通道。Step S604: In the case that the first application satisfies the condition for enabling network acceleration, the policy management component sends a channel activation message to the flow-level path management component, requesting activation of the main network channel.

具体地,若策略管理组件确定第一应用满足开启网络加速的条件下,则可以启动针对第一应用的加速业务,并且,向流级路径管理组件发送加速启用消息,该加速启用消息用于指示流级路径管理组件可以启动针对于第一应用的加速业务。Specifically, if the policy management component determines that the first application meets the conditions for enabling network acceleration, it can start the acceleration service for the first application, and send an acceleration enabling message to the flow-level path management component, and the acceleration enabling message is used to indicate The flow-level path management component can start the acceleration service for the first application.

上述加速业务可以包括但不限于:在电子设备所处环境或者电子设备的系统环境变化时,启用一条备用网络通道,使得该备用网络通道从休眠状态转换为唤醒状态;和/或,监控第一应用中若干条流的网络质量,在电子设备监控到第一应用的某条流质量变差时,将第一应用包括上述质量变差的流在内的多条流切换至备用网络通道,从而使得网络应用的上述多条流始终承载在质量相对较好的网络通道上,保证流的传输质量,降低第一应用出现业务卡顿的可能性,提升用户体验。The above-mentioned acceleration services may include but are not limited to: when the environment of the electronic device or the system environment of the electronic device changes, enabling a backup network channel so that the backup network channel transitions from a dormant state to a wake-up state; and/or, monitoring the first For the network quality of several streams in the application, when the electronic device monitors that the quality of a certain stream of the first application deteriorates, it switches multiple streams of the first application including the stream with degraded quality to the backup network channel, thereby The above-mentioned multiple streams of the network application are always carried on the network channel with relatively good quality, ensuring the transmission quality of the streams, reducing the possibility of service stalls in the first application, and improving user experience.

需要说明的是,如果决策将多条流切换至备用网络通道时,电子设备已经启用了备用网络通道,则将多条流切换至已经启用的备用网络通道,如果决策将多条流切换至备用网络通道时,电子设备未启用备用网络通道,则,电子设备需要先启用一条备用网络通道,再切换至已启用的备用网络通道。It should be noted that if the electronic device has enabled the standby network channel when the decision is made to switch multiple streams to the standby network channel, the multiple streams will be switched to the standby When the network channel is selected, if the electronic device does not enable the backup network channel, the electronic device needs to enable a backup network channel first, and then switch to the enabled backup network channel.

可选地,加速启动消息中可以包括第一应用的身份标识对应的信息,例如可以包括:第一应用的身份标识,目标流类型,目标流类型对应的流模型、网络质量评估参数信息、以及流切换策略信息。具体可以参考前述相关说明,这里不赘述。Optionally, the acceleration start message may include information corresponding to the identity of the first application, for example, it may include: the identity of the first application, the target flow type, the flow model corresponding to the target flow type, network quality evaluation parameter information, and Stream switching policy information. For details, reference may be made to the aforementioned related descriptions, and details are not repeated here.

步骤S605:流级路径管理组件向流量上报组件发送第二通知消息。Step S605: the flow-level path management component sends a second notification message to the traffic reporting component.

具体地,第二通知消息用于通知流量上报组件,第一应用已被切换到前台,并指示流量上报组件监控第一应用与服务器之间的数据流。Specifically, the second notification message is used to notify the traffic reporting component that the first application has been switched to the foreground, and instruct the traffic reporting component to monitor the data flow between the first application and the server.

步骤S606:流量上报组件接收流级路径管理组件发送的第二通知消息后,注册报文监控钩子。Step S606: After receiving the second notification message sent by the flow-level path management component, the traffic reporting component registers a message monitoring hook.

具体地,流量上报组件接收流级路径管理组件发送的第二通知消息后,注册报文监控钩子,该报文监控钩子用于监控网络通道中,第一应用与服务器之间的数据流。Specifically, after receiving the second notification message sent by the flow-level path management component, the traffic reporting component registers a message monitoring hook, which is used to monitor the data flow between the first application and the server in the network channel.

步骤S607:流级路径管理组件向通道级路径管理组件请求主网络通道。Step S607: the flow-level path management component requests the main network channel from the channel-level path management component.

具体地,流级路径管理组件在接收到通道启用消息后,流级路径管理组件向通道级路径管理组件请求主网络通道。本申请实施例以电子设备支持同时使用两张SIM卡(主卡和副卡),且两张SIM卡开启了移动数据服务,且所述电子设备同时连接了两个WIFI网络通道(主WIFI网络通道和副WIFI网络通道)为例进行举例说明。由于,电子设备开启了两张SIM卡的移动数据服务,且电子设备同时连接了两个WIFI网络通道,因此,电子设备当前连接了四个网络通道,分别为:主WIFI网络通道、主移动数据网络通道、副WIFI网络通道和副移动数据网络通道。其中,主WIFI、主SIM卡、副WIFI、副SIM卡对应的网络通道依次为:主WIFI网络通道、主移动数据网络通道、副WIFI网络通道以及副移动数据网络通道。Specifically, after the flow-level path management component receives the channel activation message, the flow-level path management component requests the main network channel from the channel-level path management component. In the embodiment of the present application, the electronic device supports the simultaneous use of two SIM cards (primary card and secondary card), and the mobile data service is enabled on the two SIM cards, and the electronic device is connected to two WIFI network channels (primary WIFI network) at the same time. channel and secondary WIFI network channel) as an example for illustration. Since the mobile data service of two SIM cards is enabled on the electronic device, and the electronic device is connected to two WIFI network channels at the same time, the electronic device is currently connected to four network channels, which are: main WIFI network channel, main mobile data Network channel, secondary WIFI network channel and secondary mobile data network channel. Among them, the main WIFI, the main SIM card, the secondary WIFI, and the network channels corresponding to the secondary SIM card are: the main WIFI network channel, the main mobile data network channel, the secondary WIFI network channel and the secondary mobile data network channel.

在第一应用启动后,流级路径管理组件可以依次请求主WIFI网络通道、主移动数据网络通道、副WIFI网络通道以及副移动数据网络通道为主网络通道,若流级路径管理组件当前请求的网络通道可用(流级路径管理组件当前请求的网络通道可以传输第一应用与服务器之间的数据流),则流级路径管理组件将该条网络通道作为主网络通道,并不再请求网络通道,否则,流级路径管理组件根据上述次序依次向通道级路径管理组件请求主网络通道,直至找到一条可用的网络通道。若未找到一条可用的网络通道,则第一应用的网路加速失效,不再对第一应用进行网络加速。例如,流级路径管理组件向通道级路径管理组件请求主WIFI网络通道为主网络通道,若主WIFI网络通道可用,则将主WIFI网络通道作为主网络通道,并且流级路径管理组件不再请求主移动数据网络通道、副WIFI网络通道以及副移动数据网络通道作为主网络通道。若主WIFI网络通道不可用,则依次按照主移动数据网络通道、副WIFI网络通道和副移动数据网络通道次序请求主网络通道,直至找到一条网络通道作为主网络通道。若上述四个网络通道都不可用,则第一应用网络加速失败,不会对第一应用进行网络加速,即切换第一应用的网络通道。After the first application is started, the stream-level path management component can request the primary WIFI network channel, the primary mobile data network channel, the secondary WIFI network channel, and the secondary mobile data network channel to be the primary network channel in sequence. If the stream-level path management component currently requests If the network channel is available (the network channel currently requested by the flow-level path management component can transmit the data flow between the first application and the server), the flow-level path management component will use this network channel as the main network channel and no longer request a network channel , otherwise, the flow-level path management component requests the main network channel from the channel-level path management component in turn according to the above order, until an available network channel is found. If no available network channel is found, the network acceleration of the first application is disabled, and the network acceleration of the first application is no longer performed. For example, the flow-level path management component requests the main WIFI network channel from the channel-level path management component. If the main WIFI network channel is available, the main WIFI network channel is used as the main network channel, and the flow-level path management component no longer requests The main mobile data network channel, the secondary WIFI network channel and the secondary mobile data network channel serve as the main network channel. If the main WIFI network channel is not available, request the main network channel in sequence according to the order of the main mobile data network channel, the secondary WIFI network channel and the secondary mobile data network channel until a network channel is found as the main network channel. If none of the above four network channels is available, the network acceleration of the first application fails, and the network acceleration of the first application is not performed, that is, the network channel of the first application is switched.

应当理解的是,流级路径管理组件可以根据主WIFI网络通道、主移动数据网络通道、副WIFI网络通道、副移动数据网络通道的顺序依次向通道级路径管理组件请求主网络通道之外,还可以根据其它顺序请求主网络通道,例如,流级路径管理组件可以根据主WIFI网络通道、副WIFI网络通道、主移动数据网络通道、副移动数据网络通道的顺序依次向通道级路径管理组件请求主网络通道,本申请实施例对此不做限制。It should be understood that, the stream-level path management component may request the channel-level path management component in order of the primary network channel, the primary network channel, the secondary mobile data network channel, and The main network channel can be requested according to other orders. For example, the flow-level path management component can request the main network channel from the channel-level path management component according to the order of the main WIFI network channel, secondary WIFI network channel, primary mobile data network channel, and secondary mobile data network channel. The network channel is not limited in this embodiment of the present application.

此外,流级路径管理组件请求主网络通道的次序也与电子设备连接的网络通道数相关,例如,在电子设备仅连接主WIFI网络,开启主SIM卡移动数据业务和副SIM卡移动数据的情况下,电子设备仅与主WIFI网络通道、主移动数据网络通道、副移动数据网络通道连接,流级路径管理组件向通道级路径管理组件请求主网络通道的顺序可以为主WIFI网络通道、主移动数据网络通道、副移动数据网络通道,也可以为基于这三个网络通道的其它组合的次序。本申请实施例对电子设备连接的网络通道数目,以及流级路径管理组件基于电子设备连接的网络通道,向通道级路径管理组件请求主网络通道的次序不做限制。In addition, the order in which the flow-level path management component requests the main network channel is also related to the number of network channels connected to the electronic device. For example, when the electronic device is only connected to the main WIFI network, the mobile data service of the main SIM card and the mobile data service of the secondary SIM card are enabled. Next, the electronic device is only connected to the main WIFI network channel, the main mobile data network channel, and the secondary mobile data network channel. The data network channel and the secondary mobile data network channel may also be based on other combinations of these three network channels. The embodiment of the present application does not limit the number of network channels connected to the electronic device and the order in which the flow-level path management component requests the main network channel from the channel-level path management component based on the network channels connected to the electronic device.

应当理解的是,步骤S607可以和步骤S605同时执行,也可以在步骤S605之前执行,也可以在步骤S605之后执行,本申请实施例对此不做限制。It should be understood that step S607 may be performed simultaneously with step S605, or may be performed before step S605, or may be performed after step S605, which is not limited in this embodiment of the present application.

步骤S608:通道级路径管理组件判断流级路径管理组件当前请求的主网络通道是否可用。Step S608: the channel-level path management component determines whether the main network channel currently requested by the flow-level path management component is available.

具体地,当通道级路径管理组件接收到流级路径管理组件发送的主网络通道请求后,通道级路径管理组件会判断流级路径管理组件当前请求的主网络通道是否可用。若不可用,通道级路径管理组件会向流级路径管理组件返回消息,该消息用于通知流级路径管理组件请求的主网络通道不可用,以便流级路径管理组件申请其它网络通道为主网络通道。Specifically, after the channel-level path management component receives the main network channel request sent by the flow-level path management component, the channel-level path management component will determine whether the main network channel currently requested by the flow-level path management component is available. If it is unavailable, the channel-level path management component will return a message to the flow-level path management component, which is used to notify the flow-level path management component that the requested main network channel is unavailable, so that the flow-level path management component can apply for other network channels as the main network aisle.

应当理解的是,在第一应用启动后,流级路径管理组件向通道级路径管理组件发送主网络通道请求后,通道级路径管理组件会定时地记录电子设备连接的所有网络通道的可用性。It should be understood that, after the first application is started, after the flow-level path management component sends a main network channel request to the channel-level path management component, the channel-level path management component will regularly record the availability of all network channels connected to the electronic device.

步骤S609:在流级路径管理组件当前请求的主网络通道为可用网络通道的情况下,通道级路径管理组件向网络连接组件请求启用主网络通道。Step S609: In the case that the main network channel currently requested by the flow-level path management component is an available network channel, the channel-level path management component requests the network connection component to enable the main network channel.

示例性的,若流级路径管理模块向通道级路径管理模块请求主WIFI网络通道为主网络通道,且通道级路径管理模块确定主WIFI网络通道可用,通道级路径管理组件会向网络连接组件请求启用主WIFI网络通道,使得第一应用与服务器之间的数据流可以在主WIFI网络通道上传输。Exemplarily, if the flow-level path management module requests the main WIFI network channel from the channel-level path management module, and the channel-level path management module determines that the main WIFI network channel is available, the channel-level path management component will request to the network connection component The main WIFI network channel is enabled, so that the data flow between the first application and the server can be transmitted on the main WIFI network channel.

步骤S610:网络连接管理组件启用主网络通道,向通道级路径管理组件反馈主网络通道已启用的通知消息。Step S610: the network connection management component enables the main network channel, and feeds back a notification message that the main network channel has been enabled to the channel-level path management component.

步骤S611:通道级路径管理组件请求通道质量检测组件检测该主网络通道的通道质量。Step S611: the channel-level path management component requests the channel quality detection component to detect the channel quality of the main network channel.

具体地,通道级路径管理组件在收到主网络通道已启用的通知消息后,通道级路径管理模块向通道质量检测组件请求对当前启用的主网络通道进行质量检测。Specifically, after the channel-level path management component receives the notification message that the main network channel has been enabled, the channel-level path management module requests the channel quality detection component to perform quality inspection on the currently enabled main network channel.

示例性的,可以根据网络通道的以下至少一个参数对主网络通道的质量进行检测:通道的时延、丢包率、带宽及速率等。举例来说,上述质量检测可以是对主网络通道的往返时延(Round-Trip Time,RTT)进行检测。Exemplarily, the quality of the main network channel may be detected according to at least one of the following parameters of the network channel: channel delay, packet loss rate, bandwidth, and rate. For example, the above-mentioned quality detection may be to detect the round-trip time delay (Round-Trip Time, RTT) of the main network channel.

可选地,当前启用的主网络通道有历史选用记录时,也就是说,当前启用的网络通道曾经被启用过,此时,可以结合上述RTT及历史记录对主网络通道的质量进行评估,其中,该历史记录可以包括历史接收速率、通道质量为差的历史次数等,本申请实施例对上述通道质量的评估方式不做特殊限定。Optionally, when the currently enabled main network channel has historical selection records, that is to say, the currently enabled network channel has been used before, at this time, the quality of the main network channel can be evaluated in combination with the above RTT and historical records, wherein , the historical records may include historical receiving rates, historical times of poor channel quality, etc., and the embodiment of the present application does not specifically limit the evaluation method of the above-mentioned channel quality.

步骤S612:通道质量检测组件将通道质量检测结果发送给通道级路径管理组件。Step S612: the channel quality detection component sends the channel quality detection result to the channel-level path management component.

应当理解的是,当通道质量检测组件将网络质量检测结果发送给通道级管理组件之后,通道级管理组件对该网络质量检测结果进行分析,若当前启用的主网络通道的网络质量未达到要求,通道级路径管理组件执行步骤S609,即:通道级路径管理模块基于流级路径管理模块请求主网络通道的次序(不包括当前启用的网络通道),向网络连接通道请求启动可用网络通道,直至找到一条网络质量达到要求的网络通道作为主网络通道。若未找到一条网络质量符合要求的主网络通道,第一应用的加速失效,不对第一应用进行加速。It should be understood that after the channel quality detection component sends the network quality detection result to the channel-level management component, the channel-level management component analyzes the network quality detection result. If the network quality of the currently enabled main network channel does not meet the requirements, The channel-level path management component executes step S609, that is: the channel-level path management module requests the network connection channel to start an available network channel based on the order of the flow-level path management module requesting the main network channel (not including the currently enabled network channel), until it finds A network channel whose network quality meets the requirements is used as the main network channel. If no main network channel whose network quality meets the requirements is found, the acceleration of the first application fails, and the acceleration of the first application is not performed.

例如,当前启用的主网络通道为主WIFI网络通道,可用的网络通道包括主WIFI网络通道、主移动数据网络通道、副WIFI网络通道、副移动数据网络通道,且流级路径管理组件请求可用的主网络通道的顺序为主WIFI网络通道、主移动数据网络通道、副WIFI网络通道、副移动数据网络通道。若当前的启用的主网络通道(主WIFI网络通道)的网络质量未达到要求,通道级路径管理组件向网络连接组件申请启用主移动数据网络通道作为主网络通道,并通过通道质量检测模块检测主移动数据网络通道的网络质量,若主移动数据网络通道的网络质量符合要求,则通道级路径管理组件不再向网络连接组件请求可用主网络通道,否则,通道级路径管理组件依次向网络连接组件请求将副WIFI网络通道、副移动数据网络通道作为主网络通道,并启用,然后再检测其网络质量,直至找到一条可用的、网络质量满足要求的网络通道作为主网络通道,并启用,实现第一应用与应用程序的数据流在主网络通道上传输。For example, the currently enabled main network channel is the main WIFI network channel, and the available network channels include the main WIFI network channel, the main mobile data network channel, the secondary WIFI network channel, and the secondary mobile data network channel, and the stream-level path management component requests available The order of the main network channel is the main WIFI network channel, the main mobile data network channel, the secondary WIFI network channel, and the secondary mobile data network channel. If the network quality of the currently enabled main network channel (main WIFI network channel) does not meet the requirements, the channel-level path management component applies to the network connection component for enabling the main mobile data network channel as the main network channel, and detects the main network channel through the channel quality detection module. The network quality of the mobile data network channel, if the network quality of the main mobile data network channel meets the requirements, the channel-level path management component no longer requests the available main network channel from the network connection component, otherwise, the channel-level path management component sends the network connection component Request to use the secondary WIFI network channel and the secondary mobile data network channel as the main network channel and enable them, and then check their network quality until an available network channel with network quality that meets the requirements is found as the main network channel and enabled, realizing the first An application and an application's data stream are transmitted on the main network channel.

步骤S613:策略管理组件向流量感知组件发送流量探测请求。Step S613: The policy management component sends a traffic detection request to the traffic perception component.

具体地,该流量探测请求可以用于指示流量感知组件启动主网络通道上的网络应用的报文统计和监控。其中,该流量探测请求可以包括当前待探测的第一应用的身份标识(例如UID),用于请求对该主网络通道上的与上述身份标识对应的网络应用与服务器之间的数据流进行探测和监控。可以理解的是,该数据流可以是报文的形式。Specifically, the traffic detection request may be used to instruct the traffic sensing component to start packet statistics and monitoring of network applications on the main network channel. Wherein, the traffic detection request may include the identity (such as UID) of the first application currently to be detected, and is used to request to detect the data flow between the network application corresponding to the above identity and the server on the main network channel and monitoring. It can be understood that the data stream may be in the form of a message.

应当理解的是,步骤S613和步骤S604可以同时执行,步骤S613也可以在步骤S604之后执行,本申请实施例对此不做限制。It should be understood that step S613 and step S604 may be performed simultaneously, and step S613 may also be performed after step S604, which is not limited in this embodiment of the present application.

步骤S614:流量感知组件向流量上报组件发送流量上报请求。Step S614: the traffic sensing component sends a traffic reporting request to the traffic reporting component.

具体地,当流量感知组件收到应用级策略管理组件发送的流量探测请求后,可以向流量上报组件发送流量上报请求,其中,该流量上报请求可以用于指示流量上报组件对当前主网络通道上的第一应用与服务器之间传输的数据流进行探测,并将探测到的数据流进行上报。可以理解的是,上述流量探测请求可以包含第一应用的身份标识(例如UID)。Specifically, after the traffic sensing component receives the traffic detection request sent by the application-level policy management component, it can send a traffic reporting request to the traffic reporting component, wherein the traffic reporting request can be used to instruct the traffic reporting The data flow transmitted between the first application and the server is detected, and the detected data flow is reported. It can be understood that the above traffic detection request may include the identity (eg, UID) of the first application.

步骤S615:流量上报组件进行流量探测,并将目标流的报文统计信息上报给流量感知组件。Step S615: The traffic reporting component performs traffic detection, and reports the packet statistics information of the target flow to the traffic sensing component.

具体地,当流量上报组件接收到流量上报请求后,可以根据流量上报请求对主网络通道上的目标流进行探测,并将探测到的目标流的报文统计信息上报给流量感知组件。其中,目标流可以为第一应用与服务器之间传输的数据流。Specifically, after the traffic reporting component receives the traffic reporting request, it can detect the target flow on the main network channel according to the traffic reporting request, and report the packet statistics information of the detected target flow to the traffic sensing component. Wherein, the target flow may be a data flow transmitted between the first application and the server.

在具体实现时,流量上报组件可以通过调用组件(例如,安卓系统的Netfilter组件)获取当前主网络通道上目标流的报文。应当理解的是,上述Netfilter组件仅为示例性说明,并不构成对本申请实施例的限定,在一些实施例中,也可以通过其他组件完成上述目标流的探测。During specific implementation, the traffic reporting component can obtain the message of the target flow on the current main network channel by calling a component (for example, the Netfilter component of the Android system). It should be understood that the above-mentioned Netfilter component is only an illustration and does not constitute a limitation to the embodiment of the present application. In some embodiments, the detection of the above-mentioned target flow may also be completed through other components.

由于流量上报组件事先注册了报文监控钩子,当流量上报组件进行流量探测时,可以通过该报文监控钩子,获取目标流的报文。整体实现框图例如图7所示,Netfilter钩包到流量上报组件的nf_hook钩子函数,当前主网络通道上承载的报文即进入到流量上报组件,流量上报组件经过报文解析、流表创建、报文内容分析等流程,将目标流的报文存放到SKB队列中,对于SKB队列中的报文,按照报文所属目标流的上报策略,需要定时上报的目标流的报文统计信息由定时器触发上报至流量感知组件。Since the traffic reporting component has registered a packet monitoring hook in advance, when the traffic reporting component performs traffic detection, the packet of the target flow can be obtained through the packet monitoring hook. The overall implementation block diagram is shown in Figure 7, for example. Netfilter hooks packets to the nf_hook hook function of the traffic reporting component, and the packets carried on the current main network channel enter the traffic reporting component. According to the process of file content analysis and other processes, the packets of the target flow are stored in the SKB queue. For the packets in the SKB queue, according to the reporting policy of the target flow to which the packet belongs, the packet statistics of the target flow that need to be reported regularly are determined by the timer Trigger reporting to the traffic sensing component.

参见图7,报文上报组件的具体实现流程可以包括:Referring to Figure 7, the specific implementation process of the message reporting component may include:

步骤S1,初始化;Step S1, initialization;

在第一应用启动加载时,流量上报组件会收到上述步骤S606中的第二通知消息,去注册报文监控钩子函数。When the first application is started and loaded, the traffic reporting component will receive the second notification message in the above step S606 to register the message monitoring hook function.

步骤S2,报文处理;Step S2, message processing;

本步骤具体包括报文解析、查流表和报文分析三个步骤。流表中记录有各网络应用中的流的标识信息、以及每条流的统计信息,每条流的统计信息可以包括:接收到的该条流的报文数量、接收到的该条流的报文的总字节数、出错的包数等。流的标识信息可以根据流中报文的五元组或者四元组计算得到,上述计算具体可以使用hash算法,从而流的标识信息可以是报文的五元组或者四元组计算得到的hash值。This step specifically includes three steps: packet parsing, flow table checking, and packet analysis. The flow table records the identification information of the flow in each network application and the statistical information of each flow. The statistical information of each flow may include: the number of received packets of the flow, the number of received packets of the flow The total number of bytes in the message, the number of error packets, etc. The identification information of the flow can be calculated according to the five-tuple or four-tuple of the message in the flow. The above calculation can specifically use the hash algorithm, so that the identification information of the flow can be the hash calculated by the five-tuple or four-tuple of the message. value.

在报文解析时,流量上报组件获取到报文,可以解析报文中是否存在第一应用的UID;如果存在,说明该报文是第一应用的报文,解析报文的四元组(或者五元组),执行后续的查流表步骤;如果不存在,说明该报文不是第一应用的报文,流程结束。上述四元组可以包括:源IP、目的IP、源端口、目的端口;五元组可以包括:源IP、目的IP、源端口、目的端口以及协议号。When the message is parsed, the traffic reporting component obtains the message, and can analyze whether there is a UID of the first application in the message; if it exists, it indicates that the message is a message of the first application, and the quadruple ( or quintuple), perform the subsequent step of checking the flow table; if it does not exist, it means that the message is not the message of the first application, and the process ends. The above four-tuple may include: source IP, destination IP, source port, destination port; the five-tuple may include: source IP, destination IP, source port, destination port and protocol number.

在查流表时,可以根据报文的四元组(或者五元组)计算流的标识信息,使用计算得到的标识信息查找流表中是否已经记录有该标识信息,如果是,更新流表中该标识信息对应的统计信息;如果否,在流表中根据该流的标识信息创建流结点,更新流结点中该流的统计信息。When checking the flow table, you can calculate the identification information of the flow according to the four-tuple (or five-tuple) of the message, and use the calculated identification information to find out whether the identification information has been recorded in the flow table, and if so, update the flow table The statistical information corresponding to the identification information in the flow table; if not, create a flow node in the flow table according to the identification information of the flow, and update the statistical information of the flow in the flow node.

在进行报文分析时,流量上报组件可以通过预设条件来过滤接收到的报文,从而获得目标流的全部或部分报文。例如,该预设条件可以为:报文的源IP地址为主网络通道所连接网络的IP地址、报文的目的IP地址为第一应用的服务器、源端口、目的端口等,或者报文的目的IP地址为主网络通道所连接网络的IP地址、报文的源IP地址为第一应用的服务器、源端口、目的端口等。上述预设条件可以通过配置文件配置给流量上报组件,上述配置文件可以在步骤S614中流量感知组件发送的流量上报请求中携带,记录有报文需要匹配的特征信息。When performing packet analysis, the traffic reporting component can filter the received packets through preset conditions, so as to obtain all or part of the packets of the target flow. For example, the preset condition may be: the source IP address of the message is the IP address of the network connected to the main network channel, the destination IP address of the message is the server, source port, and destination port of the first application, or the The destination IP address is the IP address of the network connected to the main network channel, the source IP address of the message is the server of the first application, the source port, the destination port, etc. The above preset conditions can be configured to the traffic reporting component through a configuration file, and the above configuration file can be carried in the traffic reporting request sent by the traffic sensing component in step S614, and record the feature information that the message needs to match.

步骤S3,根据流上报策略将匹配到的目标流以及目标流报文的统计信息上报给流量感知模块。Step S3, report the matched target flow and statistical information of the target flow packet to the traffic perception module according to the flow reporting policy.

步骤S616:流量感知组件根据报文上报组件上报的目标流的报文统计信息检测网络质量,并基于该网络质量判断是否切换网络通道。Step S616: The traffic sensing component detects the network quality according to the packet statistical information of the target flow reported by the packet reporting component, and judges whether to switch the network channel based on the network quality.

具体地,流量上报组件周期性地向流量感知组件上报目标流报文的统计信息,周期性地对第一应用与服务器之间目标流的网络质量进行检测。下面,结合图8,对流量感知组件以一个周期为单位检测网络质量的流程进行具体说明,具体流程如下:Specifically, the traffic reporting component periodically reports the statistical information of the target flow packets to the traffic sensing component, and periodically detects the network quality of the target flow between the first application and the server. In the following, in combination with Figure 8, the process of detecting network quality by the traffic sensing component in units of one cycle is described in detail, and the specific process is as follows:

步骤S801:流量感知组件接收流量上报组件上报的本周期目标流报文的统计信息。Step S801: The traffic sensing component receives the statistical information of the current cycle target flow packets reported by the traffic reporting component.

具体地,流量上报组件探测第一应用与服务器之间的数据流,该数据流为目标数据流,并以周期为单位对目标数据流中的上行报文和下行报文进行统计,目标流报文的统计信息,并将本周期的目标流报文的统计信息发送给流量感知组件。其中,目标流报文的统计信息包括不仅限于:上行报文的数量、下行报文的数量、每个报文的协议号、报文的字节数、报文的源IP地址、报文的目的IP地址等信息。Specifically, the traffic reporting component detects the data flow between the first application and the server, the data flow is the target data flow, and counts the uplink packets and downlink packets in the target data flow in units of periods, and the target flow reports The statistical information of the packet, and the statistical information of the target flow packet in this period is sent to the traffic awareness component. Among them, the statistical information of the target stream packet includes but not limited to: the number of uplink packets, the number of downlink packets, the protocol number of each packet, the number of bytes of the packet, the source IP address of the packet, the Destination IP address and other information.

步骤S802:流量感知组件根据基于本周期的报文统计信息判断第一应用是否处于暂停下载/停止下载的状态。Step S802: The traffic sensing component judges whether the first application is in a state of suspending downloading/stopping downloading according to the packet statistics information based on the current period.

具体地,流量感知组件可以从当前周期和以往周期的目标流的报文统计信息获取当前周期和过去多个周期的下行网络速率,并基于这多个下行网络速率判断第一应用处于暂停下载/停止下载状态。其中,第一应用的下载状态为服务器向第一应用发送下行数据流的状态。流量感知组件基于下行网络速率判断第一应用是否处于暂停下载/停止下载状态的方法可以为:若在当前周期内,下行网络速率大于第一速率值,小于Threshhold,且上一个周期的网络质量记录为优,流量感知组件判断第一应用的处于暂停下载/停止下载状态,不记录当前周期的网络质量。否则,第一应用不处于暂停下载/停止下载状态。其中,Threshhold用与判断当前周期的网络质量,若当前周期的下行网络速率大于或等于Threshhold,则当前周期网络质量记录为优,若当前周期的下行网络速率小于Threshhold,则当前周期的网络质量记录为差,Threshhold大于第一速率值。第一速率值可以由历史数据得到,可以由实验数据得到,本申请实施例不做限制。Specifically, the traffic sensing component can obtain the downlink network rate of the current period and the past multiple periods from the packet statistics information of the target flow in the current period and previous periods, and judge that the first application is in the pause downloading/downloading mode based on the multiple downlink network rates. Stop downloading status. Wherein, the download state of the first application is a state in which the server sends downlink data streams to the first application. The method for the traffic perception component to judge whether the first application is in the state of suspending download/stop downloading based on the downlink network rate may be as follows: if in the current period, the downlink network rate is greater than the first rate value and less than Threshhold, and the network quality record of the previous period is For optimality, the traffic sensing component judges that the first application is in the state of suspending download/stop downloading, and does not record the network quality of the current period. Otherwise, the first application is not in the state of pausing download/stopping download. Among them, Threshhold is used to judge the network quality of the current period. If the downlink network rate of the current period is greater than or equal to Threshhold, the network quality record of the current period is excellent. If the downlink network rate of the current period is less than Threshhold, the network quality record of the current period is For difference, Threshhold is greater than the first rate value. The first rate value may be obtained from historical data or experimental data, which is not limited in this embodiment of the present application.

应当理解的是,本申请实施例对流量感知组件基于当前周期的报文统计信息判断出所述第一应用处于暂停下载/停止下载状态的方法仅做示例性说明,不做限制。It should be understood that, the embodiment of the present application is only an exemplary description of the method in which the traffic sensing component determines that the first application is in the state of suspending download/stopping download based on the packet statistics information of the current period, and does not limit it.

若第一应用处于暂停下载/停止下载状态,流量感知组件执行步骤S803,若第一应用不处于暂停下载/停止下载状态,流量感知组件执行步骤S804。If the first application is in the state of pausing/stopping downloading, the traffic sensing component executes step S803; if the first application is not in the state of pausing/stopping downloading, the traffic sensing component executes step S804.

步骤S803:流量感知组件将下载结束标志设置为第一标识。Step S803: The traffic sensing component sets the download end flag as the first flag.

具体地,下载结束标志用于指示第一应用的下载状态,若下载结束标志为第一标识,流量感知组件确定第一应用处于暂停下载/停止下载状态,若下载结束标志不为第一标识,则流量感知组件确定第一应用不处于暂停下载/停止下载状态。示例性的,第一标识可以为“True”或“1”等字符,本申请实施例对第一标识的表示方法不做限制。Specifically, the download end flag is used to indicate the download status of the first application. If the download end flag is the first flag, the traffic awareness component determines that the first application is in the state of pausing download/stop downloading. If the download end flag is not the first flag, Then the traffic sensing component determines that the first application is not in the state of pausing download/stopping download. Exemplarily, the first identifier may be characters such as "True" or "1", and this embodiment of the present application does not limit the representation method of the first identifier.

步骤S804:流量感知组件判断下载结束标志是否为第一标识。Step S804: The traffic sensing component judges whether the download end flag is the first flag.

具体地,若判断为是,流量感知组件执行步骤S806,若判断为否,流量感知组件执行步骤S805。Specifically, if the judgment is yes, the traffic sensing component executes step S806, and if the judgment is no, the traffic sensing component executes step S805.

步骤S805:流量感知组件基于本周期的报文统计信息,记录本周期的网络质量。Step S805: The traffic sensing component records the network quality of the current period based on the packet statistics information of the current period.

具体地,流量感知组件可以将本周期的下行网络速率与预设的速率阈值Threshhold进行比较,若下行网络速率大于或等于Threshhold,则流量感知组件记录本周期网络质量优,若下行网络速率小于Threshhold,则流量感知组件记录本周期网络质量差。其中,Threshhold可以基于历史数据得到,也可以基于经验值得到,还可以基于实验数据得到,本申请实施例对此不做限制。其中,Threshhold大于第一速率值。Specifically, the traffic sensing component can compare the downlink network rate in this period with the preset rate threshold Threshhold. If the downlink network rate is greater than or equal to Threshhold, the traffic sensing component records that the network quality in this period is excellent. If the downlink network rate is less than Threshhold , the traffic sensing component records that the network quality in this period is poor. Wherein, Threshhold may be obtained based on historical data, may also be obtained based on empirical values, and may also be obtained based on experimental data, which is not limited in this embodiment of the present application. Wherein, Threshhold is greater than the first rate value.

步骤S806:流量感知组件不记录本周期的网络质量。Step S806: The traffic sensing component does not record the network quality of this period.

步骤S807:在存在上行报文的情况下,流量感知组件基于本周期的报文统计信息判断上行报文的网络协议是否为GQUIC协议。Step S807: In the case that there are uplink packets, the traffic sensing component judges whether the network protocol of the uplink packets is the GQUIC protocol based on the packet statistics information of this period.

具体地,如步骤S615所述,流量上报组件在对目标流进行探测的过程中,会对目标流中的报文进行解析,从而得到目标流中的报文所使用的网络协议。流量上报组件在捕获报文后,判断在上行报文中是否存在CHLO(Client Hello)字段,则判断报文使用的网络协议为GQUIC协议,如果使用GQUIC协议,流量上报组件将其记录在目标流的报文统计信息中。图9是本申请实施例提供的使用GQUIC协议的数据报的示意图,由图9可知,该报文含有CHLO字段。Specifically, as described in step S615, during the process of detecting the target flow, the traffic reporting component analyzes the packets in the target flow, so as to obtain the network protocol used by the packets in the target flow. After the traffic reporting component captures the message, it judges whether there is a CHLO (Client Hello) field in the upstream message, and then judges that the network protocol used by the message is the GQUIC protocol. If the GQUIC protocol is used, the traffic reporting component records it in the target flow in the packet statistics information. FIG. 9 is a schematic diagram of a datagram using the GQUIC protocol provided by the embodiment of the present application. It can be seen from FIG. 9 that the packet contains a CHLO field.

流量感知组件基于目标流的报文统计信息判断本周期中的上行报文的协议号判断报文的网络协议是否为GQUIC协议,若判断为是,执行步骤S808,若判断为否,结束流程。The traffic perception component judges the protocol number of the uplink packet in this period based on the packet statistics information of the target flow to judge whether the network protocol of the packet is the GQUIC protocol, if it is judged to be yes, execute step S808, if it is judged to be no, end the process.

步骤S808:流量感知组件判断上行数据报文是否为使用GQUIC协议的ACK报文。Step S808: the traffic sensing component judges whether the uplink data message is an ACK message using the GQUIC protocol.

具体地,流量感知组件在确定本周期内的报文使用的网络协议为GQUIC协议的情况下,判断上行数据报文是否为ACK报文,若判断为是,则说明上行报文不为下载请求报文,本周期的网络质量检测流程完成,结束流程,若判断为否,执行步骤S809。流量感知组件可以根据上行报文中payload字段的字节长度来判断上行报文是否为ACK报文,若payload字段的字节长度大于或等于第一阈值(例如,300Byte),则不为ACK报文,该上行报文为下载请求报文,否则,该上行报文为ACK报文。其中,第一阈值可以由经验值得到,也可以由历史数据得到,还可以由实验数据得到,本申请实施例不做限制。Specifically, when the traffic perception component determines that the network protocol used by the messages in this period is the GQUIC protocol, it judges whether the uplink data message is an ACK message, and if it is judged to be yes, it means that the uplink message is not a download request message, the network quality detection process of this cycle is completed, and the process ends, if the judgment is negative, go to step S809. The traffic perception component can judge whether the uplink message is an ACK message according to the byte length of the payload field in the uplink message. If the byte length of the payload field is greater than or equal to the first threshold (for example, 300Byte), it is not an ACK message. text, the uplink message is a download request message; otherwise, the uplink message is an ACK message. Wherein, the first threshold may be obtained from empirical values, historical data, or experimental data, which is not limited in this embodiment of the present application.

为了便于理解,下面,结合图10对上述步骤S807-步骤S808中,流量感知组件判断上行报文是否为ACK报文的详细流程进行说明,请参见图10,图10是本申请实施例提供的一种流量感知组件判断上行报文是否为ACK报文的流程图,具体流程如下:For ease of understanding, the detailed flow of the traffic perception component judging whether the uplink message is an ACK message in the above step S807-step S808 will be described below in conjunction with FIG. 10. Please refer to FIG. 10, which is provided by the embodiment of the present application A flow chart of a flow perception component judging whether an uplink message is an ACK message. The specific process is as follows:

步骤S1001:流量感知组件判断上行报文是否存在CHLO字段。若判断为是,执行步骤S1002,若判断为否,则说明该上行报文使用的网络协议不为GQUIC协议,执行步骤S1005。Step S1001: The traffic sensing component judges whether there is a CHLO field in the uplink message. If it is judged as yes, execute step S1002; if it is judged as no, it means that the network protocol used by the uplink message is not GQUIC protocol, and execute step S1005.

步骤S1002:流量感知组件确定该上行报文的网络协议为GQUIC协议。Step S1002: the traffic sensing component determines that the network protocol of the uplink packet is the GQUIC protocol.

步骤S1003:流量感知组件判断该上行报文的payload字段的字节长度是否大于或等于第一阈值。若判断为否,执行步骤S1004,若判断为是,执行步骤S1005。Step S1003: the traffic sensing component judges whether the byte length of the payload field of the uplink packet is greater than or equal to a first threshold. If it is judged as no, execute step S1004; if it is judged as yes, execute step S1005.

步骤S1004:流量感知组件确定该上行报文为ACK报文。Step S1004: the traffic sensing component determines that the uplink message is an ACK message.

步骤S1005:流量感知组件确定该上行报文不为ACK报文。Step S1005: the traffic sensing component determines that the uplink packet is not an ACK packet.

步骤S809:流量感知组件设置将下载结束标志设置为第二标识。Step S809: The traffic awareness component sets the download end flag as the second flag.

具体地,若在当前周期内的上行数据报不为使用GQUIC协议的ACK报文,将下载结束标志设置为第二标识,以便流量感知组件在下一周期根据下载结束标志判断是否要记录网络质量。如图11所示,在周期1~周期3中,第一应用处于下载状态,即服务器向第一应用发送下行数据流,流量感知组件在周期4判断下载过程暂停,将下载结束标志设置为第一标识,周期5~周期6下载结束标志都为第一标识,但在周期6,流量感知组件检测到有上行下载请求报文,此时说明第一应用的下载重新开始了,流量感知组件将下载结束标志设置为第二标识,在周期7,流量感知组件基于下载结束标志确定是否记录当前周期的网络质量,若下载结束标识不为第一标识,则记录当前周期的网络质量。Specifically, if the uplink datagram in the current cycle is not an ACK message using the GQUIC protocol, the download end flag is set as the second flag, so that the flow sensing component judges whether to record the network quality according to the download end flag in the next cycle. As shown in Figure 11, in period 1 to period 3, the first application is in the downloading state, that is, the server sends downlink data streams to the first application, and the traffic sensing component judges that the download process is suspended in period 4, and sets the download end flag to the first One sign, the download end sign of period 5 to period 6 is the first sign, but in period 6, the flow sensing component detects that there is an uplink download request message, which means that the download of the first application has restarted, and the flow sensing component will The download end flag is set as the second flag, and in period 7, the traffic perception component determines whether to record the network quality of the current cycle based on the download end flag, and if the download end flag is not the first flag, record the network quality of the current cycle.

下面,结合图12对流量感知组件基于其记录的每个周期的网络质量,判断是否要切换网络通道的具体流程进行说明,具体流程如下:Next, in conjunction with Figure 12, the specific process of determining whether to switch the network channel based on the network quality recorded by the traffic sensing component in each period will be described. The specific process is as follows:

步骤S1201:流量感知组件获取与当前周期相邻的前M个周期的网络质量检测结果。Step S1201: The traffic sensing component obtains the network quality detection results of the previous M periods adjacent to the current period.

步骤S1202:在流量感知组件在所述M个周期的网络质量检测结果中,判断是否超过N个周期的网络质量检测结果为差。若判断为是,执行步骤S1203,若判断为否,执行步骤S1204。Step S1202: Among the network quality detection results of the M periods by the flow sensing component, it is judged whether the network quality detection results of more than N periods are bad. If it is determined to be yes, execute step S1203; if it is determined to be no, execute step S1204.

在一些实施例中,当统计周期不足M个时,则根据已统计的周期数P内是否超过(N*P)/M个周期的网络质量检测结果为差。若判断为是,执行步骤S1203,若判断为否,执行步骤S1204In some embodiments, when the statistical period is less than M, the network quality detection result according to whether the counted period number P exceeds (N*P)/M periods is poor. If it is judged to be yes, execute step S1203, if it is judged to be no, execute step S1204

步骤S1203:流量感知组件确定切换网络通道。Step S1203: The flow sensing component determines to switch the network channel.

步骤S1204:流量感知组件确定不切换网络通道。Step S1204: The traffic sensing component determines not to switch the network channel.

应当理解的是,在上述图12实施例中,流量感知组件基于网络质量检测结果判断是否切换网络通道的方法仅是示例性说明,对于流量感知组件基于网络质量检测结果判断是否切换网络通道的其他方法,本申请实施例不做限制。It should be understood that, in the above-mentioned embodiment of FIG. 12, the method in which the traffic sensing component judges whether to switch the network channel based on the network quality detection result is only an exemplary illustration. For other methods in which the traffic sensing component judges whether to switch the network channel based on the network quality detection result The method is not limited by the embodiment of this application.

步骤S617:在确定切换网络通道的情况下,流量感知组件向流级路径管理组件发送网络通道切换指令。Step S617: In the case of determining to switch the network channel, the traffic perception component sends a network channel switching instruction to the flow-level path management component.

具体地,在确定切换网络通道的情况下,流量感知组件向流级路径管理组件发送网络通道切换指令,该网络通道切换指令用于指示流级路径管理组件可以启动网络通道切换的业务。Specifically, in the case of determining to switch the network channel, the traffic awareness component sends a network channel switching instruction to the flow-level path management component, and the network channel switching instruction is used to instruct the flow-level path management component to start the service of network channel switching.

可选地,该通道切换指令包括第一应用的身份标识(例如,第一应用的UID)。Optionally, the channel switching instruction includes the identity of the first application (for example, the UID of the first application).

步骤S618:流级路径管理组件向通道级路径管理组件请求启用备用网络通道。Step S618: the stream-level path management component requests the channel-level path management component to activate the standby network channel.

具体地,在接收到流量感知组件发送的通道切换指令后,流级路径管理组件向通道级路径管理组件请求启用备用网络通道。Specifically, after receiving the channel switching instruction sent by the traffic sensing component, the flow-level path management component requests the channel-level path management component to activate the standby network channel.

步骤S619:通道级路径管理组件向网络连接组件请求启用备用网络通道。Step S619: the channel-level path management component requests the network connection component to activate the standby network channel.

具体地,通道级路径管理组件在当前可用网络通道中,选择一条除主网络通道之外的网络通道作为备用网络通道。例如,若电子设备与主WIFI网络通道、主移动数据网络通道、副WIFI网络通道、副移动数据网络通道连接,上述四个网络通道均可用,主网络通道为主WIFI网络通道,那么,通道级路径管理组件可以从主移动数据网络通道、副WIFI网络通道、副移动数据网络通道中选择一条网络通道作为备用网络通道。Specifically, the channel-level path management component selects a network channel other than the main network channel as a backup network channel among currently available network channels. For example, if the electronic device is connected to the main WIFI network channel, the main mobile data network channel, the secondary WIFI network channel, and the secondary mobile data network channel, and the above four network channels are all available, and the main network channel is the main WIFI network channel, then the channel level The path management component can select a network channel from the primary mobile data network channel, the secondary WIFI network channel, and the secondary mobile data network channel as a backup network channel.

步骤S620:网络连接管理组件启动备用网络通道,向通道级路径管理组件反馈备用网络通道已启用的通知消息。Step S620: The network connection management component activates the backup network channel, and feeds back a notification message that the backup network channel has been enabled to the channel-level path management component.

具体地,这里的启用备用网络通道是指使得备用网络通道从休眠状态转换至唤醒状态,从而在后续需要进行网络通道切换时,能够快速的从当前网络通道切换至备用网络通道。例如,备用网络通道为主移动数据网络通道,网络连接组件启动主移动数据网络通道的方法就是将主移动数据网络通道从休眠状态转换至唤醒状态。Specifically, enabling the standby network channel here refers to switching the standby network channel from the dormant state to the wake-up state, so that the current network channel can be quickly switched to the standby network channel when subsequent network channel switching is required. For example, the standby network channel is the primary mobile data network channel, and the method for the network connection component to activate the primary mobile data network channel is to switch the primary mobile data network channel from a dormant state to an awake state.

步骤S621:通道级路径管理组件请求通道质量检测组件检测该备用网络通道的通道质量。Step S621: the channel-level path management component requests the channel quality detection component to detect the channel quality of the standby network channel.

步骤S622:通道质量检测组件将通道质量检测结果发送给通道级路径管理组件。Step S622: the channel quality detection component sends the channel quality detection result to the channel-level path management component.

具体地,步骤S621-步骤S622请参考步骤S611-步骤S612,在此不再赘述。Specifically, for step S621-step S622, please refer to step S611-step S612, which will not be repeated here.

步骤S623:通道级路径管理组件将备用网络通道的路径发送给流级路径管理组件。Step S623: the channel-level path management component sends the path of the standby network channel to the stream-level path management component.

步骤S624:流级路径管理组件向策略执行组件发送网络通道切换通知。Step S624: the flow-level path management component sends a network channel switching notification to the policy enforcement component.

步骤S625:策略执行组件切换网络通道。Step S625: The policy enforcement component switches the network channel.

具体地,在接收到流级路径管理组件向策略执行组件发送网络通道切换通知后,策略执行组件切换网络通道,将主网络通道上第一应用与服务器之间的数据流切换到备用网络通道进行传输。Specifically, after receiving the network channel switching notification sent by the flow-level path management component to the policy enforcement component, the policy enforcement component switches the network channel, and switches the data flow between the first application and the server on the main network channel to the backup network channel for processing. transmission.

本申请实施例,电子设备检测到应用向服务器发送下载请求报文后,会周期性地检测网络质量以及下载过程是否结束/暂停,若在本周期内,下载过程结束/暂停,则电子设备不会将本周期内下行网络速率作为判断网络质量好坏的参考因素,同时,电子设备会识别本周期内应用向服务器发送的上行数据报是否为下载请求数据报,若为下载请求数据报,电子设备将下载结束标志位设置为下载状态,通过这样的方法,避免了在下载过程停止或暂停后,电子设备将应用向服务器发送的ACK确认报文识别为下载请求报文,进而将接收该确认报文之后的下行网络速率作为判断是否进行网络通道切换的参考因素,从而造成网络通道的误切。In the embodiment of this application, after the electronic device detects that the application sends a download request message to the server, it will periodically detect the network quality and whether the download process is completed/paused. If the download process is completed/paused within this period, the electronic device will not The downlink network speed in this period will be used as a reference factor for judging the quality of the network. At the same time, the electronic device will identify whether the uplink datagram sent by the application to the server in this period is a download request datagram. If it is a download request datagram, the electronic device will The device sets the download end flag to the download state. Through this method, after the download process stops or pauses, the electronic device will not recognize the ACK confirmation message sent by the application to the server as a download request message, and then will receive the confirmation message. The downlink network rate after the message is used as a reference factor for judging whether to switch the network channel, thus causing the wrong switching of the network channel.

下面对电子设备的系统框架图进行说明。如图13所示,电子设备包括应用层、服务层、策略层及内核层。其中,应用层可以用于提供多种网络应用,上述网络应用可以是第三方应用,也可以是系统应用,例如,游戏、音乐、视频等网络应用。本申请对上述应用层提供的网络应用的类型不做特殊限定。这里的网络应用是指需要使用电子设备的网络通道从网络上获取资源的应用。The system frame diagram of the electronic device will be described below. As shown in FIG. 13 , the electronic device includes an application layer, a service layer, a policy layer and a kernel layer. Wherein, the application layer may be used to provide various network applications, and the above network applications may be third-party applications or system applications, for example, network applications such as games, music, and video. This application does not specifically limit the types of network applications provided by the above application layer. The network application here refers to the application that needs to use the network channel of the electronic device to obtain resources from the network.

服务层可以包括环境感知组件、通道级路径管理组件、策略管理组件及通道质量检测组件。其中,环境感知组件可以用于对应用的状态进行探测,例如上述第一应用的状态可以包括应用退出、应用打开、应用运行、应用安装及应用卸载等状态,可以理解的是,上述状态仅为示例性说明,还可以包括更多的状态,在此不再赘述。通道级路径管理组件可以用于负责请求/关闭网络通道,感知网络通道的状态变化,更新网络通道的选取策略,还可以用于存储多条网络通道的路径。策略管理组件可以基于输入信息生成不同的执行策略,示例性的,该策略可以是启用网络通道的加速功能,也可以是启动流量感知(例如,对网络通道的流量进行探测)等。通道质量检测组件可以用于评估网络通道的质量。服务层还可以包括:网络连接组件,用于启用网络通道,也即将网络通道从休眠状态转换为唤醒状态,在唤醒状态下网络通道可以直接被使用。The service layer may include environment awareness components, channel-level path management components, policy management components and channel quality detection components. Wherein, the environment sensing component can be used to detect the state of the application. For example, the state of the above-mentioned first application can include the states of application exit, application opening, application running, application installation, and application uninstallation. It can be understood that the above-mentioned states are only As an example, it may also include more states, which will not be repeated here. The channel-level path management component can be used to be responsible for requesting/closing the network channel, to sense the state change of the network channel, to update the selection strategy of the network channel, and to store the paths of multiple network channels. The policy management component can generate different execution policies based on the input information. Exemplarily, the policy can be to enable the acceleration function of the network channel, or to enable traffic awareness (for example, to detect the traffic of the network channel), etc. The channel quality detection component can be used to evaluate the quality of network channels. The service layer may also include: a network connection component, configured to enable a network channel, that is, to convert the network channel from a dormant state to a wake-up state, and the network channel can be used directly in the wake-up state.

策略层可以包括流级路径管理组件及流量感知组件。其中,流级路径管理组件可以用于根据上层的策略变化更新网络通道的选取,触发网络通道质量探测,动态选取最优通道,还可以用于存储不同的网络通道的路径,示例性的,可以存储应用当前使用的网络通道(例如,主网络通道)及备用网络通道的路径。流量感知组件可以用于对上报的流量进行统计,评估各条流的网络质量。The policy layer may include flow-level path management components and traffic awareness components. Among them, the flow-level path management component can be used to update the selection of network channels according to the policy changes of the upper layer, trigger network channel quality detection, dynamically select the optimal channel, and can also be used to store the paths of different network channels. For example, it can Paths of the network channel currently used by the application (for example, the primary network channel) and the backup network channel are stored. The flow sensing component can be used to collect statistics on the reported flow and evaluate the network quality of each flow.

内核层可以包括流量上报组件及策略执行组件。其中,流量上报组件可以用于对流量信息的收集及上报。策略执行组件可以用于执行网络通道的切换。The kernel layer may include traffic reporting components and policy enforcement components. Wherein, the traffic reporting component may be used to collect and report traffic information. The policy enforcement component can be used to perform network channel switching.

可以理解的是,本申请实施例示意的各组件间的接口连接关系,只是示意性说明,并不构成对电子设备的结构限定。在本申请另一些实施例中,电子设备也可以采用上述实施例中不同的接口连接方式,或多种接口连接方式的组合。It can be understood that the interface connection relationship among the components shown in the embodiment of the present application is only a schematic illustration, and does not constitute a structural limitation of the electronic device. In other embodiments of the present application, the electronic device may also adopt different interface connection methods in the above embodiments, or a combination of multiple interface connection methods.

上述图13所示的系统框架仅用于说明电子设备的分层架构的实现。图13所示系统架构还可以作为已有的分层软件架构的一部分实现。以安卓(Android)系统为例,图13所示为本申请实施例提供的一种Android系统的电子设备的软件结构框图。分层架构将软件分成若干个层,每一层都有清晰的角色和分工。层与层之间通过软件接口通信。在图14所示的本申请实施例中,将Android系统分为五层,从上至下分别为应用程序层、应用程序框架层(也称:系统框架层)、系统库和安卓运行时层、硬件抽象层(hardware abstraction layer,HAL)和内核层。The above-mentioned system framework shown in FIG. 13 is only used to illustrate the implementation of the layered architecture of the electronic device. The system architecture shown in Figure 13 can also be implemented as part of an existing layered software architecture. Taking Android (Android) system as an example, FIG. 13 is a software structural block diagram of an electronic device with Android system provided by an embodiment of the present application. The layered architecture divides the software into several layers, and each layer has a clear role and division of labor. Layers communicate through software interfaces. In the embodiment of the present application shown in Figure 14, the Android system is divided into five layers, from top to bottom are the application program layer, application program framework layer (also known as: system framework layer), system library and Android runtime layer , hardware abstraction layer (hardware abstraction layer, HAL) and kernel layer.

应用程序层包括若干个应用程序(下文简称为应用),例如相机,图库,日历,WLAN等。在一种可能的实例中,图14所示系统架构中的应用层可以与该应用程序层对应。图14所示电子设备的应用程序层可以包括本申请实施例所述的网络应用,例如视频播放应用、游戏应用等。The application program layer includes several application programs (hereinafter referred to as applications), such as camera, gallery, calendar, WLAN and so on. In a possible example, the application layer in the system architecture shown in FIG. 14 may correspond to the application program layer. The application program layer of the electronic device shown in FIG. 14 may include the network application described in the embodiment of the present application, such as a video playing application, a game application, and the like.

应用程序框架层为应用程序层的应用提供应用编程接口(ApplicationProgramming Interface,API)和编程框架,包括各种组件和服务来支持开发者的安卓开发。应用程序框架层还包括一些预先定义的函数。例如应用程序框架层可包括窗口管理器、内容提供器、资源管理器、摄像头服务等。在一种可能的实例中,图13所示系统架构中的服务层和策略层可以位于应用程序框架层。The application framework layer provides an application programming interface (Application Programming Interface, API) and a programming framework for the application of the application layer, including various components and services to support the developer's Android development. The application framework layer also includes some predefined functions. For example, the application framework layer may include a window manager, a content provider, a resource manager, a camera service, and the like. In a possible example, the service layer and the policy layer in the system architecture shown in FIG. 13 may be located at the application framework layer.

系统库和安卓运行时层包括系统库和安卓运行时(Android Runtime)。系统库可以包括多个功能模块。例如:表面管理器、二维图形引擎、三维图形处理库(例如:OpenGLES),媒体库、字体库等。System library and Android runtime layer includes system library and Android runtime (Android Runtime). A system library can include multiple function modules. For example: surface manager, two-dimensional graphics engine, three-dimensional graphics processing library (eg: OpenGLES), media library, font library, etc.

HAL层为位于操作系统内核与硬件电路之间的接口层。HAL层包括但不限于:音频硬件抽象层(Audio HAL)和摄像头硬件抽象层(Camera HAL)。The HAL layer is an interface layer between the operating system kernel and the hardware circuit. The HAL layer includes but is not limited to: Audio Hardware Abstraction Layer (Audio HAL) and Camera Hardware Abstraction Layer (Camera HAL).

内核层是硬件和软件之间的层。内核层可以包括:显示驱动,摄像头驱动,音频驱动,传感器驱动等。在一种可能的实例中,图13所示系统架构中的内核层可以对应图14所示软件架构中的内核层,此时,如图14所示,内核层可以包括:流量上报组件及策略执行组件。The kernel layer is the layer between hardware and software. The kernel layer can include: display driver, camera driver, audio driver, sensor driver, etc. In a possible example, the kernel layer in the system architecture shown in FIG. 13 may correspond to the kernel layer in the software architecture shown in FIG. 14. At this time, as shown in FIG. 14, the kernel layer may include: traffic reporting components and policies Executive component.

在上述实施例中,可以全部或部分地通过软件、硬件、固件或者其任意组合来实现。当使用软件实现时,可以全部或部分地以计算机程序产品的形式实现。所述计算机程序产品包括一个或多个计算机指令。在计算机上加载和执行所述计算机程序指令时,全部或部分地产生按照本申请所述的流程或功能。所述计算机可以是通用计算机、专用计算机、计算机网络、或者其他可编程装置。所述计算机指令可以存储在计算机可读存储介质中,或者从一个计算机可读存储介质向另一个计算机可读存储介质传输,例如,所述计算机指令可以从一个网站站点、计算机、服务器或数据中心通过有线(例如同轴电缆、光纤、数字用户线)或无线(例如红外、无线、微波等)方式向另一个网站站点、计算机、服务器或数据中心进行传输。所述计算机可读存储介质可以是计算机能够存取的任何可用介质或者是包含一个或多个可用介质集成的服务器、数据中心等数据存储设备。所述可用介质可以是磁性介质,(例如,软盘、硬盘、磁带)、光介质(例如,DVD)、或者半导体介质(例如固态硬盘Solid StateDisk)等。In the above embodiments, all or part of them may be implemented by software, hardware, firmware or any combination thereof. When implemented using software, it may be implemented in whole or in part in the form of a computer program product. The computer program product includes one or more computer instructions. When the computer program instructions are loaded and executed on the computer, the processes or functions according to the present application will be generated in whole or in part. The computer can be a general purpose computer, a special purpose computer, a computer network, or other programmable devices. The computer instructions may be stored in or transmitted from one computer-readable storage medium to another computer-readable storage medium, for example, the computer instructions may be transmitted from a website, computer, server or data center Transmission to another website site, computer, server, or data center by wired (eg, coaxial cable, optical fiber, DSL) or wireless (eg, infrared, wireless, microwave, etc.) means. The computer-readable storage medium may be any available medium that can be accessed by a computer, or a data storage device such as a server or a data center integrated with one or more available media. The available medium may be a magnetic medium (for example, a floppy disk, a hard disk, a magnetic tape), an optical medium (for example, a DVD), or a semiconductor medium (for example, a Solid State Disk).

本领域普通技术人员可以理解实现上述实施例方法中的全部或部分流程,可以由计算机程序来指令相关的硬件完成,该程序可存储于计算机可读取存储介质中,该程序在执行时,可包括如上述各方法实施例的流程。而前述的存储介质包括:ROM或随机存储记忆体RAM、磁碟或者光盘等各种可存储程序代码的介质。Those of ordinary skill in the art can understand that all or part of the processes in the methods of the above embodiments can be implemented by a computer program to instruct related hardware to complete. The program can be stored in a computer-readable storage medium. When the program is executed, it can It includes the processes of the above-mentioned method embodiments. The aforementioned storage medium includes: ROM or random access memory RAM, magnetic disk or optical disk, and other various media that can store program codes.

总之,以上所述仅为本发明技术方案的实施例,并非用于限定本发明的保护范围。凡根据本发明的揭露,所作的任何修改、等同替换、改进等,均应包含在本发明的保护范围之内。In a word, the above description is only an embodiment of the technical solution of the present invention, and is not intended to limit the protection scope of the present invention. All modifications, equivalent replacements, improvements, etc. made according to the disclosure of the present invention shall be included in the protection scope of the present invention.

Claims (10)

1.一种网络质量的检测方法,其特征在于,包括:1. A detection method of network quality, characterized in that, comprising: 响应用户的第一操作,启动第一应用;In response to the user's first operation, start the first application; 周期性地接收目标流的报文统计信息;所述报文统计信息为所述第一应用与服务器之间数据流的统计信息;periodically receiving packet statistical information of the target flow; the packet statistical information is the statistical information of the data flow between the first application and the server; 在基于当前周期的报文统计信息判断出所述第一应用处于暂停下载/停止下载状态的情况下,不记录所述当前周期的网络质量;When it is determined based on the packet statistics information of the current period that the first application is in the state of suspending downloading/stopping downloading, not recording the network quality of the current period; 基于所述当前周期的报文统计信息判断上行报文是否为ACK报文;judging whether the uplink message is an ACK message based on the message statistical information of the current period; 在所述上行报文不为ACK报文的情况下,记录下一周期的网络质量;When the uplink message is not an ACK message, record the network quality of the next cycle; 其中,所述基于所述当前周期的报文统计信息判断上行报文是否为ACK报文,具体包括:Wherein, the judging whether the uplink message is an ACK message based on the message statistical information of the current period specifically includes: 基于所述报文统计信息判断所述上行报文的网络协议是否为GQUIC协议;judging whether the network protocol of the uplink message is the GQUIC protocol based on the message statistical information; 在所述网络协议不为GQUIC协议的情况下,确定所述上行报文不为ACK报文;When the network protocol is not the GQUIC protocol, determine that the uplink message is not an ACK message; 在所述网络协议为GQUIC协议的情况下,检测所述上行报文的payload字段的长度是否大于或等于第一阈值;In the case where the network protocol is the GQUIC protocol, detect whether the length of the payload field of the uplink message is greater than or equal to a first threshold; 若大于或等于所述第一阈值,确定所述上行报文不为ACK报文;If it is greater than or equal to the first threshold, determine that the uplink message is not an ACK message; 若小于所述第一阈值,确定所述上行报文为ACK报文。If it is smaller than the first threshold, determine that the uplink packet is an ACK packet. 2.如权利要求1所述的方法,其特征在于,所述方法还包括:2. The method of claim 1, further comprising: 在所述上行报文为ACK报文的情况下,判断下一周期的上行报文是否为ACK报文。If the uplink message is an ACK message, it is judged whether the uplink message of the next period is an ACK message. 3.如权利要求1所述的方法,其特征在于,所述基于所述报文统计信息判断所述上行报文的网络协议是否为GQUIC协议,包括:3. The method according to claim 1, wherein said judging whether the network protocol of said uplink message is a GQUIC protocol based on said message statistical information comprises: 判断所述上行报文是否存在CHLO字段;judging whether the uplink message has a CHLO field; 若存在所述CHLO字段,确定所述上行报文的网络协议为GQUIC协议;If the CHLO field exists, determine that the network protocol of the uplink message is the GQUIC protocol; 若不存在所述CHLO字段,确定所述上行报文的网络协议不为GQUIC协议。If the CHLO field does not exist, it is determined that the network protocol of the uplink message is not the GQUIC protocol. 4.如权利要求1-3任一项所述的方法,其特征在于,所述网络质量为基于所述当前周期的报文统计信息中的下行网络速率得到的;4. The method according to any one of claims 1-3, wherein the network quality is obtained based on the downlink network rate in the packet statistical information of the current period; 若所述下行网络速率小于或等于预设的速率阈值,则所述当前周期的网络质量记录为差;If the downlink network rate is less than or equal to a preset rate threshold, the network quality record of the current period is poor; 若所述下行网络速率大于所述预设的速率阈值,则所述当前周期的网络质量记录为优。If the downlink network rate is greater than the preset rate threshold, the network quality record of the current period is excellent. 5.如权利要求4所述的方法,其特征在于,所述基于所述当前周期的报文统计信息判断上行报文是否为ACK报文之后,还包括:5. The method according to claim 4, wherein after determining whether the uplink message is an ACK message based on the message statistical information of the current period, further comprising: 在当前的统计周期数量大于M的情况下,获取与所述当前周期相邻的M个周期的网络质量;In the case that the number of current statistical periods is greater than M, acquire the network quality of M periods adjacent to the current period; 判断在所述M个周期中,是否超过N个周期的网络质量为差;Judging whether the network quality of more than N periods is poor in the M periods; 若判断为是,确定切换所述第一应用的网络通道;If the judgment is yes, determine to switch the network channel of the first application; 若判断为否,确定不切换所述第一应用的网络通道;If the judgment is no, determine not to switch the network channel of the first application; 在当前的统计周期数量小于或等于M的情况下,获取与所述当前周期所有相邻的P个周期的网络质量;In the case that the number of current statistical periods is less than or equal to M, acquire the network quality of all P periods adjacent to the current period; 判断在所述P个周期中,是否超过(P*N)/M个周期的网络质量为差;Judging in the P periods, whether the network quality exceeding (P*N)/M periods is poor; 若判断为是,确定切换所述第一应用的网络通道;If the judgment is yes, determine to switch the network channel of the first application; 若判断为否,确定不切换所述第一应用的网络通道。If the judgment is negative, it is determined not to switch the network channel of the first application. 6.如权利要求1所述的方法,其特征在于,在所述基于所述当前周期的报文统计信息判断所述上行报文不为所述ACK报文之后,所述记录下一周期的网络质量之前,还包括:6. The method according to claim 1, characterized in that, after determining that the uplink message is not the ACK message based on the message statistical information of the current cycle, the record of the next cycle Before network quality, also includes: 将所述下载结束标志设置为第二标识,所述第二标识用于表征所述第一应用处于开始下载状态。The download end flag is set as a second flag, and the second flag is used to indicate that the first application is in a state of starting to download. 7.如权利要求1所述的方法,其特征在于,所述在基于当前周期的报文统计信息判断出所述第一应用处于暂停下载/停止下载状态的情况下,不记录所述当前周期的网络质量,包括:7. The method according to claim 1, wherein when it is judged that the first application is in the state of suspending download/stop downloading based on the packet statistical information of the current period, the current period is not recorded network quality, including: 基于所述当前周期的报文统计信息判断出下载结束标志为第一标识的情况下,不记录所述当前周期的网络质量;其中,所述下载结束标志为用于表征所述第一应用的下载状态;所述第一标识用于表征所述第一应用处于暂停下载/停止下载状态。If it is determined based on the packet statistical information of the current period that the download end flag is the first identifier, the network quality of the current period is not recorded; wherein the download end flag is used to characterize the first application Download state: the first identifier is used to indicate that the first application is in a state of pausing download/stopping download. 8.如权利要求7所述的方法,其特征在于,所述基于所述当前周期的报文统计信息判断出下载结束标志为第一标志的情况下,不记录所述当前周期的网络质量之前,还包括:8. The method according to claim 7, wherein, when it is determined that the download end flag is the first flag based on the packet statistical information of the current period, the network quality of the current period is not recorded. ,Also includes: 基于所述当前周期的报文统计信息判断是否将所述下载结束标志设置为所述第一标识;judging whether to set the download end flag as the first flag based on the packet statistical information of the current period; 在判断为是的情况下,将所述下载结束标志设置为所述第一标识;If the judgment is yes, setting the download end flag as the first identifier; 判断所述下载结束标志是否为第一标识。It is judged whether the download end mark is the first mark. 9.一种电子设备,其特征在于,包括:存储器、处理器和触控屏;其中:9. An electronic device, comprising: a memory, a processor and a touch screen; wherein: 所述触控屏用于显示内容;The touch screen is used to display content; 所述存储器,用于存储计算机程序,所述计算机程序包括程序指令;The memory is used to store a computer program, and the computer program includes program instructions; 所述处理器用于调用所述程序指令,使得终端执行如权利要求1-8任一项所述的方法。The processor is configured to call the program instruction, so that the terminal executes the method according to any one of claims 1-8. 10.一种计算机可读存储介质,其特征在于,所述计算机可读存储介质存储有计算机程序,该计算机程序被处理器执行时,实现如权利要求1-8任意一项所述的方法。10. A computer-readable storage medium, wherein the computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, the method according to any one of claims 1-8 is implemented.
CN202111367405.5A 2021-11-18 2021-11-18 Network quality detection method and related electronic equipment Active CN115002797B (en)

Priority Applications (2)

Application Number Priority Date Filing Date Title
CN202111367405.5A CN115002797B (en) 2021-11-18 2021-11-18 Network quality detection method and related electronic equipment
CN202310358098.7A CN116405960B (en) 2021-11-18 2021-11-18 A network quality detection method and related electronic equipment

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202111367405.5A CN115002797B (en) 2021-11-18 2021-11-18 Network quality detection method and related electronic equipment

Related Child Applications (1)

Application Number Title Priority Date Filing Date
CN202310358098.7A Division CN116405960B (en) 2021-11-18 2021-11-18 A network quality detection method and related electronic equipment

Publications (2)

Publication Number Publication Date
CN115002797A CN115002797A (en) 2022-09-02
CN115002797B true CN115002797B (en) 2023-04-07

Family

ID=83018845

Family Applications (2)

Application Number Title Priority Date Filing Date
CN202111367405.5A Active CN115002797B (en) 2021-11-18 2021-11-18 Network quality detection method and related electronic equipment
CN202310358098.7A Active CN116405960B (en) 2021-11-18 2021-11-18 A network quality detection method and related electronic equipment

Family Applications After (1)

Application Number Title Priority Date Filing Date
CN202310358098.7A Active CN116405960B (en) 2021-11-18 2021-11-18 A network quality detection method and related electronic equipment

Country Status (1)

Country Link
CN (2) CN115002797B (en)

Family Cites Families (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN107889128B (en) * 2016-09-30 2020-12-18 腾讯科技(深圳)有限公司 Network quality adjusting method and device
WO2018119923A1 (en) * 2016-12-29 2018-07-05 华为技术有限公司 Communication method and mobile terminal
CN107484217B (en) * 2017-09-20 2018-11-27 广东欧珀移动通信有限公司 Method for switching and registering IP multimedia subsystem, mobile terminal and storage medium
CN108449771B (en) * 2018-06-29 2020-08-11 Oppo(重庆)智能科技有限公司 Network switching method, device, terminal and storage medium
CN109005175B (en) * 2018-08-07 2020-12-25 腾讯科技(深圳)有限公司 Network protection method, device, server and storage medium
CN112422357B (en) * 2019-08-23 2024-03-08 华为云计算技术有限公司 Method and device for detecting state of network communication path
CN111988445B (en) * 2020-08-19 2022-12-20 北京天融信网络安全技术有限公司 Message forwarding method and device, storage medium and electronic equipment

Also Published As

Publication number Publication date
CN115002797A (en) 2022-09-02
CN116405960B (en) 2024-03-29
CN116405960A (en) 2023-07-07

Similar Documents

Publication Publication Date Title
US11736224B2 (en) Data transmission method and electronic device
CN113795040B (en) Channel switching method, electronic device and storage medium
US20240089822A1 (en) Channel switching method, electronic device, and storage medium
US20240022518A1 (en) Channel Switching Method, Electronic Device and Storage Medium
CN114286402B (en) Channel switching method, electronic device and storage medium
WO2020019533A1 (en) Data transmission method and electronic device
CN113890905B (en) Channel switching method, electronic device and storage medium
WO2020124447A1 (en) Multi-sim facing network management
CN115002797B (en) Network quality detection method and related electronic equipment
CN116155729B (en) Network acceleration method based on user traffic portrayal and related electronic equipment
CN113810965B (en) Channel switching method, electronic device and storage medium
RU2802678C1 (en) Channel switching method, electronic device and storage medium
CN116744328B (en) Network acceleration method and device
CN116744329A (en) Network acceleration method and electronic equipment
CN119383673A (en) Control method of application bandwidth and electronic equipment
CN115696464A (en) Data transmission method and electronic equipment

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
GR01 Patent grant
GR01 Patent grant
CP03 Change of name, title or address

Address after: Unit 3401, unit a, building 6, Shenye Zhongcheng, No. 8089, Hongli West Road, Donghai community, Xiangmihu street, Futian District, Shenzhen, Guangdong 518040

Patentee after: Honor Terminal Co.,Ltd.

Country or region after: China

Address before: 3401, unit a, building 6, Shenye Zhongcheng, No. 8089, Hongli West Road, Donghai community, Xiangmihu street, Futian District, Shenzhen, Guangdong

Patentee before: Honor Device Co.,Ltd.

Country or region before: China