BatteryStats: Fix up semantics of SamplingTimer

SamplingTimer has been losing some data, as well as not correctly handling
entries that have gone away and come back with less data (reset).

This change correctly ends a SamplingTimer sample by adding the accumulated amount
to the total, then reseting the running counter to accept new values.

This is also triggered automatically when the incoming data is less than what is currently
recorded.

Bug:25695597
Change-Id: I6b540906e6be527578d1003485384a75ba211b52
2 files changed