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

Commit 26ecc31f authored by Robert Greenwalt's avatar Robert Greenwalt Committed by Android Git Automerger
Browse files

am 594745ab: am b9f87f19: Merge "First pass tying into per-interface DNS cache"

* commit '594745ab':
  First pass tying into per-interface DNS cache
parents 3a2d1c23 594745ab
Loading
Loading
Loading
Loading
+16 −0
Original line number Diff line number Diff line
@@ -38,6 +38,7 @@ import android.os.Handler;
import android.os.IBinder;
import android.os.Looper;
import android.os.Message;
import android.os.INetworkManagementService;
import android.os.RemoteException;
import android.os.ServiceManager;
import android.os.SystemProperties;
@@ -111,6 +112,9 @@ public class ConnectivityService extends IConnectivityManager.Stub {

    private boolean mTestMode;
    private static ConnectivityService sServiceInstance;

    private INetworkManagementService mNetd;

    private static final int ENABLED  = 1;
    private static final int DISABLED = 0;

@@ -1278,6 +1282,9 @@ public class ConnectivityService extends IConnectivityManager.Stub {
    }

    void systemReady() {
        IBinder b = ServiceManager.getService(Context.NETWORKMANAGEMENT_SERVICE);
        mNetd = INetworkManagementService.Stub.asInterface(b);

        synchronized(this) {
            mSystemReady = true;
            if (mInitialBroadcast != null) {
@@ -1470,6 +1477,11 @@ public class ConnectivityService extends IConnectivityManager.Stub {
        NetworkStateTracker nt = mNetTrackers[netType];
        if (nt != null && nt.getNetworkInfo().isConnected() && !nt.isTeardownRequested()) {
            String[] dnsList = nt.getNameServers();
            try {
                mNetd.setDnsServersForInterface(Integer.toString(netType), dnsList);
            } catch (Exception e) {
                Slog.e(TAG, "exception setting dns servers: " + e);
            }
            if (mNetAttributes[netType].isDefault()) {
                int j = 1;
                for (String dns : dnsList) {
@@ -1481,6 +1493,10 @@ public class ConnectivityService extends IConnectivityManager.Stub {
                        SystemProperties.set("net.dns" + j++, dns);
                    }
                }
                try {
                    mNetd.setDefaultInterfaceForDns(Integer.toString(netType));
                } catch (Exception e) {
                    Slog.e(TAG, "exception setting default dns interface: " + e);}
                for (int k=j ; k<mNumDnsEntries; k++) {
                    if (DBG) Slog.d(TAG, "erasing net.dns" + k);
                    SystemProperties.set("net.dns" + k, "");