Fix boot time BatteryStats reset failure

We need some services to create a battery stats snapshot
captured at the time of battery reset.
The issue is that if the battery stats reset occurs during boot,
before the system is ready, those services may not be prepared.

The fix is to postpone battery stats reset until after the
system server is ready.

Also, we will now reset the stats if battery got partially charged
and discharged repeatedly without ever reaching the full charge.
This will prevent battery sessions from going on forever and
overflowing internal data structures.

This CL partially reverts https://cs.android.com/android/_/android/platform/frameworks/base/+/0ed84f12639c4cb7ba6623dc232ae31602827bae

Bug: 192252233
Test: run PowerOnOffTest#testPowerOnOff repeatedly
Change-Id: Ib486e4caeeac7c933288c3a1055259c05f45c6c8
7 files changed