Some battery stats history fixes.

- Now the full wake history uses the history tag if it can.
  Hopefully this will still result in a consistent history,
  since that isn't really want the tag is for...  but the
  current implementation in places will probably make this work.

- Possibly fix a bug with inconsistent state between partial
  history snapshots: after a snapshot is printed, don't allow
  any more batching into the most recent history entry, so the
  next snapshot will not miss anything that might get placed
  into it soon after.

Also rework command line arguments for enable/disable to make these
commands instead of options.

Change-Id: Ia33445cad1538bf8df549cef284f1e736efbc079
diff --git a/core/java/android/os/BatteryStats.java b/core/java/android/os/BatteryStats.java
index bc57b33..e627d49 100644
--- a/core/java/android/os/BatteryStats.java
+++ b/core/java/android/os/BatteryStats.java
@@ -931,6 +931,14 @@
         }
     }
 
+    /**
+     * Don't allow any more batching in to the current history event.  This
+     * is called when printing partial histories, so to ensure that the next
+     * history event will go in to a new batch after what was printed in the
+     * last partial history.
+     */
+    public abstract void commitCurrentHistoryBatchLocked();
+
     public abstract int getHistoryTotalSize();
 
     public abstract int getHistoryUsedSize();
@@ -3366,6 +3374,7 @@
             }
         }
         if (histStart >= 0) {
+            commitCurrentHistoryBatchLocked();
             pw.print(checkin ? "NEXT: " : "  NEXT: "); pw.println(lastTime+1);
         }
     }