netd: Add support for timestamp in idletimer netlink notification.
Change-Id: I77e9052e988d65c6b543441a8f03876bcd7c15ce
Signed-off-by: Ruchi Kandoi <kandoiruchi@google.com>
diff --git a/NetlinkHandler.cpp b/NetlinkHandler.cpp
index 7edd190..9c2984f 100644
--- a/NetlinkHandler.cpp
+++ b/NetlinkHandler.cpp
@@ -93,8 +93,9 @@
int action = evt->getAction();
const char *label = evt->findParam("INTERFACE");
const char *state = evt->findParam("STATE");
+ const char *timestamp = evt->findParam("TIME_NS");
if (state)
- notifyInterfaceClassActivity(label, !strcmp("active", state));
+ notifyInterfaceClassActivity(label, !strcmp("active", state), timestamp);
#if !LOG_NDEBUG
} else if (strcmp(subsys, "platform") && strcmp(subsys, "backlight")) {
@@ -140,9 +141,13 @@
}
void NetlinkHandler::notifyInterfaceClassActivity(const char *name,
- bool isActive) {
- notify(ResponseCode::InterfaceClassActivity,
+ bool isActive, const char *timestamp) {
+ if (timestamp == NULL)
+ notify(ResponseCode::InterfaceClassActivity,
"IfaceClass %s %s", isActive ? "active" : "idle", name);
+ else
+ notify(ResponseCode::InterfaceClassActivity,
+ "IfaceClass %s %s %s", isActive ? "active" : "idle", name, timestamp);
}
void NetlinkHandler::notifyAddressChanged(int action, const char *addr,