summaryrefslogtreecommitdiff
path: root/services/java/com/android/server/NetworkManagementService.java
diff options
context:
space:
mode:
authorStan Chesnutt <chesnutt@google.com>2011-01-03 08:43:57 -0800
committerStan Chesnutt <chesnutt@google.com>2011-01-07 11:40:33 -0800
commit780dfa42aa8664afa53c30ae669fc0e1f10f6537 (patch)
treec5c852f6b798d6ad9a2c10dbfb6601bbb3144ec3 /services/java/com/android/server/NetworkManagementService.java
parenta78060345b80ca6e6d3571cdd7afb4a997e709b0 (diff)
Propagate new link-status-change message to any NetworkManagementService
observers. Also fix the syntax of the "interface-status-change" message. Add a null handler in the ThrottleService and Tethering classes (plus fix names). Change-Id: I58cabc7b0ce5662243bc6513b2de4818065e6c52
Diffstat (limited to 'services/java/com/android/server/NetworkManagementService.java')
-rw-r--r--services/java/com/android/server/NetworkManagementService.java26
1 files changed, 22 insertions, 4 deletions
diff --git a/services/java/com/android/server/NetworkManagementService.java b/services/java/com/android/server/NetworkManagementService.java
index 152605f0a4ae..08970d1b4736 100644
--- a/services/java/com/android/server/NetworkManagementService.java
+++ b/services/java/com/android/server/NetworkManagementService.java
@@ -131,12 +131,26 @@ class NetworkManagementService extends INetworkManagementService.Stub {
}
/**
- * Notify our observers of an interface link status change
+ * Notify our observers of an interface status change
*/
- private void notifyInterfaceLinkStatusChanged(String iface, boolean link) {
+ private void notifyInterfaceStatusChanged(String iface, boolean up) {
for (INetworkManagementEventObserver obs : mObservers) {
try {
- obs.interfaceLinkStatusChanged(iface, link);
+ obs.interfaceStatusChanged(iface, up);
+ } catch (Exception ex) {
+ Slog.w(TAG, "Observer notifier failed", ex);
+ }
+ }
+ }
+
+ /**
+ * Notify our observers of an interface link status change.
+ * (typically, an Ethernet cable has been plugged-in or unplugged).
+ */
+ private void notifyInterfaceLinkStateChanged(String iface, boolean up) {
+ for (INetworkManagementEventObserver obs : mObservers) {
+ try {
+ obs.interfaceLinkStateChanged(iface, up);
} catch (Exception ex) {
Slog.w(TAG, "Observer notifier failed", ex);
}
@@ -197,6 +211,7 @@ class NetworkManagementService extends INetworkManagementService.Stub {
* Format: "NNN Iface added <name>"
* "NNN Iface removed <name>"
* "NNN Iface changed <name> <up/down>"
+ * "NNN Iface linkstatus <name> <up/down>"
*/
if (cooked.length < 4 || !cooked[1].equals("Iface")) {
throw new IllegalStateException(
@@ -209,7 +224,10 @@ class NetworkManagementService extends INetworkManagementService.Stub {
notifyInterfaceRemoved(cooked[3]);
return true;
} else if (cooked[2].equals("changed") && cooked.length == 5) {
- notifyInterfaceLinkStatusChanged(cooked[3], cooked[4].equals("up"));
+ notifyInterfaceStatusChanged(cooked[3], cooked[4].equals("up"));
+ return true;
+ } else if (cooked[2].equals("linkstatus") && cooked.length == 5) {
+ notifyInterfaceLinkStateChanged(cooked[3], cooked[4].equals("up"));
return true;
}
throw new IllegalStateException(