Statsd: change power units from double to int64

Changes the units for the following atoms from mAh to nAs:

DeviceCalculatedPowerUse
DeviceCalculatedPowerBlameUid
DeviceCalculatedPowerBlameOther

and changes them from floats to int64s.

int64 is better supported in statsd. In particular, Anomaly Detection
currently works only for int64, not floats.

The loss in precision here should be minimal or none. These numbers come
from BatteryStats, which calculates them as follows:

BatteryStats reports time in microseconds (us) as a long.
PowerProfile reports current in mA as a double.
  On the power_profile.xml files I have seen, they only have three
  decimal places of precision. So uA precision should suffice.

Thus, the absolute smallest unit of charge BatteryStats can therefore
measure (assuming three digits in the PowerProfile) is nAs. Given that our
measurements are over much longer periods of time than a microsecond, we
should be very safe.

In terms of max value: a phone battery is typically around
4000mAh  ~ 10^13 nAs << max_int64 by many orders of magnitude.

Bug: 119111972

Test: cts-tradefed run cts-dev -m CtsStatsdHostTestCases -t android.cts.statsd.atom.UidAtomTests#testDeviceCalculatedPowerUse
Test: cts-tradefed run cts-dev -m CtsStatsdHostTestCases -t android.cts.statsd.atom.UidAtomTests#testDeviceCalculatedPowerBlameUid

Test: cts-tradefed run cts-dev -m CtsStatsdHostTestCases -t android.cts.statsd.validation.BatteryStatsValidationTests#testPowerUse
Test: cts-tradefed run cts-dev -m CtsStatsdHostTestCases -t android.cts.statsd.validation.BatteryStatsValidationTests#testPowerBlameUid

Change-Id: I1cfd0a05717d7d357b43dd2408c85096599516c7
2 files changed