设置网络接口优先级

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

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));
        }

  

posted @ 2023-09-18 16:38  轻轻的吻  阅读(105)  评论(0编辑  收藏  举报