Add a class lable parameter to idletimer.

Now the idletimer should be setup by this command:
ndc idletimer add <interface> <timeout> <class label>

Class label can be a number or string to identify device type, such as
mobile or wifi. Idletimer will send label in the netd message instead
of the actual interface name.

Change-Id: Ic8b69dc5e38a4436c74723697905643a1214aa2a
diff --git a/NetlinkHandler.cpp b/NetlinkHandler.cpp
index 94e9240..47f9496 100644
--- a/NetlinkHandler.cpp
+++ b/NetlinkHandler.cpp
@@ -76,10 +76,14 @@
 
     } else if (!strcmp(subsys, "xt_idletimer")) {
         int action = evt->getAction();
-        const char *iface = evt->findParam("INTERFACE");
+        const char *label = evt->findParam("LABEL");
         const char *state = evt->findParam("STATE");
+        // if no LABEL, use INTERFACE instead
+        if (label == NULL) {
+            label = evt->findParam("INTERFACE");
+        }
         if (state)
-            notifyInterfaceActivity(iface, !strcmp("active", state));
+            notifyInterfaceClassActivity(label, !strcmp("active", state));
 
 #if !LOG_NDEBUG
     } else if (strcmp(subsys, "platform") && strcmp(subsys, "backlight")) {
@@ -131,12 +135,15 @@
             msg, false);
 }
 
-void NetlinkHandler::notifyInterfaceActivity(const char *name, bool isActive) {
+void NetlinkHandler::notifyInterfaceClassActivity(const char *name,
+                                                  bool isActive) {
     char msg[255];
 
-    snprintf(msg, sizeof(msg), "Iface %s %s", name, isActive ? "active" : "idle");
+    snprintf(msg, sizeof(msg), "Iface %s %s", name, 
+             isActive ? "active" : "idle");
     ALOGV("Broadcasting interface activity msg: %s", msg);
-    mNm->getBroadcaster()->sendBroadcast(isActive ? ResponseCode::InterfaceActive
-            : ResponseCode::InterfaceIdle,
+    mNm->getBroadcaster()->sendBroadcast(
+            isActive ? ResponseCode::InterfaceClassActive
+                     : ResponseCode::InterfaceClassIdle,
             msg, false);
 }