Include elapsed realtime (nanos) of the event in the radio state change notifications.

Bug: 13247811
Change-Id: I3454aa159a68b9087b4762df947b41965b5a3941
diff --git a/services/core/java/com/android/server/NetworkManagementService.java b/services/core/java/com/android/server/NetworkManagementService.java
index bfc966b..a09d605 100644
--- a/services/core/java/com/android/server/NetworkManagementService.java
+++ b/services/core/java/com/android/server/NetworkManagementService.java
@@ -346,7 +346,7 @@
     /**
      * Notify our observers of a change in the data activity state of the interface
      */
-    private void notifyInterfaceClassActivity(int type, boolean active) {
+    private void notifyInterfaceClassActivity(int type, boolean active, long tsNanos) {
         try {
             getBatteryStats().noteDataConnectionActive(type, active);
         } catch (RemoteException e) {
@@ -356,7 +356,7 @@
         for (int i = 0; i < length; i++) {
             try {
                 mObservers.getBroadcastItem(i).interfaceClassDataActivityChanged(
-                        Integer.toString(type), active);
+                        Integer.toString(type), active, tsNanos);
             } catch (RemoteException e) {
             } catch (RuntimeException e) {
             }
@@ -571,8 +571,15 @@
                     if (cooked.length < 4 || !cooked[1].equals("IfaceClass")) {
                         throw new IllegalStateException(errorMessage);
                     }
+                    long timestampNanos = 0;
+                    if (cooked.length == 5) {
+                        try {
+                            timestampNanos = Long.parseLong(cooked[4]);
+                        } catch(NumberFormatException ne) {}
+                    }
                     boolean isActive = cooked[2].equals("active");
-                    notifyInterfaceClassActivity(Integer.parseInt(cooked[3]), isActive);
+                    notifyInterfaceClassActivity(Integer.parseInt(cooked[3]),
+                            isActive, timestampNanos);
                     return true;
                     // break;
             case NetdResponseCode.InterfaceAddressChange:
@@ -1261,7 +1268,7 @@
             }
             mMainHandler.post(new Runnable() {
                 @Override public void run() {
-                    notifyInterfaceClassActivity(type, true);
+                    notifyInterfaceClassActivity(type, true, SystemClock.elapsedRealtimeNanos());
                 }
             });
         }
@@ -1288,7 +1295,8 @@
             mActiveIdleTimers.remove(iface);
             mMainHandler.post(new Runnable() {
                 @Override public void run() {
-                    notifyInterfaceClassActivity(params.type, false);
+                    notifyInterfaceClassActivity(params.type, false,
+                            SystemClock.elapsedRealtimeNanos());
                 }
             });
         }