rk3399 android以太网和wifi共存

Android 9

1.修改 frameworks/base/core/java/android/net/NetworkFactory.java

evalRequest 方法 注释两行

private void evalRequest(NetworkRequestInfo n) {
        if (VDBG) log("evalRequest");
        if (n.requested == false && n.score < mScore &&
                n.request.networkCapabilities.satisfiedByNetworkCapabilities(
                mCapabilityFilter) && acceptRequest(n.request, n.score)) {
            if (VDBG) log("  needNetworkFor");
            needNetworkFor(n.request, n.score);
            n.requested = true;
            Log.d(TAG, "needNetworkFor");
        } else if (n.requested == true &&
                (n.score > mScore || n.request.networkCapabilities.satisfiedByNetworkCapabilities(
                mCapabilityFilter) == false || acceptRequest(n.request, n.score) == false)) {
            if (VDBG) log("  releaseNetworkFor");
            Log.d(TAG, "releaseNetworkFor");
            //releaseNetworkFor(n.request);//注释
            //n.requested = false;//注释
        } else {
            if (VDBG) log("  done");
        }
    }

2.修改frameworks/opt/net/ethernet/java/com/android/server/ethernet/EthernetNetworkFactory.java文件修改 NETWORK_SCORE=30 降低优先级

这样以太网和wifi都能连接成功

Android 12 修改的路径为 

frameworks\opt\net\ethernet\java\com\android\server\ethernet\EthernetNetworkFactory.java

frameworks\libs\net\common\device\android\net\NetworkFactoryLegacyImpl.java

你可能感兴趣的:(android)