summaryrefslogtreecommitdiffstats
path: root/services
diff options
context:
space:
mode:
authorRobert Greenwalt <rgreenwalt@google.com>2014-05-15 15:27:13 -0700
committerRobert Greenwalt <rgreenwalt@google.com>2014-05-15 16:29:40 -0700
commitd5648dcf6a477a350c281c769bae07b8cbe982a3 (patch)
treec9cebbfa4bbcae1545c1ab88fb26de6d8c4c46f0 /services
parent177cf2155dae43cb8766dd239d34a861d8fba335 (diff)
downloadframeworks_base-d5648dcf6a477a350c281c769bae07b8cbe982a3.zip
frameworks_base-d5648dcf6a477a350c281c769bae07b8cbe982a3.tar.gz
frameworks_base-d5648dcf6a477a350c281c769bae07b8cbe982a3.tar.bz2
Add net.dns system properties
Some apps rely on them. bug: 14992618 Change-Id: I5766f26b77004e9cfcc90fac657817eab67f9ac7
Diffstat (limited to 'services')
-rw-r--r--services/core/java/com/android/server/ConnectivityService.java26
1 files changed, 25 insertions, 1 deletions
diff --git a/services/core/java/com/android/server/ConnectivityService.java b/services/core/java/com/android/server/ConnectivityService.java
index 0708e55..982dce0 100644
--- a/services/core/java/com/android/server/ConnectivityService.java
+++ b/services/core/java/com/android/server/ConnectivityService.java
@@ -5491,10 +5491,29 @@ public class ConnectivityService extends IConnectivityManager.Stub {
} catch (Exception e) {
loge("Exception in setDnsServersForNetwork: " + e);
}
- // TODO - setprop "net.dnsX"
+ NetworkAgentInfo defaultNai = mNetworkForRequestId.get(mDefaultRequest.requestId);
+ if (defaultNai != null && defaultNai.network.netId == netId) {
+ setDefaultDnsSystemProperties(dnses);
+ }
}
}
+ private void setDefaultDnsSystemProperties(Collection<InetAddress> dnses) {
+ int last = 0;
+ for (InetAddress dns : dnses) {
+ ++last;
+ String key = "net.dns" + last;
+ String value = dns.getHostAddress();
+ SystemProperties.set(key, value);
+ }
+ for (int i = last + 1; i <= mNumDnsEntries; ++i) {
+ String key = "net.dns" + i;
+ SystemProperties.set(key, "");
+ }
+ mNumDnsEntries = last;
+ }
+
+
private void updateCapabilities(NetworkAgentInfo networkAgent,
NetworkCapabilities networkCapabilities) {
// TODO - what else here? Verify still satisfies everybody?
@@ -5610,6 +5629,11 @@ public class ConnectivityService extends IConnectivityManager.Stub {
if (mDefaultRequest.requestId == nri.request.requestId) {
isNewDefault = true;
updateActiveDefaultNetwork(newNetwork);
+ if (newNetwork.linkProperties != null) {
+ setDefaultDnsSystemProperties(newNetwork.linkProperties.getDnses());
+ } else {
+ setDefaultDnsSystemProperties(new ArrayList<InetAddress>());
+ }
}
}
}