summaryrefslogtreecommitdiffstats
path: root/services
diff options
context:
space:
mode:
authorRobert Greenwalt <rgreenwalt@google.com>2014-05-16 00:06:40 +0000
committerAndroid (Google) Code Review <android-gerrit@google.com>2014-05-16 00:06:41 +0000
commit00bcf01a916938c5be4ca84c5fd8a3d6f502edb9 (patch)
tree93e8ad3feab85e254734d488704bd0b450e2f9ef /services
parent389f5b81a069a8f5b6d11790a403c32d3156e0de (diff)
parentd5648dcf6a477a350c281c769bae07b8cbe982a3 (diff)
downloadframeworks_base-00bcf01a916938c5be4ca84c5fd8a3d6f502edb9.zip
frameworks_base-00bcf01a916938c5be4ca84c5fd8a3d6f502edb9.tar.gz
frameworks_base-00bcf01a916938c5be4ca84c5fd8a3d6f502edb9.tar.bz2
Merge "Add net.dns system properties"
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>());
+ }
}
}
}