Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 678d77ff authored by frank PREEL's avatar frank PREEL Committed by Romain Hunault
Browse files

Force Update

parent 7798076c
Loading
Loading
Loading
Loading
+37 −8
Original line number Diff line number Diff line
@@ -4861,6 +4861,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);
@@ -4870,6 +4874,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 String getNetworkPermission(NetworkCapabilities nc) {
+16 −1
Original line number Diff line number Diff line
@@ -782,7 +782,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));
		}

        
    }

    /**