设置网络接口优先级
设置网络接口优先级:数字越大,优先级越大
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)); } |
【推荐】国内首个AI IDE,深度理解中文开发场景,立即下载体验Trae
【推荐】编程新体验,更懂你的AI,立即体验豆包MarsCode编程助手
【推荐】抖音旗下AI助手豆包,你的智能百科全书,全免费不限次数
【推荐】轻量又高性能的 SSH 工具 IShell:AI 加持,快人一步
· 震惊!C++程序真的从main开始吗?99%的程序员都答错了
· 别再用vector<bool>了!Google高级工程师:这可能是STL最大的设计失误
· 单元测试从入门到精通
· 【硬核科普】Trae如何「偷看」你的代码?零基础破解AI编程运行原理
· 上周热点回顾(3.3-3.9)