framework层修改网络优先级,4G > wifi > eth
修改patch如下:
java
diff --git a/frameworks/base/services/core/java/com/android/server/connectivity/NetworkAgentInfo.java b/frameworks/base/services/core/java/com/android/server/connectivity/NetworkAgentInfo.java
index 2e26769..14821f3 100644
--- a/frameworks/base/services/core/java/com/android/server/connectivity/NetworkAgentInfo.java
+++ b/frameworks/base/services/core/java/com/android/server/connectivity/NetworkAgentInfo.java
@@ -436,6 +436,15 @@ public class NetworkAgentInfo implements Comparable<NetworkAgentInfo> {
}
int score = currentScore;
+ if(networkCapabilities.hasTransport(NetworkCapabilities.TRANSPORT_WIFI)){
+ return 20;
+ }
+ if(networkCapabilities.hasTransport(NetworkCapabilities.TRANSPORT_ETHERNET)){
+ return 10;
+ }
+ if(networkCapabilities.hasTransport(NetworkCapabilities.TRANSPORT_CELLULAR)){
+ return 30;
+ }
if (!lastValidated && !pretendValidated && !ignoreWifiUnvalidationPenalty()) {
score -= ConnectivityConstants.UNVALIDATED_SCORE_PENALTY;
}
diff --git a/vendor/mediatek/proprietary/frameworks/opt/net/services/core/java/com/android/server/MtkConnectivityService.java b/vendor/mediatek/proprietary/frameworks/opt/net/services/core/java/com/android/s
index 7cd7e69..7cc2b4f 100644
--- a/vendor/mediatek/proprietary/frameworks/opt/net/services/core/java/com/android/server/MtkConnectivityService.java
+++ b/vendor/mediatek/proprietary/frameworks/opt/net/services/core/java/com/android/server/MtkConnectivityService.java
@@ -5271,7 +5271,7 @@ public class MtkConnectivityService extends ConnectivityService {
break;
}
}
- nai.asyncChannel.disconnect();
+ //nai.asyncChannel.disconnect();
}
private void handleLingerComplete(NetworkAgentInfo oldNetwork) {