summaryrefslogtreecommitdiffstats
path: root/services/java/com/android/server/NetworkManagementService.java
diff options
context:
space:
mode:
authorLorenzo Colitti <lorenzo@google.com>2013-10-31 11:59:46 +0900
committerLorenzo Colitti <lorenzo@google.com>2013-11-25 17:27:17 +0900
commit5ae4a531cc31be2868f65c40e8636658f1ae2f06 (patch)
treed2a5bf64fd3bb9ee4ddfa45ff44750459ead8d94 /services/java/com/android/server/NetworkManagementService.java
parenta9626c1c956f51e7b4cb783d70b75abc3b180a00 (diff)
downloadframeworks_base-5ae4a531cc31be2868f65c40e8636658f1ae2f06.zip
frameworks_base-5ae4a531cc31be2868f65c40e8636658f1ae2f06.tar.gz
frameworks_base-5ae4a531cc31be2868f65c40e8636658f1ae2f06.tar.bz2
Pass DNS server info notifications to observers.
These are sent if the device receives IPv6 Router Advertisements with DNS server configuration options. Currently, nothing listens to them; in a future change we will use them as IPv6 DNS servers. [Cherry-pick of 416740ad4d9132005a71dc0883334e852235a18a] Bug: 9180552 Change-Id: I05000c0cd3867a68ab390102e8470b6912a9d3aa
Diffstat (limited to 'services/java/com/android/server/NetworkManagementService.java')
-rw-r--r--services/java/com/android/server/NetworkManagementService.java36
1 files changed, 36 insertions, 0 deletions
diff --git a/services/java/com/android/server/NetworkManagementService.java b/services/java/com/android/server/NetworkManagementService.java
index 9a0d648..8089fbc 100644
--- a/services/java/com/android/server/NetworkManagementService.java
+++ b/services/java/com/android/server/NetworkManagementService.java
@@ -136,6 +136,7 @@ public class NetworkManagementService extends INetworkManagementService.Stub
public static final int BandwidthControl = 601;
public static final int InterfaceClassActivity = 613;
public static final int InterfaceAddressChange = 614;
+ public static final int InterfaceDnsServerInfo = 615;
}
/**
@@ -431,6 +432,21 @@ public class NetworkManagementService extends INetworkManagementService.Stub
mObservers.finishBroadcast();
}
+ /**
+ * Notify our observers of DNS server information received.
+ */
+ private void notifyInterfaceDnsServerInfo(String iface, long lifetime, String[] addresses) {
+ final int length = mObservers.beginBroadcast();
+ for (int i = 0; i < length; i++) {
+ try {
+ mObservers.getBroadcastItem(i).interfaceDnsServerInfo(iface, lifetime, addresses);
+ } catch (RemoteException e) {
+ } catch (RuntimeException e) {
+ }
+ }
+ mObservers.finishBroadcast();
+ }
+
//
// Netd Callback handling
//
@@ -535,6 +551,26 @@ public class NetworkManagementService extends INetworkManagementService.Stub
}
return true;
// break;
+ case NetdResponseCode.InterfaceDnsServerInfo:
+ /*
+ * Information about available DNS servers has been received.
+ * Format: "NNN DnsInfo servers <interface> <lifetime> <servers>"
+ */
+ long lifetime; // Actually a 32-bit unsigned integer.
+
+ if (cooked.length == 6 &&
+ cooked[1].equals("DnsInfo") &&
+ cooked[2].equals("servers")) {
+ try {
+ lifetime = Long.parseLong(cooked[4]);
+ } catch (NumberFormatException e) {
+ throw new IllegalStateException(errorMessage);
+ }
+ String[] servers = cooked[5].split(",");
+ notifyInterfaceDnsServerInfo(cooked[3], lifetime, servers);
+ }
+ return true;
+ // break;
default: break;
}
return false;