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) {
相关推荐
刘争Stanley5 天前
Android系统开发(八):从麦克风到扬声器,音频HAL框架的奇妙之旅
android·c语言·framework·音视频·框架·c·hal
千里马学框架7 天前
aosp系统源码aidl文件如何查看对应生成的java文件-安卓系统开发实战小技巧分享
android·java·开发语言·车载系统·framework·系统开发·aosp15
庆 、14 天前
Django REST framework 源码剖析-视图集详解(ViewSet)
后端·python·django·framework·restful·rest·viewset
蜘蛛侠不会飞16 天前
基于安卓14 的ANR dump信息原理
android·java·framework·安卓源码
庆 、20 天前
Django REST framework 源码剖析-视图类详解(Views)
后端·python·django·framework·框架·restful·rest
千里马学框架21 天前
千里马2024年终总结-android framework实战
android·framework·input·车机车载
CheungChunChiu1 个月前
Android10 rk3399 以太网接入流程分析
android·framework·以太网·eth·net·netd
事后不诸葛1 个月前
安卓音频之dumpsys audio
framework·安卓·audio
小西米米lxtx1 个月前
Android GO 版本锁屏声音无效问题
android·java·framework·android系统开发
画个太阳作晴天1 个月前
Android13应用在后台录音无声音
android·framework·android-studio·录音