Fix battery history corruption

The corruption occurs when CPU wakes up after being suspended and
the new history event has lower battery level than the last recorded
before suspend.

Bug: 247338158
Test: atest FrameworksServicesTests:BatteryStatsTests
Change-Id: Id78c0acd60a92b26c818a2c4a5feb45b8e58f040
6 files changed