Battery monitoring fixes:

- Improve monitoring of level changes to not be confused
  when it goes up while draining or down while charging.
- Put back in connectivity service code to tell battery
  stats about the interfaces.
- Turn back on reporting of mobile radio active state
  from the RIL.
- Fix bug in marshalling/unmarshalling that would cause
  the UI to show bad data.

Change-Id: I733ef52702894cca81a0813eccdfc1023e546fce
diff --git a/services/core/java/com/android/server/ConnectivityService.java b/services/core/java/com/android/server/ConnectivityService.java
index 37b75d6..1e21e1c 100644
--- a/services/core/java/com/android/server/ConnectivityService.java
+++ b/services/core/java/com/android/server/ConnectivityService.java
@@ -5709,10 +5709,11 @@
                 // updateNetworkSettings();
             }
             // notify battery stats service about this network
-//            try {
-                // TODO
-                //BatteryStatsService.getService().noteNetworkInterfaceType(iface, netType);
-//            } catch (RemoteException e) { }
+            try {
+                BatteryStatsService.getService().noteNetworkInterfaceType(
+                        newNetwork.linkProperties.getInterfaceName(),
+                        newNetwork.networkInfo.getType());
+            } catch (RemoteException e) { }
             notifyNetworkCallbacks(newNetwork, ConnectivityManager.CALLBACK_AVAILABLE);
         } else {
             if (DBG && newNetwork.networkRequests.size() != 0) {