diff options
| author | Michael Wachenschwanz <mwachens@google.com> | 2021-02-16 18:39:27 -0800 |
|---|---|---|
| committer | Michael Wachenschwanz <mwachens@google.com> | 2021-03-08 11:53:59 -0800 |
| commit | 68b8157e4eb7bba5a2d25850762c730058714b54 (patch) | |
| tree | a48765e6a4e8f89c3cef88351665955b5fd82bc5 /core/java/android/os/BatteryStats.java | |
| parent | 95bd56660ef231026e63f9fa6f6e55a63bc1d2e6 (diff) | |
Accumulate charge instead of energy in BatteryStatsImpl
Track battery voltage along side the measured energy to calculate
battery charge consumption per EnergyConsumer. This better represents
a consumer's impact on battery. Also change numerous variable/method
names from energy units to charge units.
Bug: 180079165
Fixes: 173765509
Test: atest FrameworksCoreTests:com.android.internal.power.MeasuredEnergyStatsTest
Test: atest FrameworksCoreTests:com.android.internal.os.BatteryStatsNoteTest
Test: atest ScreenPowerCalculatorTest
Test: atest FrameworksServicesTests:com.android.server.am.MeasuredEnergySnapshotTest
Change-Id: I5e727cebf1252cc7b1645a53282de2281c68ae85
Diffstat (limited to 'core/java/android/os/BatteryStats.java')
| -rw-r--r-- | core/java/android/os/BatteryStats.java | 47 |
1 files changed, 24 insertions, 23 deletions
diff --git a/core/java/android/os/BatteryStats.java b/core/java/android/os/BatteryStats.java index 6901df7508ab..66f7bd9d8dee 100644 --- a/core/java/android/os/BatteryStats.java +++ b/core/java/android/os/BatteryStats.java @@ -986,26 +986,26 @@ public abstract class BatteryStats implements Parcelable { public abstract void getDeferredJobsLineLocked(StringBuilder sb, int which); /** - * Returns the measured energy in microjoules that the display consumed while the screen - * was on and uid active. - * Will return {@link #ENERGY_DATA_UNAVAILABLE} if data is unavailable + * Returns the battery consumption (in microcoulombs) of the screen while on and uid active, + * derived from on device power measurement data. + * Will return {@link #POWER_DATA_UNAVAILABLE} if data is unavailable. * * {@hide} */ - public abstract long getScreenOnEnergy(); + public abstract long getScreenOnMeasuredBatteryConsumptionUC(); /** - * Returns the energies used by this uid for each + * Returns the battery consumption (in microcoulombs) used by this uid for each * {@link android.hardware.power.stats.EnergyConsumer.ordinal} of (custom) energy consumer * type {@link android.hardware.power.stats.EnergyConsumerType#OTHER}). * - * @return energies (in microjoules) used since boot for each (custom) energy consumer of - * type OTHER, indexed by their ordinal. Returns null if no energy reporting is - * supported. + * @return charge (in microcoulombs) consumed since last reset for each (custom) energy + * consumer of type OTHER, indexed by their ordinal. Returns null if no energy + * reporting is supported. * * {@hide} */ - public abstract @Nullable long[] getCustomMeasuredEnergiesMicroJoules(); + public abstract @Nullable long[] getCustomConsumerMeasuredBatteryConsumptionUC(); public static abstract class Sensor { @@ -2496,40 +2496,41 @@ public abstract class BatteryStats implements Parcelable { }; /** - * Returned value if energy data is unavailable + * Returned value if power data is unavailable * * {@hide} */ - public static final long ENERGY_DATA_UNAVAILABLE = -1; + public static final long POWER_DATA_UNAVAILABLE = -1; /** - * Returns the energy in microjoules that the screen consumed while on. - * Will return {@link #ENERGY_DATA_UNAVAILABLE} if data is unavailable + * Returns the battery consumption (in microcoulombs) of the screen while on, derived from on + * device power measurement data. + * Will return {@link #POWER_DATA_UNAVAILABLE} if data is unavailable. * * {@hide} */ - public abstract long getScreenOnEnergy(); + public abstract long getScreenOnMeasuredBatteryConsumptionUC(); /** - * Returns the energy in microjoules that the screen consumed while in doze - * Will return {@link #ENERGY_DATA_UNAVAILABLE} if data is unavailable + * Returns the battery consumption (in microcoulombs) of the screen in doze, derived from on + * device power measurement data. + * Will return {@link #POWER_DATA_UNAVAILABLE} if data is unavailable. * * {@hide} */ - public abstract long getScreenDozeEnergy(); + public abstract long getScreenDozeMeasuredBatteryConsumptionUC(); /** - * Returns the energies used for each + * Returns the battery consumption (in microcoulombs) that each * {@link android.hardware.power.stats.EnergyConsumer.ordinal} of (custom) energy consumer - * type {@link android.hardware.power.stats.EnergyConsumerType#OTHER}). + * type {@link android.hardware.power.stats.EnergyConsumerType#OTHER}) consumed. * - * @return energies (in microjoules) used since boot for each (custom) energy consumer of - * type OTHER, indexed by their ordinal. Returns null if no energy reporting is - * supported. + * @return charge (in microcoulombs) used by each (custom) energy consumer of type OTHER, + * indexed by their ordinal. Returns null if no energy reporting is supported. * * {@hide} */ - public abstract @Nullable long[] getCustomMeasuredEnergiesMicroJoules(); + public abstract @Nullable long[] getCustomConsumerMeasuredBatteryConsumptionUC(); public static final BitDescription[] HISTORY_STATE_DESCRIPTIONS = new BitDescription[] { new BitDescription(HistoryItem.STATE_CPU_RUNNING_FLAG, "running", "r"), |
