Loading cmds/statsd/src/atoms.proto +10 −10 Original line number Diff line number Diff line Loading @@ -3474,10 +3474,10 @@ message BuildInformation { * Pulls on-device BatteryStats power use calculations for the overall device. */ message DeviceCalculatedPowerUse { // Power used by the device in mAh, as computed by BatteryStats, since BatteryStats last reset // (i.e. roughly since device was last significantly charged). // Currently, this is BatteryStatsHelper.getComputedPower() (not getTotalPower()). optional float computed_power_milli_amp_hours = 1; // Power used by the device in nAs (i.e. nanocoulombs (nC)), as computed by BatteryStats, since // BatteryStats last reset (i.e. roughly since device was last significantly charged). // Currently, this is from BatteryStatsHelper.getComputedPower() (not getTotalPower()). optional int64 computed_power_nano_amp_secs = 1; } /** Loading @@ -3489,9 +3489,9 @@ message DeviceCalculatedPowerBlameUid { // Uid being blamed. Note: isolated uids have already been mapped to host uid. optional int32 uid = 1 [(is_uid) = true]; // Power used by this uid in mAh, as computed by BatteryStats, since BatteryStats last reset // (i.e. roughly since device was last significantly charged). optional float power_milli_amp_hours = 2; // Power used by this uid in nAs (i.e. nanocoulombs (nC)), as computed by BatteryStats, since // BatteryStats last reset (i.e. roughly since device was last significantly charged). optional int64 power_nano_amp_secs = 2; } /** Loading Loading @@ -3525,9 +3525,9 @@ message DeviceCalculatedPowerBlameOther { } optional DrainType drain_type = 1; // Power used by this item in mAh, as computed by BatteryStats, since BatteryStats last reset // (i.e. roughly since device was last significantly charged). optional float power_milli_amp_hours = 2; // Power used by this item in nAs (i.e. nanocoulombs (nC)), as computed by BatteryStats, since // BatteryStats last reset (i.e. roughly since device was last significantly charged). optional int64 power_nano_amp_secs = 2; } /** Loading services/core/java/com/android/server/stats/StatsCompanionService.java +8 −3 Original line number Diff line number Diff line Loading @@ -1563,11 +1563,16 @@ public class StatsCompanionService extends IStatsCompanionService.Stub { return mBatteryStatsHelper; } private long milliAmpHrsToNanoAmpSecs(double mAh) { final long MILLI_AMP_HR_TO_NANO_AMP_SECS = 1_000_000L * 3600L; return (long) (mAh * MILLI_AMP_HR_TO_NANO_AMP_SECS + 0.5); } private void pullDeviceCalculatedPowerUse(int tagId, long elapsedNanos, final long wallClockNanos, List<StatsLogEventWrapper> pulledData) { BatteryStatsHelper bsHelper = getBatteryStatsHelper(); StatsLogEventWrapper e = new StatsLogEventWrapper(tagId, elapsedNanos, wallClockNanos); e.writeFloat((float) bsHelper.getComputedPower()); e.writeLong(milliAmpHrsToNanoAmpSecs(bsHelper.getComputedPower())); pulledData.add(e); } Loading @@ -1583,7 +1588,7 @@ public class StatsCompanionService extends IStatsCompanionService.Stub { } StatsLogEventWrapper e = new StatsLogEventWrapper(tagId, elapsedNanos, wallClockNanos); e.writeInt(bs.uidObj.getUid()); e.writeFloat((float) bs.totalPowerMah); e.writeLong(milliAmpHrsToNanoAmpSecs(bs.totalPowerMah)); pulledData.add(e); } } Loading @@ -1603,7 +1608,7 @@ public class StatsCompanionService extends IStatsCompanionService.Stub { } StatsLogEventWrapper e = new StatsLogEventWrapper(tagId, elapsedNanos, wallClockNanos); e.writeInt(bs.drainType.ordinal()); e.writeFloat((float) bs.totalPowerMah); e.writeLong(milliAmpHrsToNanoAmpSecs(bs.totalPowerMah)); pulledData.add(e); } } Loading Loading
cmds/statsd/src/atoms.proto +10 −10 Original line number Diff line number Diff line Loading @@ -3474,10 +3474,10 @@ message BuildInformation { * Pulls on-device BatteryStats power use calculations for the overall device. */ message DeviceCalculatedPowerUse { // Power used by the device in mAh, as computed by BatteryStats, since BatteryStats last reset // (i.e. roughly since device was last significantly charged). // Currently, this is BatteryStatsHelper.getComputedPower() (not getTotalPower()). optional float computed_power_milli_amp_hours = 1; // Power used by the device in nAs (i.e. nanocoulombs (nC)), as computed by BatteryStats, since // BatteryStats last reset (i.e. roughly since device was last significantly charged). // Currently, this is from BatteryStatsHelper.getComputedPower() (not getTotalPower()). optional int64 computed_power_nano_amp_secs = 1; } /** Loading @@ -3489,9 +3489,9 @@ message DeviceCalculatedPowerBlameUid { // Uid being blamed. Note: isolated uids have already been mapped to host uid. optional int32 uid = 1 [(is_uid) = true]; // Power used by this uid in mAh, as computed by BatteryStats, since BatteryStats last reset // (i.e. roughly since device was last significantly charged). optional float power_milli_amp_hours = 2; // Power used by this uid in nAs (i.e. nanocoulombs (nC)), as computed by BatteryStats, since // BatteryStats last reset (i.e. roughly since device was last significantly charged). optional int64 power_nano_amp_secs = 2; } /** Loading Loading @@ -3525,9 +3525,9 @@ message DeviceCalculatedPowerBlameOther { } optional DrainType drain_type = 1; // Power used by this item in mAh, as computed by BatteryStats, since BatteryStats last reset // (i.e. roughly since device was last significantly charged). optional float power_milli_amp_hours = 2; // Power used by this item in nAs (i.e. nanocoulombs (nC)), as computed by BatteryStats, since // BatteryStats last reset (i.e. roughly since device was last significantly charged). optional int64 power_nano_amp_secs = 2; } /** Loading
services/core/java/com/android/server/stats/StatsCompanionService.java +8 −3 Original line number Diff line number Diff line Loading @@ -1563,11 +1563,16 @@ public class StatsCompanionService extends IStatsCompanionService.Stub { return mBatteryStatsHelper; } private long milliAmpHrsToNanoAmpSecs(double mAh) { final long MILLI_AMP_HR_TO_NANO_AMP_SECS = 1_000_000L * 3600L; return (long) (mAh * MILLI_AMP_HR_TO_NANO_AMP_SECS + 0.5); } private void pullDeviceCalculatedPowerUse(int tagId, long elapsedNanos, final long wallClockNanos, List<StatsLogEventWrapper> pulledData) { BatteryStatsHelper bsHelper = getBatteryStatsHelper(); StatsLogEventWrapper e = new StatsLogEventWrapper(tagId, elapsedNanos, wallClockNanos); e.writeFloat((float) bsHelper.getComputedPower()); e.writeLong(milliAmpHrsToNanoAmpSecs(bsHelper.getComputedPower())); pulledData.add(e); } Loading @@ -1583,7 +1588,7 @@ public class StatsCompanionService extends IStatsCompanionService.Stub { } StatsLogEventWrapper e = new StatsLogEventWrapper(tagId, elapsedNanos, wallClockNanos); e.writeInt(bs.uidObj.getUid()); e.writeFloat((float) bs.totalPowerMah); e.writeLong(milliAmpHrsToNanoAmpSecs(bs.totalPowerMah)); pulledData.add(e); } } Loading @@ -1603,7 +1608,7 @@ public class StatsCompanionService extends IStatsCompanionService.Stub { } StatsLogEventWrapper e = new StatsLogEventWrapper(tagId, elapsedNanos, wallClockNanos); e.writeInt(bs.drainType.ordinal()); e.writeFloat((float) bs.totalPowerMah); e.writeLong(milliAmpHrsToNanoAmpSecs(bs.totalPowerMah)); pulledData.add(e); } } Loading