Add unit tests for BatteryStatsImpl.

- Add a Clocks interface to wrap SystemClock.uptimeMillis and
  SystemClock.elapsedRealtime.
- Make the inner classes static so they can be created independently,
  which meant passing explicit pointers to the BatteryStatsImpl and
  the Uid objects in a lot of places.
- Make several fields protected so they can be accessed by the tests (they are
  still @hidden)
- Add a test suite for the battery stats.
- Add the tests

Change-Id: I4e45afedc64f7050985c28a7eb4f5c1ddbaa63fa
diff --git a/core/java/android/os/BatteryStats.java b/core/java/android/os/BatteryStats.java
index a738b2e..8281279 100644
--- a/core/java/android/os/BatteryStats.java
+++ b/core/java/android/os/BatteryStats.java
@@ -623,7 +623,7 @@
             /**
              * The statistics associated with a particular service.
              */
-            public abstract class Serv {
+            public static abstract class Serv {
 
                 /**
                  * Returns the amount of time spent started.