BatteryStatsImpl uid blaming for measured energy data
Adds support for blaming measured energy (rail) data on individual uids
starting with display.
1. Display measured energy data is apportioned to apps.
This is based on their relative foreground activity time and PROCESS_STATE_TOP
time, in accordance with the current BatteryStatsHelper smearing algorithm.
2. Infrastructure is in place for additional energy rails
to do likewise.
3. Fixes a bug in Bluetooth activity data not being reset properly
4. Fixes a bug in that resets didn't handle external data properly
Test: atest FrameworksServicesTests:com.android.server.am.MeasuredEnergySnapshotTest \
FrameworksCoreTests:com.android.internal.power.MeasuredEnergyStatsTest \
FrameworksCoreTests:com.android.internal.os.BatteryStatsNoteTest#testUpdateDisplayEnergyLocked
Bug: 174818228
Bug: 174818483
Bug: 174818545
Bug: 173652857
Change-Id: Ibade3689ad7c3c22e181c8086df25c203fe0ad6b
11 files changed