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

Commit 1d3528ba authored by Erik Kline's avatar Erik Kline Committed by android-build-merger
Browse files

Merge "Ignore potential SystemProperties errors when setting net.dns" am: f854c903

am: 1303b8b9

Change-Id: I3fb343daa4d1d5f01d5cc99d842574c841970d03
parents 997e6b08 1303b8b9
Loading
Loading
Loading
Loading
+12 −5
Original line number Diff line number Diff line
@@ -4580,17 +4580,24 @@ public class ConnectivityService extends IConnectivityManager.Stub
        int last = 0;
        for (InetAddress dns : dnses) {
            ++last;
            String key = "net.dns" + last;
            String value = dns.getHostAddress();
            mSystemProperties.set(key, value);
            setNetDnsProperty(last, dns.getHostAddress());
        }
        for (int i = last + 1; i <= mNumDnsEntries; ++i) {
            String key = "net.dns" + i;
            mSystemProperties.set(key, "");
            setNetDnsProperty(i, "");
        }
        mNumDnsEntries = last;
    }

    private void setNetDnsProperty(int which, String value) {
        final String key = "net.dns" + which;
        // Log and forget errors setting unsupported properties.
        try {
            mSystemProperties.set(key, value);
        } catch (Exception e) {
            Log.e(TAG, "Error setting unsupported net.dns property: ", e);
        }
    }

    private String getNetworkPermission(NetworkCapabilities nc) {
        // TODO: make these permission strings AIDL constants instead.
        if (!nc.hasCapability(NET_CAPABILITY_NOT_RESTRICTED)) {