设置网络接口优先级

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

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

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
/**
       * 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));
      }

  

posted @   轻轻的吻  阅读(129)  评论(0编辑  收藏  举报
相关博文:
阅读排行:
· 震惊!C++程序真的从main开始吗?99%的程序员都答错了
· 别再用vector<bool>了!Google高级工程师:这可能是STL最大的设计失误
· 单元测试从入门到精通
· 【硬核科普】Trae如何「偷看」你的代码?零基础破解AI编程运行原理
· 上周热点回顾(3.3-3.9)
点击右上角即可分享
微信分享提示