[go: up one dir, main page]

CN116405960B - A network quality detection method and related electronic equipment - Google Patents

A network quality detection method and related electronic equipment Download PDF

Info

Publication number
CN116405960B
CN116405960B CN202310358098.7A CN202310358098A CN116405960B CN 116405960 B CN116405960 B CN 116405960B CN 202310358098 A CN202310358098 A CN 202310358098A CN 116405960 B CN116405960 B CN 116405960B
Authority
CN
China
Prior art keywords
network
message
application
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
CN202310358098.7A
Other languages
Chinese (zh)
Other versions
CN116405960A (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 CN202310358098.7A priority Critical patent/CN116405960B/en
Publication of CN116405960A publication Critical patent/CN116405960A/en
Application granted granted Critical
Publication of CN116405960B publication Critical patent/CN116405960B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

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报文的情况下,记录下一周期的网络质量。

This application provides a network quality detection method and related electronic equipment. The method includes: 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 determined that the first application is in a download pause/stop download state based on the packet statistics of the current cycle, the network quality of the current cycle is not recorded; based on the current cycle The packet statistics information determines whether the uplink packet is an ACK packet; if the uplink packet is not an ACK packet, the network quality of the next cycle is recorded.

Description

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

技术领域Technical Field

本申请涉及网络质量检测领域,尤其涉及一种网络质量的检测方法及相关电子设备。The present application relates to the field of network quality detection, and 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 phones and other mobile devices are increasingly used in people's daily lives. For example, mobile payments and games can be performed through mobile phones. In order to ensure the normal operation of common services (for example, games, calls, social software and other services), users' mobile phones are usually connected to wireless networks. Network acceleration is often performed when network quality deteriorates. However, when users are surfing the Internet, there are often inaccurate network quality detection problems. When network quality detection is inaccurate, network errors 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, causing the user to pay additional phone bills, thereby reducing the user's Internet experience.

发明内容Contents of the invention

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

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

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

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

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

在一种可能实现的方式中,网络质量为基于当前周期的报文统计信息中的下行网络速率得到的;若下行网络速率小于或等于预设的速率阈值,则当前周期的网络质量记录为差;若下行网络速率大于预设的速率阈值,则当前周期的网络质量记录为优。这样,电子设备能够基于网络质量判断是否进行网络通道的切换,从而避免第一应用出现业务卡顿,降低用户的上网体验。In one possible implementation method, the network quality is obtained based on the downlink network rate in the packet statistics 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 period is excellent. In this way, the electronic device can determine whether to switch network channels based on network quality, thereby avoiding service lags in the first application and degrading the user's Internet experience.

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

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

在一种可能实现的方式中,在基于当前周期的报文统计信息判断出第一应用处于暂停下载/停止下载状态的情况下,不记录当前周期的网络质量,包括:基于当前周期的报文统计信息判断出下载结束标志为第一标识的情况下,不记录当前周期的网络质量;其中,下载结束标志为用于表征第一应用的下载状态;第一标识用于表征第一应用处于暂停下载/停止下载状态。In a possible implementation manner, when it is determined that the first application is in a download pause/stop download state based on the packet statistics of the current cycle, the network quality of the current cycle is not recorded, including: packets based on the current cycle When the statistical information determines that the download end flag is the first flag, the network quality of the current period is not recorded; where 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 determined that the download end flag is the first flag based on the packet statistics of the current period, before the network quality of the current period is not recorded, the packet statistics of the current period are also included. The information determines whether to set the download end flag as the first identification; if the determination is yes, set the download end flag as the first identification; and determine whether the download end flag is the first identification.

第二方面,本申请实施例提供了一种电子设备,该电子设备包括:一个或多个处理器和存储器;该存储器与该一个或多个处理器耦合,该存储器用于存储计算机程序代码,该计算机程序代码包括计算机指令,该一个或多个处理器调用该计算机指令以使得该电子设备执行:响应用户的第一操作,启动第一应用;周期性地接收目标流的报文统计信息;该报文统计信息为第一应用与服务器之间数据流的统计信息;在基于当前周期的报文统计信息判断出第一应用处于暂停下载/停止下载状态的情况下,不记录当前周期的网络质量;基于当前周期的报文统计信息判断上行报文是否为ACK报文;在上行报文不为ACK报文的情况下,记录下一周期的网络质量。In a second aspect, embodiments of the present application provide an electronic device. The electronic device 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 call the computer instructions to cause the electronic device to perform: in response to the user's first operation, start the first application; periodically receive packet statistics 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 that the first application is in the download pause/stop download state based on the packet statistics of the current period, the network of the current period is not recorded. Quality; determine whether the upstream message is an ACK message based on the packet statistics of the current cycle; if the upstream message is not an ACK message, record the network quality of the next cycle.

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

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

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

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

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

在一种可能实现的方式中,该一个或多个处理器调用该计算机指令以使得该电子设备执行:在基于当前周期的报文统计信息判断出第一应用处于暂停下载/停止下载状态的情况下,不记录当前周期的网络质量,具体包括:基于当前周期的报文统计信息判断出下载结束标志为第一标识的情况下,不记录当前周期的网络质量;其中,下载结束标志为用于表征第一应用的下载状态;第一标识用于表征第一应用处于暂停下载/停止下载状态。In a possible implementation manner, the one or more processors call the computer instructions to cause the electronic device to execute: when it is determined that the first application is in a download pause/stop download state based on the packet statistics of the current cycle. Under this condition, the network quality of the current cycle is not recorded, specifically including: when the download end flag is judged to be the first flag based on the packet statistics of the current cycle, the network quality of the current cycle 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 download pause/stop download state.

在一种可能实现的方式中,该一个或多个处理器调用该计算机指令还可以使得该电子设备执行:所述当前周期的报文统计信息判断是否将所述下载结束标志设置为所述第一标识;在判断为是的情况下,将下载结束标志设置为所述第一标识;判断下载结束标志是否为第一标识。In one possible implementation, the one or more processors calling the computer instructions can also cause the electronic device to execute: judging whether to set the download end flag to the first identifier based on the message statistics information of the current cycle; if the judgment is yes, setting the download end flag to 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, comprising: a touch screen, a camera, one or more processors and one or more memories; the one or more processors are coupled to the touch screen, the camera, and the one or more memories, and the one or more memories are used to store computer program code, and the computer program code includes computer instructions. When the one or more processors execute the computer instructions, the electronic device executes the method described in the first aspect or any possible implementation method of the first aspect.

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

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

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

附图说明Description of drawings

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

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

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

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

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

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

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

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

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

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

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

图12是本申请实施例提供一种第一应用判断是否切换网络通道的流程图;12 is a flowchart of a first application determining whether to switch a network channel according to an embodiment of the present application;

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

图14是本申请实施例提供的一种Android系统的电子设备的软件结构框图。Figure 14 is a software structure block diagram of an electronic device of the 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 with reference to the accompanying drawings in the embodiments of the present application. Obviously, the described embodiments are only some of the embodiments of the present application, but not all of the embodiments. 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 embodiment application. The appearances 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. Those skilled in the art will understand, both explicitly and implicitly, that the embodiments described herein may be combined with other embodiments. Based on the embodiments in this application, all other embodiments obtained by those of ordinary skill in the art without creative efforts fall within the scope of protection of this application.

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

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

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

首先对本申请实施例涉及的名词进行示例性而非限定性的说明。First, the nouns involved in the embodiments of this application will be described in an illustrative and non-restrictive manner.

1、移动识别模块(Subscriber Identity Module,SIM)卡:是GSM系统的移动用户所持有的IC卡,称为用户识别卡。GSM系统通过SIM卡来识别GSM用户,同一张SIM卡可在不同的手机上使用,GSM手机只有插入SIM卡后,才能入网使用。1. Mobile Identity Module (Subscriber Identity Module, SIM) card: It is an IC card held by mobile users of the GSM system and is called a subscriber identification card. The GSM system identifies GSM users through SIM cards. The same SIM card can be used on different mobile phones. GSM mobile phones can only be used on 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 developed 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 (GPRS), 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 Mobile Communication Technology (5G) and other mobile communication technology devices for accessing the Internet.

4、WIFI网卡是支持通过无线局域网(Wireless Local Area Network,WLAN)方式上网的装置。4. A WIFI network card is a device that supports Internet access via a 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 developed by Google based on the UDP protocol.

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网络通道,将使用数据业务网卡建立的网络通道称为移动数据网络通道。In the embodiment of the present application, the network channel of the electronic device refers to the route established between the device using the above-mentioned WIFI network card or data service network card to access the Internet and other electronic devices such as servers. In the embodiment of this application, the network channel established using the WIFI network card is called the WIFI network channel, and the network channel established 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 can be pre-configured in the electronic device. Exemplarily, the multiple network channels may include a main WIFI network channel, an auxiliary WIFI network channel, a main mobile data network channel, and an auxiliary mobile data network channel, wherein the above-mentioned main WIFI network channel and the auxiliary WIFI network channel can operate in the 2.4GHz frequency band or the 5GHz frequency band. Exemplarily, if the main WIFI network channel operates in the 2.4GHz frequency band, the auxiliary WIFI network channel operates in the 5GHz frequency band; if the main WIFI network channel operates in the 5GHz frequency band, the auxiliary WIFI network channel operates in the 2.4GHz frequency band. In addition, the main mobile data network channel and the auxiliary mobile data network channel can correspond to the operator network. For example, the main mobile data network channel can use SIM card 1 (the SIM card 1 belongs to operator A), and the auxiliary mobile data network channel can 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 the other three channels, so the main network channel is usually the main WIFI network channel. Under normal circumstances, considering the data traffic consumption of the electronic device, the priority of the WIFI network channel is higher than the priority of the mobile data network channel. It is understood that the above preset channels are only exemplary and do not constitute a limitation on the embodiments of the present application. 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 on the embodiments 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 is introduced below. Please refer to FIG. 1 , which is a schematic diagram of the hardware structure of the 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 (USB) interface 130, a charging management module 140, a power management module 141, a battery 142, an antenna 1, an antenna 2 , mobile communication module 150, wireless communication module 160, audio module 170, speaker 170A, receiver 170B, microphone 170C, headphone interface 170D, sensor module 180, button 190, motor 191, indicator 192, camera 193, display screen 194, and Subscriber identification module (subscriber identification module, SIM) card interface 195, etc. The sensor module 180 may include a pressure sensor 180A, a gyro 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, and 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 figures, or some components may be combined, some components may be separated, or some components may be arranged differently. The components illustrated may be implemented 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 (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 processing unit (NPU), etc. . Among them, different processing units can be independent devices or integrated in one or more processors.

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

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

移动通信模块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 solutions for wireless communication 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 (LNA), etc. The mobile communication module 150 can receive electromagnetic waves through the antenna 1, perform filtering, amplification and other processing on the received electromagnetic waves, and transmit them to the modem processor for demodulation. The mobile communication module 150 can also amplify the signal modulated by the modem processor and convert it into electromagnetic waves through the antenna 1 for radiation. In some embodiments, at least part of the functional modules of the mobile communication module 150 may be disposed 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 provided 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 communication solutions including wireless local area networks (WLAN) (such as Wi-Fi networks), Bluetooth (BT), BLE broadcast, global navigation satellite system (GNSS), frequency modulation (FM), near field communication (NFC), infrared (IR), etc., which are applied to the electronic device 100. The wireless communication module 160 can be one or more devices integrating at least one communication processing module. The wireless communication module 160 receives electromagnetic waves via the antenna 2, modulates the frequency of the electromagnetic wave signal and performs filtering, and sends the processed signal to the processor 110. The wireless communication module 160 can also receive the signal to be sent from the processor 110, modulate the frequency of it, amplify it, and convert it into electromagnetic waves for radiation through the antenna 2.

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

显示屏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, etc. Display 194 includes a display panel. The display panel can use 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-matrix organic light emitting diode). (AMOLED), flexible light-emitting diode (FLED), Miniled, MicroLed, Micro-oLed, 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 implement the shooting function through an ISP, a camera 193, a video codec, a GPU, a display screen 194, an application processor, and the like.

ISP用于处理摄像头193反馈的数据。例如,拍照时,打开快门,光线通过镜头被传递到摄像头感光元件上,光信号转换为电信号,摄像头感光元件将所述电信号传递给ISP处理,转化为肉眼可见的图像。ISP还可以对图像的噪点,亮度,肤色进行算法优化。ISP还可以对拍摄场景的曝光,色温等参数优化。在一些实施例中,ISP可以设置在摄像头193中。The ISP is used to process the data fed back by the camera 193. For example, when taking a photo, the shutter is opened, the light is transmitted to the camera sensor through the lens, the optical signal is converted into an electrical signal, and the camera sensor passes 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 provided 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 frequency point energy.

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

电子设备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 headphone 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 signals. Audio module 170 may also be used to encode and decode audio signals. In some embodiments, the audio module 170 may be provided in the processor 110 , or some functional modules of the audio module 170 may be provided in the processor 110 .

扬声器170A,也称“喇叭”,用于将音频电信号转换为声音信号。电子设备100可以通过扬声器170A收听音乐,或收听免提通话。Speaker 170A, also called "speaker", is used to convert audio electrical signals into sound signals. The electronic device 100 can listen to music through the 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 answers a call or a voice message, the voice can be heard by bringing the receiver 170B close to the human ear.

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

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

气压传感器180C用于测量气压。在一些实施例中,电子设备100通过气压传感器180C测得的气压值计算海拔高度,辅助定位和导航。Air pressure sensor 180C is used to measure air pressure. In some embodiments, the electronic device 100 calculates the altitude through 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, and the electronic device 100 can detect the opening and closing of the flip leather case by using the magnetic sensor 180D.

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

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

触摸传感器180K,也称“触控面板”。触摸传感器180K可以设置于显示屏194,由触摸传感器180K与显示屏194组成触摸屏,也称“触控屏”。触摸传感器180K用于检测作用于其上或附近的触摸操作。触摸传感器可以将检测到的触摸操作传递给应用处理器,以确定触摸事件类型。可以通过显示屏194提供与触摸操作相关的视觉输出。在另一些实施例中,触摸传感器180K也可以设置于电子设备100的表面,与显示屏194所处的位置不同。The touch sensor 180K is also called a "touch panel". The touch sensor 180K can be set 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 touch operations acting 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 can also be set 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 obtain a vibration signal. In some embodiments, the bone conduction sensor 180M can obtain a vibration signal of a vibrating bone block of a human vocal part.

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

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

下面,结合图3A-图3F对用户在线观看视频的过程中,由于网络质量变差,电子设备进行网络通道切换的应用场景进行介绍,图3A-图3F是本申请实施例提供的一组用户使用电子设备100在线观看视频的示例性界面。Next, an application scenario in which the electronic device switches network channels due to the deterioration of the network quality while the user is watching videos online is introduced with reference to Figures 3A to 3F. Figures 3A to 3F are a group of users provided by the embodiment of the present 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。Figure 3A shows the user interface 10 of the electronic device 100. The user interface 10 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 Both SIM cards have started mobile data services. As shown in Figure 3A, the electronic device 100 is currently connected to the WIFI network channel, the main mobile data network channel (the network channel corresponding to the main SIM card) and the secondary mobile data network channel (the secondary SIM card). The network channel corresponding to the card). The embodiments of this application are explained by taking the electronic device 100 using the WIFI network channel as the main network channel and the network channel currently enabled by the electronic device 100 as the main network channel as an example. The network speed display icon 304 is used to display the downlink rate of the currently enabled network channel. For example, as shown in Figure 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 Stories". When the electronic device 100 detects a single-click input operation on the video cover 311, the electronic device 100 displays the user interface 30 shown in Figure 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 videos. It can be seen from Figure 3C that the network channel currently enabled by the electronic device 100 is the main network channel (assuming that the main network channel is the 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 FIG3D , during the video viewing process, the user carries the electronic device 100 and moves from the activity area 1 to the activity area 2, and then moves from the activity area 2 to the activity area 3 to turn on the air conditioner, and the distances between the activity area 1, the activity area 2, and the activity area 3 and the router 101 decrease in sequence. When the user moves to the activity area 2, the electronic device 100 displays the user interface 40 shown in FIG3E .

如图3E所示,用户界面40为视频播放界面,当前电子设备100启用的网络通道为主网络通道,当前网速为512k/s,当前视频的播放进度为06:48。由图3E可知,由于电子设备100在活动区域2处的网络质量差于在活动区域1的网络质量,使得电子设备100的网速相较于在活动区域1时有所下降,当用户移动到活动区域3后,电子设备100显示如图3F所示的用户界面50。As shown in FIG3E , the user interface 40 is a video playback interface, the network channel currently 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. As can be seen from FIG3E , since the network quality of the electronic device 100 in the activity area 2 is worse than that in the activity area 1, the network speed of the electronic device 100 is reduced compared to that in the activity area 1. When the user moves to the activity area 3, the electronic device 100 displays the user interface 50 shown in FIG3F .

如图3F所示,用户界面50为视频播放界面,该视频播放界面包括网络加速提示框501,该网络加速提示框501用于提示已开启视频应用的网络加速。例如,图3F中的网络加速提示框501显示“已完成网络通道的切换,进行网络加速”的信息。可以在用户界面50中看到,当前视频应用启用的网络通道为备用网络通道,当前网速为1.8M/s,当前视频的播放进度为06:48。电子设备100完成了由主网络通道到备用网络的切换,且相较于在活动区域2的网络速率,电子设备在活动区域3切换到备用网络通道后,网络速率有大幅提高。As shown in Figure 3F, the user interface 50 is a video playback interface. The video playback interface includes a network acceleration prompt box 501. The network acceleration prompt box 501 is used to prompt that network acceleration of the video application has been turned on. For example, the network acceleration prompt box 501 in Figure 3F displays the message "The switching of network channels has been completed and network acceleration is performed." It can be seen in the user interface 50 that the network channel currently enabled by the video application is the 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 has completed the switching from the main network channel to the backup network, and compared with the network rate in the active area 2, after the electronic device switches to the backup 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 to 3F show that when the electronic device is playing a video, the change in the straight-line distance between the electronic device and the router causes changes in the network quality. The electronic device performs operations based on the detected network quality. A set of exemplary user interfaces for network channel switching should not limit the embodiments of the present application.

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

下面,结合附图对电子设备网络质量检测方法的原理进行介绍,如图4所示,电子设备通过WIFI网络通道与服务器进行数据流的传输,在WIFI网络通道中包括多条流通道(图中只列举了两条流通道),其中,流通道A用于传输应用1向服务器的上行数据流,流通道B用于服务器向应用1传输下行数据流。当应用1通过流通道1向服务器发送上行报文后,电子设备开始检测下行数据流网络质量(例如,下行数据报的传输速率、数据报的延时、丢包率等等),在检测到数据流的网络质量变差时,将应用1与服务器之间的数据流切换到移动数据网络通道上进行传输。Next, the principle of the network quality detection method for electronic equipment is introduced with reference to the accompanying drawings. As shown in Figure 4, the electronic equipment transmits data streams with the server through the WIFI network channel. The WIFI network channel includes multiple stream channels (in the figure Only two flow channels are listed), among which flow channel A is used to transmit the upstream data flow from application 1 to the server, and flow channel B is used by the server to transmit the downlink data flow to application 1. After application 1 sends an uplink message to the server through flow channel 1, the electronic device begins to detect the network quality of the downlink data stream (for example, the transmission rate of the downlink datagram, the delay of the datagram, the packet loss rate, etc.). After detecting When the network quality of the data flow deteriorates, the data flow between 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. After the server receives the uplink download request message, it sends a downlink data stream to Application 1. At this time, the electronic device will be triggered to perform message detection on the downlink data stream, thereby detecting the network quality of the current data stream and determining whether the network channel needs to be switched based on the network quality. After the server finishes sending the downlink data stream, the electronic device will no longer perform related operations such as network quality detection and network channel switching.

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

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

步骤S601:响应于用户的第一操作,启动第一应用。Step S601: In response to the user's first operation, start the first application.

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

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

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

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

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

步骤S604:在第一应用满足开启网络加速条件的情况下,策略管理组件向流级路径管理组件发送通道启用消息,请求启用主网络通道。Step S604: When the first application meets the conditions 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 turning on network acceleration, it can start the acceleration service for the first application, and send an acceleration enablement message to the flow-level path management component, where the acceleration enablement 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: activating a backup network channel when the environment of the electronic device or the system environment of the electronic device changes, causing the backup network channel to transition from a sleep state to a wake-up state; and/or monitoring the first The network quality of several streams in the application. When the electronic device monitors that the quality of a stream of the first application has deteriorated, it switches multiple streams of the first application, including the above-mentioned streams with deteriorated quality, to the backup network channel, thereby This allows the above-mentioned multiple streams of network applications to always be carried on relatively good-quality network channels, ensuring the transmission quality of the streams, reducing the possibility of service lags in the first application, and improving user experience.

需要说明的是,如果决策将多条流切换至备用网络通道时,电子设备已经启用了备用网络通道,则将多条流切换至已经启用的备用网络通道,如果决策将多条流切换至备用网络通道时,电子设备未启用备用网络通道,则,电子设备需要先启用一条备用网络通道,再切换至已启用的备用网络通道。It should be noted that if the decision is made to switch multiple flows to the backup network channel, the electronic device has already enabled the backup network channel, then the multiple flows will be switched to the backup network channel that has been enabled. When using a network channel, if the electronic device does not enable a backup network channel, the electronic device needs to first enable a backup network channel 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, the identity of the first application, the target flow type, the flow model corresponding to the target flow type, network quality assessment parameter information, and flow switching strategy information. For details, please refer to the above related instructions, which will not be 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 the packet monitoring hook.

具体地,流量上报组件接收流级路径管理组件发送的第二通知消息后,注册报文监控钩子,该报文监控钩子用于监控网络通道中,第一应用与服务器之间的数据流。Specifically, after the traffic reporting component receives the second notification message sent by the flow-level path management component, it 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 stream-level path management component requests the channel-level path management component for the main network channel.

具体地,流级路径管理组件在接收到通道启用消息后,流级路径管理组件向通道级路径管理组件请求主网络通道。本申请实施例以电子设备支持同时使用两张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 enable 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 two SIM cards enable mobile data services, and the electronic device is connected to two WIFI network channels (main WIFI network) at the same time. channel and secondary WIFI network channel) as an example. Since the electronic device has turned on the mobile data services of two SIM cards, 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, namely: main WIFI network channel, main mobile data Network channel, secondary WIFI network channel and secondary mobile data network channel. Among them, the network channels corresponding to the main WIFI, main SIM card, secondary WIFI, and secondary SIM card are: primary WIFI network channel, primary mobile data network channel, secondary WIFI network channel, and 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 sequentially request the main WIFI network channel, the main mobile data network channel, the secondary WIFI network channel, and the secondary mobile data network channel as the main network channel. If the network channel currently requested by the stream-level path management component is available (the network channel currently requested by the stream-level path management component can transmit the data stream between the first application and the server), the stream-level path management component uses the network channel as the main network channel and no longer requests the network channel. Otherwise, the stream-level path management component sequentially requests the main network channel from the channel-level path management component according to the above order until an available network channel is found. If an available network channel is not found, the network acceleration of the first application fails, and the network acceleration of the first application is no longer performed. For example, the stream-level path management component requests the main WIFI network channel from the channel-level path management component as the main network channel. If the main WIFI network channel is available, the main WIFI network channel is used as the main network channel, and the stream-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 as the main network channel. If the primary WIFI network channel is unavailable, the primary network channel is requested in the order of the primary mobile data network channel, the secondary WIFI network channel, and the secondary mobile data network channel until a network channel is found as the primary network channel. If none of the above four network channels are available, the network acceleration of the first application fails, and the network acceleration of the first application will not be performed, that is, the network channel of the first application is switched.

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

此外,流级路径管理组件请求主网络通道的次序也与电子设备连接的网络通道数相关,例如,在电子设备仅连接主WIFI网络,开启主SIM卡移动数据业务和副SIM卡移动数据的情况下,电子设备仅与主WIFI网络通道、主移动数据网络通道、副移动数据网络通道连接,流级路径管理组件向通道级路径管理组件请求主网络通道的顺序可以为主WIFI网络通道、主移动数据网络通道、副移动数据网络通道,也可以为基于这三个网络通道的其它组合的次序。本申请实施例对电子设备连接的网络通道数目,以及流级路径管理组件基于电子设备连接的网络通道,向通道级路径管理组件请求主网络通道的次序不做限制。In addition, the order in which the flow-level path management component requests the main network channels 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 of the secondary SIM card are enabled. Under this circumstance, 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 order in which the flow-level path management component requests the main network channel from the channel-level path management component can be the main WIFI network channel, the main mobile data network channel, and the main WIFI network channel. The data network channel and the secondary mobile data network channel can also be in sequence based on other combinations of these three network channels. The embodiments of the present application do 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 executed at the same time as step S605, may be executed before step S605, or may be executed after step S605. The embodiment of the present application does not limit this.

步骤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, when 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 determines 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. This message 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 stream-level path management component sends a primary network channel request to the channel-level path management component, the channel-level path management component will periodically record the availability of all network channels to which the electronic device is connected.

步骤S609:在流级路径管理组件当前请求的主网络通道为可用网络通道的情况下,通道级路径管理组件向网络连接组件请求启用主网络通道。Step S609: When 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网络通道上传输。For example, 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 the network connection component. Enable the main WIFI network channel 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 detection on the currently enabled main network channel.

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

可选地,当前启用的主网络通道有历史选用记录时,也就是说,当前启用的网络通道曾经被启用过,此时,可以结合上述RTT及历史记录对主网络通道的质量进行评估,其中,该历史记录可以包括历史接收速率、通道质量为差的历史次数等,本申请实施例对上述通道质量的评估方式不做特殊限定。Optionally, when the currently enabled main network channel has a historical selection record, that is, the currently enabled network channel has been enabled before, at this time, the quality of the main network channel can be evaluated based on the above RTT and historical records, where , the historical record may include the historical reception rate, the historical number of times when the channel quality was poor, etc. The embodiment of the present application does not place special limitations on 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 in which the flow-level path management module requests the main network channel (excluding 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 a main network channel whose network quality meets the requirements is not found, the acceleration of the first application will be invalid and the first application will not be accelerated.

例如,当前启用的主网络通道为主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 order in which the stream-level path management component requests the available main network channels 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 to enable the main mobile data network channel as the main network channel, and detects the network quality of the main mobile data network channel through the channel quality detection module. If the network quality of the main mobile data network channel meets the requirements, the channel-level path management component no longer requests the network connection component for the available main network channel. Otherwise, the channel-level path management component sequentially requests the network connection component to use the secondary WIFI network channel and the secondary mobile data network channel as the main network channel, and enables them, and then detects their network quality, until an available network channel with network quality that meets the requirements is found as the main network channel, and enabled, so as to achieve the transmission of the data stream of the first application and the application program on the main network channel.

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

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

应当理解的是,步骤S613和步骤S604可以同时执行,步骤S613也可以在步骤S604之后执行,本申请实施例对此不做限制。It should be understood that step S613 and step S604 can be executed at the same time, and step S613 can also be executed 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, when the traffic perception 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 component to detect the data flow transmitted between the first application and the server on the current main network channel, and report the detected data flow. It can be understood that the above-mentioned traffic detection request can include the identity of the first application (such as UID).

步骤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 of the detected target flow to the traffic sensing component. The target stream may be a data stream transmitted between the first application and the server.

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

由于流量上报组件事先注册了报文监控钩子,当流量上报组件进行流量探测时,可以通过该报文监控钩子,获取目标流的报文。整体实现框图例如图7所示,Netfilter钩包到流量上报组件的nf_hook钩子函数,当前主网络通道上承载的报文即进入到流量上报组件,流量上报组件经过报文解析、流表创建、报文内容分析等流程,将目标流的报文存放到SKB队列中,对于SKB队列中的报文,按照报文所属目标流的上报策略,需要定时上报的目标流的报文统计信息由定时器触发上报至流量感知组件。Since the traffic reporting component has registered the packet monitoring hook in advance, when the traffic reporting component performs traffic detection, it can obtain the packets of the target flow through the packet monitoring hook. The overall implementation block diagram is shown in Figure 7, for example. Netfilter hooks the nf_hook hook function of the traffic reporting component. The packets currently carried on the main network channel enter the traffic reporting component. The traffic reporting component undergoes message parsing, flow table creation, and reporting. Through processes such as packet content analysis, 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 packets belong, 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 starts to be loaded, the traffic reporting component will receive the second notification message in step S606 and register the packet monitoring hook function.

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

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

在报文解析时,流量上报组件获取到报文,可以解析报文中是否存在第一应用的UID;如果存在,说明该报文是第一应用的报文,解析报文的四元组(或者五元组),执行后续的查流表步骤;如果不存在,说明该报文不是第一应用的报文,流程结束。上述四元组可以包括:源IP、目的IP、源端口、目的端口;五元组可以包括:源IP、目的IP、源端口、目的端口以及协议号。During message parsing, the traffic reporting component obtains the message and can parse whether the UID of the first application exists in the message; if so, it means that the message is the message of the first application, parse the four-tuple (or five-tuple) of the message, and perform the subsequent flow table query steps; if not, 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 based on the four-tuple (or five-tuple) of the message, and use the calculated identification information to find whether the identification information has been recorded in the flow table. 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 based on 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 received packets based on preset conditions to obtain all or part of the packets in 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 of the first application, the source port, the destination port, etc., or the message's The destination IP address is the IP address of the network connected to the main network channel, and the source IP address of the message is the server of the first application, source port, destination port, etc. The above preset conditions can be configured to the traffic reporting component through a configuration file. The above configuration file can be carried in the traffic reporting request sent by the traffic sensing component in step S614, and records the characteristic information that the packet needs to match.

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

步骤S616:流量感知组件根据报文上报组件上报的目标流的报文统计信息检测网络质量,并基于该网络质量判断是否切换网络通道。Step S616: The traffic sensing component detects the network quality based on the packet statistical information of the target flow reported by the packet reporting component, and determines 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. Next, combined with Figure 8, the process of detecting network quality by the traffic sensing component in one cycle is explained in detail. The specific process is as follows:

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

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

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

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

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

若第一应用处于暂停下载/停止下载状态,流量感知组件执行步骤S803,若第一应用不处于暂停下载/停止下载状态,流量感知组件执行步骤S804。If the first application is in a paused download/stopped download state, the traffic sensing component executes step S803; if the first application is not in a paused download/stopped download state, 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 identification, the traffic sensing component determines that the first application is in the download pause/stop download state. If the download end flag is not the first identification, Then the traffic sensing component determines that the first application is not in a download pause/stop download state. For example, the first identifier may be a character such as "True" or "1", and the embodiment of this application does not limit the method of expressing the first identifier.

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

具体地,若判断为是,流量感知组件执行步骤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 this period based on the message statistics of this period.

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

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

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

具体地,如步骤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 parses the packets in the target flow, thereby obtaining the network protocol used by the packets in the target flow. After capturing the message, the traffic reporting component determines whether there is a CHLO (Client Hello) field in the upstream message, and then determines 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. Figure 9 is a schematic diagram of a datagram using the GQUIC protocol provided by an embodiment of the present application. It can be seen from Figure 9 that the packet contains a CHLO field.

流量感知组件基于目标流的报文统计信息判断本周期中的上行报文的协议号判断报文的网络协议是否为GQUIC协议,若判断为是,执行步骤S808,若判断为否,结束流程。The traffic perception component determines the protocol number of the uplink message in this cycle based on the message statistics of the target flow to determine whether the network protocol of the message 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 determines whether the uplink data packet is an ACK packet using the GQUIC protocol.

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

为了便于理解,下面,结合图10对上述步骤S807-步骤S808中,流量感知组件判断上行报文是否为ACK报文的详细流程进行说明,请参见图10,图10是本申请实施例提供的一种流量感知组件判断上行报文是否为ACK报文的流程图,具体流程如下:For ease of understanding, the detailed process of the traffic sensing component judging whether the uplink message is an ACK message in the above steps S807-S808 will be described below in conjunction with Figure 10. Please refer to Figure 10. Figure 10 is provided by the embodiment of the present application. A flow chart for a traffic sensing component to determine 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 determines whether the uplink message has a CHLO field. If the determination is yes, step S1002 is executed. If the determination is no, it indicates that the network protocol used by the uplink message is not the GQUIC protocol, and step S1005 is executed.

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

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

步骤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 message is not an ACK message.

步骤S809:流量感知组件设置将下载结束标志设置为第二标识。Step S809: The traffic sensing 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 traffic sensing component determines whether to record the network quality based on the download end flag in the next cycle. As shown in Figure 11, in cycle 1 to cycle 3, the first application is in the downloading state, that is, the server sends a downstream data stream to the first application. The traffic sensing component determines that the download process is suspended in cycle 4, and sets the download end flag to the first application. First identification, the download end flags in cycles 5 to 6 are all the first identification, but in cycle 6, the traffic sensing component detects an uplink download request message. At this time, it means that the download of the first application has restarted, and the traffic sensing component will The download end flag is set to the second flag. In period 7, the traffic sensing component determines whether to record the network quality of the current period based on the download end flag. If the download end flag is not the first flag, the network quality of the current period is recorded.

下面,结合图12对流量感知组件基于其记录的每个周期的网络质量,判断是否要切换网络通道的具体流程进行说明,具体流程如下:Next, combined with Figure 12, the specific process for the traffic sensing component to determine whether to switch the network channel based on the network quality recorded in each cycle 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 first M cycles adjacent to the current cycle.

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

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

步骤S1203:流量感知组件确定切换网络通道。Step S1203: The traffic 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 Figure 12 embodiment, the method in which the traffic perception component determines whether to switch the network channel based on the network quality detection results is only an exemplary description, and the embodiments of the present application do not limit other methods in which the traffic perception component determines whether to switch the network channel based on the network quality detection results.

步骤S617:在确定切换网络通道的情况下,流量感知组件向流级路径管理组件发送网络通道切换指令。Step S617: When it is determined to switch the network channel, the traffic sensing 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 perception component sends a network channel switching instruction to the flow-level path management component, where the network channel switching instruction is used to instruct the flow-level path management component to start the network channel switching service.

可选地,该通道切换指令包括第一应用的身份标识(例如,第一应用的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 flow-level path management component requests the channel-level path management component to enable the backup 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 enable the backup network channel.

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

具体地,通道级路径管理组件在当前可用网络通道中,选择一条除主网络通道之外的网络通道作为备用网络通道。例如,若电子设备与主WIFI网络通道、主移动数据网络通道、副WIFI网络通道、副移动数据网络通道连接,上述四个网络通道均可用,主网络通道为主WIFI网络通道,那么,通道级路径管理组件可以从主移动数据网络通道、副WIFI网络通道、副移动数据网络通道中选择一条网络通道作为备用网络通道。Specifically, the channel-level path management component selects a network channel other than the main network channel as the backup network channel among the 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 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 main mobile data network channel, the secondary WIFI network channel, and the secondary mobile data network channel as the 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 backup network channel here refers to switching the backup network channel from the sleep state to the wake-up state, so that when subsequent network channel switching is required, the current network channel can be quickly switched to the backup network channel. For example, if the backup network channel is the main mobile data network channel, the method for the network connection component to start the main mobile data network channel is to convert the main mobile data network channel from the sleep state to the wake-up state.

步骤S621:通道级路径管理组件请求通道质量检测组件检测该备用网络通道的通道质量。Step S621: the channel-level path management component requests the channel quality detection component to detect the channel quality of the backup 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, please refer to step S611 to step S612 for steps S621 to S622, which will not be described again here.

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

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

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

具体地,在接收到流级路径管理组件向策略执行组件发送网络通道切换通知后,策略执行组件切换网络通道,将主网络通道上第一应用与服务器之间的数据流切换到备用网络通道进行传输。Specifically, after receiving the network channel switching notification sent by the flow-level path management component to the policy execution component, the policy execution 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. transmission.

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

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

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

策略层可以包括流级路径管理组件及流量感知组件。其中,流级路径管理组件可以用于根据上层的策略变化更新网络通道的选取,触发网络通道质量探测,动态选取最优通道,还可以用于存储不同的网络通道的路径,示例性的,可以存储应用当前使用的网络通道(例如,主网络通道)及备用网络通道的路径。流量感知组件可以用于对上报的流量进行统计,评估各条流的网络质量。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 upper-layer policy changes, 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 Stores the network channel currently used by the application (for example, the primary network channel) and the path to the backup network channel. The traffic awareness component can be used to collect statistics on reported traffic and evaluate the network quality of each flow.

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

可以理解的是,本申请实施例示意的各组件间的接口连接关系,只是示意性说明,并不构成对电子设备的结构限定。在本申请另一些实施例中,电子设备也可以采用上述实施例中不同的接口连接方式,或多种接口连接方式的组合。It is understandable that the interface connection relationship between the components illustrated in the embodiments of the present application is only a schematic illustration and does not constitute a structural limitation on 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 system framework shown in Figure 13 above 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 the Android system as an example, FIG. 13 shows a software structure block diagram of an electronic device of the Android system provided by an embodiment of the present application. The layered architecture divides the software into several layers, and each layer has clear roles and division of labor. The 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, they are the application layer, application framework layer (also called: system framework layer), system library and Android runtime layer. , hardware abstraction layer (HAL) and kernel layer.

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

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

系统库和安卓运行时层包括系统库和安卓运行时(Android Runtime)。系统库可以包括多个功能模块。例如:表面管理器、二维图形引擎、三维图形处理库(例如:OpenGLES),媒体库、字体库等。The system library and Android runtime layer include the system library and Android runtime. The system library can include multiple functional modules, such as surface manager, 2D graphics engine, 3D graphics processing library (such as OpenGLES), media library, font library, etc.

HAL层为位于操作系统内核与硬件电路之间的接口层。HAL层包括但不限于:音频硬件抽象层(Audio HAL)和摄像头硬件抽象层(Camera HAL)。The HAL layer is the interface layer between the operating system kernel and hardware circuits. 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 a layer between hardware and software. The kernel layer may include: display driver, camera driver, audio driver, sensor driver, etc. In a possible example, the kernel layer in the system architecture shown in FIG13 may correspond to the kernel layer in the software architecture shown in FIG14. At this time, as shown in FIG14, the kernel layer may include: traffic reporting component and policy execution component.

在上述实施例中,可以全部或部分地通过软件、硬件、固件或者其任意组合来实现。当使用软件实现时,可以全部或部分地以计算机程序产品的形式实现。所述计算机程序产品包括一个或多个计算机指令。在计算机上加载和执行所述计算机程序指令时,全部或部分地产生按照本申请所述的流程或功能。所述计算机可以是通用计算机、专用计算机、计算机网络、或者其他可编程装置。所述计算机指令可以存储在计算机可读存储介质中,或者从一个计算机可读存储介质向另一个计算机可读存储介质传输,例如,所述计算机指令可以从一个网站站点、计算机、服务器或数据中心通过有线(例如同轴电缆、光纤、数字用户线)或无线(例如红外、无线、微波等)方式向另一个网站站点、计算机、服务器或数据中心进行传输。所述计算机可读存储介质可以是计算机能够存取的任何可用介质或者是包含一个或多个可用介质集成的服务器、数据中心等数据存储设备。所述可用介质可以是磁性介质,(例如,软盘、硬盘、磁带)、光介质(例如,DVD)、或者半导体介质(例如固态硬盘Solid StateDisk)等。In the above embodiments, it may be implemented in whole or in part 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 a computer, the processes or functions described in this application are generated in whole or in part. The computer may be a general-purpose computer, a special-purpose computer, a computer network, or other programmable device. The computer instructions may be stored in or transmitted from one computer-readable storage medium to another, e.g., the computer instructions may be transferred from a website, computer, server, or data center Transmission to another website, computer, server or data center through wired (such as coaxial cable, optical fiber, digital subscriber line) or wireless (such as 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, data center, etc. that contains one or more available media integrated. The available media may be magnetic media (eg, floppy disk, hard disk, tape), optical media (eg, DVD), or semiconductor media (eg, Solid State Disk), etc.

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

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

Claims (11)

1. A method for detecting network quality, comprising:
responding to a first operation of a user, and starting a first application;
periodically receiving message statistical information of a target stream; the message statistical information is statistical information of data flow between the first application and a server;
under the condition that the first application is judged to be in a downloading suspension/downloading suspension state based on the message statistical information of the current period, the network quality of the current period is not recorded;
Judging whether the uplink message is an ACK message or not based on the message statistical information of the current period under the condition that the uplink message exists in the target stream;
recording network quality of the next period under the condition that the uplink message is not an ACK message;
whether to switch network channels is determined based on the recorded network quality for a number of cycles.
2. The method of claim 1, wherein the method further comprises:
and judging whether the uplink message in the next period is an ACK message or not under the condition that the uplink message is the ACK message.
3. The method according to any one of claims 1-2, wherein the determining whether the uplink message is an ACK message based on the message statistics information of the current period specifically includes:
judging whether the network protocol of the uplink message is a GQUIC protocol or not based on the message statistical information;
under the condition that the network protocol is not GQUIC protocol, determining that the uplink message is not an ACK message;
detecting whether the length of a payload field of the uplink message is greater than or equal to a first threshold value under the condition that the network protocol is a GQUIC protocol;
if the uplink message is greater than or equal to the first threshold, determining that the uplink message is not an ACK message;
And if the uplink message is smaller than the first threshold value, determining that the uplink message is an ACK message.
4. The method of claim 3, wherein the determining whether the network protocol of the uplink message is a gqic protocol based on the message statistics information comprises:
judging whether the CHLO field exists in the uplink message;
if the CHLO field exists, determining that the network protocol of the uplink message is a GQUIC protocol;
and if the CHLO field does not exist, determining that the network protocol of the uplink message is not GQUIC protocol.
5. The method of any one of claims 1, 2, 4, wherein the network quality is derived based on a downlink network rate in the current period of message statistics;
if the downlink network rate is smaller than or equal to a preset rate threshold, recording the network quality of the current period as poor;
if the downlink network rate is greater than the preset rate threshold, the network quality record of the current period is good.
6. The method of claim 5, wherein after the determining whether the uplink message is an ACK message based on the message statistics of the current period, further comprising:
Under the condition that the number of the current statistical periods is larger than M, acquiring network quality of M periods adjacent to the current period;
judging whether the network quality exceeding N periods is poor in the M periods;
if yes, determining to switch the network channel of the first application;
if not, determining not to switch the network channel of the first application;
acquiring network quality of all P adjacent periods with the current period under the condition that the current statistical period number is less than or equal to M;
judging whether the network quality exceeding (P x N)/M periods is poor in the P periods;
if yes, determining to switch the network channel of the first application;
and if not, determining not to switch the network channel of the first application.
7. The method of any one of claims 1, 2, 4, and 6, wherein after the determining that the uplink message is not the ACK message based on the message statistics of the current period, before the recording of the network quality of the next period, further comprises:
and setting the downloading end mark as a second mark, wherein the second mark is used for representing that the first application is in a downloading starting state.
8. The method of any one of claims 1, 2, 4, and 6, wherein the not recording the network quality of the current period if the first application is determined to be in a suspended download/stop download state based on the packet statistics of the current period comprises:
under the condition that the downloading end mark is judged to be the first mark based on the message statistical information of the current period, the network quality of the current period is not recorded; the download ending mark is used for representing the download state of the first application; the first identifier is used for representing that the first application is in a suspended downloading/stopped downloading state.
9. The method of claim 8, wherein the determining that the download end flag is the first flag based on the packet statistics of the current period, before not recording the network quality of the current period, further comprises:
judging whether to set the downloading end mark as the first mark based on the message statistical information of the current period;
if yes, setting the downloading end mark as the first mark;
and judging whether the downloading end mark is a first mark or not.
10. An electronic device, comprising: the device comprises a memory, a processor and a touch screen; wherein:
the touch screen is used for displaying content;
the memory is used for storing a computer program, and the computer program comprises program instructions;
the processor is configured to invoke the program instructions to cause the electronic device to perform the method of any of claims 1-9.
11. A computer readable storage medium, characterized in that the computer readable storage medium stores a computer program which, when executed by a processor, implements the method according to any of claims 1-9.
CN202310358098.7A 2021-11-18 2021-11-18 A network quality detection method and related electronic equipment Active CN116405960B (en)

Priority Applications (1)

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

Applications Claiming Priority (2)

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

Related Parent Applications (1)

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

Publications (2)

Publication Number Publication Date
CN116405960A CN116405960A (en) 2023-07-07
CN116405960B true CN116405960B (en) 2024-03-29

Family

ID=83018845

Family Applications (2)

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
CN202111367405.5A Active CN115002797B (en) 2021-11-18 2021-11-18 Network quality detection method and related electronic equipment

Family Applications After (1)

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

Country Status (1)

Country Link
CN (2) CN116405960B (en)

Families Citing this family (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20250184000A1 (en) * 2023-12-06 2025-06-05 Yongzhou Noyafa Electronic Co., Ltd. Multi-Functional Network Tester
CN119094476A (en) * 2024-08-01 2024-12-06 荣耀终端有限公司 Network acceleration method, device and storage medium

Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN107889128A (en) * 2016-09-30 2018-04-06 腾讯科技(深圳)有限公司 Network quality method of adjustment and device
WO2018119923A1 (en) * 2016-12-29 2018-07-05 华为技术有限公司 Communication method and mobile terminal
CN111988445A (en) * 2020-08-19 2020-11-24 北京天融信网络安全技术有限公司 Message forwarding method and device, storage medium and electronic equipment
CN112422357A (en) * 2019-08-23 2021-02-26 华为技术有限公司 Method and device for detecting state of network communication path

Family Cites Families (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
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

Patent Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN107889128A (en) * 2016-09-30 2018-04-06 腾讯科技(深圳)有限公司 Network quality method of adjustment and device
WO2018119923A1 (en) * 2016-12-29 2018-07-05 华为技术有限公司 Communication method and mobile terminal
CN112422357A (en) * 2019-08-23 2021-02-26 华为技术有限公司 Method and device for detecting state of network communication path
CN111988445A (en) * 2020-08-19 2020-11-24 北京天融信网络安全技术有限公司 Message forwarding method and device, storage medium and electronic equipment

Also Published As

Publication number Publication date
CN115002797A (en) 2022-09-02
CN116405960A (en) 2023-07-07
CN115002797B (en) 2023-04-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
US20240022518A1 (en) Channel Switching Method, Electronic Device and Storage Medium
WO2021218864A1 (en) Implementation method for wi-fi peer-to-peer service and related device
US20240089822A1 (en) Channel switching method, electronic device, and storage medium
US11997736B2 (en) Connection establishment method and terminal device
KR102491006B1 (en) Data Transmission Methods and Electronic Devices
CN114286402B (en) Channel switching method, electronic device and storage medium
CN116405960B (en) A network quality detection method and related electronic equipment
CN113890905B (en) Channel switching method, electronic device and storage medium
WO2020124447A1 (en) Multi-sim facing network management
CN116155729B (en) Network acceleration method based on user traffic portrayal and related electronic equipment
CN113810965B (en) Channel switching method, electronic device and storage medium
WO2022206603A1 (en) Communication resource cooperation method and electronic device
RU2802678C1 (en) Channel switching method, electronic device and storage medium
CN116744329A (en) Network acceleration method and electronic equipment
HK40068161B (en) Channel switching method, electronic device and storage medium

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

CP03 Change of name, title or address