Export aggregated PowerStats as BatteryUsageStats

Also, fix a bug in PowerStatsAggregator that resulted in
incorrect handling of state changes preceding power stats collection.

Bug: 302013436
Test: atest PowerStatsTests

Change-Id: I2333568d60469d8140f11f07590bd4c35021736c
20 files changed