首页 > 其他分享 >设置网络接口优先级

设置网络接口优先级

时间:2023-09-18 16:59:09浏览次数:35  
标签:优先级 设置 TransportInfo SCORE sTransports new TYPE TRANSPORT 网络接口

设置网络接口优先级:数字越大,优先级越大

framework/opt/net/ethernet/java/com/android/server/ethernet/EthernetNetworkFactory.java

  /**
         * A map of TRANSPORT_* types to TransportInfo, making scoring and legacy type information
         * available for each type an ethernet interface could propagate.
         *
         * Unfortunately, base scores for the various transports are not yet centrally located.
         * They've been lifted from the corresponding NetworkFactory files in the meantime.
         *
         * Additionally, there are no legacy type equivalents to LOWPAN or WIFI_AWARE. These types
         * are set to TYPE_NONE to match the behavior of their own network factories.
         */
        private static final SparseArray<TransportInfo> sTransports = new SparseArray();
        static {
            // LowpanInterfaceTracker.NETWORK_SCORE
            sTransports.put(NetworkCapabilities.TRANSPORT_LOWPAN,
                    new TransportInfo(ConnectivityManager.TYPE_NONE, 30));
            // WifiAwareDataPathStateManager.NETWORK_FACTORY_SCORE_AVAIL
            sTransports.put(NetworkCapabilities.TRANSPORT_WIFI_AWARE,
                    new TransportInfo(ConnectivityManager.TYPE_NONE, 1));
            // EthernetNetworkFactory.NETWORK_SCORE
            sTransports.put(NetworkCapabilities.TRANSPORT_ETHERNET,
                    new TransportInfo(ConnectivityManager.TYPE_ETHERNET, 70));
            // BluetoothTetheringNetworkFactory.NETWORK_SCORE
            sTransports.put(NetworkCapabilities.TRANSPORT_BLUETOOTH,
                    new TransportInfo(ConnectivityManager.TYPE_BLUETOOTH, 69));
            // WifiNetworkFactory.SCORE_FILTER / NetworkAgent.WIFI_BASE_SCORE
            sTransports.put(NetworkCapabilities.TRANSPORT_WIFI,
                    new TransportInfo(ConnectivityManager.TYPE_WIFI, 60));
            // TelephonyNetworkFactory.TELEPHONY_NETWORK_SCORE
            sTransports.put(NetworkCapabilities.TRANSPORT_CELLULAR,
                    new TransportInfo(ConnectivityManager.TYPE_MOBILE, 50));
        }

  

标签:优先级,设置,TransportInfo,SCORE,sTransports,new,TYPE,TRANSPORT,网络接口
From: https://www.cnblogs.com/yuanqiangfei/p/17712375.html

相关文章

  • ++与*的优先级
    符号优先级https://blog.csdn.net/yuliying/article/details/72898132++的优先级高于*,举例说明#include<stdio.h>intmain(){inta[5];int*p=&a[0];*p=35;*(p+1)=56;printf("p:%p\n",p);printf("p+1:%p\n......
  • Microsoft Edge浏览器如何设置HTTP代理
    当使用MicrosoftEdge浏览器时,你可以通过以下步骤设置代理IP,让浏览器使用代理服务器进行网络请求。步骤一:打开MicrosoftEdge浏览器设置在浏览器中点击右上角的菜单按钮(通常是三个水平点或者更多选项),然后选择"Settings"或者"设置"选项。步骤二:进入网络设置在浏览器设置界面中,向下滚......
  • CentOs设置国内源
    1、切用户、切到原文件件surootcd/etc/yum.repos.d/2、下载源文件wgethttp://mirrors.aliyun.com/repo/Centos-7.repo3、重命名mvCentOS-Base.repoCentOS-Base.repo.bakmvCentos-7.repoCentOS-Base.repo4、更新缓存yumcleanallyummakecacheyumupdate......
  • linux设置http/https proxy及忽略proxy的方法
    msys2设置网络代理在文件.bashrc中添加exporthttp_proxy="proxyIP:port"如exporthttp_proxy="192.168.0.1:8080"exporthttps_proxy="192.168.0.1:8080" 一,场景:有些linux服务器处于内网,并且没有公网ip,故要想与外网进行http/https通信只能通过nat或者加proxy的方式......
  • Qt设置窗口显示到扩展屏
      #include<QDesktopWidget>voidDialog::setDisplayPos(){QDesktopWidget*desktop=QApplication::desktop();//获取显示器个数intnum=desktop->screenCount();//设置窗口显示到扩展屏上//如果有两个显示器,num=2,默认主屏inde......
  • .net core 浏览器缓存设置
    1、浏览器缓存设置  [ResponseCache(Duration=20)] 将ResponseCache特性设置在接口方法上就可以了,Duration中的时间是以秒为单位2、服务端缓存设置 a、将app.UseResponseCaching()方法放在app.MapControllers()方法之前  b、如果使用了app.UseCors()方法,要确保app.......
  • Ubuntu22.04防火墙设置
    使用管理员账号sudosuroot如果你的系统还没有安装ufw,则使用以下命令进行安装sudoaptupdatesudoaptinstallufw安装完成后查看防火墙状态sudoufwstatus如果输出结果为Status:inactive则代表防火墙是关闭状态使用以下命令打开防火墙sudoufwenabl......
  • 【win怎么给两个屏幕设置不同壁纸】
    在现在经济的发展下,多数用户都拥有了两个屏幕,那么如何在不适用壁纸软件的情况下,将两个屏幕设置成不同的壁纸呢?操作首先将需要进行设置的图片选好,将其保存到桌面上,紧接着框选两张图片,右键鼠标,选择设置为桌面背景,这时就可以将两个屏幕的桌面背景分别设置成不同的壁纸若一个横屏一......
  • 最短路之Floyd(医院设置)
    题意题目链接:https://www.luogu.com.cn/problem/P1364给一个二叉树,每个结点有一个值,这个值代表这个结点(即城市)有多少人,然后需要在这些结点中选出一个结点作为医院,问选哪个结点得到的距离和最小。距离和为人数乘以路径长度。思路用最短路,就是先求出每两个点之间的最短......
  • springboot中配置类型转换,设置开启矩阵变量
    2023-09-17packagecom.hh.springboot05.config;importcom.hh.springboot05.bean.Pet;importorg.springframework.context.annotation.Bean;importorg.springframework.context.annotation.Configuration;importorg.springframework.core.convert.converter.Conver......