Formalize time bases in battery stats.

Battery stats used to revolve around a single time base
it maintained, "battery uptime and realtime."  This is derived
from the system's uptime and realtime, but only increments while
the device is on battery.  It is used to update its timers for
things like the screen being on, wake locks, etc only while the
device is not plugged in to power.

This change formalizes that time base into a separate class that
maintains all of its state.  This is used to introduce a new
time base, "battery screen off," which only increments while the
device is on battery *and* the screen is off.  Wake locks are now
based on this time base, so we don't count them while the screen
is on -- it is misleading to have them increment while the screen
is on because the device is defined to always stay awake anyway
during that time, so what they are doing is irrelevant.

Change-Id: I020e20c930d8dca2953c6c3ddef1dc93c24161a5
3 files changed