MeasuredEnergy comment cleanup
Cleans up some: documentation comments dumpsys output Test: manual Bug: 174818228 Change-Id: I6b78432ba37a5ba1b00947e2ae9bbaec2349590f
This commit is contained in:
@@ -5296,8 +5296,11 @@ public abstract class BatteryStats implements Parcelable {
|
||||
}
|
||||
if (bs.customMeasuredPowerMah != null) {
|
||||
for (int idx = 0; idx < bs.customMeasuredPowerMah.length; idx++) {
|
||||
pw.print(" custom[" + idx + "]=");
|
||||
printmAh(pw, bs.customMeasuredPowerMah[idx]);
|
||||
final double customPowerMah = bs.customMeasuredPowerMah[idx];
|
||||
if (customPowerMah != 0) {
|
||||
pw.print(" custom[" + idx + "]=");
|
||||
printmAh(pw, customPowerMah);
|
||||
}
|
||||
}
|
||||
}
|
||||
pw.print(" )");
|
||||
|
||||
@@ -1001,8 +1001,12 @@ public class BatteryStatsImpl extends BatteryStats {
|
||||
int mWifiRadioPowerState = DataConnectionRealTimeInfo.DC_POWER_STATE_LOW;
|
||||
|
||||
/**
|
||||
* Accumulated energy consumption, that is not attributed to individual uids, of various
|
||||
* consumers while on battery.
|
||||
* Accumulated global (generally, device-wide total) energy consumption of various consumers
|
||||
* while on battery.
|
||||
* Its '<b>custom</b> energy buckets' correspond to the
|
||||
* {@link android.hardware.power.stats.EnergyConsumer.ordinal}s of (custom) energy consumer
|
||||
* type {@link android.hardware.power.stats.EnergyConsumerType#OTHER}).
|
||||
*
|
||||
* If energy consumer data is completely unavailable this will be null.
|
||||
*/
|
||||
@GuardedBy("this")
|
||||
@@ -7532,9 +7536,16 @@ public class BatteryStatsImpl extends BatteryStats {
|
||||
*/
|
||||
private final ArraySet<BinderCallStats> mBinderCallStats = new ArraySet<>();
|
||||
|
||||
/** Measured energies attributed to this uid while on battery. */
|
||||
// We do not use a SparseArray<LongSamplingCounters> since it would cause lots of
|
||||
// unnecessary timebase references, and we're just going to use on-battery anyway...
|
||||
/**
|
||||
* Measured energies attributed to this uid while on battery.
|
||||
* Its '<b>custom</b> energy buckets' correspond to the
|
||||
* {@link android.hardware.power.stats.EnergyConsumer.ordinal}s of (custom) energy consumer
|
||||
* type {@link android.hardware.power.stats.EnergyConsumerType#OTHER}).
|
||||
*
|
||||
* Will be null if energy consumer data is completely unavailable (in which case
|
||||
* {@link #mGlobalMeasuredEnergyStats} will also be null) or if the power usage by this uid
|
||||
* is 0 for every bucket.
|
||||
*/
|
||||
private MeasuredEnergyStats mUidMeasuredEnergyStats;
|
||||
|
||||
/**
|
||||
@@ -12518,11 +12529,8 @@ public class BatteryStatsImpl extends BatteryStats {
|
||||
final int uidInt = mapUid(uidEnergies.keyAt(i));
|
||||
final long uidEnergyUJ = uidEnergies.valueAt(i);
|
||||
if (uidEnergyUJ == 0) continue;
|
||||
// TODO: Worry about uids not in BSI currently, including uninstalled uids 'coming back'
|
||||
// Specifically: What if the uid had been removed? We'll re-create it now.
|
||||
// And if we instead use getAvailableUidStatsLocked() and chec for null, then we might
|
||||
// not create a Uid even when we should be (say, the app's first event, somehow, was to
|
||||
// use GPU). I guess that CPU/kernel data might already have this problem?
|
||||
// TODO(b/180030409): Worry about dead Uids (no longer in BSI) being revived by this,
|
||||
// or converse problem of not creating a new Uid if its first blame is recorded here.
|
||||
final Uid uidObj = getUidStatsLocked(uidInt);
|
||||
uidObj.addEnergyToCustomBucketLocked(uidEnergyUJ, customEnergyBucket, true);
|
||||
}
|
||||
@@ -14524,7 +14532,7 @@ public class BatteryStatsImpl extends BatteryStats {
|
||||
return;
|
||||
}
|
||||
|
||||
dumpMeasuredEnergyStatsLocked(pw, "non-uid usage", mGlobalMeasuredEnergyStats);
|
||||
dumpMeasuredEnergyStatsLocked(pw, "global usage", mGlobalMeasuredEnergyStats);
|
||||
|
||||
int size = mUidStats.size();
|
||||
for (int i = 0; i < size; i++) {
|
||||
|
||||
@@ -149,7 +149,7 @@ class BatteryExternalStatsWorker implements BatteryStatsImpl.ExternalStatsSync {
|
||||
* Maps an {@link EnergyConsumerType} to it's corresponding {@link EnergyConsumer#id}s,
|
||||
* unless it is of {@link EnergyConsumer#type}=={@link EnergyConsumerType#OTHER}
|
||||
*/
|
||||
// TODO: Hook this up (it isn't used yet)
|
||||
// TODO(b/180029015): Hook this up (it isn't used yet)
|
||||
@GuardedBy("mWorkerLock")
|
||||
private @Nullable SparseArray<int[]> mEnergyConsumerTypeToIdMap = null;
|
||||
|
||||
@@ -818,14 +818,14 @@ class BatteryExternalStatsWorker implements BatteryStatsImpl.ExternalStatsSync {
|
||||
if (energyConsumerIds.isEmpty()) {
|
||||
return null;
|
||||
}
|
||||
// TODO: Query *specific* subsystems from HAL based on energyConsumerIds.toArray()
|
||||
// TODO(b/180029015): Query specific subsystems from HAL based on energyConsumerIds.toArray
|
||||
return getEnergyConsumptionData();
|
||||
}
|
||||
|
||||
@GuardedBy("mWorkerLock")
|
||||
private void addEnergyConsumerIdLocked(
|
||||
List<Integer> energyConsumerIds, @EnergyConsumerType int type) {
|
||||
final int consumerId = 0; // TODO: Use mEnergyConsumerTypeToIdMap to get this
|
||||
final int consumerId = 0; // TODO(b/180029015): Use mEnergyConsumerTypeToIdMap to get this
|
||||
energyConsumerIds.add(consumerId);
|
||||
}
|
||||
|
||||
@@ -840,7 +840,7 @@ class BatteryExternalStatsWorker implements BatteryStatsImpl.ExternalStatsSync {
|
||||
return null;
|
||||
}
|
||||
|
||||
// TODO: Initialize typeToIds
|
||||
// TODO(b/180029015): Initialize typeToIds
|
||||
// Maps type -> {ids} (1:n map, since multiple ids might have the same type)
|
||||
// final SparseArray<SparseIntArray> typeToIds = new SparseArray<>();
|
||||
|
||||
@@ -862,9 +862,9 @@ class BatteryExternalStatsWorker implements BatteryStatsImpl.ExternalStatsSync {
|
||||
}
|
||||
}
|
||||
idToConsumer.put(consumer.id, consumer);
|
||||
// TODO: Also populate typeToIds map
|
||||
// TODO(b/180029015): Also populate typeToIds map
|
||||
}
|
||||
// TODO: Store typeToIds in mEnergyConsumerTypeToIdMap.
|
||||
// TODO(b/180029015): Store typeToIds in mEnergyConsumerTypeToIdMap.
|
||||
return idToConsumer;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user