Android rom开发:9.0系统上实现4G wifi 以太网共存

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) {
相关推荐
小西米米lxtx6 天前
Android GO 版本锁屏声音无效问题
android·java·framework·android系统开发
画个太阳作晴天14 天前
Android13应用在后台录音无声音
android·framework·android-studio·录音
事后不诸葛20 天前
新增白名单赋予应用安装权限
framework·安卓
画个太阳作晴天20 天前
Android10 设备死机的问题分析和解决
android·framework·anr
画个太阳作晴天1 个月前
DreamCamera2相机预览变形的处理
framework·dreamcamera·相机预览
JabamiLight1 个月前
Android 12.0新增自定义HIDL问题记录
android·gitee·framework·hal·android 12·hidl
Eastsea.Chen1 个月前
MTK Android12 user版本MtkLogger
android·framework
图王大胜2 个月前
Android Framework AMS(10)广播组件分析-1
android·framework·应用·组件·broadcast·ams·广播
胖虎12 个月前
实现iOS Framework生成全流程详解
ios·framework·swift·xcframework
千里马学框架2 个月前
安卓窗口wms/input小知识NO_INPUT_CHANNEL剖析
android·车载系统·framework·wms·input·系统开发