Improve logging of first wake lock, history size.

We now try to have a better label for the first wake lock
that is acquired in the log.  This is done in two ways:

- The alarm manager now sorts the alarms it is going to
  execute so that wakeup alarms are first, which are more
  important w.r.t. which one should be logged.
- There is a new power manager facility to make a wake lock
  as "unimportant for logging," which just means in battery
  stats that a wake lock acquired after that can be considered
  the actual one to log.  This is only used by the alarm manager
  to mark its TIME_TICK alarms as unimportant for logging.

Also reworked the battery history code to be cleaner and a bit
smaller.  There is no longer a separate EVENT command, instead
the event code and tag are just another thing that can be included
in an UPDATE command.

The bits used in the first history int are also re-arrange, so
that only the ones that really change a fair amount in the state
bits are up at the top and there is no longer space used for
the command code (since now it is always just UPDATE).  This
allows us to have more room for the time delta at the bottom,
to better avoid situations where we need to write an int delta.

Change-Id: I1bb860ae5b558a248800b090b03a84fbf7acd68a
diff --git a/core/java/com/android/internal/app/IBatteryStats.aidl b/core/java/com/android/internal/app/IBatteryStats.aidl
index 1946d86..9a04760 100644
--- a/core/java/com/android/internal/app/IBatteryStats.aidl
+++ b/core/java/com/android/internal/app/IBatteryStats.aidl
@@ -35,10 +35,11 @@
 
     void noteEvent(int code, String name, int uid);
 
-    void noteStartWakelock(int uid, int pid, String name, int type);
+    void noteStartWakelock(int uid, int pid, String name, int type, boolean unimportantForLogging);
     void noteStopWakelock(int uid, int pid, String name, int type);
 
-    void noteStartWakelockFromSource(in WorkSource ws, int pid, String name, int type);
+    void noteStartWakelockFromSource(in WorkSource ws, int pid, String name, int type,
+            boolean unimportantForLogging);
     void noteStopWakelockFromSource(in WorkSource ws, int pid, String name, int type);
 
     void noteVibratorOn(int uid, long durationMillis);