Loading services/core/java/com/android/server/ConnectivityService.java +47 −3 Original line number Diff line number Diff line /* * Copyright (C) 2008 The Android Open Source Project * Copyright (C) 2019 e.foundation * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. Loading Loading @@ -184,8 +185,9 @@ public class ConnectivityService extends IConnectivityManager.Stub implements PendingIntent.OnFinished { private static final String TAG = ConnectivityService.class.getSimpleName(); private static final boolean DBG = true; private static final boolean VDBG = false; private static final boolean VDBG = true; private static final boolean LOGD_RULES = false; private static final boolean LOGD_BLOCKED_NETWORKINFO = true; Loading Loading @@ -4661,7 +4663,27 @@ public class ConnectivityService extends IConnectivityManager.Stub return; // no updating necessary } Collection<InetAddress> dnses = newLp.getDnsServers(); Collection<InetAddress> dnses = null;//newLp.getDnsServers(); int useNwDNS = android.provider.Settings.System.getInt(mContext.getContentResolver(), "USE_NETWORK_DNS", 1); if (DBG) log("useNwDNS>"+useNwDNS+"<"); if ( 0 != useNwDNS ) { dnses = newLp.getDnsServers(); } else { dnses = new ArrayList<InetAddress>(); try { String s = android.provider.Settings.System.getString(mContext.getContentResolver(), "OVERRIDE_DNS_IP_V4"); if (s == null) s = "9.9.9.9"; if (DBG) log("Override dnses>"+s+"<"); InetAddress addr = InetAddress.getByName(s); dnses.add(addr); } catch (Exception e) { loge("Cannot set custom DNS: " + e); } } if (DBG) log("Setting DNS servers for network " + netId + " to " + dnses); try { mNetd.setDnsConfigurationForNetwork( Loading @@ -4669,6 +4691,7 @@ public class ConnectivityService extends IConnectivityManager.Stub } catch (Exception e) { loge("Exception in setDnsConfigurationForNetwork: " + e); } if (DBG) log("Setting DNS servers for network (2)" + netId + " to " + dnses); final NetworkAgentInfo defaultNai = getDefaultNetwork(); if (defaultNai != null && defaultNai.network.netId == netId) { setDefaultDnsSystemProperties(dnses); Loading Loading @@ -4908,7 +4931,28 @@ public class ConnectivityService extends IConnectivityManager.Stub handleApplyDefaultProxy(newNetwork.linkProperties.getHttpProxy()); updateTcpBufferSizes(newNetwork); updateTcpDelayedAck(newNetwork); setDefaultDnsSystemProperties(newNetwork.linkProperties.getDnsServers()); Collection<InetAddress> dnses = null; int useNwDNS = android.provider.Settings.System.getInt(mContext.getContentResolver(), "USE_NETWORK_DNS", 1); if (DBG) log("useNwDNS>"+useNwDNS+"<"); if ( 0 != useNwDNS ) { dnses = newNetwork.linkProperties.getDnsServers(); } else { dnses = new ArrayList<InetAddress>(); try { String s = android.provider.Settings.System.getString(mContext.getContentResolver(), "OVERRIDE_DNS_IP_V4"); if (s == null) s = "9.9.9.9"; if (DBG) log("Override dnses>"+s+"<"); InetAddress addr = InetAddress.getByName(s); dnses.add(addr); } catch (Exception e) { loge("Cannot set custom DNS: " + e); } } setDefaultDnsSystemProperties(dnses); } private void processListenRequests(NetworkAgentInfo nai, boolean capabilitiesChanged) { Loading services/core/java/com/android/server/NetworkManagementService.java +28 −12 Original line number Diff line number Diff line /* * Copyright (C) 2007 The Android Open Source Project * Copyright (C) 2019 e.foundation * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. Loading Loading @@ -777,6 +778,9 @@ public class NetworkManagementService extends INetworkManagementService.Stub * Notify our observers of DNS server information received. */ private void notifyInterfaceDnsServerInfo(String iface, long lifetime, String[] addresses) { int useNwDNS = android.provider.Settings.System.getInt(mContext.getContentResolver(), "USE_NETWORK_DNS", 1); if ( 0 != useNwDNS ) { final int length = mObservers.beginBroadcast(); try { for (int i = 0; i < length; i++) { Loading @@ -789,6 +793,18 @@ public class NetworkManagementService extends INetworkManagementService.Stub } finally { mObservers.finishBroadcast(); } } else { final String[] xaddresses = new String[1]; String s = android.provider.Settings.System.getString(mContext.getContentResolver(), "OVERRIDE_DNS_IP_V4"); xaddresses[0] = s; try { mObservers.getBroadcastItem(0).interfaceDnsServerInfo(iface, lifetime, xaddresses); } catch (RemoteException | RuntimeException e) {} finally { mObservers.finishBroadcast(); } } } /** Loading Loading
services/core/java/com/android/server/ConnectivityService.java +47 −3 Original line number Diff line number Diff line /* * Copyright (C) 2008 The Android Open Source Project * Copyright (C) 2019 e.foundation * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. Loading Loading @@ -184,8 +185,9 @@ public class ConnectivityService extends IConnectivityManager.Stub implements PendingIntent.OnFinished { private static final String TAG = ConnectivityService.class.getSimpleName(); private static final boolean DBG = true; private static final boolean VDBG = false; private static final boolean VDBG = true; private static final boolean LOGD_RULES = false; private static final boolean LOGD_BLOCKED_NETWORKINFO = true; Loading Loading @@ -4661,7 +4663,27 @@ public class ConnectivityService extends IConnectivityManager.Stub return; // no updating necessary } Collection<InetAddress> dnses = newLp.getDnsServers(); Collection<InetAddress> dnses = null;//newLp.getDnsServers(); int useNwDNS = android.provider.Settings.System.getInt(mContext.getContentResolver(), "USE_NETWORK_DNS", 1); if (DBG) log("useNwDNS>"+useNwDNS+"<"); if ( 0 != useNwDNS ) { dnses = newLp.getDnsServers(); } else { dnses = new ArrayList<InetAddress>(); try { String s = android.provider.Settings.System.getString(mContext.getContentResolver(), "OVERRIDE_DNS_IP_V4"); if (s == null) s = "9.9.9.9"; if (DBG) log("Override dnses>"+s+"<"); InetAddress addr = InetAddress.getByName(s); dnses.add(addr); } catch (Exception e) { loge("Cannot set custom DNS: " + e); } } if (DBG) log("Setting DNS servers for network " + netId + " to " + dnses); try { mNetd.setDnsConfigurationForNetwork( Loading @@ -4669,6 +4691,7 @@ public class ConnectivityService extends IConnectivityManager.Stub } catch (Exception e) { loge("Exception in setDnsConfigurationForNetwork: " + e); } if (DBG) log("Setting DNS servers for network (2)" + netId + " to " + dnses); final NetworkAgentInfo defaultNai = getDefaultNetwork(); if (defaultNai != null && defaultNai.network.netId == netId) { setDefaultDnsSystemProperties(dnses); Loading Loading @@ -4908,7 +4931,28 @@ public class ConnectivityService extends IConnectivityManager.Stub handleApplyDefaultProxy(newNetwork.linkProperties.getHttpProxy()); updateTcpBufferSizes(newNetwork); updateTcpDelayedAck(newNetwork); setDefaultDnsSystemProperties(newNetwork.linkProperties.getDnsServers()); Collection<InetAddress> dnses = null; int useNwDNS = android.provider.Settings.System.getInt(mContext.getContentResolver(), "USE_NETWORK_DNS", 1); if (DBG) log("useNwDNS>"+useNwDNS+"<"); if ( 0 != useNwDNS ) { dnses = newNetwork.linkProperties.getDnsServers(); } else { dnses = new ArrayList<InetAddress>(); try { String s = android.provider.Settings.System.getString(mContext.getContentResolver(), "OVERRIDE_DNS_IP_V4"); if (s == null) s = "9.9.9.9"; if (DBG) log("Override dnses>"+s+"<"); InetAddress addr = InetAddress.getByName(s); dnses.add(addr); } catch (Exception e) { loge("Cannot set custom DNS: " + e); } } setDefaultDnsSystemProperties(dnses); } private void processListenRequests(NetworkAgentInfo nai, boolean capabilitiesChanged) { Loading
services/core/java/com/android/server/NetworkManagementService.java +28 −12 Original line number Diff line number Diff line /* * Copyright (C) 2007 The Android Open Source Project * Copyright (C) 2019 e.foundation * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. Loading Loading @@ -777,6 +778,9 @@ public class NetworkManagementService extends INetworkManagementService.Stub * Notify our observers of DNS server information received. */ private void notifyInterfaceDnsServerInfo(String iface, long lifetime, String[] addresses) { int useNwDNS = android.provider.Settings.System.getInt(mContext.getContentResolver(), "USE_NETWORK_DNS", 1); if ( 0 != useNwDNS ) { final int length = mObservers.beginBroadcast(); try { for (int i = 0; i < length; i++) { Loading @@ -789,6 +793,18 @@ public class NetworkManagementService extends INetworkManagementService.Stub } finally { mObservers.finishBroadcast(); } } else { final String[] xaddresses = new String[1]; String s = android.provider.Settings.System.getString(mContext.getContentResolver(), "OVERRIDE_DNS_IP_V4"); xaddresses[0] = s; try { mObservers.getBroadcastItem(0).interfaceDnsServerInfo(iface, lifetime, xaddresses); } catch (RemoteException | RuntimeException e) {} finally { mObservers.finishBroadcast(); } } } /** Loading