Loading services/core/java/com/android/server/ConnectivityService.java +37 −8 Original line number Diff line number Diff line Loading @@ -5714,6 +5714,10 @@ public class ConnectivityService extends IConnectivityManager.Stub final NetworkAgentInfo defaultNai = getDefaultNetwork(); final boolean isDefaultNetwork = (defaultNai != null && defaultNai.network.netId == netId); int useNwDNS = android.provider.Settings.System.getInt(mContext.getContentResolver(), "USE_NETWORK_DNS", 1); if (DBG) log("useNwDNS>"+useNwDNS+"<"); if ( 0 != useNwDNS ) { if (DBG) { final Collection<InetAddress> dnses = newLp.getDnsServers(); log("Setting DNS servers for network " + netId + " to " + dnses); Loading @@ -5723,6 +5727,31 @@ public class ConnectivityService extends IConnectivityManager.Stub } catch (Exception e) { loge("Exception in setDnsConfigurationForNetwork: " + e); } } 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); if (DBG) { final Collection<InetAddress> dnses = newLp.getDnsServers(); log("Setting DNS servers for network " + netId + " to " + dnses); } try { mDnsManager.setDnsConfigurationForNetwork(netId, defaultNai, isDefaultNetwork); } catch (Exception e) { loge("Exception in setDnsConfigurationForNetwork: " + e); } } catch (Exception e) { loge("Cannot set custom DNS: " + e); } } } private void updateVpnFiltering(LinkProperties newLp, LinkProperties oldLp, Loading services/core/java/com/android/server/NetworkManagementService.java +16 −1 Original line number Diff line number Diff line Loading @@ -749,7 +749,22 @@ 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); //Slog.i(TAG,"notifyInterfaceDnsServerInfo useNwDNS>"+useNwDNS+"<"); if ( 0 != useNwDNS ) { // Default invokeForAllObservers(o -> o.interfaceDnsServerInfo(iface, lifetime, addresses)); } else { final String[] xaddresses = new String[1]; String s = android.provider.Settings.System.getString(mContext.getContentResolver(), "OVERRIDE_DNS_IP_V4"); //Slog.i(TAG,"notifyInterfaceDnsServerInfo Override dnses>"+s+"<"); xaddresses[0] = s; invokeForAllObservers(o -> o.interfaceDnsServerInfo(iface, lifetime, xaddresses)); } } /** Loading Loading
services/core/java/com/android/server/ConnectivityService.java +37 −8 Original line number Diff line number Diff line Loading @@ -5714,6 +5714,10 @@ public class ConnectivityService extends IConnectivityManager.Stub final NetworkAgentInfo defaultNai = getDefaultNetwork(); final boolean isDefaultNetwork = (defaultNai != null && defaultNai.network.netId == netId); int useNwDNS = android.provider.Settings.System.getInt(mContext.getContentResolver(), "USE_NETWORK_DNS", 1); if (DBG) log("useNwDNS>"+useNwDNS+"<"); if ( 0 != useNwDNS ) { if (DBG) { final Collection<InetAddress> dnses = newLp.getDnsServers(); log("Setting DNS servers for network " + netId + " to " + dnses); Loading @@ -5723,6 +5727,31 @@ public class ConnectivityService extends IConnectivityManager.Stub } catch (Exception e) { loge("Exception in setDnsConfigurationForNetwork: " + e); } } 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); if (DBG) { final Collection<InetAddress> dnses = newLp.getDnsServers(); log("Setting DNS servers for network " + netId + " to " + dnses); } try { mDnsManager.setDnsConfigurationForNetwork(netId, defaultNai, isDefaultNetwork); } catch (Exception e) { loge("Exception in setDnsConfigurationForNetwork: " + e); } } catch (Exception e) { loge("Cannot set custom DNS: " + e); } } } private void updateVpnFiltering(LinkProperties newLp, LinkProperties oldLp, Loading
services/core/java/com/android/server/NetworkManagementService.java +16 −1 Original line number Diff line number Diff line Loading @@ -749,7 +749,22 @@ 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); //Slog.i(TAG,"notifyInterfaceDnsServerInfo useNwDNS>"+useNwDNS+"<"); if ( 0 != useNwDNS ) { // Default invokeForAllObservers(o -> o.interfaceDnsServerInfo(iface, lifetime, addresses)); } else { final String[] xaddresses = new String[1]; String s = android.provider.Settings.System.getString(mContext.getContentResolver(), "OVERRIDE_DNS_IP_V4"); //Slog.i(TAG,"notifyInterfaceDnsServerInfo Override dnses>"+s+"<"); xaddresses[0] = s; invokeForAllObservers(o -> o.interfaceDnsServerInfo(iface, lifetime, xaddresses)); } } /** Loading