--- a/frameworks/opt/net/ethernet/java/com/android/server/ethernet/EthernetNetworkFactory.java
+++ b/frameworks/opt/net/ethernet/java/com/android/server/ethernet/EthernetNetworkFactory.java
@@ -47,6 +47,7 @@ import android.os.Looper;
import android.os.RemoteCallbackList;
import android.os.RemoteException;
import android.os.ServiceManager;
+import android.os.SystemProperties;
import android.text.TextUtils;
import android.util.Log;
import android.content.Intent;
@@ -94,6 +95,7 @@ class EthernetNetworkFactory {
private static final String NETWORK_TYPE = "Ethernet";
private static final String TAG = "EthernetNetworkFactory";
private static final int NETWORK_SCORE = 70;
+ private static final int NETWORK_SCORE_SHARE = 30;
private static final boolean DBG = true;
/** Tracks interface changes. Called from NetworkManagementService. */
@@ -260,9 +262,16 @@ class EthernetNetworkFactory {
// set our score lower than any network could go
// so we get dropped. TODO - just unregister the factory
// when link goes down.
- mFactory.setScoreFilter(up ? NETWORK_SCORE : -1);
+ mFactory.setScoreFilter(up ? getNetworkScore() : -1);
}
}
+
+ private int getNetworkScore() {
+ if ("1".equals(SystemProperties.get("persist.tchip.iproute")))
+ return NETWORK_SCORE_SHARE;
+ else
+ return NETWORK_SCORE;
+ }
// first disconnect, then connect
public void reconnect(String iface) {
@@ -429,7 +438,7 @@ class EthernetNetworkFactory {
mNetworkAgent.sendNetworkInfo(mNetworkInfo);
mNetworkAgent.sendLinkProperties(mLinkProperties);
// never set the network score below 0.
- mNetworkAgent.sendNetworkScore(mLinkUp? NETWORK_SCORE : 0);
+ mNetworkAgent.sendNetworkScore(mLinkUp? getNetworkScore() : 0);
}
}
@@ -585,7 +594,7 @@ class EthernetNetworkFactory {
// Create our NetworkAgent.
mNetworkAgent = new NetworkAgent(mFactory.getLooper(), mContext,
NETWORK_TYPE, mNetworkInfo, mNetworkCapabilities, mLinkProperties,
- NETWORK_SCORE) {
+ getNetworkScore()) {
public void unwanted() {
synchronized(EthernetNetworkFactory.this) {
if (this == mNetworkAgent) {
Android 7.1 根据4G共享动态调整以太网优先级
猜你喜欢
转载自blog.csdn.net/zhoumushui/article/details/102892841
今日推荐
周排行